]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update of Single Muon analysis to be included in the official ESD->AOD analysis train...
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Oct 2009 07:09:58 +0000 (07:09 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Oct 2009 07:09:58 +0000 (07:09 +0000)
PWG3/muon/AddTaskSingleMuonAnalysis.C [new file with mode: 0644]

diff --git a/PWG3/muon/AddTaskSingleMuonAnalysis.C b/PWG3/muon/AddTaskSingleMuonAnalysis.C
new file mode 100644 (file)
index 0000000..7fb071a
--- /dev/null
@@ -0,0 +1,42 @@
+AliAnalysisTaskSingleMu *AddTaskSingleMuonAnalysis(){
+
+   // Get the pointer to the existing analysis manager via the static access method.
+   //==============================================================================
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   if (!mgr) {
+      ::Error("AddtaskSingleMuonAnalysis", "No analysis manager to connect to.");
+      return NULL;
+   }   
+   
+   // Check this using the analysis manager.
+   //===============================================================================
+   TString type = mgr->GetInputEventHandler()->GetDataType();
+   if (!type.Contains("ESD")) {
+      ::Error("AddTaskSingleMuonAnalysis", "ESD filtering task needs the manager to have an ESD input handler.");
+      return NULL;
+   }   
+
+//    // Check if MC handler is connected in case kine filter requested
+
+    AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
+    if (!mcH) {
+       ::Error("AddTaskSingleMuonAnalysis", "No MC handler connected");
+       return NULL;
+    }  
+
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0",TList::Class(),AliAnalysisManager::kOutputContainer,"SingleMuonAnalysis.root");
+
+  // Create the task, add it to the manager and configure it.
+   //===========================================================================   
+   // Barrel tracks filter
+   AliAnalysisTaskSingleMu *SingleMuonAnalysisTask = new AliAnalysisTaskSingleMu("Single Muon Analysis Task");
+   mgr->AddTask(SingleMuonAnalysisTask);
+   
+   // 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
+   //==============================================================================
+   mgr->ConnectInput  (SingleMuonAnalysisTask,  0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (SingleMuonAnalysisTask,  1, coutput1);
+
+   return SingleMuonAnalysisTask;
+}