Fix for AOD
authorrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 May 2012 16:14:21 +0000 (16:14 +0000)
committerrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 May 2012 16:14:21 +0000 (16:14 +0000)
PWGHF/hfe/macros/AddTaskEventPlaneTPC.C [new file with mode: 0644]
PWGHF/hfe/macros/AddTaskHFEtpctof.C

diff --git a/PWGHF/hfe/macros/AddTaskEventPlaneTPC.C b/PWGHF/hfe/macros/AddTaskEventPlaneTPC.C
new file mode 100644 (file)
index 0000000..e9463a5
--- /dev/null
@@ -0,0 +1,64 @@
+AliEPSelectionTask *AddTaskEventplaneTPC(Bool_t useEtaGap=kFALSE,Float_t etaGap=0.,Bool_t posTPC=kFALSE,TString containername = "EPStat")
+{
+  // Macro to connect an event plane selection task to an existing analysis manager.
+
+  if(useEtaGap && posTPC){
+    ::Error("AddTaskEventplane", "eta-splitting of events and one side of TPC not possible at same time!");
+    return NULL;
+  }
+  
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskEventplane", "No analysis manager to connect to.");
+    return NULL;
+  }      
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskEventplane", "This task requires an input event handler");
+    return NULL;
+  }
+  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  
+  AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection");
+  eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral);
+  if (inputDataType == "AOD"){
+    eventplaneTask->SetInput("AOD");
+  }
+  eventplaneTask->SetTrackType("TPC");
+  eventplaneTask->SetUsePtWeight();
+  eventplaneTask->SetUsePhiWeight();
+  eventplaneTask->SetSaveTrackContribution();
+  if(useEtaGap){
+    eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kEta); 
+    eventplaneTask->SetEtaGap(etaGap); 
+  }
+  if(posTPC){
+    if(inputDataType == "AOD")
+      {
+       eventplaneTask->SetPersonalAODtrackCuts(128,0.,0.8,0.15,20.);
+       eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kRandom);
+      }
+    else {
+      AliESDtrackCuts *trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+      trackCuts->SetPtRange(0.15,20.);
+      trackCuts->SetEtaRange(0.0,0.8);
+      eventplaneTask->SetPersonalESDtrackCuts(trackCuts);
+      eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kRandom);
+    }
+  }
+  
+  
+  mgr->AddTask(eventplaneTask);
+
+  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(containername,
+                TList::Class(), AliAnalysisManager::kOutputContainer,
+                "EventStat_temp.root");
+  
+  mgr->ConnectInput(eventplaneTask, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(eventplaneTask,1,coutput1);
+
+  return eventplaneTask;
+}
index 8f0d9bf..d5e91e6 100644 (file)
@@ -17,8 +17,23 @@ AliAnalysisTask *AddTaskHFEtpctof(Bool_t beauty=kTRUE, Int_t tpcCls=110,  Int_t
   printf("appendix %s\n", appendix.Data());
   
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskEventplane", "This task requires an input event handler");
+    return NULL;
+  }
+  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+
   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
   AliAnalysisTaskHFE *task = ConfigHFEpbpb(kFALSE,beauty,tpcCls,tpcClsPID,tpcClsRatio,tpcClShared,itsCls,itsChi2PerClusters,dcaxy,dcaz,tofs,ipSig,itspixelcut,appendix,prodlow,prodhigh,addflag);  
+
+  if (inputDataType == "AOD"){
+    task->SetFillNoCuts(kTRUE);
+    task->SetUseFlagAOD(kFALSE);
+    task->SetApplyCutAOD(kTRUE);
+  }  
   
   mgr->AddTask(task);