Further update
authorrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 May 2012 08:33:34 +0000 (08:33 +0000)
committerrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 May 2012 08:33:34 +0000 (08:33 +0000)
PWGHF/hfe/AliAnalysisTaskHFEFlow.cxx
PWGHF/hfe/AliAnalysisTaskHFEFlow.h

index 005b00f..6fa4512 100644 (file)
@@ -29,7 +29,9 @@
 #include "TProfile.h"\r
 #include "TProfile2D.h"\r
 \r
+#include "AliVEventHandler.h"\r
 #include "AliAnalysisTaskSE.h"\r
+#include "AliAnalysisManager.h"\r
 \r
 #include "AliVEvent.h"\r
 #include "AliESDInputHandler.h"\r
@@ -41,6 +43,7 @@
 #include "AliESDUtils.h"\r
 #include "AliMCParticle.h"\r
 #include "AliVTrack.h"\r
+#include "AliAODTrack.h"\r
 \r
 #include "AliFlowCandidateTrack.h"\r
 #include "AliFlowEvent.h"\r
@@ -64,6 +67,9 @@ AliAnalysisTaskHFEFlow::AliAnalysisTaskHFEFlow() :
   AliAnalysisTaskSE(),\r
   fListHist(0x0), \r
   fAODAnalysis(kFALSE),\r
+  fUseFlagAOD(kFALSE),\r
+  fApplyCut(kTRUE),\r
+  fFlags(1<<4),\r
   fVZEROEventPlane(kFALSE),\r
   fVZEROEventPlaneA(kFALSE),\r
   fVZEROEventPlaneC(kFALSE),\r
@@ -125,7 +131,10 @@ AliAnalysisTaskHFEFlow::AliAnalysisTaskHFEFlow() :
 AliAnalysisTaskHFEFlow:: AliAnalysisTaskHFEFlow(const char *name) :\r
   AliAnalysisTaskSE(name),\r
   fListHist(0x0),\r
-  fAODAnalysis(kFALSE), \r
+  fAODAnalysis(kFALSE),\r
+  fUseFlagAOD(kFALSE),\r
+  fApplyCut(kTRUE),\r
+  fFlags(1<<4), \r
   fVZEROEventPlane(kFALSE),\r
   fVZEROEventPlaneA(kFALSE),\r
   fVZEROEventPlaneC(kFALSE),\r
@@ -204,6 +213,9 @@ AliAnalysisTaskHFEFlow::AliAnalysisTaskHFEFlow(const AliAnalysisTaskHFEFlow &ref
   AliAnalysisTaskSE(ref),\r
   fListHist(0x0),\r
   fAODAnalysis(ref.fAODAnalysis), \r
+  fUseFlagAOD(ref.fUseFlagAOD),\r
+  fApplyCut(ref.fApplyCut),\r
+  fFlags(ref.fFlags),\r
   fVZEROEventPlane(ref.fVZEROEventPlane),\r
   fVZEROEventPlaneA(ref.fVZEROEventPlaneA),\r
   fVZEROEventPlaneC(ref.fVZEROEventPlaneC),\r
@@ -277,6 +289,9 @@ void AliAnalysisTaskHFEFlow::Copy(TObject &o) const {
   //\r
   AliAnalysisTaskHFEFlow &target = dynamic_cast<AliAnalysisTaskHFEFlow &>(o);\r
   target.fAODAnalysis = fAODAnalysis;\r
+  target.fUseFlagAOD = fUseFlagAOD;\r
+  target.fApplyCut = fApplyCut;\r
+  target.fFlags = fFlags;\r
   target.fVZEROEventPlane = fVZEROEventPlane;\r
   target.fVZEROEventPlaneA = fVZEROEventPlaneA;\r
   target.fVZEROEventPlaneC = fVZEROEventPlaneC;\r
@@ -363,6 +378,16 @@ void AliAnalysisTaskHFEFlow::UserCreateOutputObjects()
   //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt\r
   //AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;\r
   //AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;\r
\r
+  // AOD or ESD\r
+  AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());\r
+  if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){\r
+    SetAODAnalysis(kTRUE);\r
+    //printf("Put AOD analysis on\n");\r
+  } else {\r
+    SetAODAnalysis(kFALSE);\r
+  }\r
+\r
 \r
   // RP TRACK CUTS:\r
   fcutsRP = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010();\r
@@ -692,6 +717,7 @@ void AliAnalysisTaskHFEFlow::UserExec(Option_t */*option*/)
   //AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());\r
   //if(!esd) return;\r
   AliCentrality *centrality = fInputEvent->GetCentrality();\r
+  //printf("Got the centrality\n");\r
   if(!centrality) return;\r
   cntr = centrality->GetCentralityPercentile("V0M");\r
   if((0.0< cntr) && (cntr<5.0)) binct = 0.5;\r
@@ -754,6 +780,7 @@ void AliAnalysisTaskHFEFlow::UserExec(Option_t */*option*/)
   //////////////////////\r
 \r
   Int_t runnumber = fInputEvent->GetRunNumber();\r
+  //printf("Run number %d\n",runnumber);\r
    \r
   if(!fPID->IsInitialized()){\r
     // Initialize PID with the given run number\r
@@ -779,6 +806,7 @@ void AliAnalysisTaskHFEFlow::UserExec(Option_t */*option*/)
   // Event cut\r
   //////////////////\r
   if(!fHFECuts->CheckEventCuts("fEvRecCuts", fInputEvent)) {\r
+    //printf("Do not pass the event cut\n");\r
     PostData(1, fListHist);\r
     return;\r
   }\r
@@ -905,7 +933,10 @@ void AliAnalysisTaskHFEFlow::UserExec(Option_t */*option*/)
   //}\r
   //}\r
 \r
-  if((!standardQ) || (!qsub1a) || (!qsub2a)) return;\r
+  if((!standardQ) || (!qsub1a) || (!qsub2a)) {\r
+    //printf("No event plane\n");\r
+    return;\r
+  }\r
 \r
   ///////////////////////\r
   // AliFlowEvent  \r
@@ -996,16 +1027,34 @@ void AliAnalysisTaskHFEFlow::UserExec(Option_t */*option*/)
     AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k);\r
     if(!track) continue;\r
 \r
-    Bool_t survived = kTRUE;\r
-    for(Int_t icut = AliHFEcuts::kStepRecKineITSTPC; icut <= AliHFEcuts::kStepHFEcutsTRD; icut++){\r
-      if(!fHFECuts->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){\r
-       survived = kFALSE;\r
-       break;\r
+    if(fAODAnalysis) {\r
+      AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);\r
+      if(!aodtrack){\r
+       AliError("AOD track is not there");\r
+       return;\r
+      }  \r
+      //printf("Find AOD track on\n");\r
+      if(fUseFlagAOD){\r
+       if(aodtrack->GetFlags() != fFlags) continue;  // Only process AOD tracks where the HFE is set\r
+       //printf("Check flag on\n");\r
       }\r
-      //printf("Pass the cut %d\n",icut);\r
     }\r
     \r
-    if(!survived) continue;\r
+    if(fApplyCut) {\r
+      //printf("Apply cut\n");\r
+      Bool_t survived = kTRUE;\r
+      for(Int_t icut = AliHFEcuts::kStepRecKineITSTPC; icut <= AliHFEcuts::kStepHFEcutsTRD; icut++){\r
+       if(!fHFECuts->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){\r
+         survived = kFALSE;\r
+         //printf("Cut %d\n",icut);\r
+         break;\r
+       }\r
+       //printf("Pass the cut %d\n",icut);\r
+      }\r
+      if(!survived) continue;\r
+    }\r
+\r
+    //printf("Survived\n");\r
 \r
     // Apply PID\r
     if(!fNoPID) {\r
index 17768cd..38dc27a 100644 (file)
@@ -51,6 +51,11 @@ public:
   virtual void  UserExec(Option_t */*option*/);\r
   virtual void  UserCreateOutputObjects();\r
 \r
+  void SetAODAnalysis(Bool_t aodAnalysis) { fAODAnalysis = aodAnalysis; };\r
+  void SetUseFlagAOD(Bool_t useFlagAOD) { fUseFlagAOD = useFlagAOD; }\r
+  void SetApplyCut(Bool_t applyCut) { fApplyCut = applyCut; }\r
+  void SetFlags(ULong_t flags)          { fFlags = flags; }\r
+  \r
   AliHFEpid *GetPID() const { return fPID; }\r
   AliHFEpidQAmanager *GetPIDQAManager() const { return fPIDqa; }\r
 \r
@@ -88,7 +93,10 @@ public:
 private:\r
   TList     *fListHist;         //! TH list\r
   Bool_t    fAODAnalysis;       // AOD analysis\r
-\r
+  Bool_t    fUseFlagAOD;        // Use the preselected AOD track\r
+  Bool_t    fApplyCut;       // Apply the analysis cut for AOD tracks\r
+  ULong_t   fFlags;             // reconstruction AOD status flags \r
+  \r
   Bool_t    fVZEROEventPlane;  // Use Event Planes from VZERO\r
   Bool_t    fVZEROEventPlaneA; // Use Event Planes from VZERO A\r
   Bool_t    fVZEROEventPlaneC; // Use Event Planes from VZERO C\r