Extension for AOD
[u/mrichter/AliRoot.git] / ANALYSIS / macros / AddTaskEventplane.C
CommitLineData
ce7adfe9 1AliEPSelectionTask *AddTaskEventplane()
2{
3 // Macro to connect an event plane selection task to an existing analysis manager.
4 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5 if (!mgr) {
6 ::Error("AddTaskEventplane", "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("AddTaskEventplane", "This task requires an input event handler");
13 return NULL;
14 }
15 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
e51055a0 16
ce7adfe9 17
18 AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection");
19 eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB);
e51055a0 20 if (inputDataType == "AOD"){
21 eventplaneTask->SetInput("AOD");
22 }
90267ca6 23 eventplaneTask->SetTrackType("TPC");
ce7adfe9 24 eventplaneTask->SetUsePtWeight();
90267ca6 25 eventplaneTask->SetUsePhiWeight();
26 eventplaneTask->SetSaveTrackContribution();
27
ce7adfe9 28 mgr->AddTask(eventplaneTask);
29
30 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
31 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("EPStat",
32 TList::Class(), AliAnalysisManager::kOutputContainer,
33 "EventStat_temp.root");
34
35 mgr->ConnectInput(eventplaneTask, 0, mgr->GetCommonInputContainer());
36 mgr->ConnectOutput(eventplaneTask,1,coutput1);
37
38 return eventplaneTask;
39}