]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/macros/AddTaskStrange.C
Updating Strange tasks (by H.Ricaud, hricaud@gsi.de)
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / macros / AddTaskStrange.C
1 AliAnalysisTaskStrange *AddTaskStrange(Short_t lCollidingSystems=0,  /*0 = pp, 1 = AA*/,
2                                        TString lAnalysisCut="no" )
3 {
4 // Creates, configures and attaches to the train a strangeness task.
5    // Get the pointer to the existing analysis manager via the static access method.
6    //==============================================================================
7    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8    if (!mgr) {
9       ::Error("AddTaskStrange", "No analysis manager to connect to.");
10       return NULL;
11    }   
12
13    // Check the analysis type using the event handlers connected to the analysis manager.
14    //==============================================================================
15    if (!mgr->GetInputEventHandler()) {
16       ::Error("AddTaskStrange", "This task requires an input event handler");
17       return NULL;
18    }   
19    TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20
21    // Create and configure the task
22         AliAnalysisTaskStrange *taskstrange = new AliAnalysisTaskStrange("TaskStrange");
23    taskstrange->SetCollidingSystems(lCollidingSystems);
24    taskstrange->SetAnalysisType(type);
25    taskstrange->SetAnalysisCut(lAnalysisCut);
26    mgr->AddTask(taskstrange);
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    TString outname = "PP";
32    if (lCollidingSystems) outname = "AA";
33    if (mgr->GetMCtruthEventHandler()) outname += "-MC-";
34    outname += "StrangeList.root";
35         AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistStrange",
36                                                                    TList::Class(),
37                                                                    AliAnalysisManager::kOutputContainer,
38                                                                    outname );
39                            
40    mgr->ConnectInput(taskstrange, 0, mgr->GetCommonInputContainer());
41    mgr->ConnectOutput(taskstrange, 1, coutput1);
42    return taskstrange;
43 }