Added possibility to do cut on TPCnSigma and rapidity in the task.
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TPCTOF / AddTaskCombinedHadronSpectra.C
CommitLineData
c1466b2c 1\r
2\r
d3484a41 3AliAnalysisTask *AddTaskCombinedHadronSpectra(Int_t identifier = 0, Bool_t isMC = kFALSE, Bool_t isTPConly = kFALSE, Bool_t writeOwnFile = kFALSE, Bool_t saveMotherPDG = kFALSE, Bool_t smallTHnSparse = kFALSE, Double_t nSigmaTPCLow= -3., Double_t nSigmaTPCHigh = 3., Double_t rapidityLow = -0.2, Double_t rapidityHigh = 0.2, 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
d3484a41 13 TString taskName=("AliAnalysisCombinedHadronSpectra.cxx+g");\r
c1466b2c 14 //===============================================\r
15 // Load the task\r
d3484a41 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
d3484a41 30 if (smallTHnSparse){\r
31 task->SetSmallTHnSparse(kTRUE);\r
32 task->SetTPCnSigmaCuts(-3.,3.);\r
33 task->SetRapidityCuts(-0.2,0.2);\r
34 }\r
c1466b2c 35\r
36 //initialize task\r
37 task->Initialize();\r
38\r
39 //esd cuts need to be set after initialize or cuts will be replaced by standard cuts in initialize\r
40 if (setTrackCuts) task->SetESDtrackCuts(ESDtrackCuts);\r
41\r
42 //add task to manager\r
43 mgr->AddTask(task);\r
44\r
45\r
46 \r
47\r
48 //================================================\r
49 // data containers\r
50 //================================================\r
51 // find input container\r
52 //below the trunk version\r
53 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();\r
54\r
cad8c159 55/*\r
c1466b2c 56 //dumm output container\r
57 AliAnalysisDataContainer *coutput0 =\r
58 mgr->CreateContainer(Form("akalweit_tree%i",identifier),\r
59 TTree::Class(),\r
60 AliAnalysisManager::kExchangeContainer,\r
61 Form("akalweit_default%i",identifier));\r
62\r
63\r
64 //define output containers, please use 'username'_'somename'\r
65 AliAnalysisDataContainer *coutput1 = \r
66 mgr->CreateContainer(Form("akalweit_CombinedHadron%i",identifier), TList::Class(),\r
67 AliAnalysisManager::kOutputContainer,Form("akalweit_CombinedHadron%i.root",identifier));\r
cad8c159 68*/\r
69 if (!writeOwnFile) {\r
70 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("janielsk_CombinedHadron%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:janielsk_CombinedHadron", AliAnalysisManager::GetCommonFileName())); \r
71 }\r
72 else {\r
73 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("janielsk_CombinedHadron%i",identifier), TList::Class(), AliAnalysisManager::kOutputContainer, Form("janielsk_CombinedHadron.root"));\r
74 }\r
c1466b2c 75\r
76\r
77\r
78 //connect containers\r
79\r
80 //\r
81 mgr->ConnectInput (task, 0, cinput );\r
cad8c159 82 //mgr->ConnectOutput (task, 0, coutput0);\r
c1466b2c 83 mgr->ConnectOutput (task, 1, coutput1);\r
84\r
85 return task;\r
86}\r