]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/AddTaskTagCreation.C
Transition PWG3 --> PWGHF
[u/mrichter/AliRoot.git] / PWG / muon / AddTaskTagCreation.C
1 AliAnalysisTaskTagCreator *AddTaskTagCreation()
2 {
3
4 // Creates tag AOD files
5
6    // Get the pointer to the existing analysis manager via the static access method.
7    //==============================================================================
8    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9    if (!mgr) {
10       ::Error("AddTaskTagCreator ", "No analysis manager to connect to.");
11       return NULL;
12    }   
13    
14    // Check input/output handlers
15    //===============================================================================
16    AliAODInputHandler *aod_input_h = (AliAODInputHandler*)mgr->GetInputEventHandler();
17    if (!aod_input_h) {
18       ::Error("AddTaskTagCreator ", "Input AOD handler does not exist!.");
19       return NULL;
20    }
21       
22    // Create the task, add it to the manager and configure it.
23    //===========================================================================   
24
25    AliAnalysisTaskTagCreator *tagcreator  = new AliAnalysisTaskTagCreator("TagCreator");
26    mgr->AddTask(tagcreator);
27    
28    // Create ONLY the output containers for the data produced by the task.
29    // Get and connect other common input/output containers via the manager as below
30    //==============================================================================
31     // Tag container                                                          
32     AliAnalysisDataContainer *cout_tags = mgr->CreateContainer("cTag",TTree::Class(), AliAnalysisManager::kOutputContainer, "AOD.tag.root");
33     
34     mgr->ConnectInput  (tagcreator ,  0, mgr->GetCommonInputContainer());
35     mgr->ConnectOutput (tagcreator ,  1, cout_tags);
36
37    return tagcreator ;
38 }