]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/KINK/macros/AddTaskKink.C
Particle mass access updated: Evi Ganoti, University of Athens (pganoti@phys.uoa.gr)
[u/mrichter/AliRoot.git] / PWG2 / KINK / 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 outname = "PP";
35    if (lCollidingSystems) outname = "AA";
36    if (mgr->GetMCtruthEventHandler()) outname += "-MC-";
37    outname += "KinkList.root";
38         AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("KinkESDMC",
39                                                                    TList::Class(),
40                                                                    AliAnalysisManager::kOutputContainer,
41                                                                    outname );
42                            
43         mgr->ConnectInput(taskkink, 0, mgr->GetCommonInputContainer());
44    mgr->ConnectOutput(taskkink, 1, coutput1);
45    return taskkink;
46 }