1 AliHMPIDAnalysisTask *AddTaskHMPID(Bool_t useMC=kTRUE)
3 // Creates a HMPID task, configures it and adds it to the analysis manager.
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 ::Error("AddTaskHMPID", "No analysis manager to connect to.");
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");
20 // Create the task and configure it.
21 //===========================================================================
23 AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
24 hmpTask->SetDebugLevel(0);
25 hmpTask->SelectCollisionCandidates();
26 hmpTask->SetUseMC(useMC);
27 mgr->AddTask(hmpTask);
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());
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);