Warning fixed
[u/mrichter/AliRoot.git] / HMPID / AddTaskHMPID.C
CommitLineData
8ba31296 1AliHMPIDAnalysisTask *AddTaskHMPID(Bool_t useMC=kTRUE)
2{
3// Creates a HMPID task, configures it and adds it to the analysis manager.
4
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("AddTaskHMPID", "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("AddTaskHMPID", "This task requires an input event handler");
17 return NULL;
18 }
19
20 // Create the task and configure it.
21 //===========================================================================
22
23 AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
24 hmpTask->SetDebugLevel(0);
25 hmpTask->SelectCollisionCandidates();
26 hmpTask->SetUseMC(useMC);
27 mgr->AddTask(hmpTask);
28
29 AliAnalysisDataContainer *cout_hmpid= mgr->CreateContainer("HmpidOutput", TList::Class(),AliAnalysisManager::kOutputContainer,
30 AliAnalysisManager::GetCommonFileName());
31 AliAnalysisDataContainer *cout_tree = mgr->CreateContainer("HmpidTree", TTree::Class(),AliAnalysisManager::kOutputContainer,
32 AliAnalysisManager::GetCommonFileName());
33
34 // Create ONLY the output containers for the data produced by the task.
35 // Get and connect other common input/output containers via the manager as below
36 //==============================================================================
37 mgr->ConnectInput (hmpTask, 0, mgr->GetCommonInputContainer());
38 mgr->ConnectOutput (hmpTask, 0, mgr->GetCommonOutputContainer());
39 mgr->ConnectOutput (hmpTask, 1, cout_hmpid);
40 mgr->ConnectOutput (hmpTask, 2, cout_tree);
41
42 return hmpTask;
43}