Fix in physics selection OADB
[u/mrichter/AliRoot.git] / ANALYSIS / macros / AddTaskAddObject.C
CommitLineData
a9253433 1//=============================================================================
2//
3// *** AddTaskAddObject.C ***
4//
5// This macro initialize a complete AnalysisTask object for filtering ESD with AliAnalysisTaskFilterFriendSecond.
6//
7//=============================================================================
8
9AliAnalysisTaskAddObject *AddTaskAddObject()
10{
11
12 // pointer to the analysis manager
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr) {
15 Error("AddTaskTOFCalib", "No analysis manager to connect to.");
16 return NULL;
17 }
18
19 // check the input handler
20 if (!mgr->GetInputEventHandler()) {
21 ::Error("AddTask", "This task requires an input event handler");
22 return NULL;
23 }
24 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
25
26 // create the task
27 AliAnalysisTaskAddObject* add = new AliAnalysisTaskAddObject("addObj");
28 mgr->AddTask(add);
29
30 // connecting the input/output containers
31 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
32 AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("histo", TH1::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");
33
34 mgr->ConnectInput (add, 0, cinput0 );
35 mgr->ConnectOutput(add, 0, coutput0);
36
37 return add;
38}