updating task
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 May 2013 10:41:19 +0000 (10:41 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 May 2013 10:41:19 +0000 (10:41 +0000)
PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.h
PWGLF/FORWARD/macros/AddTaskZDCTree.C [new file with mode: 0644]

index 54305bb..54af9fa 100644 (file)
@@ -31,9 +31,9 @@ class AliAnalysisTaskZDCTreeMaker : public AliAnalysisTaskSE {
   virtual void Terminate(Option_t *);
 
   virtual void  SetDebugLevel(Int_t level) {fDebug = level;}
-  void SetInput(const char* input) {fAnalysisInput = input;}
+  void SetInput(int input) {fAnalysisInput = input;}
   void SetMCInput() {fIsMCInput = kTRUE;}
-   void SetUseSpecialOutput(Bool_t v=kTRUE) {fUseSpecialOutput = v;}
+  void SetUseSpecialOutput(Bool_t v=kTRUE) {fUseSpecialOutput = v;}
 
  private:
 
diff --git a/PWGLF/FORWARD/macros/AddTaskZDCTree.C b/PWGLF/FORWARD/macros/AddTaskZDCTree.C
new file mode 100644 (file)
index 0000000..8cf447a
--- /dev/null
@@ -0,0 +1,57 @@
+AliAnalysisTaskSE* AddTaskZDCTree(Bool_t  applyPS = kTRUE,
+                                 TString outfname = "ZDCpPb",
+                                 Bool_t  isMC = kFALSE)
+{
+  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if(!mgr){
+    ::Error("AddTaskZDCPbPb", "No analysis manager to connect to.");
+    return NULL;
+  }  
+
+  AliVEventHandler *inputHandler = mgr->GetInputEventHandler();
+  
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if(!inputHandler){
+    ::Error("AddTaskZDCPbPb", "This task requires an input event handler");
+    return NULL;
+  }
+  TString inputDataType = inputHandler->GetDataType(); // can be "ESD" or "AOD"
+  
+   // Configure analysis
+   //===========================================================================
+   AliAnalysisTaskZDCTreeMaker* task = new AliAnalysisTaskZDCTreeMaker("taskZDC");
+
+   if(inputDataType.CompareTo("ESD")==0){
+      task->SetInput(1);
+      //printf("  AliAnalysisTaskZDCTreeMaker initialized for ESD analysis\n");
+      //
+      // apply physics selection
+      if(applyPS) task->SelectCollisionCandidates();
+   }
+   else if(inputDataType.CompareTo("AOD")==0){
+      task->SetInput(2);
+      //printf("  AliAnalysisTaskZDCTreeMaker initialized for AOD analysis\n");
+   }
+   
+   if(isMC==kTRUE) task->SetMCInput();
+
+   mgr->AddTask(task);
+
+   TString outputFileName = AliAnalysisManager::GetCommonFileName();
+   
+   AliAnalysisDataContainer *coutput  = mgr->CreateContainer(outfname.Data(), 
+                                       TList::Class(),
+                                       AliAnalysisManager::kOutputContainer,   
+                                       Form("%s:ZDCHistos", mgr->GetCommonFileName()));
+
+   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (task, 1, coutput);
+
+   return task;   
+}
+
+