]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/macros/AddTaskPerformanceStrange.C
PerformanceStrange task: V0 multiplicity in terminate and AddTask macro (H.Ricaud)
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / macros / AddTaskPerformanceStrange.C
1 AliAnalysisTaskPerformanceStrange *AddTaskPerformanceStrange(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("AddTaskPerformanceStrange", "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("AddTaskPerformanceStrange", "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         AliAnalysisTaskPerformanceStrange *taskperformancestrange = new AliAnalysisTaskPerformanceStrange("TaskPerformanceStrange");
23    taskperformancestrange->SetCollidingSystems(lCollidingSystems);
24    taskperformancestrange->SetAnalysisType(type);
25    taskperformancestrange->SetAnalysisCut(lAnalysisCut);
26    mgr->AddTask(taskperformancestrange);
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 outputFileName = AliAnalysisManager::GetCommonFileName();
32    outputFileName += ":PWG2Strange";
33    if (lCollidingSystems) outputFileName += "_AA";
34    else outputFileName += "_PP";
35    if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";
36
37    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clistPerformanceStrange",
38                                                              TList::Class(),
39                                                              AliAnalysisManager::kOutputContainer,
40                                                              outputFileName );
41                            
42    mgr->ConnectInput(taskperformancestrange, 0, mgr->GetCommonInputContainer());
43    mgr->ConnectOutput(taskperformancestrange, 1, coutput1);
44    return taskperformancestrange;
45 }