]>
Commit | Line | Data |
---|---|---|
2defbca5 | 1 | AliCentralitySelectionTask *AddTaskCentrality() |
2 | { | |
3 | // Macro to connect a centrality selection task to an existing analysis manager. | |
4 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
5 | if (!mgr) { | |
6 | ::Error("AddTaskCentrality", "No analysis manager to connect to."); | |
7 | return NULL; | |
8 | } | |
9 | // Check the analysis type using the event handlers connected to the analysis manager. | |
10 | //============================================================================== | |
11 | if (!mgr->GetInputEventHandler()) { | |
12 | ::Error("AddTaskCentrality", "This task requires an input event handler"); | |
13 | return NULL; | |
14 | } | |
15 | TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" | |
16 | if (inputDataType != "ESD") { | |
17 | ::Error("AddTaskCentrality", "This task works only on ESD analysis"); | |
18 | return NULL; | |
19 | } | |
20 | AliCentralitySelectionTask *centralityTask = new AliCentralitySelectionTask("CentralitySelection"); | |
afb1125b | 21 | centralityTask->SetPass(2); |
a3127f95 | 22 | centralityTask->SelectCollisionCandidates(AliVEvent::kMB); |
9b1ab560 | 23 | mgr->AddTask(centralityTask); |
24 | ||
2defbca5 | 25 | AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); |
26 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("CentralityStat", | |
27 | TList::Class(), AliAnalysisManager::kOutputContainer, | |
bd5190fc | 28 | "EventStat_temp.root"); |
2defbca5 | 29 | |
30 | mgr->ConnectInput(centralityTask, 0, mgr->GetCommonInputContainer()); | |
31 | mgr->ConnectOutput(centralityTask,1,coutput1); | |
32 | ||
33 | return centralityTask; | |
34 | } |