Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / HMPID / AddTaskJetsHMPID.C
CommitLineData
bfcb155c 1AliAnalysisTaskJetsHMPID *AddTaskJetsHMPID(Char_t *jb="jets", Char_t *bb="")
2{
3// Creates a HMPID task for jet chemistry analysis, 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("AddTaskJetsHMPID", "This task requires an input event handler");
17 return NULL;
18 }
19
20 // Create the task and configure it.
21 //===========================================================================
22
23 AliAnalysisTaskJetsHMPID *hmpJetsTask = new AliAnalysisTaskJetsHMPID("JetsHMPIDAnalysisTask");
24 hmpJetsTask->SetDebugLevel(0);
25 hmpJetsTask->SelectCollisionCandidates();
26 hmpJetsTask->SetJetBranch(jb);
27 hmpJetsTask->SetBkgBranch(bb);
28 hmpJetsTask->SetJetPtCut(10.);
29 mgr->AddTask(hmpJetsTask);
30
31 AliAnalysisDataContainer *cout_hmpid= mgr->CreateContainer("JetsHmpidOutput", TList::Class(),AliAnalysisManager::kOutputContainer,
32 AliAnalysisManager::GetCommonFileName());
33 AliAnalysisDataContainer *cout_tree = mgr->CreateContainer("JetsHmpidTree", TTree::Class(),AliAnalysisManager::kOutputContainer,
34 AliAnalysisManager::GetCommonFileName());
35
36 // Create ONLY the output containers for the data produced by the task.
37 // Get and connect other common input/output containers via the manager as below
38 //==============================================================================
39 mgr->ConnectInput (hmpJetsTask, 0, mgr->GetCommonInputContainer());
40 mgr->ConnectOutput (hmpJetsTask, 0, mgr->GetCommonOutputContainer());
41 mgr->ConnectOutput (hmpJetsTask, 1, cout_hmpid);
42 mgr->ConnectOutput (hmpJetsTask, 2, cout_tree);
43
44 return hmpJetsTask;
45}