modified
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TPCTOF / AddTaskCombinedHadronSpectra.C
CommitLineData
c1466b2c 1\r
2\r
c8d1f015 3AliAnalysisTask *AddTaskCombinedHadronSpectra(Int_t identifier = 0, Bool_t isMC = kFALSE, Bool_t isTPConly = kFALSE, Bool_t writeOwnFile = kFALSE, Bool_t saveMotherPDG = kFALSE, Bool_t setTrackCuts = kFALSE, AliESDtrackCuts *ESDtrackCuts = 0){\r
c1466b2c 4\r
5\r
6 //get the current analysis manager\r
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
8 if (!mgr) {\r
cad8c159 9 Error("AddTask_janielsk_CombinedHadron", "No analysis manager found.");\r
c1466b2c 10 return 0;\r
11 }\r
12 //============= Set Task Name ===================\r
cad8c159 13 //TString taskName=("AliAnalysisCombinedHadronSpectra.cxx+g");\r
c1466b2c 14 //===============================================\r
15 // Load the task\r
cad8c159 16 //gROOT->LoadMacro(taskName.Data());\r
c1466b2c 17\r
18\r
19 \r
20 //========= Add task to the ANALYSIS manager =====\r
21\r
22 //normal tracks\r
cad8c159 23 AliAnalysisCombinedHadronSpectra *task = new AliAnalysisCombinedHadronSpectra("janielskTaskCombinedHadron");\r
c1466b2c 24 task->SelectCollisionCandidates(AliVEvent::kMB);\r
25\r
26 //switches\r
27 if (isMC) task->SetIsMCtrue(isMC);\r
28 if (isTPConly)task->SetUseTPConlyTracks(isTPConly);\r
c8d1f015 29 if (saveMotherPDG) task->SetSaveMotherPDG(saveMotherPDG);\r
c1466b2c 30\r
31 //initialize task\r
32 task->Initialize();\r
33\r
34 //esd cuts need to be set after initialize or cuts will be replaced by standard cuts in initialize\r
35 if (setTrackCuts) task->SetESDtrackCuts(ESDtrackCuts);\r
36\r
37 //add task to manager\r
38 mgr->AddTask(task);\r
39\r
40\r
41 \r
42\r
43 //================================================\r
44 // data containers\r
45 //================================================\r
46 // find input container\r
47 //below the trunk version\r
48 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();\r
49\r
cad8c159 50/*\r
c1466b2c 51 //dumm output container\r
52 AliAnalysisDataContainer *coutput0 =\r
53 mgr->CreateContainer(Form("akalweit_tree%i",identifier),\r
54 TTree::Class(),\r
55 AliAnalysisManager::kExchangeContainer,\r
56 Form("akalweit_default%i",identifier));\r
57\r
58\r
59 //define output containers, please use 'username'_'somename'\r
60 AliAnalysisDataContainer *coutput1 = \r
61 mgr->CreateContainer(Form("akalweit_CombinedHadron%i",identifier), TList::Class(),\r
62 AliAnalysisManager::kOutputContainer,Form("akalweit_CombinedHadron%i.root",identifier));\r
cad8c159 63*/\r
64 if (!writeOwnFile) {\r
65 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("janielsk_CombinedHadron%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:janielsk_CombinedHadron", AliAnalysisManager::GetCommonFileName())); \r
66 }\r
67 else {\r
68 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("janielsk_CombinedHadron%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("janielsk_CombinedHadron.root"));\r
69 }\r
c1466b2c 70\r
71\r
72\r
73 //connect containers\r
74\r
75 //\r
76 mgr->ConnectInput (task, 0, cinput );\r
cad8c159 77 //mgr->ConnectOutput (task, 0, coutput0);\r
c1466b2c 78 mgr->ConnectOutput (task, 1, coutput1);\r
79\r
80 return task;\r
81}\r