]>
Commit | Line | Data |
---|---|---|
377e5a61 | 1 | AliCentralitySelectionTask *AddTaskCentrality(Bool_t fillHistos=kTRUE, Bool_t aod=kFALSE) |
2defbca5 | 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" | |
377e5a61 | 16 | if (!aod && (inputDataType != "ESD")) { |
2defbca5 | 17 | ::Error("AddTaskCentrality", "This task works only on ESD analysis"); |
18 | return NULL; | |
19 | } | |
20 | AliCentralitySelectionTask *centralityTask = new AliCentralitySelectionTask("CentralitySelection"); | |
377e5a61 | 21 | centralityTask->SetInput(inputDataType); |
ebb6dbd1 | 22 | centralityTask->SelectCollisionCandidates(AliVEvent::kAny); |
9b1ab560 | 23 | mgr->AddTask(centralityTask); |
24 | ||
2defbca5 | 25 | mgr->ConnectInput(centralityTask, 0, mgr->GetCommonInputContainer()); |
9b55f3ac | 26 | if (fillHistos) { |
27 | centralityTask->SetFillHistos(); | |
28 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("CentralityStat", | |
29 | TList::Class(), | |
30 | AliAnalysisManager::kOutputContainer, | |
31 | "EventStat_temp.root"); | |
32 | mgr->ConnectOutput(centralityTask,1,coutput1); | |
33 | } | |
2defbca5 | 34 | |
35 | return centralityTask; | |
36 | } |