coverity fix
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / MultEvShape / AddTaskCentral.C
CommitLineData
32692aec 1AliAnalysisTaskCentral* AddTaskCentral(){
68db0507 2
3// Get the pointer to the existing analysis manager via the static access method.
4//==============================================================================
5 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
6 if (!mgr) {
7 ::Error("AddTaskCentral", "No analysis manager to connect to!");
8 return NULL;
9 }
10
11// Check the analysis type using the event handlers connected to the analysis manager.
12//==============================================================================
13 if (!mgr->GetInputEventHandler()) {
14 ::Error("AddTaskCentral", "This task requires an input event handler!");
15 return NULL;
16 }
17
18 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
19
20 if (type=="AOD"){
21 ::Error("AddTaskCentral", "This task is not tested for AOD analysis!");
22 return NULL;
23 }
24
25 // Create and configure the task
26 AliAnalysisTaskCentral *taskcentral = new AliAnalysisTaskCentral("TaskCentral");
68db0507 27 mgr->AddTask(taskcentral);
28
29 // Create ONLY the output containers for the data produced by the task.
30 // Get and connect other common input/output containers via the manager as below
31 //==============================================================================
32 TString outputFileName = AliAnalysisManager::GetCommonFileName();
33 outputFileName += ":PWG2Central";
34
35 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("cobCentral",
36 TList::Class(),
37 AliAnalysisManager::kOutputContainer,
38 outputFileName );
39
40 mgr->ConnectInput(taskcentral, 0, mgr->GetCommonInputContainer());
41 mgr->ConnectOutput(taskcentral, 0, coutput1);
42 return taskcentral;
43}