]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AddTaskHMPIDPerformance.C
Updating angular resolution calculation and correction factor as a function of chambe...
[u/mrichter/AliRoot.git] / HMPID / AddTaskHMPIDPerformance.C
1 AliHMPIDPerformanceTask *AddTaskHMPIDPerformance(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("AddTaskHMPIDPerformance", "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("AddTaskHMPIDPerformance", "This task requires an input event handler");
17       return NULL;
18    }
19
20    // Create the task and configure it.
21    //===========================================================================
22
23    AliHMPIDPerformanceTask *hmpTaskPerformance = new AliHMPIDPerformanceTask("HMPIDPerformanceTask");
24    hmpTaskPerformance->SetDebugLevel(0);
25    hmpTaskPerformance->SelectCollisionCandidates();
26    hmpTaskPerformance->SetUseMC(useMC);
27    mgr->AddTask(hmpTaskPerformance);
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  (hmpTaskPerformance, 0, mgr->GetCommonInputContainer());
38    mgr->ConnectOutput (hmpTaskPerformance, 0, mgr->GetCommonOutputContainer());
39    mgr->ConnectOutput (hmpTaskPerformance, 1, cout_hmpid);
40    mgr->ConnectOutput (hmpTaskPerformance, 2, cout_tree);
41
42    return hmpTaskPerformance;
43 }