]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added some QA to flow track cuts and event cuts, trackID fix, better redoFinish and...
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 26 Mar 2011 09:36:08 +0000 (09:36 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 26 Mar 2011 09:36:08 +0000 (09:36 +0000)
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskPIDflowQA.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.h
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h
PWG2/FLOW/macros/AddTaskFlowCentrality.C
PWG2/FLOW/macros/redoFinish.C

index ea409e912f06769109ad34c19cfac01c4058eefd..eb5d4d7a023c6b251361b1644de164b2f1d76078 100644 (file)
@@ -86,15 +86,14 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() :
   fCutsEvent(NULL),
   fCutsRP(NULL),
   fCutsPOI(NULL),
-  fQAInt(NULL),
-  fQADiff(NULL),
+  fQAList(NULL),
   fMinMult(0),
   fMaxMult(10000000),
   fMinA(-1.0),
   fMaxA(-0.01),
   fMinB(0.01),
   fMaxB(1.0),
-  fQA(kFALSE),
+  fQAon(kFALSE),
   fLoadCandidates(kFALSE),
   fNbinsMult(10000),
   fNbinsPt(100),   
@@ -140,15 +139,14 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt
   fCutsEvent(NULL),
   fCutsRP(NULL),
   fCutsPOI(NULL),
-  fQAInt(NULL),
-  fQADiff(NULL),
+  fQAList(NULL),
   fMinMult(0),
   fMaxMult(10000000),
   fMinA(-1.0),
   fMaxA(-0.01),
   fMinB(0.01),
   fMaxB(1.0),
-  fQA(on),
+  fQAon(on),
   fLoadCandidates(bCandidates),
   fNbinsMult(10000),
   fNbinsPt(100),   
@@ -196,11 +194,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt
   // Define output slots here
   // Define here the flow event output
   DefineOutput(1, AliFlowEventSimple::Class());
-  if(on)
-  {
-    DefineOutput(2, TList::Class());
-    DefineOutput(3, TList::Class());
-  }
+  DefineOutput(2, TList::Class());
 
   // and for testing open an output file
   //  fOutputFile = new TFile("FlowEvents.root","RECREATE");
@@ -215,6 +209,10 @@ AliAnalysisTaskFlowEvent::~AliAnalysisTaskFlowEvent()
   //
   delete fMyTRandom3;
   delete fFlowEvent;
+  delete fCutsEvent;
+  delete fCutsRP;
+  delete fCutsPOI;
+  delete fQAList;
   // objects in the output list are deleted
   // by the TSelector dtor (I hope)
 
@@ -263,6 +261,15 @@ void AliAnalysisTaskFlowEvent::UserCreateOutputObjects()
 
   fFlowEvent = new AliFlowEvent(3000);
 
+  if (fQAon)
+  {
+    fQAList=new TList();
+    fQAList->SetName(Form("%s QA",GetName()));
+    if (fCutsEvent->GetQA()) fQAList->Add(fCutsEvent->GetQA());
+    if (fCutsRP->GetQA()) fQAList->Add(fCutsRP->GetQA());
+    if (fCutsPOI->GetQA())fQAList->Add(fCutsPOI->GetQA());
+    PostData(2,fQAList);
+  }
 }
 
 //________________________________________________________________________
@@ -518,11 +525,6 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *)
   //fListHistos->Print();
   //fOutputFile->WriteObject(fFlowEvent,"myFlowEventSimple");
   PostData(1,fFlowEvent);
-  if (fQA)
-  {
-    PostData(2,fQAInt);
-    PostData(3,fQADiff);
-  }
 }
 
 //________________________________________________________________________
index 0a3054aea5b8eb2f8d1353f3e096e69f1a60a9be..fcc94980b948e0e6cd1955dd4447f3989bf2528d 100644 (file)
@@ -66,12 +66,9 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE {
   AliCFManager* GetCFManager1()           {return this->fCFManager1; }
   void          SetCFManager2(AliCFManager* cfmgr) {this->fCFManager2 = cfmgr; } 
   AliCFManager* GetCFManager2()           {return this->fCFManager2; }
-  void          SetQAList1(TList* list)   {this->fQAInt = list; }
-  TList*        GetQAList1()              {return this->fQAInt; }
-  void          SetQAList2(TList* list)   {this->fQADiff = list; }
-  TList*        GetQAList2()              {return this->fQADiff; }
-  void          SetQAOn(Bool_t kt)        {this->fQA = kt; }
-  Bool_t        GetQAOn()                 {return this->fQA; }
+  TList*        GetQAList()              {return fQAList; }
+  void          SetQAOn(Bool_t kt)        {fQAon = kt; }
+  Bool_t        GetQAOn()                 {return fQAon; }
 
   // setters for common constants
   void SetNbinsMult( Int_t i ) { fNbinsMult = i; }
@@ -114,8 +111,7 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE {
   AliFlowEventCuts* fCutsEvent;     //event cuts
   AliFlowTrackCuts* fCutsRP;        //cuts for RPs
   AliFlowTrackCuts* fCutsPOI;       //cuts for POIs
-  TList*        fQAInt;             // QA histogram list
-  TList*        fQADiff;            // QA histogram list
+  TList*        fQAList;             // QA histogram list
   Int_t         fMinMult;           // Minimum multiplicity from tracks selected using CORRFW
   Int_t         fMaxMult;           // Maximum multiplicity from tracks selected using CORRFW 
   Double_t      fMinA;              // Minimum of eta range for subevent A
@@ -123,7 +119,7 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE {
   Double_t      fMinB;              // Minimum of eta range for subevent B
   Double_t      fMaxB;              // Maximum of eta range for subevent B
 
-  Bool_t fQA;                       // flag to set the filling of the QA hostograms
+  Bool_t fQAon;                       // flag to set the filling of the QA hostograms
   Bool_t fLoadCandidates;           // true if reciving candidates collection
 
   // setters for common constants
index be8beb3b5f5a6d991428b817a3c2d028a4f4b785..146d50d09438e8f85bc5ec1e9f8b4b6670764452 100644 (file)
@@ -558,46 +558,14 @@ void  AliAnalysisTaskPIDflowQA::UserCreateOutputObjects()
 
   //fOutputList->Add(fESDpid);
 
-  TH1* h=NULL; 
-  h = static_cast<TH1*>(fCutsTOFPions->GetQA()->At(0));
-  h->SetName(Form("pion direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFKaons->GetQA()->At(0));
-  h->SetName(Form("kaon direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFProtons->GetQA()->At(0));
-  h->SetName(Form("proton direct %s",h->GetName()));
-  fOutputList->Add(fCutsTOFPions->GetQA()->At(0));
-  fOutputList->Add(fCutsTOFKaons->GetQA()->At(0));
-  fOutputList->Add(fCutsTOFProtons->GetQA()->At(0));
-
-  h = static_cast<TH1*>(fCutsTOFPions->GetQA()->At(1));
-  h->SetName(Form("pion direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFKaons->GetQA()->At(1));
-  h->SetName(Form("kaon direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFProtons->GetQA()->At(1));
-  h->SetName(Form("proton direct %s",h->GetName()));
-  fOutputList->Add(fCutsTOFPions->GetQA()->At(1));
-  fOutputList->Add(fCutsTOFKaons->GetQA()->At(1));
-  fOutputList->Add(fCutsTOFProtons->GetQA()->At(1));
-
-  h = static_cast<TH1*>(fCutsTOFPions->GetQA()->At(2));
-  h->SetName(Form("pion direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFKaons->GetQA()->At(2));
-  h->SetName(Form("kaon direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFProtons->GetQA()->At(2));
-  h->SetName(Form("proton direct %s",h->GetName()));
-  fOutputList->Add(fCutsTOFPions->GetQA()->At(2));
-  fOutputList->Add(fCutsTOFKaons->GetQA()->At(2));
-  fOutputList->Add(fCutsTOFProtons->GetQA()->At(2));
-
-  h = static_cast<TH1*>(fCutsTOFPions->GetQA()->At(3));
-  h->SetName(Form("pion direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFKaons->GetQA()->At(3));
-  h->SetName(Form("kaon direct %s",h->GetName()));
-  h = static_cast<TH1*>(fCutsTOFProtons->GetQA()->At(3));
-  h->SetName(Form("proton direct %s",h->GetName()));
-  fOutputList->Add(fCutsTOFPions->GetQA()->At(3));
-  fOutputList->Add(fCutsTOFKaons->GetQA()->At(3));
-  fOutputList->Add(fCutsTOFProtons->GetQA()->At(3));
+  fOutputList->Add(fCutsTPCElectrons);
+  fOutputList->Add(fCutsTPCPions);
+  fOutputList->Add(fCutsTPCKaons);
+  fOutputList->Add(fCutsTPCProtons);
+  fOutputList->Add(fCutsTOFElectrons);
+  fOutputList->Add(fCutsTOFPions);
+  fOutputList->Add(fCutsTOFKaons);
+  fOutputList->Add(fCutsTOFProtons);
 
   if (fUseDebugFile) fFile = fopen("debug.txt","w");
 
@@ -640,6 +608,16 @@ void  AliAnalysisTaskPIDflowQA::UserExec(Option_t *)
 
   AliESDtrack *trackESD=0;
 
+  fCuts->SetEvent(fESD);
+  fCutsTPCElectrons->SetEvent(fESD);
+  fCutsTPCPions->SetEvent(fESD);
+  fCutsTPCKaons->SetEvent(fESD);
+  fCutsTPCProtons->SetEvent(fESD);
+  fCutsTOFElectrons->SetEvent(fESD);
+  fCutsTOFPions->SetEvent(fESD);
+  fCutsTOFKaons->SetEvent(fESD);
+  fCutsTOFProtons->SetEvent(fESD);
+
   for(int tr1=0; tr1<nTracks; tr1++)
   {
     trackESD=fESD->GetTrack(tr1);
@@ -713,7 +691,7 @@ void AliAnalysisTaskPIDflowQA::pidTPC(AliESDtrack* t, Int_t pdgcode)
   const AliExternalTrackParam* innerParam = t->GetInnerParam();
   if (!innerParam) return;
   Double_t pinTPCglobal=innerParam->GetP();
-  Double_t tpcSignal =t ->GetTPCsignal();
+  Double_t tpcSignal =t->GetTPCsignal();
   Float_t p=innerParam->P();
   Float_t pt=innerParam->Pt();
   Float_t sigPion     = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kPion);
@@ -870,23 +848,6 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
     invbetadiff[i] = invbeta-invbetaHypothesis[i];
   }
 
-  /////////////simple cuts
-  Bool_t isPion   = ( (betadiff[2]<0.015) && (betadiff[2]>-0.015) &&
-                      (betadiff[3]>0.025) &&
-                      (betadiff[4]>0.03) );
-
-  Bool_t isKaon   = ( (betadiff[3]<0.015) && (betadiff[3]>-0.015) &&
-                      (betadiff[2]<-0.03) &&
-                      (betadiff[4]>0.03) );
-
-  Bool_t isProton = ( (betadiff[4]<0.015) && (betadiff[4]>-0.015) &&
-                      (betadiff[3]<-0.025) &&
-                      (betadiff[2]<-0.025) );
-
-  if (isPion)     fTOFbetaAfterPionCuts1->Fill(p,beta);
-  if (isKaon)     fTOFbetaAfterKaonCuts1->Fill(p,beta);
-  if (isProton)   fTOFbetaAfterProtonCuts1->Fill(p,beta);
-
   //responses
   fTOFbeta->Fill(p,beta);
   fTOFbetaE->Fill(p,betadiff[0]);
@@ -900,7 +861,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
   fTOFinvbetaK->Fill(p,invbetadiff[3]);
   fTOFinvbetaP->Fill(p,invbetadiff[4]);
 
-  if (fCutsTOFElectrons->PassesTOFbetaCut(track)) 
+  if (fCutsTOFElectrons->IsSelected(track)) 
   {
     fTOFbetaAfterElectronsCuts->Fill(p,beta);
     fTOFbetaEafter->Fill(p,beta-betaHypothesis[0]);
@@ -928,7 +889,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
       }
     }
   }
-  if (fCutsTOFPions->PassesTOFbetaCut(track)) 
+  if (fCutsTOFPions->IsSelected(track)) 
   {
     fTPCdedxAfterTOFpidPions->Fill(pinTPCglobal,tpcSignal);
     fTOFbetaAfterPionCuts->Fill(p,beta);
@@ -957,7 +918,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
       }
     }
   }
-  if (fCutsTOFKaons->PassesTOFbetaCut(track)) 
+  if (fCutsTOFKaons->IsSelected(track)) 
   {
     fTPCdedxAfterTOFpidKaons->Fill(pinTPCglobal,tpcSignal);
     fTOFbetaAfterKaonCuts->Fill(p,beta);
@@ -986,7 +947,7 @@ void AliAnalysisTaskPIDflowQA::pidTOF(AliESDtrack* track, Int_t pdgcode)
       }
     }
   }
-  if (fCutsTOFProtons->PassesTOFbetaCut(track)) 
+  if (fCutsTOFProtons->IsSelected(track)) 
   {
     fTPCdedxAfterTOFpidProtons->Fill(pinTPCglobal,tpcSignal);
     fTOFbetaAfterProtonCuts->Fill(p,beta);
index 845d8bfafccc5602bf314841f24b53c60fa11e09..e1bba7af3c738a41b69531871af3a2c969e98182 100644 (file)
@@ -641,13 +641,6 @@ void AliFlowEvent::Fill( AliFlowTrackCuts* rpCuts,
         if (!poiCuts->FillFlowTrack(pTrack)) continue;
         pTrack->TagPOI();
       }
-      
-      //store the index of the ESD track for AODs and ESDs
-      //TODO: should be moved to AliFlowTrackCuts
-      Int_t trackID = -1;
-      AliVTrack *toGetfID = dynamic_cast<AliVTrack*> (particle);
-      if (toGetfID) trackID = toGetfID->GetID();
-      pTrack->SetID(trackID);
       fNumberOfTracks++;
     }//end of while (i < numberOfTracks)
   }
@@ -745,14 +738,6 @@ AliFlowEvent::AliFlowEvent( AliFlowTrackCuts* rpCuts,
         if (!pTrack) continue;
         pTrack->TagPOI();
       }
-      
-      //store the index of the ESD track for AODs and ESDs
-      //TODO: should be moved to AliFlowTrackCuts
-      Int_t trackID = -1;
-      AliVTrack *toGetfID = dynamic_cast<AliVTrack*> (particle);
-      if (toGetfID) trackID = toGetfID->GetID();
-      pTrack->SetID(trackID);
-
       AddTrack(pTrack);
     }//end of while (i < numberOfTracks)
   }
index 351f9d6c4bc85de22e5be4d99b1703c4ac8daea5..2e45fe0096113f1c292a36512530f87a377f4e9e 100644 (file)
@@ -22,6 +22,9 @@
 
 #include <limits.h>
 #include <float.h>
+#include <TList.h>
+#include <TH1F.h>
+#include <TBrowser.h>
 #include "TMath.h"
 #include "TNamed.h"
 #include "AliVVertex.h"
@@ -40,6 +43,7 @@ ClassImp(AliFlowEventCuts)
 //-----------------------------------------------------------------------
 AliFlowEventCuts::AliFlowEventCuts():
   TNamed(),
+  fQA(NULL),
   fCutNumberOfTracks(kFALSE),
   fNumberOfTracksMax(INT_MAX),
   fNumberOfTracksMin(INT_MIN),
@@ -82,6 +86,7 @@ AliFlowEventCuts::AliFlowEventCuts():
 //-----------------------------------------------------------------------
 AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
   TNamed(name, title),
+  fQA(NULL),
   fCutNumberOfTracks(kFALSE),
   fNumberOfTracksMax(INT_MAX),
   fNumberOfTracksMin(INT_MIN),
@@ -124,6 +129,7 @@ AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title):
 ////-----------------------------------------------------------------------
 AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that):
   TNamed(that),
+  fQA(NULL),
   fCutNumberOfTracks(that.fCutNumberOfTracks),
   fNumberOfTracksMax(that.fNumberOfTracksMax),
   fNumberOfTracksMin(that.fNumberOfTracksMin),
@@ -160,6 +166,7 @@ AliFlowEventCuts::AliFlowEventCuts(const AliFlowEventCuts& that):
   fCutZDCtiming(that.fCutZDCtiming),
   fTrigAna()
 {
+  if (that.fQA) DefineHistograms();
   //copy constructor 
   if (that.fRefMultCuts)
     fRefMultCuts = new AliFlowTrackCuts(*(that.fRefMultCuts));
@@ -177,6 +184,7 @@ AliFlowEventCuts::~AliFlowEventCuts()
   //dtor
   delete fMeanPtCuts;
   delete fRefMultCuts;
+  if (fQA) { fQA->SetOwner(); fQA->Delete(); delete fQA; }
 }
 
 ////-----------------------------------------------------------------------
@@ -185,6 +193,22 @@ AliFlowEventCuts& AliFlowEventCuts::operator=(const AliFlowEventCuts& that)
   //assignment
   if (this==&that) return *this;
 
+  if (that.fQA)
+  {
+    if (fQA)
+    {
+      fQA->Delete();
+      delete fQA;
+    }
+    fQA = static_cast<TList*>(that.fQA->Clone());
+  }
+  else
+  {
+    fQA->Delete();
+    delete fQA;
+    fQA=NULL;
+  }
+
   fCutNumberOfTracks=that.fCutNumberOfTracks;
   fNumberOfTracksMax=that.fNumberOfTracksMax;
   fNumberOfTracksMin=that.fNumberOfTracksMin;
@@ -312,7 +336,9 @@ Bool_t AliFlowEventCuts::PassesCuts(AliVEvent *event)
   if (fCutPrimaryVertexZ)
   {
     if (pvtxz < fPrimaryVertexZmin || pvtxz >= fPrimaryVertexZmax)
+    {
       return kFALSE;
+    }
   }
   if (fCutTPCmultiplicityOutliers)
   {
@@ -417,3 +443,48 @@ Int_t AliFlowEventCuts::RefMult(AliVEvent* event)
   }
   return refmult;
 }
+//_____________________________________________________________________________
+void AliFlowEventCuts::DefineHistograms()
+{
+  Bool_t adddirstatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+  if (!fQA) fQA = new TList();
+  fQA->SetName(Form("%s QA",GetName()));
+  TList* before = new TList();
+  before->SetName("before");
+  TList* after = new TList();
+  after->SetName("after");
+  fQA->Add(before);
+  fQA->Add(after);
+  before->Add(new TH1F("zvertex",";z;event cout",500,-15.,15.));
+  after->Add(new TH1F("zvertex",";z;event cout",500,-15.,15.));
+  TH1::AddDirectory(adddirstatus);
+}
+
+//---------------------------------------------------------------//
+void AliFlowEventCuts::Browse(TBrowser* b)
+{
+  //some browsing capabilities
+  if (fQA) b->Add(fQA);
+}
+
+//---------------------------------------------------------------//
+Long64_t AliFlowEventCuts::Merge(TCollection* list)
+{
+  //merge
+  Int_t number=0;
+  AliFlowEventCuts* obj;
+  if (!list) return 0;
+  if (list->GetEntries()<1) return 0;
+  TIter next(list);
+  while ( (obj = dynamic_cast<AliFlowEventCuts*>(next())) )
+  {
+    if (obj==this) continue;
+    TList listwrapper;
+    listwrapper.Add(obj->GetQA());
+    fQA->Merge(&listwrapper);
+    number++;
+  }
+  return number;
+}
+
index 76c691504b9e4a5172bd895d0ba735bb40b8cbdc..3e637352fb0e33954f041958d96a8e29262480df 100644 (file)
@@ -14,6 +14,9 @@
 #include "TNamed.h"
 
 class AliVEvent;
+class TBrowser;
+#include "TList.h"
+#include "TH1.h"
 #include "AliTriggerAnalysis.h"
 #include "AliFlowTrackCuts.h"
 
@@ -62,6 +65,11 @@ class AliFlowEventCuts : public TNamed {
   void SetRefMultCuts( AliFlowTrackCuts* cuts ) {fRefMultCuts=static_cast<AliFlowTrackCuts*>(cuts->Clone());}
   void SetMeanPtCuts( AliFlowTrackCuts* cuts ) {fMeanPtCuts=static_cast<AliFlowTrackCuts*>(cuts->Clone());}
   AliFlowTrackCuts* GetRefMultCuts() const {return fRefMultCuts;}
+  void DefineHistograms();
+  void SetQA() {DefineHistograms();}
+  TList* GetQA() const {return fQA;}
+  TH1* QAbefore(Int_t i) {return static_cast<TH1*>(static_cast<TList*>(fQA->At(0))->At(i));}
+  TH1* QAafter(Int_t i) {return static_cast<TH1*>(static_cast<TList*>(fQA->At(1))->At(i));}
 
   Int_t RefMult(AliVEvent* event);
   //Int_t GetRefMult() {return fRefMult;}
@@ -72,8 +80,12 @@ class AliFlowEventCuts : public TNamed {
                                                                fCutCentralityPercentile=kTRUE; }
   void SetCentralityPercentileMethod( refMultMethod m) {fCentralityPercentileMethod=m;}
   void SetUseCentralityUnchecked(Bool_t b=kTRUE) {fUseCentralityUnchecked=b;}
+  
+  void Browse(TBrowser* b);
+  Long64_t Merge(TCollection* list);  
 
  private:
+  TList* fQA; //QA
   Bool_t fCutNumberOfTracks;//cut on # of tracks
   Int_t fNumberOfTracksMax;  //limits
   Int_t fNumberOfTracksMin;  //limits
@@ -110,7 +122,7 @@ class AliFlowEventCuts : public TNamed {
   Bool_t fCutZDCtiming;   //cut on ZDC timing
   AliTriggerAnalysis fTrigAna; //trigger analysis object
 
-  ClassDef(AliFlowEventCuts,2)
+  ClassDef(AliFlowEventCuts,3)
 };
 
 #endif
index 66d86dd9e499b50aa21e8373ec05e3f3b43a4195..0cf6e3dd052e9b1b2c38fa3ba719ee5b4d80a0c3 100644 (file)
@@ -39,8 +39,8 @@
 #include <TMatrix.h>
 #include "TParticle.h"
 #include "TH2F.h"
-#include "TObjArray.h"
 #include "AliStack.h"
+#include "TBrowser.h"
 #include "AliMCEvent.h"
 #include "AliESDEvent.h"
 #include "AliVParticle.h"
@@ -116,7 +116,8 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fTPCpidCuts(NULL),
   fTOFpidCuts(NULL),
   fParticleID(AliPID::kPion),
-  fParticleProbability(.9)
+  fParticleProbability(.9),
+  fAllowTOFmismatch(kFALSE)
 {
   //io constructor 
   for ( Int_t i=0; i<5; i++ ) { fProbBayes[i]=0.0; }
@@ -182,7 +183,8 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fTPCpidCuts(NULL),
   fTOFpidCuts(NULL),
   fParticleID(AliPID::kPion),
-  fParticleProbability(.9)
+  fParticleProbability(.9),
+  fAllowTOFmismatch(kFALSE)
 {
   //constructor 
   SetName(name);
@@ -256,7 +258,8 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   fTPCpidCuts(NULL),
   fTOFpidCuts(NULL),
   fParticleID(that.fParticleID),
-  fParticleProbability(that.fParticleProbability)
+  fParticleProbability(that.fParticleProbability),
+  fAllowTOFmismatch(that.fAllowTOFmismatch)
 {
   //copy constructor
   if (that.fTPCpidCuts) fTPCpidCuts = new TMatrixF(*(that.fTPCpidCuts));
@@ -342,6 +345,7 @@ AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
 
   fParticleID=that.fParticleID;
   fParticleProbability=that.fParticleProbability;
+  fAllowTOFmismatch=that.fAllowTOFmismatch;
   memcpy(fProbBayes,that.fProbBayes,sizeof(fProbBayes));
 
   return *this;
@@ -354,6 +358,7 @@ AliFlowTrackCuts::~AliFlowTrackCuts()
   delete fAliESDtrackCuts;
   delete fTPCpidCuts;
   delete fTOFpidCuts;
+  if (fQA) { fQA->SetOwner(); fQA->Delete(); delete fQA; }
 }
 
 //-----------------------------------------------------------------------
@@ -623,10 +628,10 @@ Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
 {
   //check cuts on ESD tracks
   Bool_t pass=kTRUE;
+  const AliExternalTrackParam* pout = track->GetOuterParam();
+  const AliExternalTrackParam* pin = track->GetInnerParam();
   if (fIgnoreTPCzRange)
   {
-    const AliExternalTrackParam* pin = track->GetOuterParam();
-    const AliExternalTrackParam* pout = track->GetInnerParam();
     if (pin&&pout)
     {
       Double_t zin = pin->GetZ();
@@ -670,6 +675,13 @@ Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
     if (!fAliESDtrackCuts->IsSelected(track)) pass=kFALSE;
   }
  
+  Double_t beta = GetBeta(track);
+  Double_t dedx = Getdedx(track);
+  if (fQA)
+  {
+    if (pass) QAbefore(0)->Fill(track->GetP(),beta);
+    if (pass) QAbefore(1)->Fill(pin->GetP(),dedx);
+  }
   if (fCutPID)
   {
     switch (fPIDsource)    
@@ -700,6 +712,11 @@ Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
         break;
     }
   }    
+  if (fQA)
+  {
+    if (pass) QAafter(0)->Fill(track->GetP(),beta);
+    if (pass) QAafter(1)->Fill(pin->GetP(),dedx);
+  }
 
   return pass;
 }
@@ -938,10 +955,26 @@ Bool_t AliFlowTrackCuts::FillFlowTrackVParticle(AliFlowTrack* flowtrack) const
       flowtrack->Set(fTrack);
       break;
   }
-  if (fParamType==kMC) flowtrack->SetSource(AliFlowTrack::kFromMC);
-  else if (dynamic_cast<AliESDtrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromESD);
-  else if (dynamic_cast<AliAODTrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD);
-  else if (dynamic_cast<AliMCParticle*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC);
+  if (fParamType==kMC) 
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromMC);
+    flowtrack->SetID(fTrack->GetLabel());
+  }
+  else if (dynamic_cast<AliESDtrack*>(fTrack))
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromESD);
+    flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
+  }
+  else if (dynamic_cast<AliAODTrack*>(fTrack)) 
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromAOD);
+    flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
+  }
+  else if (dynamic_cast<AliMCParticle*>(fTrack)) 
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromMC);
+    flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
+  }
   return kTRUE;
 }
 
@@ -1055,10 +1088,26 @@ AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackVParticle() const
       flowtrack = new AliFlowTrack(fTrack);
       break;
   }
-  if (fParamType==kMC) flowtrack->SetSource(AliFlowTrack::kFromMC);
-  else if (dynamic_cast<AliESDtrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromESD);
-  else if (dynamic_cast<AliAODTrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD);
-  else if (dynamic_cast<AliMCParticle*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC);
+  if (fParamType==kMC) 
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromMC);
+    flowtrack->SetID(fTrack->GetLabel());
+  }
+  else if (dynamic_cast<AliESDtrack*>(fTrack))
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromESD);
+    flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
+  }
+  else if (dynamic_cast<AliAODTrack*>(fTrack)) 
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromAOD);
+    flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
+  }
+  else if (dynamic_cast<AliMCParticle*>(fTrack)) 
+  {
+    flowtrack->SetSource(AliFlowTrack::kFromMC);
+    flowtrack->SetID(static_cast<AliVTrack*>(fTrack)->GetID());
+  }
   return flowtrack;
 }
 
@@ -1219,22 +1268,35 @@ void AliFlowTrackCuts::DefineHistograms()
   //define qa histograms
   if (fQA) return;
   
-  Int_t kPBins=60;
-  Double_t binsPDummy[kPBins+1];
-  binsPDummy[0]=0.0;
-  for(int i=1; i<=kPBins+1; i++)
+  Int_t kNbinsP=60;
+  Double_t binsP[kNbinsP+1];
+  binsP[0]=0.0;
+  for(int i=1; i<=kNbinsP+1; i++)
   {
-    if(binsPDummy[i-1]+0.05<1.01)
-      binsPDummy[i]=binsPDummy[i-1]+0.05;
+    if(binsP[i-1]+0.05<1.01)
+      binsP[i]=binsP[i-1]+0.05;
     else
-      binsPDummy[i]=binsPDummy[i-1]+0.1;
+      binsP[i]=binsP[i-1]+0.1;
   }
 
-  fQA=new TObjArray(4);
-  fQA->Add(new TH2F("after TOFpidQA betadiffVSp",";p;#beta-#beta_{particle}",100,0,5,500,-0.25,0.25));
-  fQA->Add(new TH2F("after TOFpidQA betaVSp",";p;#beta",kPBins,binsPDummy,1000,0.4,1.1));
-  fQA->Add(new TH2F("before TOFpidQA betadiffVSp",";p;#beta-#beta_{particle}",100,0,5,500,-0.25,0.25));
-  fQA->Add(new TH2F("before TOFpidQA betaVSp",";p;#beta",kPBins,binsPDummy,1000,0.4,1.1));
+  Bool_t adddirstatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+  fQA=new TList();
+  fQA->SetOwner();
+  fQA->SetName(Form("%s QA",GetName()));
+  TList* before = new TList();
+  before->SetOwner();
+  before->SetName("before");
+  TList* after = new TList();
+  after->SetOwner();
+  after->SetName("after");
+  fQA->Add(before);
+  fQA->Add(after);
+  before->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1));
+  after->Add(new TH2F("TOFbeta",";p [GeV/c];#beta",kNbinsP,binsP,1000,0.4,1.1));
+  before->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500));
+  after->Add(new TH2F("TPCdedx",";p [GeV/c];dEdx",kNbinsP,binsP,500,0,500));
+  TH1::AddDirectory(adddirstatus);
 }
 
 //-----------------------------------------------------------------------
@@ -1314,8 +1376,9 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaSimpleCut(const AliESDtrack* track )
                      (track->GetStatus() & AliESDtrack::kTOFpid) && 
                      (track->GetTOFsignal() > 12000) && 
                      (track->GetTOFsignal() < 100000) && 
-                     (track->GetIntegratedLength() > 365) && 
-                    !(track->GetStatus() & AliESDtrack::kTOFmismatch);
+                     (track->GetIntegratedLength() > 365);
+                    
+  if ((track->GetStatus() & AliESDtrack::kTOFmismatch) && !fAllowTOFmismatch) return kFALSE;
 
   if (!goodtrack) return kFALSE;
   
@@ -1346,7 +1409,7 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaSimpleCut(const AliESDtrack* track )
                (s[2]<-0.03) &&
                (s[4]>0.03) );
     case AliPID::kProton:
-      return ( (s[4]<0.015) && (s[2]>-0.015) &&
+      return ( (s[4]<0.015) && (s[4]>-0.015) &&
                (s[3]<-0.025) &&
                (s[2]<-0.025) );
     default:
@@ -1355,6 +1418,18 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaSimpleCut(const AliESDtrack* track )
   return kFALSE;
 }
 
+//-----------------------------------------------------------------------
+Float_t AliFlowTrackCuts::GetBeta(const AliESDtrack* track)
+{
+  //get beta
+  const Float_t c = 2.99792457999999984e-02;  
+  Float_t p = track->GetP();
+  Float_t l = track->GetIntegratedLength();  
+  Float_t trackT0 = fESDpid.GetTOFResponse().GetStartTime(p);
+  Float_t timeTOF = track->GetTOFsignal()- trackT0; 
+  return l/timeTOF/c;
+}
+
 //-----------------------------------------------------------------------
 Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliESDtrack* track )
 {
@@ -1363,17 +1438,14 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliESDtrack* track )
                      (track->GetStatus() & AliESDtrack::kTOFpid) && 
                      (track->GetTOFsignal() > 12000) && 
                      (track->GetTOFsignal() < 100000) && 
-                     (track->GetIntegratedLength() > 365) && 
-                    !(track->GetStatus() & AliESDtrack::kTOFmismatch);
+                     (track->GetIntegratedLength() > 365);
+
+  if ((track->GetStatus() & AliESDtrack::kTOFmismatch) && !fAllowTOFmismatch) return kFALSE;
 
   if (!goodtrack) return kFALSE;
   
-  const Float_t c = 2.99792457999999984e-02;  
-  Float_t p = track->GetP();
-  Float_t l = track->GetIntegratedLength();  
-  Float_t trackT0 = fESDpid.GetTOFResponse().GetStartTime(p);
-  Float_t timeTOF = track->GetTOFsignal()- trackT0; 
-  Float_t beta = l/timeTOF/c;
+  Float_t beta = GetBeta(track);
+
   Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
   track->GetIntegratedTimes(integratedTimes);
 
@@ -1395,6 +1467,9 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliESDtrack* track )
   }
 
   //signal to cut on
+  const Float_t c = 2.99792457999999984e-02;  
+  Float_t l = track->GetIntegratedLength();  
+  Float_t p = track->GetP();  
   Float_t betahypothesis = l/integratedTimes[pid]/c;
   Float_t betadiff = beta-betahypothesis;
 
@@ -1406,18 +1481,6 @@ Bool_t AliFlowTrackCuts::PassesTOFbetaCut(const AliESDtrack* track )
 
   Bool_t pass = (betadiff>min && betadiff<max);
   
-  if (fQA)
-  {
-    TH2F* qahistbetadiff = static_cast<TH2F*>(fQA->At(0));
-    TH2F* qahistbeta = static_cast<TH2F*>(fQA->At(1));
-    TH2F* qahistbetadiffbefore = static_cast<TH2F*>(fQA->At(2));
-    TH2F* qahistbetabefore = static_cast<TH2F*>(fQA->At(3));
-    if (pass&&qahistbetadiff) qahistbetadiff->Fill(p,betadiff);
-    if (pass&&qahistbeta) qahistbeta->Fill(p,beta);
-    if (qahistbetadiffbefore) qahistbetadiffbefore->Fill(p,betadiff);
-    if (qahistbetabefore) qahistbetabefore->Fill(p,beta);
-  }
-  
   return pass;
 }
 
@@ -1450,6 +1513,13 @@ Bool_t AliFlowTrackCuts::PassesTPCpidCut(const AliESDtrack* track) const
   return kFALSE;
 }
 
+//-----------------------------------------------------------------------
+Float_t AliFlowTrackCuts::Getdedx(const AliESDtrack* track)
+{
+  //get TPC dedx
+  return track->GetTPCsignal();
+}
+
 //-----------------------------------------------------------------------
 Bool_t AliFlowTrackCuts::PassesTPCdedxCut(const AliESDtrack* track)
 {
@@ -2232,4 +2302,30 @@ Double_t AliFlowTrackCuts::GetPmdPhi(Float_t xPos, Float_t yPos)
   phi = phi*3.14159/180.;
   return   phi;
 }
+
+//---------------------------------------------------------------//
+void AliFlowTrackCuts::Browse(TBrowser* b)
+{
+  //some browsing capabilities
+  if (fQA) b->Add(fQA);
+}
+
 //---------------------------------------------------------------//
+Long64_t AliFlowTrackCuts::Merge(TCollection* list)
+{
+  //merge
+  Int_t number=0;
+  AliFlowTrackCuts* obj;
+  if (!list) return 0;
+  if (list->GetEntries()<1) return 0;
+  TIter next(list);
+  while ( (obj = dynamic_cast<AliFlowTrackCuts*>(next())) )
+  {
+    if (obj==this) continue;
+    TList listwrapper;
+    listwrapper.Add(obj->GetQA());
+    fQA->Merge(&listwrapper);
+    number++;
+  }
+  return number;
+}
index c46f94f48785bdfd3363900db5025c830a78b463..c8aefaac248d1dce4d763883f9bd61582128bd2d 100644 (file)
@@ -10,6 +10,7 @@
 #define ALIFLOWTRACKCUTS_H
 
 #include <TMatrix.h>
+#include <TList.h>
 #include "AliFlowTrackSimpleCuts.h"
 #include "AliESDtrackCuts.h"
 #include "TMCProcess.h"
@@ -17,7 +18,7 @@
 #include "AliPID.h"
 #include "AliESDpid.h"
 
-class TObjArray;
+class TBrowser;
 class AliVParticle;
 class AliMCParticle;
 class AliFlowTrack;
@@ -131,10 +132,14 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Double_t GetMinimalTPCdedx() const {return fMinimalTPCdedx;}
   Int_t GetPmdDetPlane()const {return fPmdDet; }
   Float_t GetPmdAdc()const {return fPmdAdc;}
-  Float_t GetPmdNcell() const {return fPmdNcell; }  
+  Float_t GetPmdNcell() const {return fPmdNcell; }
+  Float_t GetBeta(const AliESDtrack* t);
+  Float_t Getdedx(const AliESDtrack* t);
  
   void SetQA() {DefineHistograms();}
-  TObjArray* GetQA() const {return fQA;}
+  TList* GetQA() const {return fQA;}
+  TH1* QAbefore(Int_t i) {return static_cast<TH1*>(static_cast<TList*>(fQA->At(0))->At(i));}
+  TH1* QAafter(Int_t i) {return static_cast<TH1*>(static_cast<TList*>(fQA->At(1))->At(i));}  
 
   //MC stuff
   void SetCutMC( Bool_t b=kTRUE );
@@ -178,6 +183,8 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   void SetTOFpidCuts(TMatrixF* mat) {fTOFpidCuts=new TMatrixF(*mat);}
   static const char* PIDsourceName(PIDsource s);
   AliESDpid& GetESDpid() {return fESDpid;}
+  void SetAllowTOFmismatch(Bool_t b=kTRUE) {fAllowTOFmismatch=b;}
+  Bool_t GetAllowTOFmismatch() const {return fAllowTOFmismatch;}
 
   //these should maybe be protected
   Bool_t PassesCuts(AliVParticle* track);
@@ -195,6 +202,9 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Bool_t PassesTOFbetaSimpleCut(const AliESDtrack* track);  
   Bool_t PassesTOFpidCut(const AliESDtrack* track) const;  
 
+  void Browse(TBrowser* b);
+  Long64_t Merge(TCollection* list);
+
  protected:
   AliFlowTrack* MakeFlowTrackSPDtracklet() const;
   AliFlowTrack* MakeFlowTrackPMDtrack() const;
@@ -215,7 +225,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
   //the cuts
   AliESDtrackCuts* fAliESDtrackCuts; //alianalysis cuts
-  TObjArray* fQA;                   //qa histograms go here
+  TList* fQA;                        //qa histograms go here
   Bool_t fCutMC;                     //do we cut on MC?
   Bool_t fCutMCprocessType;          //do we cut on mc process type?
   TMCProcess fMCprocessType;         //mc process type
@@ -275,6 +285,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   TMatrixF* fTOFpidCuts; //tof pid cuts
   AliPID::EParticleType fParticleID; //alipid
   Double_t fParticleProbability; //desired prob for a particle type
+  Bool_t fAllowTOFmismatch; //allow TPC mismatch
 
   // part added by F. Noferini
   static const Int_t fgkPIDptBin = 20; // pT bins for priors
@@ -284,7 +295,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
   static const Int_t fgkNumberOfV0tracks=64; //number of V0 channels
 
-  ClassDef(AliFlowTrackCuts,6)
+  ClassDef(AliFlowTrackCuts,7)
 };
 
 #endif
index fd25d22a81a9a844fb6d04bb8a965df132319c13..2299fcd10c67602762caf1f8ffa31595fe34b125 100644 (file)
@@ -31,7 +31,7 @@ Double_t excludePhiMax = 0.;
 // use physics selection class
 Bool_t  UsePhysicsSelection = kTRUE;
 
-// QA
+// separate QA task
 Bool_t runQAtask=kFALSE;
 Bool_t FillQAntuple=kFALSE;
 Bool_t DoQAcorrelations=kFALSE;
@@ -76,11 +76,6 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
                             Float_t centrMax=100.,
                             TString fileNameBase="AnalysisResults" )
 {
-  TString centralityName("");
-  centralityName+=Form("%.0f",centrMin);
-  centralityName+="-";
-  centralityName+=Form("%.0f",centrMax);
-
   TString fileName(fileNameBase);
   fileName.Append(".root");
   //===========================================================================
@@ -101,7 +96,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
   //cutsEvent->SetUseCentralityUnchecked();
   
   // RP TRACK CUTS:
-  AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("rp cuts");
+  AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("GlobalRP");
   cutsRP->SetParamType(rptype);
   cutsRP->SetParamMix(rpmix);
   cutsRP->SetPtRange(0.2,5.);
@@ -125,7 +120,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
   cutsRP->SetMinimalTPCdedx(10.);
 
   // POI TRACK CUTS:
-  AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("poi cuts");
+  AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("GlobalPOI");
   cutsPOI->SetParamType(poitype);
   cutsPOI->SetParamMix(poimix);
   cutsPOI->SetPtRange(0.0,10.);
@@ -151,10 +146,18 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
   //cutsPOI->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCpid);
   //cutsPOI->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCdedx);
   //cutsPOI->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbeta);
+  //cutsPOI->SetAllowTOFmismatch(kFALSE);
   //iexample: francesco's tunig TPC Bethe Bloch for data:
   //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);
   //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);
 
+  TString outputSlotName("");
+  outputSlotName+=Form("%.0f",centrMin);
+  outputSlotName+="-";
+  outputSlotName+=Form("%.0f",centrMax);
+  outputSlotName+=" ";
+  outputSlotName+=cutsRP->GetName()
+
   Bool_t useWeights  = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];
   if (useWeights) cout<<"Weights are used"<<endl;
   else cout<<"Weights are not used"<<endl;
@@ -219,7 +222,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
        break;
       }
       else {
-       TList* fInputListLYZ2SUM = (TList*)fInputFileLYZ2SUM->Get("cobjLYZ1SUM");
+       TList* fInputListLYZ2SUM = (TList*)fInputFileLYZ2SUM->Get("LYZ1SUM");
        if (!fInputListLYZ2SUM) {cout<<"list is NULL pointer!"<<endl;}
       }
       cout<<"LYZ2SUM input file/list read..."<<endl;
@@ -236,7 +239,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
        break;
       }
       else {
-       TList* fInputListLYZ2PROD = (TList*)fInputFileLYZ2PROD->Get("cobjLYZ1PROD");
+       TList* fInputListLYZ2PROD = (TList*)fInputFileLYZ2PROD->Get("LYZ1PROD");
        if (!fInputListLYZ2PROD) {cout<<"list is NULL pointer!"<<endl;}
       }
       cout<<"LYZ2PROD input file/list read..."<<endl;
@@ -268,7 +271,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
       break;
     }
     else {
-      TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("cobjLYZ2SUM");
+      TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("LYZ2SUM");
       if (!fInputListLYZEP) {cout<<"list is NULL pointer!"<<endl;}
     }
     cout<<"LYZEP input file/list read..."<<endl;
@@ -421,7 +424,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
   
   if (rptypestr == "FMD") {
     AliAnalysisDataContainer *coutputFMD = 
-      mgr->CreateContainer(Form("BackgroundCorrected_%s",centralityName.Data()), TList::Class(), AliAnalysisManager::kExchangeContainer);
+      mgr->CreateContainer(Form("BackgroundCorrected_%s",outputSlotName.Data()), TList::Class(), AliAnalysisManager::kExchangeContainer);
     //input and output taskFMD     
     mgr->ConnectInput(taskfmd, 0, cinput1);
     mgr->ConnectOutput(taskfmd, 1, coutputFMD);
@@ -430,16 +433,22 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
   }
   
   AliAnalysisDataContainer *coutputFE = 
-  mgr->CreateContainer(Form("cobjFlowEventSimple_%s",centralityName.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+  mgr->CreateContainer(Form("FlowEventSimple_%s",outputSlotName.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
   mgr->ConnectInput(taskFE,0,cinput1); 
   mgr->ConnectOutput(taskFE,1,coutputFE);
-  
+
+  if (taskFE->GetQAon())
+  {
+    AliAnalysisDataContainer* coutputFEQA = 
+    mgr->CreateContainer(Form("QA %s",outputSlotName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:QA %s",fileName,rptypestr));
+    mgr->ConnectOutput(taskFE,2,coutputFEQA);
+  }
 
   // Create the output containers for the data produced by the analysis tasks
   // Connect to the input and output containers
   //===========================================================================
   if (useWeights) {    
-    AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer(Form("cobjWeights_%s",centralityName.Data()),
+    AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer(Form("Weights_%s",outputSlotName.Data()),
                                                                   TList::Class(),AliAnalysisManager::kInputContainer); 
   }
 
@@ -447,7 +456,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     TString outputSP = fileName;
     outputSP += ":outputSPanalysis";
     outputSP+= rptypestr;
-    AliAnalysisDataContainer *coutputSP = mgr->CreateContainer(Form("cobjSP_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputSP = mgr->CreateContainer(Form("SP_%s",outputSlotName.Data()), 
                                                               TList::Class(),AliAnalysisManager::kOutputContainer,outputSP); 
     mgr->ConnectInput(taskSP,0,coutputFE); 
     mgr->ConnectOutput(taskSP,1,coutputSP); 
@@ -460,7 +469,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     TString outputLYZ1SUM = fileName;
     outputLYZ1SUM += ":outputLYZ1SUManalysis";
     outputLYZ1SUM+= rptypestr;
-    AliAnalysisDataContainer *coutputLYZ1SUM = mgr->CreateContainer(Form("cobjLYZ1SUM_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputLYZ1SUM = mgr->CreateContainer(Form("LYZ1SUM_%s",outputSlotName.Data()), 
                                                                    TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1SUM); 
     mgr->ConnectInput(taskLYZ1SUM,0,coutputFE);
     mgr->ConnectOutput(taskLYZ1SUM,1,coutputLYZ1SUM);
@@ -469,19 +478,19 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     TString outputLYZ1PROD = fileName;
     outputLYZ1PROD += ":outputLYZ1PRODanalysis";
     outputLYZ1PROD+= rptypestr;
-    AliAnalysisDataContainer *coutputLYZ1PROD = mgr->CreateContainer(Form("cobjLYZ1PROD_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputLYZ1PROD = mgr->CreateContainer(Form("LYZ1PROD_%s",outputSlotName.Data()), 
                                                                     TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1PROD); 
     mgr->ConnectInput(taskLYZ1PROD,0,coutputFE); 
     mgr->ConnectOutput(taskLYZ1PROD,1,coutputLYZ1PROD);
   }
   if(LYZ2SUM) {
-    AliAnalysisDataContainer *cinputLYZ2SUM = mgr->CreateContainer(Form("cobjLYZ2SUMin_%s",centralityName.Data()),
+    AliAnalysisDataContainer *cinputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUMin_%s",outputSlotName.Data()),
                                                                   TList::Class(),AliAnalysisManager::kInputContainer);
     TString outputLYZ2SUM = fileName;
     outputLYZ2SUM += ":outputLYZ2SUManalysis";
     outputLYZ2SUM+= rptypestr;
     
-    AliAnalysisDataContainer *coutputLYZ2SUM = mgr->CreateContainer(Form("cobjLYZ2SUM_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUM_%s",outputSlotName.Data()), 
                                                                    TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2SUM); 
     mgr->ConnectInput(taskLYZ2SUM,0,coutputFE); 
     mgr->ConnectInput(taskLYZ2SUM,1,cinputLYZ2SUM);
@@ -489,13 +498,13 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     cinputLYZ2SUM->SetData(fInputListLYZ2SUM);
   }
   if(LYZ2PROD) {
-    AliAnalysisDataContainer *cinputLYZ2PROD = mgr->CreateContainer(Form("cobjLYZ2PRODin_%s",centralityName.Data()),
+    AliAnalysisDataContainer *cinputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PRODin_%s",outputSlotName.Data()),
                                                                    TList::Class(),AliAnalysisManager::kInputContainer);
     TString outputLYZ2PROD = fileName;
     outputLYZ2PROD += ":outputLYZ2PRODanalysis";
     outputLYZ2PROD+= rptypestr;
     
-    AliAnalysisDataContainer *coutputLYZ2PROD = mgr->CreateContainer(Form("cobjLYZ2PROD_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PROD_%s",outputSlotName.Data()), 
                                                                     TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2PROD); 
     mgr->ConnectInput(taskLYZ2PROD,0,coutputFE); 
     mgr->ConnectInput(taskLYZ2PROD,1,cinputLYZ2PROD);
@@ -503,13 +512,13 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     cinputLYZ2PROD->SetData(fInputListLYZ2PROD);
   }
   if(LYZEP) {
-    AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer(Form("cobjLYZEPin_%s",centralityName.Data()),
+    AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer(Form("LYZEPin_%s",outputSlotName.Data()),
                                                                 TList::Class(),AliAnalysisManager::kInputContainer);
     TString outputLYZEP = fileName;
     outputLYZEP += ":outputLYZEPanalysis";
     outputLYZEP+= rptypestr;
     
-    AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer(Form("cobjLYZEP_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer(Form("LYZEP_%s",outputSlotName.Data()), 
                                                                  TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZEP); 
     mgr->ConnectInput(taskLYZEP,0,coutputFE); 
     mgr->ConnectInput(taskLYZEP,1,cinputLYZEP);
@@ -521,7 +530,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     outputGFC += ":outputGFCanalysis";
     outputGFC+= rptypestr;
     
-    AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer(Form("cobjGFC_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer(Form("GFC_%s",outputSlotName.Data()), 
                                                                TList::Class(),AliAnalysisManager::kOutputContainer,outputGFC); 
     mgr->ConnectInput(taskGFC,0,coutputFE); 
     mgr->ConnectOutput(taskGFC,1,coutputGFC);
@@ -535,7 +544,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     outputQC += ":outputQCanalysis";
     outputQC+= rptypestr;
 
-    AliAnalysisDataContainer *coutputQC = mgr->CreateContainer(Form("cobjQC_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputQC = mgr->CreateContainer(Form("QC_%s",outputSlotName.Data()), 
                                                               TList::Class(),AliAnalysisManager::kOutputContainer,outputQC); 
     mgr->ConnectInput(taskQC,0,coutputFE); 
     mgr->ConnectOutput(taskQC,1,coutputQC);
@@ -549,7 +558,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     outputFQD += ":outputFQDanalysis";
     outputFQD+= rptypestr;
     
-    AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer(Form("cobjFQD_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer(Form("FQD_%s",outputSlotName.Data()), 
                                                                TList::Class(),AliAnalysisManager::kOutputContainer,outputFQD); 
     mgr->ConnectInput(taskFQD,0,coutputFE); 
     mgr->ConnectOutput(taskFQD,1,coutputFQD);
@@ -563,7 +572,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     outputMCEP += ":outputMCEPanalysis";
     outputMCEP+= rptypestr;
     
-    AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer(Form("cobjMCEP_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer(Form("MCEP_%s",outputSlotName.Data()), 
                                                                 TList::Class(),AliAnalysisManager::kOutputContainer,outputMCEP); 
     mgr->ConnectInput(taskMCEP,0,coutputFE);
     mgr->ConnectOutput(taskMCEP,1,coutputMCEP); 
@@ -573,7 +582,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     outputMH += ":outputMHanalysis";
     outputMH += rptypestr;
         
-    AliAnalysisDataContainer *coutputMH = mgr->CreateContainer(Form("cobjMH_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputMH = mgr->CreateContainer(Form("MH_%s",outputSlotName.Data()), 
                                                               TList::Class(),AliAnalysisManager::kOutputContainer,outputMH); 
     mgr->ConnectInput(taskMH,0,coutputFE); 
     mgr->ConnectOutput(taskMH,1,coutputMH); 
@@ -587,7 +596,7 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     outputNL += ":outputNLanalysis";
     outputNL += rptypestr;
 
-    AliAnalysisDataContainer *coutputNL = mgr->CreateContainer(Form("cobjNL_%s",centralityName.Data()), 
+    AliAnalysisDataContainer *coutputNL = mgr->CreateContainer(Form("NL_%s",outputSlotName.Data()), 
                                                               TList::Class(),AliAnalysisManager::kOutputContainer,outputNL); 
     mgr->ConnectInput(taskNL,0,coutputFE);
     mgr->ConnectOutput(taskNL,1,coutputNL);
@@ -607,14 +616,14 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
     taskQAflow->SetDoCorrelations(DoQAcorrelations);
     mgr->AddTask(taskQAflow);
     
-    Printf("centralityName %s",centralityName.Data());
+    Printf("outputSlotName %s",outputSlotName.Data());
     TString taskQAoutputFileName(fileNameBase);
     taskQAoutputFileName.Append("_QA.root");
-    AliAnalysisDataContainer* coutputQAtask = mgr->CreateContainer(Form("flowQA_%s",centralityName.Data()),
+    AliAnalysisDataContainer* coutputQAtask = mgr->CreateContainer(Form("flowQA_%s",outputSlotName.Data()),
                                               TObjArray::Class(),
                                               AliAnalysisManager::kOutputContainer,
                                               taskQAoutputFileName);
-    AliAnalysisDataContainer* coutputQAtaskTree = mgr->CreateContainer(Form("flowQAntuple_%s",centralityName.Data()),
+    AliAnalysisDataContainer* coutputQAtaskTree = mgr->CreateContainer(Form("flowQAntuple_%s",outputSlotName.Data()),
                                               TNtuple::Class(),
                                               AliAnalysisManager::kOutputContainer,
                                               taskQAoutputFileName);
index 75e8c77c6ff915b25df36c37fe6216ba1fcc94aa..fe4146a9ef167547b8a6494d196b4eb1f18d9649 100644 (file)
@@ -9,32 +9,19 @@
 // effects in QC code because by default this correction is switched off).
 
 // Name of the merged, large statistics file obtained with the merging macros:
-TString mergedFileName = "outputCentralityTrain.root";
+TString mergedFileName = "output.root";
 // Final output file name holding correct final results for large statistics sample:
 TString outputFileName = "AnalysisResults.root";
-// Methods for which the flow analysis will be redone:
-const Int_t nMethods = 12;
-TString method[nMethods] = {"MCEP","SP","GFC","QC","FQD","LYZ1SUM","LYZ1PROD","LYZ2SUM","LYZ2PROD","LYZEP","MH","NL"};
-// Methods for which some settings can be modified before redoing Finish():
-// QC:
+
 Bool_t bApplyCorrectionForNUA = kFALSE; // apply correction for non-uniform acceptance
 Bool_t bApplyCorrectionForNUAVsM = kFALSE; // apply correction for non-uniform acceptance in each multiplicity bin independently
 Bool_t bPropagateErrorAlsoFromNIT = kFALSE; // propagate error also from non-isotropic terms
 Bool_t bMinimumBiasReferenceFlow = kTRUE; // store in CRH for reference flow the result obtained wihout rebinning in multiplicity (kTRUE)
 
-enum libModes {mLocal,mLocalSource};
-
-void redoFinish(TString type="ESD global", Int_t mode=mLocal)
+void redoFinish()
 {
-  // type: type of analysis can be ESD, AOD, MC, ....
-  //       (if type="" output files are from simulation 'on the fly')
-  // mode: if mode = mLocal: analyze data on your computer using aliroot
-  //       if mode = mLocalSource: analyze data on your computer using root + source files
+  LoadLibraries();
 
-  // Load needed libraries:
-  LoadLibrariesRF(mode);
-
-  // Accessing <mergedFileName>:
   TString mergedFileFullPathName(gSystem->pwd());
   mergedFileFullPathName+="/";
   mergedFileFullPathName+=mergedFileName.Data();
@@ -61,41 +48,21 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
   }
 
   // Access from <mergedFileName> the merged TDirectoryFile's for each method and from them the lists holding histograms:
-  for(Int_t i=0; i<nMethods; i++)
+  
+  TList* mergedFileKeys = mergedFile->GetListOfKeys();
+  for(Int_t i=0; i<mergedFileKeys->GetEntries(); i++)
   {
-    TString directoryName("");
-    TDirectory* directory = NULL;
-    cout<<endl;
-    // Form a file name for each method:
-    directoryName+="output";
-    directoryName+=method[i].Data();
-    directoryName+="analysis";
-    directoryName+=type.Data();
-    // Access this file:
-    directory = (TDirectory*)mergedFile->FindObjectAny(directoryName.Data());
-    // Form a list name for each method:
-    if(!directory)
-    {
-      cout<<" WARNING: Couldn't find a TDirectory "<<directoryName.Data()<<" in file "<<mergedFileName.Data()<<endl;
-      continue;
-    }
+    TDirectory* directory = dynamic_cast<TDirectory*>(mergedFile->Get(mergedFileKeys->At(i)->GetName()));
+    if (!directory) continue;
 
     TList* listTemp = directory->GetListOfKeys();
-    if (!listTemp)
-      {
-        cout<<" WARNING: Accessing TList from TDirectoryFile failed for method "<<method[i].Data()<<" !!!!"<<endl;
-        cout<<"          Did you actually specify "<<method[i].Data()<<" in the analysis?"<<endl;
-        cout<<endl;
-        continue;
-      }
-
     for (Int_t icent=0; icent<listTemp->GetEntries(); icent++)
     {
       TList* list = dynamic_cast<TList*>(directory->Get(listTemp->At(icent)->GetName()));
       if (!list) continue;
 
       ////////////////////
-      if(TString(list->GetName()).Contains("cobjMCEP"))
+      if(TString(list->GetName()).Contains("MCEP"))
       {
         AliFlowAnalysisWithMCEventPlane* mcep = new AliFlowAnalysisWithMCEventPlane();
         mcep->GetOutputHistograms(list);
@@ -104,7 +71,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // SP:
-      else if(TString(list->GetName()).Contains("cobjSP"))
+      else if(TString(list->GetName()).Contains("SP"))
       {
         AliFlowAnalysisWithScalarProduct* sp = new AliFlowAnalysisWithScalarProduct();
         sp->GetOutputHistograms(list);
@@ -113,7 +80,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // GFC:
-      else if(TString(list->GetName()).Contains("cobjGFC"))
+      else if(TString(list->GetName()).Contains("GFC"))
       {
         AliFlowAnalysisWithCumulants* gfc = new AliFlowAnalysisWithCumulants();
         gfc->GetOutputHistograms(list);
@@ -122,7 +89,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // QC:
-      else if(TString(list->GetName()).Contains("cobjQC"))
+      else if(TString(list->GetName()).Contains("QC"))
       {
         AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants();
         qc->GetOutputHistograms(list);
@@ -135,7 +102,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // FQD:
-      else if(TString(list->GetName()).Contains("cobjFQD"))
+      else if(TString(list->GetName()).Contains("FQD"))
       {
         AliFlowAnalysisWithFittingQDistribution* fqd = new AliFlowAnalysisWithFittingQDistribution();
         fqd->GetOutputHistograms(list);
@@ -144,7 +111,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // LYZ1SUM:
-      else if(TString(list->GetName()).Contains("cobjLYZ1SUM"))
+      else if(TString(list->GetName()).Contains("LYZ1SUM"))
       {
         AliFlowAnalysisWithLeeYangZeros* lyz1sum = new AliFlowAnalysisWithLeeYangZeros();
         lyz1sum->SetFirstRun(kTRUE);
@@ -155,7 +122,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // LYZ2SUM:
-      else if(TString(list->GetName()).Contains("cobjLYZ2SUM"))
+      else if(TString(list->GetName()).Contains("LYZ2SUM"))
       {
         AliFlowAnalysisWithLeeYangZeros* lyz2sum = new AliFlowAnalysisWithLeeYangZeros();
         lyz2sum->SetFirstRun(kFALSE);
@@ -166,7 +133,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // LYZ1PROD:
-      else if(TString(list->GetName()).Contains("cobjLYZ1PROD"))
+      else if(TString(list->GetName()).Contains("LYZ1PROD"))
       {
         AliFlowAnalysisWithLeeYangZeros* lyz1prod = new AliFlowAnalysisWithLeeYangZeros();
         lyz1prod->SetFirstRun(kTRUE);
@@ -177,7 +144,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // LYZ2PROD:
-      else if(TString(list->GetName()).Contains("cobjLYZ2PROD"))
+      else if(TString(list->GetName()).Contains("LYZ2PROD"))
       {
         AliFlowAnalysisWithLeeYangZeros* lyz2prod = new AliFlowAnalysisWithLeeYangZeros();
         lyz2prod->SetFirstRun(kFALSE);
@@ -188,7 +155,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // LYZEP:
-      else if(TString(list->GetName()).Contains("cobjLYZEP"))
+      else if(TString(list->GetName()).Contains("LYZEP"))
       {
         AliFlowAnalysisWithLYZEventPlane* lyzep = new AliFlowAnalysisWithLYZEventPlane();
         lyzep->GetOutputHistograms(list);
@@ -197,7 +164,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // MH:
-      else if(TString(list->GetName()).Contains("cobjMH"))
+      else if(TString(list->GetName()).Contains("MH"))
       {
         AliFlowAnalysisWithMixedHarmonics* mh = new AliFlowAnalysisWithMixedHarmonics();
         mh->GetOutputHistograms(list);
@@ -206,7 +173,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
       // NL:
-      else if(TString(list->GetName()).Contains("cobjNL"))
+      else if(TString(list->GetName()).Contains("NL"))
       {
         AliFlowAnalysisWithNestedLoops* nl = new AliFlowAnalysisWithNestedLoops();
         nl->GetOutputHistograms(list);
@@ -215,7 +182,7 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
         directory->Write(directory->GetName(),TObject::kSingleKey+TObject::kWriteDelete);
       }
     }//for icent
-  }// end of for(Int_t i=0;i<nMethods;i++)
+  }//
 
     // Close the final output file:
     delete mergedFile;
@@ -235,9 +202,8 @@ void redoFinish(TString type="ESD global", Int_t mode=mLocal)
 
 } // end of void redoFinish(Int_t mode=mLocal)
 
-void LoadLibrariesRF(const libModes mode)
+void LoadLibraries()
 {
-
   //--------------------------------------
   // Load the needed libraries most of them already loaded by aliroot
   //--------------------------------------
@@ -247,69 +213,11 @@ void LoadLibrariesRF(const libModes mode)
   gSystem->Load("libXMLIO");
   gSystem->Load("libPhysics");
 
-  //----------------------------------------------------------
-  // >>>>>>>>>>> Local mode <<<<<<<<<<<<<<
-  //----------------------------------------------------------
-  if (mode==mLocal)
-  {
-    //--------------------------------------------------------
-    // If you want to use already compiled libraries
-    // in the aliroot distribution
-    //--------------------------------------------------------
-
-    //==================================================================================
-    //load needed libraries:
-    gSystem->AddIncludePath("-I$ROOTSYS/include");
-    //gSystem->Load("libTree");
-
-    // for AliRoot
-    gSystem->AddIncludePath("-I$ALICE_ROOT/include");
-    gSystem->Load("libANALYSIS");
-    gSystem->Load("libPWG2flowCommon");
-    //cerr<<"libPWG2flowCommon loaded ..."<<endl;
-
-  }
-
-  else if (mode==mLocalSource)
-  {
-
-    // In root inline compile
-
-    // Constants
-    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonConstants.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZConstants.cxx+");
-
-    // Flow event
-    gROOT->LoadMacro("AliFlowCommon/AliFlowVector.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowTrackSimple.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowTrackSimpleCuts.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowEventSimple.cxx+");
-
-    // Output histograms
-    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHist.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHistResults.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist1.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist2.cxx+");
-
-    // Functions needed for various methods
-    gROOT->LoadMacro("AliFlowCommon/AliCumulantsFunctions.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowLYZEventPlane.cxx+");
-
-    // Flow Analysis code for various methods
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithMCEventPlane.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithScalarProduct.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithLYZEventPlane.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithCumulants.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithMixedHarmonics.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithNestedLoops.cxx+");
-
-    cout << "finished loading macros!" << endl;
-
-  } // end of else if (mode==mLocalSource)
-
+  // for AliRoot
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libPWG2flowCommon");
+  gSystem->Load("libPWG2flowTasks");
 } // end of void LoadLibrariesRF(const libModes mode)