]>
Commit | Line | Data |
---|---|---|
d394951c | 1 | AliAnalysisTaskSingleMu *AddTaskSingleMuonAnalysis(){ |
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("AddtaskSingleMuonAnalysis", "No analysis manager to connect to."); | |
8 | return NULL; | |
9 | } | |
10 | ||
11 | // Check this using the analysis manager. | |
12 | //=============================================================================== | |
13 | TString type = mgr->GetInputEventHandler()->GetDataType(); | |
14 | if (!type.Contains("ESD")) { | |
15 | ::Error("AddTaskSingleMuonAnalysis", "ESD filtering task needs the manager to have an ESD input handler."); | |
16 | return NULL; | |
17 | } | |
18 | ||
19 | // // Check if MC handler is connected in case kine filter requested | |
20 | ||
21 | AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler(); | |
22 | if (!mcH) { | |
23 | ::Error("AddTaskSingleMuonAnalysis", "No MC handler connected"); | |
24 | return NULL; | |
25 | } | |
26 | ||
27 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0",TList::Class(),AliAnalysisManager::kOutputContainer,"SingleMuonAnalysis.root"); | |
28 | ||
29 | // Create the task, add it to the manager and configure it. | |
30 | //=========================================================================== | |
31 | // Barrel tracks filter | |
32 | AliAnalysisTaskSingleMu *SingleMuonAnalysisTask = new AliAnalysisTaskSingleMu("Single Muon Analysis Task"); | |
33 | mgr->AddTask(SingleMuonAnalysisTask); | |
34 | ||
35 | // Create ONLY the output containers for the data produced by the task. | |
36 | // Get and connect other common input/output containers via the manager as below | |
37 | //============================================================================== | |
38 | mgr->ConnectInput (SingleMuonAnalysisTask, 0, mgr->GetCommonInputContainer()); | |
39 | mgr->ConnectOutput (SingleMuonAnalysisTask, 1, coutput1); | |
40 | ||
41 | return SingleMuonAnalysisTask; | |
42 | } |