]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/macros/AddTaskEventplane.C
new version (M.Vala)
[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"
16 if (inputDataType != "ESD") {
17 ::Error("AddTaskEventplane", "This task works only on ESD analysis");
18 return NULL;
19 }
20
21 AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection");
22 eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB);
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}