]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/Kinks/macros/AddTaskKink.C
Migration of PWG2/RESONANCES -> PWGLF/RESONANCES
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Kinks / macros / AddTaskKink.C
1 AliAnalysisKinkESDMC *AddTaskKink(Short_t lCollidingSystems=0  /*0 = pp, 1 = AA*/)
2 {
3 // Creates, configures and attaches to the train a V0 check task.
4    // Get the pointer to the existing analysis manager via the static access method.
5    //==============================================================================
6    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7    if (!mgr) {
8       ::Error("AddTaskKink", "No analysis manager to connect to.");
9       return NULL;
10    }   
11
12    // Check the analysis type using the event handlers connected to the analysis manager.
13    //==============================================================================
14    if (!mgr->GetInputEventHandler()) {
15       ::Error("AddTaskKink", "This task requires an input event handler");
16       return NULL;
17    }   
18    TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
19    if (type != "ESD") {
20       ::Error("AddTaskKink", "This task needs ESD input handler");
21       return NULL;
22    }   
23    if (!mgr->GetMCtruthEventHandler()) {
24       ::Error("AddTaskKink", "This task needs an MC handler");
25       return NULL;
26    }
27    // Create and configure the task
28         AliAnalysisKinkESDMC *taskkink = new AliAnalysisKinkESDMC("TaskkinkESDMC");
29    mgr->AddTask(taskkink);
30
31    // Create ONLY the output containers for the data produced by the task.
32    // Get and connect other common input/output containers via the manager as below
33    //==============================================================================
34    TString outputFileName = AliAnalysisManager::GetCommonFileName();
35    outputFileName += ":PWG2KINKESDMC";
36    if (lCollidingSystems) outputFileName += "_AA";
37    else outputFileName += "_PP";
38    if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";
39
40    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("KinkESDMC",
41                                                              TList::Class(),
42                                                              AliAnalysisManager::kOutputContainer,
43                                                              outputFileName );
44    mgr->ConnectInput(taskkink, 0, mgr->GetCommonInputContainer());
45    mgr->ConnectOutput(taskkink, 1, coutput1);
46    return taskkink;
47 }