]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AddTaskHFMixing.C
move macros to macros/
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskHFMixing.C
1 AliAnalysisTaskMEVertexingHF *AddTaskHFMixing() {
2   //
3   // Creates a task for event mixing and adds it to the analysis manager.
4   // r.romita@gsi.de
5   //
6
7   // Get the pointer to the existing analysis manager via the static access method.
8   //==============================================================================
9   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10   if (!mgr) {
11     ::Error("AddTaskHFMixing", "No analysis manager to connect to.");
12     return NULL;
13   }   
14    
15   // This task requires  AOD input handler and an AOD output handler.
16   // Check this using the analysis manager.
17   //===============================================================================
18
19   // Check if AOD output handler exist.
20   AliAODHandler *aodh = (AliAODHandler*)mgr->GetOutputEventHandler();
21   if (!aodh) {
22     ::Error("AddTaskMixing", "HF vertexing task needs the manager to have an AOD output handler.");
23     return NULL;
24   }   
25   
26   // Create the task, add it to the manager and configure it.
27   //===========================================================================
28   AliAnalysisTaskMEVertexingHF *hfTask = new AliAnalysisTaskMEVertexingHF("mixing vertexing HF");
29   mgr->AddTask(hfTask);
30
31   //
32   // Create containers for input/output
33   AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), AliAnalysisManager::kInputContainer);
34   mgr->ConnectInput(hfTask,0,mgr->GetCommonInputContainer());
35   mgr->ConnectOutput(hfTask,0,mgr->GetCommonOutputContainer());
36
37   return hfTask;
38 }