Added macro AddTaskCheckCascade.C temporary in ANALYSIS/macros. To be moved after...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 09:04:08 +0000 (09:04 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 09:04:08 +0000 (09:04 +0000)
ANALYSIS/macros/AddTaskCheckCascade.C [new file with mode: 0644]

diff --git a/ANALYSIS/macros/AddTaskCheckCascade.C b/ANALYSIS/macros/AddTaskCheckCascade.C
new file mode 100644 (file)
index 0000000..fc70436
--- /dev/null
@@ -0,0 +1,41 @@
+AliAnalysisTaskCheckCascade *AddTaskCheckCascade(Short_t lCollidingSystems=0  /*0 = pp, 1 = AA*/)
+{
+// Creates, configures and attaches to the train a cascades check task.
+   // Get the pointer to the existing analysis manager via the static access method.
+   //==============================================================================
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   if (!mgr) {
+      Error("AddTaskCheckCascade", "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("AddTaskCheckCascade", "This task requires an input event handler");
+      return NULL;
+   }   
+   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+
+   // Create and configure the task
+       AliAnalysisTaskCheckCascade *taskcheckcascade = new AliAnalysisTaskCheckCascade("TaskCheckCascade");
+   taskcheckcascade->SetCollidingSystems(lCollidingSystems);
+   taskcheckcascade->SetAnalysisType(type);
+   mgr->AddTask(taskcheckcascade);
+
+   // Create ONLY the output containers for the data produced by the task.
+   // Get and connect other common input/output containers via the manager as below
+   //==============================================================================
+   TString outname = "PP";
+   if (lCollidingSystems) outname = "AA";
+   if (mgr->GetMCtruthEventHandler()) outname += "-MC-";
+   outname += "CascadeList.root";
+       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistCasc",
+                                                                  TList::Class(),
+                                                                  AliAnalysisManager::kOutputContainer,
+                                                                  outname );
+                           
+       mgr->ConnectInput(taskcheckcascade, 0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput(taskcheckcascade, 1, coutput1);
+   return taskcheckcascade;
+}