]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/EBYE/NetParticle/macros/AddTaskNetParticle.C
including Eta and Pt cuts for AOD analysis (for ESDs this is done in ESDTrackCuts)
[u/mrichter/AliRoot.git] / PWGCF / EBYE / NetParticle / macros / AddTaskNetParticle.C
CommitLineData
cb68eb1d 1/* *********************************************************************************
2 * File : AddTaskNetParticle.C
3 * Author : Jochen Thaeder <jochen@thaeder.de>
4 * *********************************************************************************
5 * Configuring NetParticle Task:
6 * - ARGUMENTS :
7 * name -> Name of the task, containing partcile type :
8 * Currently : Proton, Pion, Kaon
9 * isModeDist -> Fill Distributions
10 * isModeEff -> Fill Efficiency/Contamination ThnSparse
11 * isModeDCA -> Fill DCA ThnSparse
12 * useQAThnSparse -> Fill QA ThnSparse
13 * isCreateCSC -> Prepare for CrossSectionCorrection
14 * - requires isModeEff to be set
15 * - Proton only
16 *
17 * - OUTPUT CONTAINER : #N = 5
18 * (1) - Standard Output, Distributions
19 * (2) - Efficiency ThnSparse
20 * (3) - Contamination ThnSparse
21 * (4) - DCA ThnSparse
22 * (5) - QA ThnSparse
23 *
24 ********************************************************************************* */
25
26AliAnalysisTask *AddTaskNetParticle(const Char_t * name = "jthaeder_NetProton",
27 Bool_t isModeDist, Bool_t isModeEff, Bool_t isModeDCA, Bool_t useQAThnSparse = kFALSE,
9be43c8e 28 Bool_t isCreateCSC = kFALSE, Bool_t isModeAOD = kFALSE) {
cb68eb1d 29
30 TString sName(name);
31
32 if (isCreateCSC && !isModeEff) {
33 Error("AddTaskNetParticle", "Creating CrossSectionCorrection needs 'isModeEff' to be set.");
34 return NULL;
35 }
36
37 // ----------------------------------------------
38 // -- Get the current analysis manager
39 // ----------------------------------------------
40 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
41 if (!mgr) {
42 Error("AddTaskNetParticle", "No analysis manager found.");
43 return NULL;
44 }
45
46 // ----------------------------------------------
47 // -- Check for MC
48 // ----------------------------------------------
49 Bool_t isMC = (mgr->GetMCtruthEventHandler() != NULL);
50 if (isMC)
51 Info("AddTaskNetParticle", "This task has MC.");
52
53 // ----------------------------------------------
54 // -- Create task configure it
55 // ----------------------------------------------
56 AliAnalysisTaskNetParticle *task = new AliAnalysisTaskNetParticle("AliAnalysisTaskNetParticle");
57 if (!task) {
58 Error("AddTaskNetParticle", "Task could not be created.");
59 return NULL;
60 }
61
62 if (isMC)
63 task->SetIsMC();
64
65 // -- Set particle type
66 // ----------------------------------------------
67 Float_t minPt, maxPt, minPtEff, maxPtEff, minPtForTOF;
68
69 if (sName.Contains("Proton")) {
70 task->SetParticleSpecies(AliPID::kProton);
71 task->SetControlParticleSpecies(3122, kTRUE, "Lambda");
72 minPt = 0.4; maxPt = 2.2;
73 minPtEff = 0.2; maxPtEff = 2.6;
74 minPtForTOF = 0.8;
75 if (isCreateCSC) {
76 minPtForTOF = maxPtEff;
77 }
78 }
79 else if (sName.Contains("Pion")) {
80 task->SetParticleSpecies(AliPID::kPion);
81 task->SetControlParticleSpecies(3122, kTRUE, "Lambda"); /// maybe something else ...
82 minPt = 0.3; maxPt = 0.9;
83 minPtEff = 0.2; maxPtEff = 1.2;
84 minPtForTOF = 0.8;
85 }
86 else if (sName.Contains("Kaon")) {
87 task->SetParticleSpecies(AliPID::kKaon);
88 task->SetControlParticleSpecies(3122, kTRUE, "Lambda"); /// maybe something else ...
e45ea6db 89 minPt = 0.4; maxPt = 0.8;
9be43c8e 90 minPtEff = 0.1; maxPtEff = 2.5;
e45ea6db 91 minPtForTOF = 0.5;
cb68eb1d 92 }
93 else {
94 Error("AddTaskNetParticle", "Unknown Particle type.");
95 return NULL;
96 }
97
98 // -- Configure flags
99 // ----------------------------------------------
100 if (isModeEff)
101 task->SetModeEffCreation(1); // => 1 = on | 0 = off (default)
102 if (isModeDCA)
103 task->SetModeDCACreation(1); // => 1 = on | 0 = off (default)
104 if (isModeDist)
105 task->SetModeDistCreation(1); // => 1 = on | 0 = off (default)
9be43c8e 106 if(isModeAOD){
107 task->SetIsAOD(1); // => 1 = AODs | 0 = ESDs
108 task->SetTrackFilterBit(1024); // 1024 = RAA cuts
109 }
cb68eb1d 110 // -- Enable QA plots
111 if (useQAThnSparse)
112 task->SetUseQATHnSparse(kTRUE);
113
114 // -- Configure cuts
115 // ----------------------------------------------
116
117 // -- Set cut flags ...
118 task->SetESDTrackCutMode(0); // => 0 = clean | 1 = dirty
119
120 // -- Set standard event cuts
121 task->SetVertexZMax(10.);
122 task->SetCentralityBinMax(7);
123
124 // -- Set track event cuts
125 task->SetRapidityMax(0.5);
126 task->SetMinTrackLengthMC(70.);
127 task->SetNSigmaMaxCdd(3.);
128 task->SetNSigmaMaxCzz(3.);
129
e45ea6db 130 task->SetNSigmaMaxTPC(3);
131 task->SetNSigmaMaxTOF(3);
cb68eb1d 132 task->SetMinPtForTOFRequired(minPtForTOF);
133
134 // -- Set analysis ranges
135 task->SetEtaMax(0.9);
136 task->SetPtRange(minPt, maxPt); // pt cut range for the analysis
137 task->SetPtRangeEff(minPtEff, maxPtEff); // pt cut range for the correction / efficiency / contamination creation
138
139 // ----------------------------------------------
140 // -- Initialize and add task to the ANALYSIS manager
141 // ----------------------------------------------
142 if (!task->Initialize())
143 mgr->AddTask(task);
144 else {
145 Error("Initialize failed, not adding AliAnalysistaskNetParticle !!!");
146 delete task;
147 return NULL;
148 }
149
150 // ----------------------------------------------
151 // -- data containers - input
152 // ----------------------------------------------
153 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
154
155 // ----------------------------------------------
156 // -- data containers - output
157 // ----------------------------------------------
158 AliAnalysisDataContainer *coutput = mgr->CreateContainer(name, TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
159 AliAnalysisDataContainer *coutputEff = mgr->CreateContainer(Form("%s_eff", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
160 AliAnalysisDataContainer *coutputCont = mgr->CreateContainer(Form("%s_cont", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
161 AliAnalysisDataContainer *coutputDca = mgr->CreateContainer(Form("%s_dca", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s.root", name));
162
163 AliAnalysisDataContainer *coutputQA = mgr->CreateContainer(Form("%sQA", name), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%sQA.root", name));
164
165 mgr->ConnectInput (task, 0, cinput );
166 mgr->ConnectOutput (task, 1, coutput);
167 mgr->ConnectOutput (task, 2, coutputEff);
168 mgr->ConnectOutput (task, 3, coutputCont);
169 mgr->ConnectOutput (task, 4, coutputDca);
170 mgr->ConnectOutput (task, 5, coutputQA);
171
172 return task;
173}