]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/macros/fd/AddTaskMCTruthCent.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / Correlations / macros / fd / AddTaskMCTruthCent.C
CommitLineData
ceeaa699 1AliMCTruthCent* AddTaskMCTruthCent(Bool_t doHists = kFALSE)
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 {
8 ::Error("AddTaskMCTruthCent", "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("AddTaskMCTruthCent", "This task requires an input event handler");
17 return NULL;
18 }
19
20 //-------------------------------------------------------
21 // Init the task and do settings
22 //-------------------------------------------------------
23 TString name("AliMCTruthCent");
24 AliMCTruthCent *eTask = new AliMCTruthCent(name);
25 if (doHists) {
26 eTask->SetFillHistos();
27 }
28
29 //-------------------------------------------------------
30 // Final settings, pass to manager and set the containers
31 //-------------------------------------------------------
32 mgr->AddTask(eTask);
33
34 // Create containers for input/output
35 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
36 mgr->ConnectInput (eTask, 0, cinput1 );
37
38 if (doHists) {
39 AliAnalysisDataContainer *coutput = mgr->CreateContainer("MCTruthCentStat",
40 TList::Class(),
41 AliAnalysisManager::kOutputContainer,
42 "MCTruthCent.root");
43 mgr->ConnectOutput(eTask,1,coutput);
44 }
45
46 return eTask;
47}