]>
Commit | Line | Data |
---|---|---|
c683985a | 1 | using namespace AliHelperPIDNameSpace; |
2 | ||
3 | AliAnalysisTaskContMC* AddTaskContMC(Bool_t mc=kFALSE){ | |
4 | ||
5 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
6 | if (!mgr) | |
7 | { | |
8 | ::Error("AddAliAnalysisTaskContMC", "No analysis manager to connect to."); | |
9 | return NULL; | |
10 | } | |
11 | ||
12 | // Check the analysis type using the event handlers connected to the analysis manager. | |
13 | //============================================================================== | |
14 | if (!mgr->GetInputEventHandler()) | |
15 | { | |
16 | ::Error("AddTaskITSsaTracks", "This task requires an input event handler"); | |
17 | return NULL; | |
18 | } | |
19 | ||
20 | TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
21 | if(type.Contains("ESD")) | |
22 | { | |
23 | ::Error("AddTaskITSsaTracks", "This task requires to run on AOD"); | |
24 | return NULL; | |
25 | } | |
26 | ||
27 | ||
28 | AliAnalysisTaskContMC *task = new AliAnalysisTaskContMC("ContMC"); | |
29 | task->SetIsMC(mc); | |
30 | mgr->AddTask(task); | |
31 | ||
32 | TString outputFileName = AliAnalysisManager::GetCommonFileName(); | |
33 | cout<<"-------------- outputFileName: "<<outputFileName<<endl; | |
34 | ||
35 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); | |
36 | AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("fOutput", TList::Class(), AliAnalysisManager::kOutputContainer,outputFileName); | |
37 | ||
38 | //connect containers | |
39 | mgr->ConnectInput(task, 0, cinput); | |
40 | mgr->ConnectOutput(task, 1, coutputpt2); | |
41 | return task; | |
42 | } |