Coverity
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / AliAnalysisTaskLukeAOD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id: AliAnalysisTaskLukeAOD.cxx 46301 2011-01-06 14:25:27Z agheata $ */
17
18 /* AliAnalysisTaskLukeAOD.cxx
19  *
20  * Template task producing a P_t spectrum and pseudorapidity distribution.
21  *
22  * Instructions for adding histograms can be found below, starting with NEW HISTO
23  *
24  * Based on tutorial example from offline pages
25  * Edited by Arvinder Palaha
26  * Edited by Luke Hanratty for AODS
27  */
28 #include "AliAnalysisTaskLukeAOD.h"
29
30 #include "Riostream.h"
31 #include "TChain.h"
32 #include "TTree.h"
33 #include "TH1F.h"
34 #include "TH2F.h"
35 #include "TCanvas.h"
36 #include "TList.h"
37 #include "TPDGCode.h"
38
39 #include "AliAnalysisTaskSE.h"
40 #include "AliAnalysisManager.h"
41 #include "AliStack.h"
42 #include "AliESDtrackCuts.h"
43 #include "AliESDEvent.h"
44 #include "AliESDInputHandler.h"
45 #include "AliAODEvent.h"
46 #include "AliMCEvent.h"
47 #include "AliMCVertex.h"
48
49 #include "AliAODEvent.h"
50 #include "AliAODv0.h"
51 #include "AliAODcascade.h"
52
53 #include "AliPID.h"
54 #include "AliPIDResponse.h"
55 #include "AliAODPid.h"
56 #include "AliCentrality.h"
57
58 #include "AliAODMCHeader.h"
59 #include "AliAODMCParticle.h"
60
61 #include "AliInputEventHandler.h"
62
63
64
65 ClassImp(AliAnalysisTaskLukeAOD)
66
67 //________________________________________________________________________
68 AliAnalysisTaskLukeAOD::AliAnalysisTaskLukeAOD() // All data members should be initialised here
69 :AliAnalysisTaskSE(),
70 fOutput(0),
71 fPIDResponse(0),
72 maskIsSelected(0),
73
74 fHistPt(0), 
75 fHistEta(0),
76 fHistLog(0),
77 fHistNV0(0),
78 fHistZVertex(0),
79 fHistMCZVertex(0),
80 fHistCentrality(0),
81
82 fHistBBK0Pos(0),
83 fHistBBK0Neg(0),
84 fHistBBLaPos(0),
85 fHistBBLaNeg(0),
86 fHistBBLbPos(0),
87 fHistBBLbNeg(0),
88
89 fHistBB3SigProton(0),
90 fHistMK0Pt(0), 
91 fHistMLaPt(0), 
92 fHistMLbPt(0),
93 fHistMcPMK0Pt(0),
94 fHistMcPMLaPt(0),
95 fHistMcPMLbPt(0),
96
97 fHistMcFMLaPt(0),
98
99 fHistMK0PtCent0005(0), 
100 fHistMLaPtCent0005(0), 
101 fHistMLbPtCent0005(0),
102 fHistMcPMK0PtCent0005(0),
103 fHistMcPMLaPtCent0005(0),
104 fHistMcPMLbPtCent0005(0),
105 fHistZVertexCent0005(0),
106 fHistMCZVertexCent0005(0),
107
108 fHistMK0PtCent0510(0), 
109 fHistMLaPtCent0510(0), 
110 fHistMLbPtCent0510(0),
111 fHistMcPMK0PtCent0510(0),
112 fHistMcPMLaPtCent0510(0),
113 fHistMcPMLbPtCent0510(0),
114 fHistZVertexCent0510(0),
115 fHistMCZVertexCent0510(0),
116
117 fHistMK0PtCent1020(0), 
118 fHistMLaPtCent1020(0), 
119 fHistMLbPtCent1020(0),
120 fHistMcPMK0PtCent1020(0),
121 fHistMcPMLaPtCent1020(0),
122 fHistMcPMLbPtCent1020(0),
123 fHistZVertexCent1020(0),
124 fHistMCZVertexCent1020(0),
125
126 fHistMK0PtCent2040(0), 
127 fHistMLaPtCent2040(0), 
128 fHistMLbPtCent2040(0),
129 fHistMcPMK0PtCent2040(0),
130 fHistMcPMLaPtCent2040(0),
131 fHistMcPMLbPtCent2040(0),
132 fHistZVertexCent2040(0),
133 fHistMCZVertexCent2040(0),
134
135 fHistMK0PtCent4060(0), 
136 fHistMLaPtCent4060(0), 
137 fHistMLbPtCent4060(0),
138 fHistMcPMK0PtCent4060(0),
139 fHistMcPMLaPtCent4060(0),
140 fHistMcPMLbPtCent4060(0),
141 fHistZVertexCent4060(0),
142 fHistMCZVertexCent4060(0),
143
144 fHistMK0PtCent6090(0), 
145 fHistMLaPtCent6090(0), 
146 fHistMLbPtCent6090(0),
147 fHistMcPMK0PtCent6090(0),
148 fHistMcPMLaPtCent6090(0),
149 fHistMcPMLbPtCent6090(0),
150 fHistZVertexCent6090(0),
151 fHistMCZVertexCent6090(0),
152
153 fHistMK0PtCent0090(0), 
154 fHistMLaPtCent0090(0), 
155 fHistMLbPtCent0090(0),
156 fHistMcPMK0PtCent0090(0),
157 fHistMcPMLaPtCent0090(0),
158 fHistMcPMLbPtCent0090(0),
159 fHistZVertexCent0090(0),
160 fHistMCZVertexCent0090(0),
161
162 fHistCosPaLaPt(0),
163 fHistCosPaLbPt(0),
164 fHistCosPaK0Pt(0),      
165 fHistMcCosPaAllLaPt(0),
166 fHistMcCosPaAllLbPt(0),
167 fHistMcCosPaAllK0Pt(0), 
168 fHistMcCosPaFoundLaPt(0),
169 fHistMcCosPaFoundLbPt(0),
170 fHistMcCosPaAFoundK0Pt(0),
171
172 fHistcTauLaPt(0),       
173 fHistcTauLbPt(0),
174 fHistcTauK0Pt(0),               
175 fHistMccTauAllLaPt(0),
176 fHistMccTauAllLbPt(0),
177 fHistMccTauAllK0Pt(0),  
178 fHistMccTauFoundLaPt(0),
179 fHistMccTauFoundLbPt(0),        
180 fHistMccTauAFoundK0Pt(0),
181
182 fHistDcaLaPt(0),        
183 fHistDcaLbPt(0),        
184 fHistDcaK0Pt(0),        
185 fHistMcDcaAllLaPt(0),
186 fHistMcDcaAllLbPt(0),
187 fHistMcDcaAllK0Pt(0),   
188 fHistMcDcaFoundLaPt(0), 
189 fHistMcDcaFoundLbPt(0), 
190 fHistMcDcaAFoundK0Pt(0),
191
192 fHistNSigmaLaPt(0),     
193 fHistNSigmaLbPt(0),             
194 fHistNSigmaK0Pt(0),             
195 fHistMcNSigmaAllLaPt(0),        
196 fHistMcNSigmaAllLbPt(0),        
197 fHistMcNSigmaAllK0Pt(0),        
198 fHistMcNSigmaFoundLaPt(0),      
199 fHistMcNSigmaFoundLbPt(0),      
200 fHistMcNSigmaAFoundK0Pt(0),
201
202 fHistEtaLaPt(0),        
203 fHistEtaLbPt(0),        
204 fHistEtaK0Pt(0),                
205 fHistMcEtaAllLaPt(0),
206 fHistMcEtaAllLbPt(0),   
207 fHistMcEtaAllK0Pt(0),
208 fHistMcEtaFoundLaPt(0), 
209 fHistMcEtaFoundLbPt(0), 
210 fHistMcEtaAFoundK0Pt(0),
211
212 fHistRapLaPt(0),
213 fHistRapLbPt(0),                
214 fHistRapK0Pt(0),        
215 fHistMcRapAllLaPt(0),   
216 fHistMcRapAllLbPt(0),   
217 fHistMcRapAllK0Pt(0),   
218 fHistMcRapFoundLaPt(0),
219 fHistMcRapFoundLbPt(0),
220 fHistMcRapAFoundK0Pt(0)
221
222 // The last in the above list should not have a comma after it
223 {
224     // Dummy constructor ALWAYS needed for I/O.
225 }
226
227 //________________________________________________________________________
228 AliAnalysisTaskLukeAOD::AliAnalysisTaskLukeAOD(const char *name) // All data members should be initialised here
229 :AliAnalysisTaskSE(name),
230 fOutput(0),
231 fPIDResponse(0),
232 maskIsSelected(0),
233
234 fHistPt(0), 
235 fHistEta(0),
236 fHistLog(0),
237 fHistNV0(0),
238 fHistZVertex(0),
239 fHistMCZVertex(0),
240 fHistCentrality(0),
241
242 fHistBBK0Pos(0),
243 fHistBBK0Neg(0),
244 fHistBBLaPos(0),
245 fHistBBLaNeg(0),
246 fHistBBLbPos(0),
247 fHistBBLbNeg(0),
248
249 fHistBB3SigProton(0),
250 fHistMK0Pt(0), 
251 fHistMLaPt(0), 
252 fHistMLbPt(0),
253 fHistMcPMK0Pt(0),
254 fHistMcPMLaPt(0),
255 fHistMcPMLbPt(0),
256
257 fHistMcFMLaPt(0),
258
259 fHistMK0PtCent0005(0), 
260 fHistMLaPtCent0005(0), 
261 fHistMLbPtCent0005(0),
262 fHistMcPMK0PtCent0005(0),
263 fHistMcPMLaPtCent0005(0),
264 fHistMcPMLbPtCent0005(0),
265 fHistZVertexCent0005(0),
266 fHistMCZVertexCent0005(0),
267
268 fHistMK0PtCent0510(0), 
269 fHistMLaPtCent0510(0), 
270 fHistMLbPtCent0510(0),
271 fHistMcPMK0PtCent0510(0),
272 fHistMcPMLaPtCent0510(0),
273 fHistMcPMLbPtCent0510(0),
274 fHistZVertexCent0510(0),
275 fHistMCZVertexCent0510(0),
276
277 fHistMK0PtCent1020(0), 
278 fHistMLaPtCent1020(0), 
279 fHistMLbPtCent1020(0),
280 fHistMcPMK0PtCent1020(0),
281 fHistMcPMLaPtCent1020(0),
282 fHistMcPMLbPtCent1020(0),
283 fHistZVertexCent1020(0),
284 fHistMCZVertexCent1020(0),
285
286 fHistMK0PtCent2040(0), 
287 fHistMLaPtCent2040(0), 
288 fHistMLbPtCent2040(0),
289 fHistMcPMK0PtCent2040(0),
290 fHistMcPMLaPtCent2040(0),
291 fHistMcPMLbPtCent2040(0),
292 fHistZVertexCent2040(0),
293 fHistMCZVertexCent2040(0),
294
295 fHistMK0PtCent4060(0), 
296 fHistMLaPtCent4060(0), 
297 fHistMLbPtCent4060(0),
298 fHistMcPMK0PtCent4060(0),
299 fHistMcPMLaPtCent4060(0),
300 fHistMcPMLbPtCent4060(0),
301 fHistZVertexCent4060(0),
302 fHistMCZVertexCent4060(0),
303
304 fHistMK0PtCent6090(0), 
305 fHistMLaPtCent6090(0), 
306 fHistMLbPtCent6090(0),
307 fHistMcPMK0PtCent6090(0),
308 fHistMcPMLaPtCent6090(0),
309 fHistMcPMLbPtCent6090(0),
310 fHistZVertexCent6090(0),
311 fHistMCZVertexCent6090(0),
312
313 fHistMK0PtCent0090(0), 
314 fHistMLaPtCent0090(0), 
315 fHistMLbPtCent0090(0),
316 fHistMcPMK0PtCent0090(0),
317 fHistMcPMLaPtCent0090(0),
318 fHistMcPMLbPtCent0090(0),
319 fHistZVertexCent0090(0),
320 fHistMCZVertexCent0090(0),
321
322 fHistCosPaLaPt(0),
323 fHistCosPaLbPt(0),
324 fHistCosPaK0Pt(0),      
325 fHistMcCosPaAllLaPt(0),
326 fHistMcCosPaAllLbPt(0),
327 fHistMcCosPaAllK0Pt(0), 
328 fHistMcCosPaFoundLaPt(0),
329 fHistMcCosPaFoundLbPt(0),
330 fHistMcCosPaAFoundK0Pt(0),
331
332 fHistcTauLaPt(0),       
333 fHistcTauLbPt(0),
334 fHistcTauK0Pt(0),               
335 fHistMccTauAllLaPt(0),
336 fHistMccTauAllLbPt(0),
337 fHistMccTauAllK0Pt(0),  
338 fHistMccTauFoundLaPt(0),
339 fHistMccTauFoundLbPt(0),        
340 fHistMccTauAFoundK0Pt(0),
341
342 fHistDcaLaPt(0),        
343 fHistDcaLbPt(0),        
344 fHistDcaK0Pt(0),        
345 fHistMcDcaAllLaPt(0),
346 fHistMcDcaAllLbPt(0),
347 fHistMcDcaAllK0Pt(0),   
348 fHistMcDcaFoundLaPt(0), 
349 fHistMcDcaFoundLbPt(0), 
350 fHistMcDcaAFoundK0Pt(0),
351
352 fHistNSigmaLaPt(0),     
353 fHistNSigmaLbPt(0),             
354 fHistNSigmaK0Pt(0),             
355 fHistMcNSigmaAllLaPt(0),        
356 fHistMcNSigmaAllLbPt(0),        
357 fHistMcNSigmaAllK0Pt(0),        
358 fHistMcNSigmaFoundLaPt(0),      
359 fHistMcNSigmaFoundLbPt(0),      
360 fHistMcNSigmaAFoundK0Pt(0),
361
362 fHistEtaLaPt(0),        
363 fHistEtaLbPt(0),        
364 fHistEtaK0Pt(0),                
365 fHistMcEtaAllLaPt(0),
366 fHistMcEtaAllLbPt(0),   
367 fHistMcEtaAllK0Pt(0),
368 fHistMcEtaFoundLaPt(0), 
369 fHistMcEtaFoundLbPt(0), 
370 fHistMcEtaAFoundK0Pt(0),
371
372 fHistRapLaPt(0),
373 fHistRapLbPt(0),                
374 fHistRapK0Pt(0),        
375 fHistMcRapAllLaPt(0),   
376 fHistMcRapAllLbPt(0),   
377 fHistMcRapAllK0Pt(0),   
378 fHistMcRapFoundLaPt(0),
379 fHistMcRapFoundLbPt(0),
380 fHistMcRapAFoundK0Pt(0)
381
382 // The last in the above list should not have a comma after it
383 {
384     // Constructor
385     // Define input and output slots here (never in the dummy constructor)
386     // Input slot #0 works with a TChain - it is connected to the default input container
387     // Output slot #1 writes into a TH1 container
388     DefineOutput(1, TList::Class());                                            // for output list
389 }
390
391 //________________________________________________________________________
392 AliAnalysisTaskLukeAOD::~AliAnalysisTaskLukeAOD()
393 {
394     // Destructor. Clean-up the output list, but not the histograms that are put inside
395     // (the list is owner and will clean-up these histograms). Protect in PROOF case.
396     if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
397         delete fOutput;
398     }
399 }
400
401 //________________________________________________________________________
402 void AliAnalysisTaskLukeAOD::UserCreateOutputObjects()
403 {
404     // Create histograms
405     // Called once (on the worker node)
406         
407     fOutput = new TList();
408     fOutput->SetOwner();  // IMPORTANT!
409         
410         AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
411         AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
412         fPIDResponse = inputHandler->GetPIDResponse();
413         maskIsSelected = inputHandler->IsEventSelected();
414     
415         // Create histograms
416     Int_t ptbins = 15;
417     Float_t ptlow = 0.1, ptup = 3.1;
418     fHistPt = new TH1F("fHistPt", "P_{T} distribution for reconstructed", ptbins, ptlow, ptup);
419     fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
420     fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
421     fHistPt->SetMarkerStyle(kFullCircle);
422         
423     Int_t etabins = 40;
424     Float_t etalow = -2.0, etaup = 2.0;
425     fHistEta = new TH1F("fHistEta","#eta distribution for reconstructed",etabins, etalow, etaup);
426     fHistEta->GetXaxis()->SetTitle("#eta");
427     fHistEta->GetYaxis()->SetTitle("counts");
428         
429         fHistLog = new TH1F("fHistLog","Log Variables",100, -0.5, 99.5);
430         fHistNV0 = new TH1F("fHistNV0","Number of V0s per event",100, 0, 5000);
431         fHistZVertex = new TH1F("fHistZVertex","Z coordinate of primary vertex",60, -15, 15);
432         fHistMCZVertex = new TH1F("fHistMCZVertex","Z coordinate of primary vertex in MC truth",60, -15, 15);
433         fHistCentrality = new   TH1F("fHistCentrality", "Centrality of Events; Centrality Percentile (%); N",110,-5,105);
434         
435         fHistBBK0Pos = new      TH2F("fHistBBK0Pos","PID of the positive daughter of K0 candidates; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
436         fHistBBK0Neg = new      TH2F("fHistBBK0Neg","PID of the negative daughter of K0 candidates; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
437         fHistBBLaPos = new      TH2F("fHistBBLaPos","PID of the positive daughter of La candidates; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
438         fHistBBLaNeg = new      TH2F("fHistBBLaNeg","PID of the negative daughter of La candidates; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
439         fHistBBLbPos = new      TH2F("fHistBBLbPos","PID of the positive daughter of Lb candidates; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
440         fHistBBLbNeg = new      TH2F("fHistBBLbNeg","PID of the negative daughter of Lb candidates; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
441         
442         fHistBB3SigProton = new TH2F("fHistBB3SigProton","-dE/dX against Momentum for Protons @3sigma from TPC; P (GeV); -dE/dx (keV/cm ?)",1000,0,10,1000,0,200);
443         fHistMK0Pt = new        TH2F("fHistMK0Pt","K0 Mass versus Pt; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
444         fHistMLaPt = new        TH2F("fHistMLaPt","Lambda Mass versus Pt; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
445         fHistMLbPt = new        TH2F("fHistMLbPt","AntiLambda Mass versus Pt; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
446         fHistMcPMK0Pt = new     TH2F("fHistMcPMK0Pt","Monte Carlo primary K0 Mass versus Pt; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
447         fHistMcPMLaPt = new     TH2F("fHistMcPMLaPt","Monte Carlo primary (& sigma0) Lambda Mass versus Pt; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
448         fHistMcPMLbPt = new     TH2F("fHistMcPMLbPt","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
449         
450         fHistMcFMLaPt = new     TH2F("fHistMcFMLaPt","Monte Carlo Reconstructed Lambda Mass versus Pt for feeddown lambda; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
451         
452         fHistMK0PtCent0005 = new        TH2F("fHistMK0PtCent0005","K0 Mass versus Pt for Centrality 0-5%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
453         fHistMLaPtCent0005 = new        TH2F("fHistMLaPtCent0005","Lambda Mass versus Pt for Centrality 0-5%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
454         fHistMLbPtCent0005 = new        TH2F("fHistMLbPtCent0005","AntiLambda Mass versus Pt for Centrality 0-5%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
455         fHistMcPMK0PtCent0005 = new     TH2F("fHistMcPMK0PtCent0005","Monte Carlo primary K0 Mass versus Pt for Centrality 0-5%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
456         fHistMcPMLaPtCent0005 = new     TH2F("fHistMcPMLaPtCent0005","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 0-5%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
457         fHistMcPMLbPtCent0005 = new     TH2F("fHistMcPMLbPtCent0005","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 0-5%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
458         fHistZVertexCent0005 = new TH1F("fHistZVertexCent0005","Z coordinate of primary vertex for Centrality 0-5%",60, -15, 15);
459         fHistMCZVertexCent0005 = new TH1F("fHistMCZVertexCent0005","Z coordinate of primary vertex in MC truth for Centrality 0-5%",60, -15, 15);
460         
461         fHistMK0PtCent0510 = new        TH2F("fHistMK0PtCent0510","K0 Mass versus Pt for Centrality 5-10%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
462         fHistMLaPtCent0510 = new        TH2F("fHistMLaPtCent0510","Lambda Mass versus Pt for Centrality 5-10%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
463         fHistMLbPtCent0510 = new        TH2F("fHistMLbPtCent0510","AntiLambda Mass versus Pt for Centrality 5-10%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
464         fHistMcPMK0PtCent0510 = new     TH2F("fHistMcPMK0PtCent0510","Monte Carlo primary K0 Mass versus Pt for Centrality 5-10%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
465         fHistMcPMLaPtCent0510 = new     TH2F("fHistMcPMLaPtCent0510","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 5-10%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
466         fHistMcPMLbPtCent0510 = new     TH2F("fHistMcPMLbPtCent0510","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 5-10%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
467         fHistZVertexCent0510 = new TH1F("fHistZVertexCent0510","Z coordinate of primary vertex for Centrality 5-10%",60, -15, 15);
468         fHistMCZVertexCent0510 = new TH1F("fHistMCZVertexCent0510","Z coordinate of primary vertex in MC truth for Centrality 5-10%",60, -15, 15);
469         
470         fHistMK0PtCent1020 = new        TH2F("fHistMK0PtCent1020","K0 Mass versus Pt for Centrality 10-20%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
471         fHistMLaPtCent1020 = new        TH2F("fHistMLaPtCent1020","Lambda Mass versus Pt for Centrality 10-20%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
472         fHistMLbPtCent1020 = new        TH2F("fHistMLbPtCent1020","AntiLambda Mass versus Pt for Centrality 10-20%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
473         fHistMcPMK0PtCent1020 = new     TH2F("fHistMcPMK0PtCent1020","Monte Carlo primary K0 Mass versus Pt for Centrality 10-20%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
474         fHistMcPMLaPtCent1020 = new     TH2F("fHistMcPMLaPtCent1020","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 10-20%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
475         fHistMcPMLbPtCent1020 = new     TH2F("fHistMcPMLbPtCent1020","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 10-20%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
476         fHistZVertexCent1020 = new TH1F("fHistZVertexCent1020","Z coordinate of primary vertex for Centrality 10-20%",60, -15, 15);
477         fHistMCZVertexCent1020 = new TH1F("fHistMCZVertexCent1020","Z coordinate of primary vertex in MC truth for Centrality 10-20%",60, -15, 15);
478         
479         fHistMK0PtCent2040 = new        TH2F("fHistMK0PtCent2040","K0 Mass versus Pt for Centrality 20-40%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
480         fHistMLaPtCent2040 = new        TH2F("fHistMLaPtCent2040","Lambda Mass versus Pt for Centrality 20-40%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
481         fHistMLbPtCent2040 = new        TH2F("fHistMLbPtCent2040","AntiLambda Mass versus Pt for Centrality 20-40%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
482         fHistMcPMK0PtCent2040 = new     TH2F("fHistMcPMK0PtCent2040","Monte Carlo primary K0 Mass versus Pt for Centrality 20-40%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
483         fHistMcPMLaPtCent2040 = new     TH2F("fHistMcPMLaPtCent2040","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 20-40%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
484         fHistMcPMLbPtCent2040 = new     TH2F("fHistMcPMLbPtCent2040","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 20-40%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
485         fHistZVertexCent2040 = new TH1F("fHistZVertexCent2040","Z coordinate of primary vertex for Centrality 20-40%",60, -15, 15);
486         fHistMCZVertexCent2040 = new TH1F("fHistMCZVertexCent2040","Z coordinate of primary vertex in MC truth for Centrality 20-40%",60, -15, 15);
487         
488         fHistMK0PtCent4060 = new        TH2F("fHistMK0PtCent4060","K0 Mass versus Pt for Centrality 40-60%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
489         fHistMLaPtCent4060 = new        TH2F("fHistMLaPtCent4060","Lambda Mass versus Pt for Centrality 40-60%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
490         fHistMLbPtCent4060 = new        TH2F("fHistMLbPtCent4060","AntiLambda Mass versus Pt for Centrality 40-60%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
491         fHistMcPMK0PtCent4060 = new     TH2F("fHistMcPMK0PtCent4060","Monte Carlo primary K0 Mass versus Pt for Centrality 40-60%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
492         fHistMcPMLaPtCent4060 = new     TH2F("fHistMcPMLaPtCent4060","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 40-60%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
493         fHistMcPMLbPtCent4060 = new     TH2F("fHistMcPMLbPtCent4060","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 40-60%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
494         fHistZVertexCent4060 = new TH1F("fHistZVertexCent4060","Z coordinate of primary vertex for Centrality 40-60%",60, -15, 15);
495         fHistMCZVertexCent4060 = new TH1F("fHistMCZVertexCent4060","Z coordinate of primary vertex in MC truth for Centrality 40-60%",60, -15, 15);
496         
497         fHistMK0PtCent6090 = new        TH2F("fHistMK0PtCent6090","K0 Mass versus Pt for Centrality 60-90%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
498         fHistMLaPtCent6090 = new        TH2F("fHistMLaPtCent6090","Lambda Mass versus Pt for Centrality 60-90%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
499         fHistMLbPtCent6090 = new        TH2F("fHistMLbPtCent6090","AntiLambda Mass versus Pt for Centrality 60-90%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
500         fHistMcPMK0PtCent6090 = new     TH2F("fHistMcPMK0PtCent6090","Monte Carlo primary K0 Mass versus Pt for Centrality 60-90%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
501         fHistMcPMLaPtCent6090 = new     TH2F("fHistMcPMLaPtCent6090","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 60-90%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
502         fHistMcPMLbPtCent6090 = new     TH2F("fHistMcPMLbPtCent6090","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 60-90%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
503         fHistZVertexCent6090 = new TH1F("fHistZVertexCent6090","Z coordinate of primary vertex for Centrality 60-90%",60, -15, 15);
504         fHistMCZVertexCent6090 = new TH1F("fHistMCZVertexCent6090","Z coordinate of primary vertex in MC truth for Centrality 60-90%",60, -15, 15);
505         
506         fHistMK0PtCent0090 = new        TH2F("fHistMK0PtCent0090","K0 Mass versus Pt for Centrality 0-90%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
507         fHistMLaPtCent0090 = new        TH2F("fHistMLaPtCent0090","Lambda Mass versus Pt for Centrality 0-90%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
508         fHistMLbPtCent0090 = new        TH2F("fHistMLbPtCent0090","AntiLambda Mass versus Pt for Centrality 0-90%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
509         fHistMcPMK0PtCent0090 = new     TH2F("fHistMcPMK0PtCent0090","Monte Carlo primary K0 Mass versus Pt for Centrality 0-90%; P_{perp} (GeV/c); K0 Mass (GeV/c^2)",200,0,10,140,0.414,0.582);
510         fHistMcPMLaPtCent0090 = new     TH2F("fHistMcPMLaPtCent0090","Monte Carlo primary (& sigma0) Lambda Mass versus Pt for Centrality 0-90%; P_{perp} (GeV/c); M(p#pi^{-}) (GeV/c^2)",200,0,10,96,1.08,1.2);
511         fHistMcPMLbPtCent0090 = new     TH2F("fHistMcPMLbPtCent0090","Monte Carlo primary (& sigma0) AntiLambda Mass versus Pt for Centrality 0-90%; P_{perp} (GeV/c); M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,10,96,1.08,1.2);
512         fHistZVertexCent0090 = new TH1F("fHistZVertexCent0090","Z coordinate of primary vertex for Centrality 0-90%",60, -15, 15);
513         fHistMCZVertexCent0090 = new TH1F("fHistMCZVertexCent0090","Z coordinate of primary vertex in MC truth for Centrality 0-90%",60, -15, 15);
514         
515         
516         fHistCosPaLaPt           = new  TH2F("fHistCosPaLaPt"," Reconstructed Mass vs CosPa for Lambda Candidates; M(p#pi^{-}) (GeV/c^2)",200,0.99,1.001,96,1.08,1.2);
517         fHistCosPaLbPt           = new  TH2F("fHistCosPaLbPt"," Reconstructed Mass vs CosPa for AntiLambda Candidates; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0.99,1.001,96,1.08,1.2);
518         fHistCosPaK0Pt           = new  TH2F("fHistCosPaK0Pt"," Reconstructed Mass vs CosPa for K0Short Candidates; K0 Mass (GeV/c^2)",200,0.99,1.001,140,0.414,0.582);
519         fHistMcCosPaAllLaPt      = new  TH2F("fHistMcCosPaAllLaPt","    Reconstructed Mass vs CosPa for all MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,0.99,1.001,96,1.08,1.2);
520         fHistMcCosPaAllLbPt      = new  TH2F("fHistMcCosPaAllLbPt","    Reconstructed Mass vs CosPa for all MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0.99,1.001,96,1.08,1.2);
521         fHistMcCosPaAllK0Pt      = new  TH2F("fHistMcCosPaAllK0Pt","    Reconstructed Mass vs CosPa for all MC primary K0Short; K0 Mass (GeV/c^2)",200,0.99,1.001,140,0.414,0.582);
522         fHistMcCosPaFoundLaPt    = new  TH2F("fHistMcCosPaFoundLaPt","  Reconstructed Mass vs CosPa for reconstructed MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,0.99,1.001,96,1.08,1.2);
523         fHistMcCosPaFoundLbPt    = new  TH2F("fHistMcCosPaFoundLbPt","  Reconstructed Mass vs CosPa for reconstructed MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0.99,1.001,96,1.08,1.2);
524         fHistMcCosPaAFoundK0Pt = new    TH2F("fHistMcCosPaAFoundK0Pt"," Reconstructed Mass vs CosPa for reconstructed MC primary K0Short; K0 Mass (GeV/c^2)",200,0.99,1.001,140,0.414,0.582);
525         
526         fHistcTauLaPt            = new  TH2F("fHistcTauLaPt","  Reconstructed Mass vs cTau for Lambda Candidates; M(p#pi^{-}) (GeV/c^2)",200,0,50,96,1.08,1.2);
527         fHistcTauLbPt            = new  TH2F("fHistcTauLbPt","  Reconstructed Mass vs cTau for AntiLambda Candidates; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,50,96,1.08,1.2);
528         fHistcTauK0Pt            = new  TH2F("fHistcTauK0Pt","  Reconstructed Mass vs cTau for K0Short Candidates; K0 Mass (GeV/c^2)",200,0,50,140,0.414,0.582);
529         fHistMccTauAllLaPt       = new  TH2F("fHistMccTauAllLaPt","     Reconstructed Mass vs cTau for all MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,0,50,96,1.08,1.2);
530         fHistMccTauAllLbPt       = new  TH2F("fHistMccTauAllLbPt","     Reconstructed Mass vs cTau for all MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,50,96,1.08,1.2);
531         fHistMccTauAllK0Pt       = new  TH2F("fHistMccTauAllK0Pt","     Reconstructed Mass vs cTau for all MC primary K0Short; K0 Mass (GeV/c^2)",200,0,50,140,0.414,0.582);
532         fHistMccTauFoundLaPt     = new  TH2F("fHistMccTauFoundLaPt","   Reconstructed Mass vs cTau for reconstructed MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,0,50,96,1.08,1.2);
533         fHistMccTauFoundLbPt     = new  TH2F("fHistMccTauFoundLbPt","   Reconstructed Mass vs cTau for reconstructed MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,50,96,1.08,1.2);
534         fHistMccTauAFoundK0Pt = new     TH2F("fHistMccTauAFoundK0Pt","  Reconstructed Mass vs cTau for reconstructed MC primary K0Short; K0 Mass (GeV/c^2)",200,0,50,140,0.414,0.582);
535         
536         fHistDcaLaPt             = new  TH2F("fHistDcaLaPt","   Reconstructed Mass vs Dca for Lambda Candidates; M(p#pi^{-}) (GeV/c^2)",200,0,1.5,96,1.08,1.2);
537         fHistDcaLbPt             = new  TH2F("fHistDcaLbPt","   Reconstructed Mass vs Dca for AntiLambda Candidates; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,1.5,96,1.08,1.2);
538         fHistDcaK0Pt             = new  TH2F("fHistDcaK0Pt","   Reconstructed Mass vs Dca for K0Short Candidates; K0 Mass (GeV/c^2)",200,0,1.5,140,0.414,0.582);
539         fHistMcDcaAllLaPt        = new  TH2F("fHistMcDcaAllLaPt","      Reconstructed Mass vs Dca for all MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,0,50,96,1.08,1.2);
540         fHistMcDcaAllLbPt        = new  TH2F("fHistMcDcaAllLbPt","      Reconstructed Mass vs Dca for all MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,50,96,1.08,1.2);
541         fHistMcDcaAllK0Pt        = new  TH2F("fHistMcDcaAllK0Pt","      Reconstructed Mass vs Dca for all MC primary K0Short; K0 Mass (GeV/c^2)",200,0,50,140,0.414,0.582);
542         fHistMcDcaFoundLaPt      = new  TH2F("fHistMcDcaFoundLaPt","    Reconstructed Mass vs Dca for reconstructed MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,0,1.5,96,1.08,1.2);
543         fHistMcDcaFoundLbPt      = new  TH2F("fHistMcDcaFoundLbPt","    Reconstructed Mass vs Dca for reconstructed MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,0,1.5,96,1.08,1.2);
544         fHistMcDcaAFoundK0Pt = new      TH2F("fHistMcDcaAFoundK0Pt","   Reconstructed Mass vs Dca for reconstructed MC primary K0Short; K0 Mass (GeV/c^2)",200,0,1.5,140,0.414,0.582);
545         
546         fHistNSigmaLaPt          = new  TH2F("fHistNSigmaLaPt","        Reconstructed Mass vs NSigma for Lambda Candidates; M(p#pi^{-}) (GeV/c^2)",50,-5,5,96,1.08,1.2);
547         fHistNSigmaLbPt          = new  TH2F("fHistNSigmaLbPt","        Reconstructed Mass vs NSigma for AntiLambda Candidates; M(#bar{p}#pi^{+}) (GeV/c^2)",50,-5,5,96,1.08,1.2);
548         fHistNSigmaK0Pt          = new  TH2F("fHistNSigmaK0Pt","        Reconstructed Mass vs NSigma for K0Short Candidates; K0 Mass (GeV/c^2)",50,-5,5,140,0.414,0.582);
549         fHistMcNSigmaAllLaPt     = new  TH2F("fHistMcNSigmaAllLaPt","   Reconstructed Mass vs NSigma for all MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",50,-5,5,96,1.08,1.2);
550         fHistMcNSigmaAllLbPt     = new  TH2F("fHistMcNSigmaAllLbPt","   Reconstructed Mass vs NSigma for all MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",50,-5,5,96,1.08,1.2);
551         fHistMcNSigmaAllK0Pt     = new  TH2F("fHistMcNSigmaAllK0Pt","   Reconstructed Mass vs NSigma for all MC primary K0Short; K0 Mass (GeV/c^2)",50,-5,5,140,0.414,0.582);
552         fHistMcNSigmaFoundLaPt   = new  TH2F("fHistMcNSigmaFoundLaPt"," Reconstructed Mass vs NSigma for reconstructed MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",50,-5,5,96,1.08,1.2);
553         fHistMcNSigmaFoundLbPt   = new  TH2F("fHistMcNSigmaFoundLbPt"," Reconstructed Mass vs NSigma for reconstructed MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",50,-5,5,96,1.08,1.2);
554         fHistMcNSigmaAFoundK0Pt = new   TH2F("fHistMcNSigmaAFoundK0Pt","        Reconstructed Mass vs NSigma for reconstructed MC primary K0Short; K0 Mass (GeV/c^2)",50,-5,5,140,0.414,0.582);
555         
556         fHistEtaLaPt             = new  TH2F("fHistEtaLaPt","   Reconstructed Mass vs Eta for Lambda Candidates; M(p#pi^{-}) (GeV/c^2)",200,-3,3,96,1.08,1.2);
557         fHistEtaLbPt             = new  TH2F("fHistEtaLbPt","   Reconstructed Mass vs Eta for AntiLambda Candidates; M(#bar{p}#pi^{+}) (GeV/c^2)",200,-3,3,96,1.08,1.2);
558         fHistEtaK0Pt             = new  TH2F("fHistEtaK0Pt","   Reconstructed Mass vs Eta for K0Short Candidates; K0 Mass (GeV/c^2)",200,-3,3,140,0.414,0.582);
559         fHistMcEtaAllLaPt        = new  TH2F("fHistMcEtaAllLaPt","      Reconstructed Mass vs Eta for all MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,-3,3,96,1.08,1.2);
560         fHistMcEtaAllLbPt        = new  TH2F("fHistMcEtaAllLbPt","      Reconstructed Mass vs Eta for all MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,-3,3,96,1.08,1.2);
561         fHistMcEtaAllK0Pt        = new  TH2F("fHistMcEtaAllK0Pt","      Reconstructed Mass vs Eta for all MC primary K0Short; K0 Mass (GeV/c^2)",200,-3,3,140,0.414,0.582);
562         fHistMcEtaFoundLaPt      = new  TH2F("fHistMcEtaFoundLaPt","    Reconstructed Mass vs Eta for reconstructed MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,-3,3,96,1.08,1.2);
563         fHistMcEtaFoundLbPt      = new  TH2F("fHistMcEtaFoundLbPt","    Reconstructed Mass vs Eta for reconstructed MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,-3,3,96,1.08,1.2);
564         fHistMcEtaAFoundK0Pt = new      TH2F("fHistMcEtaAFoundK0Pt","   Reconstructed Mass vs Eta for reconstructed MC primary K0Short; K0 Mass (GeV/c^2)",200,-3,3,140,0.414,0.582);
565         
566         fHistRapLaPt             = new  TH2F("fHistRapLaPt","   Reconstructed Mass vs Rap for Lambda Candidates; M(p#pi^{-}) (GeV/c^2)",200,-1,1,96,1.08,1.2);
567         fHistRapLbPt             = new  TH2F("fHistRapLbPt","   Reconstructed Mass vs Rap for AntiLambda Candidates; M(#bar{p}#pi^{+}) (GeV/c^2)",200,-1,1,96,1.08,1.2);
568         fHistRapK0Pt             = new  TH2F("fHistRapK0Pt","   Reconstructed Mass vs Rap for K0Short Candidates; K0 Mass (GeV/c^2)",200,-1,1,140,0.414,0.582);
569         fHistMcRapAllLaPt        = new  TH2F("fHistMcRapAllLaPt","      Reconstructed Mass vs Rap for all MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,-1,1,96,1.08,1.2);
570         fHistMcRapAllLbPt        = new  TH2F("fHistMcRapAllLbPt","      Reconstructed Mass vs Rap for all MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,-1,1,96,1.08,1.2);
571         fHistMcRapAllK0Pt        = new  TH2F("fHistMcRapAllK0Pt","      Reconstructed Mass vs Rap for all MC primary K0Short; K0 Mass (GeV/c^2)",200,-1,1,140,0.414,0.582);
572         fHistMcRapFoundLaPt      = new  TH2F("fHistMcRapFoundLaPt","    Reconstructed Mass vs Rap for reconstructed MC primary Lambda; M(p#pi^{-}) (GeV/c^2)",200,-1,1,96,1.08,1.2);
573         fHistMcRapFoundLbPt      = new  TH2F("fHistMcRapFoundLbPt","    Reconstructed Mass vs Rap for reconstructed MC primary AntiLambda; M(#bar{p}#pi^{+}) (GeV/c^2)",200,-1,1,96,1.08,1.2);
574         fHistMcRapAFoundK0Pt = new      TH2F("fHistMcRapAFoundK0Pt","   Reconstructed Mass vs Rap for reconstructed MC primary K0Short; K0 Mass (GeV/c^2)",200,-1,1,140,0.414,0.582);
575         
576         
577         
578     // NEW HISTO should be defined here, with a sensible name,
579         
580     fOutput->Add(fHistPt);
581     fOutput->Add(fHistEta);
582     fOutput->Add(fHistLog);
583         fOutput->Add(fHistNV0);
584         fOutput->Add(fHistZVertex);
585         fOutput->Add(fHistMCZVertex);
586         fOutput->Add(fHistCentrality);
587         
588         fOutput->Add(fHistBBK0Pos);
589         fOutput->Add(fHistBBK0Neg);
590         fOutput->Add(fHistBBLaPos);
591         fOutput->Add(fHistBBLaNeg);
592         fOutput->Add(fHistBBLbPos);
593         fOutput->Add(fHistBBLbNeg);
594         
595         fOutput->Add(fHistBB3SigProton);
596         fOutput->Add(fHistMK0Pt); 
597         fOutput->Add(fHistMLaPt); 
598         fOutput->Add(fHistMLbPt);
599         fOutput->Add(fHistMcPMK0Pt);
600         fOutput->Add(fHistMcPMLaPt);
601         fOutput->Add(fHistMcPMLbPt);
602         
603         fOutput->Add(fHistMcFMLaPt);
604         
605         fOutput->Add(fHistMK0PtCent0005); 
606         fOutput->Add(fHistMLaPtCent0005); 
607         fOutput->Add(fHistMLbPtCent0005);
608         fOutput->Add(fHistMcPMK0PtCent0005);
609         fOutput->Add(fHistMcPMLaPtCent0005);
610         fOutput->Add(fHistMcPMLbPtCent0005);
611         fOutput->Add(fHistZVertexCent0005);
612         fOutput->Add(fHistMCZVertexCent0005);
613         
614         fOutput->Add(fHistMK0PtCent0510); 
615         fOutput->Add(fHistMLaPtCent0510); 
616         fOutput->Add(fHistMLbPtCent0510);
617         fOutput->Add(fHistMcPMK0PtCent0510);
618         fOutput->Add(fHistMcPMLaPtCent0510);
619         fOutput->Add(fHistMcPMLbPtCent0510);
620         fOutput->Add(fHistZVertexCent0510);
621         fOutput->Add(fHistMCZVertexCent0510);
622         
623         fOutput->Add(fHistMK0PtCent1020); 
624         fOutput->Add(fHistMLaPtCent1020); 
625         fOutput->Add(fHistMLbPtCent1020);
626         fOutput->Add(fHistMcPMK0PtCent1020);
627         fOutput->Add(fHistMcPMLaPtCent1020);
628         fOutput->Add(fHistMcPMLbPtCent1020);
629         fOutput->Add(fHistZVertexCent1020);
630         fOutput->Add(fHistMCZVertexCent1020);
631         
632         fOutput->Add(fHistMK0PtCent2040); 
633         fOutput->Add(fHistMLaPtCent2040); 
634         fOutput->Add(fHistMLbPtCent2040);
635         fOutput->Add(fHistMcPMK0PtCent2040);
636         fOutput->Add(fHistMcPMLaPtCent2040);
637         fOutput->Add(fHistMcPMLbPtCent2040);
638         fOutput->Add(fHistZVertexCent2040);
639         fOutput->Add(fHistMCZVertexCent2040);
640         
641         fOutput->Add(fHistMK0PtCent4060); 
642         fOutput->Add(fHistMLaPtCent4060); 
643         fOutput->Add(fHistMLbPtCent4060);
644         fOutput->Add(fHistMcPMK0PtCent4060);
645         fOutput->Add(fHistMcPMLaPtCent4060);
646         fOutput->Add(fHistMcPMLbPtCent4060);
647         fOutput->Add(fHistZVertexCent4060);
648         fOutput->Add(fHistMCZVertexCent4060);
649         
650         fOutput->Add(fHistMK0PtCent6090); 
651         fOutput->Add(fHistMLaPtCent6090); 
652         fOutput->Add(fHistMLbPtCent6090);
653         fOutput->Add(fHistMcPMK0PtCent6090);
654         fOutput->Add(fHistMcPMLaPtCent6090);
655         fOutput->Add(fHistMcPMLbPtCent6090);
656         fOutput->Add(fHistZVertexCent6090);
657         fOutput->Add(fHistMCZVertexCent6090);
658         
659         fOutput->Add(fHistMK0PtCent0090); 
660         fOutput->Add(fHistMLaPtCent0090); 
661         fOutput->Add(fHistMLbPtCent0090);
662         fOutput->Add(fHistMcPMK0PtCent0090);
663         fOutput->Add(fHistMcPMLaPtCent0090);
664         fOutput->Add(fHistMcPMLbPtCent0090);
665         fOutput->Add(fHistZVertexCent0090);
666         fOutput->Add(fHistMCZVertexCent0090);
667         
668         fOutput->Add(fHistCosPaLaPt);
669         fOutput->Add(fHistCosPaLbPt);
670         fOutput->Add(fHistCosPaK0Pt);   
671         fOutput->Add(fHistMcCosPaAllLaPt);
672         fOutput->Add(fHistMcCosPaAllLbPt);
673         fOutput->Add(fHistMcCosPaAllK0Pt);      
674         fOutput->Add(fHistMcCosPaFoundLaPt);
675         fOutput->Add(fHistMcCosPaFoundLbPt);
676         fOutput->Add(fHistMcCosPaAFoundK0Pt);
677         
678         fOutput->Add(fHistcTauLaPt);    
679         fOutput->Add(fHistcTauLbPt);
680         fOutput->Add(fHistcTauK0Pt);            
681         fOutput->Add(fHistMccTauAllLaPt);
682         fOutput->Add(fHistMccTauAllLbPt);
683         fOutput->Add(fHistMccTauAllK0Pt);       
684         fOutput->Add(fHistMccTauFoundLaPt);
685         fOutput->Add(fHistMccTauFoundLbPt);     
686         fOutput->Add(fHistMccTauAFoundK0Pt);
687         
688         fOutput->Add(fHistDcaLaPt);     
689         fOutput->Add(fHistDcaLbPt);     
690         fOutput->Add(fHistDcaK0Pt);     
691         fOutput->Add(fHistMcDcaAllLaPt);
692         fOutput->Add(fHistMcDcaAllLbPt);
693         fOutput->Add(fHistMcDcaAllK0Pt);        
694         fOutput->Add(fHistMcDcaFoundLaPt);      
695         fOutput->Add(fHistMcDcaFoundLbPt);      
696         fOutput->Add(fHistMcDcaAFoundK0Pt);
697         
698         fOutput->Add(fHistNSigmaLaPt);  
699         fOutput->Add(fHistNSigmaLbPt);          
700         fOutput->Add(fHistNSigmaK0Pt);          
701         fOutput->Add(fHistMcNSigmaAllLaPt);     
702         fOutput->Add(fHistMcNSigmaAllLbPt);     
703         fOutput->Add(fHistMcNSigmaAllK0Pt);     
704         fOutput->Add(fHistMcNSigmaFoundLaPt);   
705         fOutput->Add(fHistMcNSigmaFoundLbPt);   
706         fOutput->Add(fHistMcNSigmaAFoundK0Pt);
707         
708         fOutput->Add(fHistEtaLaPt);     
709         fOutput->Add(fHistEtaLbPt);     
710         fOutput->Add(fHistEtaK0Pt);             
711         fOutput->Add(fHistMcEtaAllLaPt);
712         fOutput->Add(fHistMcEtaAllLbPt);        
713         fOutput->Add(fHistMcEtaAllK0Pt);
714         fOutput->Add(fHistMcEtaFoundLaPt);      
715         fOutput->Add(fHistMcEtaFoundLbPt);      
716         fOutput->Add(fHistMcEtaAFoundK0Pt);
717         
718         fOutput->Add(fHistRapLaPt);
719         fOutput->Add(fHistRapLbPt);             
720         fOutput->Add(fHistRapK0Pt);     
721         fOutput->Add(fHistMcRapAllLaPt);        
722         fOutput->Add(fHistMcRapAllLbPt);        
723         fOutput->Add(fHistMcRapAllK0Pt);        
724         fOutput->Add(fHistMcRapFoundLaPt);
725         fOutput->Add(fHistMcRapFoundLbPt);
726         fOutput->Add(fHistMcRapAFoundK0Pt);
727     
728         // NEW HISTO added to fOutput here
729     PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
730 }
731
732 //________________________________________________________________________
733
734 static Bool_t AcceptTrack(const AliAODTrack *t, double cutMinNClustersTPC, double cutRatio) 
735 {
736         if (!t->IsOn(AliAODTrack::kTPCrefit)) return kFALSE;
737         //if (t->GetKinkIndex(0)>0) return kFALSE;
738         
739         Float_t nCrossedRowsTPC = t->GetTPCClusterInfo(2,1); 
740         if (nCrossedRowsTPC < cutMinNClustersTPC) return kFALSE;
741         Int_t findable=t->GetTPCNclsF();
742         if (findable <= 0) return kFALSE;
743         if (nCrossedRowsTPC/findable < cutRatio) return kFALSE;
744         
745         return kTRUE;
746 }
747
748 //________________________________________________________________________
749 static Bool_t AcceptV0_general(const AliAODv0 *v1, const AliAODEvent *aod, double cutCosPa, double cutNImpact, double cutDCA, double cutEta, double cutMinNClustersTPC, double cutRatio) 
750 {
751         
752         if (v1->GetOnFlyStatus()) return kFALSE;
753         
754         int nnum = 1, pnum = 0; 
755         const AliAODTrack *ntracktest=(AliAODTrack *)v1->GetDaughter(nnum);
756         if(ntracktest->Charge() > 0){nnum = 0; pnum = 1;}       
757         
758         const AliAODTrack *ntrack1=(AliAODTrack *)v1->GetDaughter(nnum);
759         if (!AcceptTrack(ntrack1, cutMinNClustersTPC, cutRatio)) return kFALSE;
760         
761         const AliAODTrack *ptrack1=(AliAODTrack *)v1->GetDaughter(pnum);
762         if (!AcceptTrack(ptrack1, cutMinNClustersTPC, cutRatio)) return kFALSE;
763         
764         Float_t impact=v1->DcaNegToPrimVertex();
765         if (TMath::Abs(impact)<0.1) return kFALSE;
766         if (TMath::Abs(impact)<cutNImpact && cutNImpact != -999) return kFALSE;
767         impact=v1->DcaPosToPrimVertex();
768         if (TMath::Abs(impact)<0.1) return kFALSE;
769         if (TMath::Abs(impact)<cutNImpact && cutNImpact != -999) return kFALSE;
770         
771         Double_t dca=v1->DcaV0Daughters();
772         if (TMath::Abs(dca)>cutDCA && cutDCA != -999) return kFALSE;
773         
774         Double_t cpa=v1->CosPointingAngle(aod->GetPrimaryVertex());
775         if (cpa<cutCosPa && cutCosPa != -999) return kFALSE;
776         
777         Double_t etaN = v1->PseudoRapNeg();
778         Double_t etaP = v1->PseudoRapPos();
779         if ((TMath::Abs(etaN)>cutEta || TMath::Abs(etaP)>cutEta) && cutEta != -999) return kFALSE;
780         
781         return kTRUE;
782 }
783
784 //________________________________________________________________________
785 static Bool_t AcceptV0_particle(const AliAODv0 *v1, int type,  double cutcTau, double cutRapidity, Double_t decayL) 
786 {
787         
788         Double_t cTau = 0;
789         if(type == 1)
790         {cTau = decayL*(v1->MassLambda())/(v1->P());}
791         if(type == 2)
792         {cTau = decayL*(v1->MassAntiLambda())/(v1->P());}
793         if(type == 0)
794         {cTau = decayL*(v1->MassK0Short())/(v1->P());}
795         
796         if (cTau < cutcTau && cTau != -999 ) return kFALSE;
797         
798         Double_t rap = 0;
799         if(type == 1 || type == 2)
800         {rap = v1->RapLambda();}
801         if(type == 0)
802         {rap = v1->RapK0Short();}
803         if (TMath::Abs(rap)>cutRapidity && cutRapidity != -999) return kFALSE;
804         
805         return kTRUE;
806 }
807
808 //________________________________________________________________________
809 static Bool_t AcceptV0_lowpt(const AliAODv0 *v1, AliPIDResponse *PIDResponse,int type, double cutBetheBloch, Double_t decayL, bool isMonteCarlo) 
810 {
811         
812         
813         Double_t cTau = 0;
814         if(type == 1)
815         {cTau = decayL*(v1->MassLambda())/(v1->P());}
816         if(type == 2)
817         {cTau = decayL*(v1->MassAntiLambda())/(v1->P());}
818         if(type == 0)
819         {cTau = decayL*(v1->MassK0Short())/(v1->P());}
820         
821         if (cTau > 30 && (type ==1 || type ==2) && TMath::Sqrt(v1->Pt2V0()) < 1) return kFALSE;
822         
823         int nnum = 1, pnum = 0;
824         const AliAODTrack *ntracktest=(AliAODTrack *)v1->GetDaughter(nnum);
825         if(ntracktest->Charge() > 0){nnum = 0; pnum = 1;}       
826         
827         const AliAODTrack *ntrack1=(AliAODTrack *)v1->GetDaughter(nnum);
828         const AliAODTrack *ptrack1=(AliAODTrack *)v1->GetDaughter(pnum);
829         
830         Double_t nsig_p = 0;
831         Double_t nsig_n = 0;
832         
833         const AliAODPid *pid_p=ptrack1->GetDetPid();
834         const AliAODPid *pid_n=ntrack1->GetDetPid();
835         
836         if (pid_p) 
837         {
838                 if(type == 1)
839                 {nsig_p=PIDResponse->NumberOfSigmasTPC(ptrack1,AliPID::kProton);
840                         if (TMath::Abs(nsig_p) > cutBetheBloch && cutBetheBloch >0 && !isMonteCarlo) return kFALSE;}
841                 if(type == 0 || type == 2)
842                 {nsig_p=PIDResponse->NumberOfSigmasTPC(ptrack1,AliPID::kPion);
843                         if (TMath::Abs(nsig_p) > cutBetheBloch && cutBetheBloch >0 && !isMonteCarlo) return kFALSE;}
844                 
845         }
846         
847         if (pid_n) 
848         {
849                 if(type == 2)
850                 {nsig_n=PIDResponse->NumberOfSigmasTPC(ntrack1,AliPID::kProton);
851                         if (TMath::Abs(nsig_n) > cutBetheBloch && cutBetheBloch >0 && !isMonteCarlo) return kFALSE;}
852                 if(type == 0 || type == 1)
853                 {nsig_n=PIDResponse->NumberOfSigmasTPC(ntrack1,AliPID::kPion);
854                         if (TMath::Abs(nsig_n) > cutBetheBloch && cutBetheBloch >0 && !isMonteCarlo) return kFALSE;}
855                 
856         }
857         
858         return kTRUE;
859 }
860
861
862 //________________________________________________________________________
863 void AliAnalysisTaskLukeAOD::UserExec(Option_t *) 
864 {
865     // Main loop
866     // Called for each event
867         
868         fHistLog->Fill(1);
869         
870         // parameters used for most cuts, to minimise editing
871         double cutCosPa(0.998), cutcTau(2);
872         double cutNImpact(-999), cutDCA(0.4);
873         double cutBetheBloch(3); // NOTE - BB cut only applies to data, must be accounted for when constructing corrected yields
874         double cutMinNClustersTPC(70), cutRatio(0.8);
875         bool isMonteCarlo(true); 
876         int isMCtype(1);    //1 = Pure Hijing only, 0 = Anything, -1 = Injected only
877         double cutEta(0.8), cutRapidity(0.5);
878         
879     // Create pointer to reconstructed event
880         AliAODEvent *aod=(AliAODEvent *)InputEvent();   
881         if (!aod) 
882         {
883                 Printf("ERROR: aod not available");
884                 fHistLog->Fill(98);
885                 return;
886         }
887         
888         
889         //Bool_t isSelected = (maskIsSelected && AliVEvent::kMB);
890         /*if (!isSelected) 
891          {
892          Printf("ERROR: failed physics selection");
893          fHistLog->Fill(88);
894          return;
895          }*/
896         
897         AliCentrality* centrality = aod->GetCentrality();
898         Double_t centPercentile = centrality->GetCentralityPercentile("V0M");
899         fHistCentrality->Fill(centPercentile);
900         
901         /********MC Loop************************************/
902         
903         int isInjected = -1;
904         
905         if(isMonteCarlo) 
906         {
907                 
908                 // Create pointer to reconstructed event
909                 TList *list = aod->GetList();
910                 TClonesArray *stack = 0x0;
911                 stack = (TClonesArray*)list->FindObject(AliAODMCParticle::StdBranchName());
912                 if (!stack) {
913                         Printf("ERROR: stack not available");
914                         fHistLog->Fill(84);     
915                 }
916                 else{
917                         
918                         AliAODMCHeader *mcHdr=(AliAODMCHeader*)list->FindObject(AliAODMCHeader::StdBranchName());
919                         
920                         Double_t mcXv=0., mcYv=0., mcZv=0.;
921                         mcXv=mcHdr->GetVtxX(); mcYv=mcHdr->GetVtxY(); mcZv=mcHdr->GetVtxZ();
922                         if (TMath::Abs(mcZv) > 10.)
923                         {
924                                 fHistLog->Fill(76);
925                         }  
926                         else{
927                                 fHistMCZVertex->Fill(mcZv);
928                                 
929                                 if(centPercentile >= 0.0001 && centPercentile <= 5.0)
930                                 {fHistMCZVertexCent0005->Fill(mcZv);}
931                                 if(centPercentile > 5.0 && centPercentile <= 10.0)
932                                 {fHistMCZVertexCent0510->Fill(mcZv);}
933                                 if(centPercentile > 10.0 && centPercentile <= 20.0)
934                                 {fHistMCZVertexCent1020->Fill(mcZv);}
935                                 if(centPercentile > 20.0 && centPercentile <= 40.0)
936                                 {fHistMCZVertexCent2040->Fill(mcZv);}
937                                 if(centPercentile > 40.0 && centPercentile <= 60.0)
938                                 {fHistMCZVertexCent4060->Fill(mcZv);}
939                                 if(centPercentile > 60.0 && centPercentile <= 90.0)
940                                 {fHistMCZVertexCent6090->Fill(mcZv);}
941                                 if(centPercentile >= 0.0001 && centPercentile <= 90.0)
942                                 {fHistMCZVertexCent0090->Fill(mcZv);}
943                                 
944                                 
945                                 Int_t ntrk=stack->GetEntriesFast(), ntrk0=ntrk;
946                                 
947                                 for(int iMCtrack = 0; iMCtrack<ntrk0; iMCtrack++)
948                                         
949                                 {       
950                                         
951                                         //booleans to check if track is La, Lb, K0 and primary
952                                         bool lambdaMC = false;
953                                         bool antilambdaMC = false;
954                                         bool kshortMC = false;
955                                         bool isprimaryMC = false;
956                                         
957                                         AliAODMCParticle *mcPart =(AliAODMCParticle*)stack->UncheckedAt(iMCtrack);
958                                         
959                                         if ((mcPart->GetStatus() == 21) || (mcPart->GetPdgCode() == 443 && mcPart->GetMother() == -1)) 
960                                         {
961                                                 isInjected = iMCtrack;
962                                         }
963                                         
964                                         if(isInjected >= 0 && isMCtype == 1)
965                                         {continue;}
966                                         if(isInjected < 0 && isMCtype == -1)
967                                         {continue;}
968                                         
969                                         Int_t code=mcPart->GetPdgCode();
970                                         if (code != kK0Short && code != kLambda0 && code != kLambda0Bar ) 
971                                         {continue;}
972                                         
973                                         if(code == kLambda0)
974                                         {
975                                                 lambdaMC = true;
976                                         }
977                                         else if(code == kK0Short)
978                                         {
979                                                 kshortMC = true;
980                                         }
981                                         else if(code == kLambda0Bar)
982                                         {
983                                                 antilambdaMC = true;
984                                         }
985                                         
986                                         
987                                         Int_t motherLabel = mcPart->GetMother();
988                                         AliAODMCParticle *mcMother = (AliAODMCParticle *)stack->UncheckedAt(motherLabel);
989                                         Int_t motherType = -1;
990                                         if(motherLabel >= 0)
991                                         {motherType = mcMother->GetPdgCode();}
992                                         
993                                         // this block of code is used to include primary Sigma0 decays as primary lambda/antilambda
994                                         bool sigma0MC = false;
995                                         if(motherType == 3212 || motherType == -3212)// || motherType == 3322 || motherType == -3322 || motherType == 3312 || motherType == -3312)
996                                         {
997                                                 if(mcMother->IsPhysicalPrimary())
998                                                 {sigma0MC = true;}
999                                         }
1000                                         
1001                                         Double_t dz=mcZv - mcPart->Zv(), dy=mcYv - mcPart->Yv(), dx=mcXv - mcPart->Xv();
1002                                         Double_t mcDecayLength = TMath::Sqrt(dx*dx + dy*dy + dz*dz);
1003                                         Double_t mccTau = mcDecayLength*(mcPart->M())/(mcPart->P());
1004                                         Double_t mcCosPA = (dx*mcPart->Px()+dy*mcPart->Py()+dz*mcPart->Pz())/(mcDecayLength*mcPart->P());
1005                                         
1006                                         if(mcPart->IsPhysicalPrimary() || sigma0MC)
1007                                         {
1008                                                 isprimaryMC = true;
1009                                                 if(lambdaMC)
1010                                                 {
1011                                                         if(TMath::Abs(mcPart->Y())<=cutRapidity)
1012                                                         {
1013                                                                 fHistMcPMLaPt->Fill(mcPart->Pt(),mcPart->M());
1014                                                                 
1015                                                                 if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1016                                                                 {fHistMcPMLaPtCent0005->Fill(mcPart->Pt(),mcPart->M());}
1017                                                                 if(centPercentile > 5.0 && centPercentile <= 10.0)
1018                                                                 {fHistMcPMLaPtCent0510->Fill(mcPart->Pt(),mcPart->M());}
1019                                                                 if(centPercentile > 10.0 && centPercentile <= 20.0)
1020                                                                 {fHistMcPMLaPtCent1020->Fill(mcPart->Pt(),mcPart->M());}
1021                                                                 if(centPercentile > 20.0 && centPercentile <= 40.0)
1022                                                                 {fHistMcPMLaPtCent2040->Fill(mcPart->Pt(),mcPart->M());}
1023                                                                 if(centPercentile > 40.0 && centPercentile <= 60.0)
1024                                                                 {fHistMcPMLaPtCent4060->Fill(mcPart->Pt(),mcPart->M());}
1025                                                                 if(centPercentile > 60.0 && centPercentile <= 90.0)
1026                                                                 {fHistMcPMLaPtCent6090->Fill(mcPart->Pt(),mcPart->M());}
1027                                                                 if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1028                                                                 {fHistMcPMLaPtCent0090->Fill(mcPart->Pt(),mcPart->M());}
1029                                                                 
1030                                                                 fHistMcCosPaAllLaPt->Fill(mcCosPA,mcPart->M()); 
1031                                                                 fHistMccTauAllLaPt->Fill(mccTau,mcPart->M()); 
1032                                                                 fHistMcDcaAllLaPt->Fill(mcDecayLength,mcPart->M()); 
1033                                                                 fHistMcNSigmaAllLaPt->Fill(1.0,mcPart->M()); 
1034                                                                 fHistMcEtaAllLaPt->Fill(mcPart->Eta(),mcPart->M()); 
1035                                                                 fHistMcRapAllLaPt->Fill(mcPart->Y(),mcPart->M()); 
1036                                                         }
1037                                                 }
1038                                                 if(antilambdaMC)
1039                                                 {
1040                                                         if(TMath::Abs(mcPart->Y())<=cutRapidity)
1041                                                         {
1042                                                                 fHistMcPMLbPt->Fill(mcPart->Pt(),mcPart->M());
1043                                                                 
1044                                                                 if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1045                                                                 {fHistMcPMLbPtCent0005->Fill(mcPart->Pt(),mcPart->M());}
1046                                                                 if(centPercentile > 5.0 && centPercentile <= 10.0)
1047                                                                 {fHistMcPMLbPtCent0510->Fill(mcPart->Pt(),mcPart->M());}
1048                                                                 if(centPercentile > 10.0 && centPercentile <= 20.0)
1049                                                                 {fHistMcPMLbPtCent1020->Fill(mcPart->Pt(),mcPart->M());}
1050                                                                 if(centPercentile > 20.0 && centPercentile <= 40.0)
1051                                                                 {fHistMcPMLbPtCent2040->Fill(mcPart->Pt(),mcPart->M());}
1052                                                                 if(centPercentile > 40.0 && centPercentile <= 60.0)
1053                                                                 {fHistMcPMLbPtCent4060->Fill(mcPart->Pt(),mcPart->M());}
1054                                                                 if(centPercentile > 60.0 && centPercentile <= 90.0)
1055                                                                 {fHistMcPMLbPtCent6090->Fill(mcPart->Pt(),mcPart->M());}
1056                                                                 if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1057                                                                 {fHistMcPMLbPtCent0090->Fill(mcPart->Pt(),mcPart->M());}
1058                                                                 
1059                                                                 fHistMcCosPaAllLbPt->Fill(mcCosPA,mcPart->M()); 
1060                                                                 fHistMccTauAllLbPt->Fill(mccTau,mcPart->M()); 
1061                                                                 fHistMcDcaAllLbPt->Fill(mcDecayLength,mcPart->M()); 
1062                                                                 fHistMcNSigmaAllLbPt->Fill(1.0,mcPart->M());    
1063                                                                 fHistMcEtaAllLbPt->Fill(mcPart->Eta(),mcPart->M()); 
1064                                                                 fHistMcRapAllLbPt->Fill(mcPart->Y(),mcPart->M());       
1065                                                                 
1066                                                         }
1067                                                 }
1068                                                 if(kshortMC)
1069                                                 {
1070                                                         if(TMath::Abs(mcPart->Y())<=cutRapidity)
1071                                                         {
1072                                                                 fHistMcPMK0Pt->Fill(mcPart->Pt(),mcPart->M());
1073                                                                 
1074                                                                 if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1075                                                                 {fHistMcPMK0PtCent0005->Fill(mcPart->Pt(),mcPart->M());}
1076                                                                 if(centPercentile > 5.0 && centPercentile <= 10.0)
1077                                                                 {fHistMcPMK0PtCent0510->Fill(mcPart->Pt(),mcPart->M());}
1078                                                                 if(centPercentile > 10.0 && centPercentile <= 20.0)
1079                                                                 {fHistMcPMK0PtCent1020->Fill(mcPart->Pt(),mcPart->M());}
1080                                                                 if(centPercentile > 20.0 && centPercentile <= 40.0)
1081                                                                 {fHistMcPMK0PtCent2040->Fill(mcPart->Pt(),mcPart->M());}
1082                                                                 if(centPercentile > 40.0 && centPercentile <= 60.0)
1083                                                                 {fHistMcPMK0PtCent4060->Fill(mcPart->Pt(),mcPart->M());}
1084                                                                 if(centPercentile > 60.0 && centPercentile <= 90.0)
1085                                                                 {fHistMcPMK0PtCent6090->Fill(mcPart->Pt(),mcPart->M());}
1086                                                                 if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1087                                                                 {fHistMcPMK0PtCent0090->Fill(mcPart->Pt(),mcPart->M());}
1088                                                                 
1089                                                                 fHistMcCosPaAllK0Pt->Fill(mcCosPA,mcPart->M());         
1090                                                                 fHistMccTauAllK0Pt->Fill(mccTau,mcPart->M());   
1091                                                                 fHistMcDcaAllK0Pt->Fill(mcDecayLength,mcPart->M()); 
1092                                                                 fHistMcNSigmaAllK0Pt->Fill(1.0,mcPart->M());    
1093                                                                 fHistMcEtaAllK0Pt->Fill(mcPart->Eta(),mcPart->M()); 
1094                                                                 fHistMcRapAllK0Pt->Fill(mcPart->Y(),mcPart->M()); 
1095                                                                 
1096                                                         }
1097                                                 }
1098                                         }
1099                                         
1100                                         
1101                                         
1102                                 }
1103                                 
1104                         }
1105                 }
1106         } 
1107         
1108         /********End of MC************************************/
1109         
1110         // Find vertex, check if its good
1111         const AliAODVertex *vtx=aod->GetPrimaryVertex();
1112         
1113         if (!vtx) 
1114         {
1115                 fHistLog->Fill(97);
1116                 return;
1117         }
1118         
1119         
1120         if (vtx->GetNContributors()<3) 
1121         {
1122                 fHistLog->Fill(vtx->GetNContributors()+20);
1123                 fHistLog->Fill(97);
1124                 return;
1125         }
1126         
1127         Double_t zv=vtx->GetZ(), xv=vtx->GetX(), yv=vtx->GetY();
1128         
1129         if (TMath::Abs(zv) > 10.)
1130         {
1131                 fHistLog->Fill(96);
1132                 return;
1133         }  
1134         
1135         fHistZVertex->Fill(zv);
1136         
1137         if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1138         {fHistZVertexCent0005->Fill(zv);}
1139         if(centPercentile > 5.0 && centPercentile <= 10.0)
1140         {fHistZVertexCent0510->Fill(zv);}
1141         if(centPercentile > 10.0 && centPercentile <= 20.0)
1142         {fHistZVertexCent1020->Fill(zv);}
1143         if(centPercentile > 20.0 && centPercentile <= 40.0)
1144         {fHistZVertexCent2040->Fill(zv);}
1145         if(centPercentile > 40.0 && centPercentile <= 60.0)
1146         {fHistZVertexCent4060->Fill(zv);}
1147         if(centPercentile > 60.0 && centPercentile <= 90.0)
1148         {fHistZVertexCent6090->Fill(zv);}
1149         if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1150         {fHistZVertexCent0090->Fill(zv);}
1151         
1152     /********V0 loop for reconstructed event************************************/
1153         
1154     Int_t nv0s = aod->GetNumberOfV0s();
1155         fHistNV0->Fill(nv0s);
1156     
1157         for(Int_t i = 0; i < nv0s; i++) 
1158         {
1159                 fHistLog->Fill(7);
1160         AliAODv0 *v0=aod->GetV0(i); // pointer to reconstructed v0          
1161         if(!v0) 
1162                 { 
1163                         //Printf("No V0 ");
1164                         fHistLog->Fill(94);
1165             continue; 
1166                 }
1167                 
1168                 Bool_t lambdaCandidate = kTRUE; 
1169                 Bool_t antilambdaCandidate = kTRUE; 
1170                 Bool_t k0Candidate = kTRUE; 
1171                 
1172                 if (v0->MassLambda() < 1.08 || v0->MassLambda() > 1.2)
1173                 {lambdaCandidate = kFALSE;}
1174         if (v0->MassAntiLambda() < 1.08 || v0->MassAntiLambda() > 1.2)
1175                 {antilambdaCandidate = kFALSE;}
1176         if (v0->MassK0Short() < 0.414 || v0->MassK0Short() > 0.582)
1177                 {k0Candidate = kFALSE;}
1178                 
1179                 if(lambdaCandidate == kFALSE && antilambdaCandidate == kFALSE && k0Candidate == kFALSE)
1180                 {continue;}
1181                 
1182                 Double_t cosPA=v0->CosPointingAngle(aod->GetPrimaryVertex());
1183                 Double_t xyz[3]; 
1184                 v0->GetSecondaryVtx(xyz);
1185                 Double_t decayL = TMath::Sqrt((xyz[0]-xv)*(xyz[0]-xv)+(xyz[1]-yv)*(xyz[1]-yv)+(xyz[2]-zv)*(xyz[2]-zv));
1186                 Double_t dca=v0->DcaV0Daughters();
1187                 Double_t eta=v0->PseudoRapV0();
1188                 
1189                 if(!AcceptV0_general(v0,aod,cutCosPa,cutNImpact,cutDCA,cutEta,cutMinNClustersTPC, cutRatio))
1190                 { 
1191                         fHistLog->Fill(86);
1192                         continue; 
1193                 }
1194                 
1195                 int nnum = 1, pnum = 0;
1196                 const AliAODTrack *ntracktest=(AliAODTrack *)v0->GetDaughter(nnum);
1197                 if(ntracktest->Charge() > 0){nnum = 0; pnum = 1;}       
1198                 
1199                 const AliAODTrack *ntrack1=(AliAODTrack *)v0->GetDaughter(nnum);
1200                 const AliAODTrack *ptrack1=(AliAODTrack *)v0->GetDaughter(pnum);
1201                 if(ntrack1->Charge()>0)
1202                 { 
1203                         fHistLog->Fill(55);
1204                 }
1205                 if(ntrack1->Charge()==0)
1206                 { 
1207                         fHistLog->Fill(50);
1208                 }
1209                 if(ntrack1->Charge()<0)
1210                 { 
1211                         fHistLog->Fill(45);
1212                 }
1213                 const AliAODPid *pid_p1=ptrack1->GetDetPid();
1214                 const AliAODPid *pid_n1=ntrack1->GetDetPid();
1215                 
1216                 
1217                 /*if(peterCuts)
1218                 {
1219                         const AliAODTrack *ptrack1=(AliAODTrack *)v0->GetDaughter(0);
1220                         if(ntrack1->Pt() < 0.160 || ptrack1->Pt() < 0.160) continue;
1221                         
1222                         Double_t r2=xyz[0]*xyz[0] + xyz[1]*xyz[1];
1223                         Double_t radius = TMath::Sqrt(r2);
1224                         if(radius <= 0.9 || radius >= 100) continue;
1225                         
1226                 }*/
1227                 
1228                 if(!AcceptV0_particle(v0,1,cutcTau, cutRapidity, decayL))
1229                 { lambdaCandidate = kFALSE; }
1230                 if(!AcceptV0_particle(v0,2,cutcTau, cutRapidity, decayL))
1231                 { antilambdaCandidate = kFALSE; }
1232                 if(!AcceptV0_particle(v0,0,cutcTau, cutRapidity, decayL))
1233                 { k0Candidate = kFALSE; }
1234                 
1235                 if(TMath::Sqrt(v0->Pt2V0())<2)
1236                 {
1237                         if(!AcceptV0_lowpt(v0,fPIDResponse,1,cutBetheBloch,decayL,isMonteCarlo))
1238                         { lambdaCandidate = kFALSE; }
1239                         if(!AcceptV0_lowpt(v0,fPIDResponse,2,cutBetheBloch,decayL,isMonteCarlo))
1240                         { antilambdaCandidate = kFALSE; }
1241                         if(!AcceptV0_lowpt(v0,fPIDResponse,0,cutBetheBloch,decayL,isMonteCarlo))
1242                         { k0Candidate = kFALSE; }
1243                 }
1244                 
1245                 if(lambdaCandidate == kFALSE && antilambdaCandidate == kFALSE && k0Candidate == kFALSE)
1246                 {continue;}
1247                 
1248                 fHistLog->Fill(7);
1249         fHistPt->Fill(TMath::Sqrt(v0->Pt2V0()));
1250         fHistEta->Fill(v0->PseudoRapV0());
1251                 
1252                 bool feeddown = false;
1253                 
1254                 if(isMonteCarlo)
1255                 {
1256                         bool passedTests = false;
1257                         TList *list = aod->GetList();
1258                         TClonesArray *stack = 0x0;
1259                         stack = (TClonesArray*)list->FindObject(AliAODMCParticle::StdBranchName());
1260                         if (!stack)
1261                         {
1262                                 Printf("ERROR: stack not available");
1263                                 fHistLog->Fill(84);     
1264                         }
1265                         else
1266                         
1267                         {
1268                                 Int_t negAssLabel = TMath::Abs(ntrack1->GetLabel());
1269                                 if(negAssLabel>=0 && negAssLabel < stack->GetEntriesFast())
1270                                 {
1271                                 AliAODMCParticle *mcNegPart =(AliAODMCParticle*)stack->UncheckedAt(negAssLabel);
1272                                 Int_t v0Label = mcNegPart->GetMother();
1273                                 if(v0Label >= 0 && v0Label < stack->GetEntriesFast())
1274                                 {
1275                                         AliAODMCParticle *mcv0 = (AliAODMCParticle *)stack->UncheckedAt(v0Label);
1276                                         passedTests = true;
1277                                         
1278                                         if ((v0Label >= isInjected && isInjected >= 0 && isMCtype == 1) || (v0Label < isInjected && isInjected >= 0 && isMCtype == -1)) 
1279                                         {
1280                                                 lambdaCandidate = false;
1281                                                 k0Candidate = false;
1282                                                 antilambdaCandidate = false;
1283                                         }
1284                                         
1285                                                 if(mcv0->GetPdgCode() != kLambda0)
1286                                                 {
1287                                                         lambdaCandidate = false;
1288                                                 }
1289                                                 if(mcv0->GetPdgCode() != kK0Short)
1290                                                 {
1291                                                         k0Candidate = false;
1292                                                 }
1293                                                 if(mcv0->GetPdgCode() != kLambda0Bar)
1294                                                 {
1295                                                         antilambdaCandidate = false;
1296                                                 }
1297                                         
1298                                         Int_t motherLabel = mcv0->GetMother();
1299                                         Int_t motherType = -1;
1300                                         bool sigma0MC2 = false;
1301                                         
1302                                         if(motherLabel >= 0 && v0Label < stack->GetEntriesFast() )
1303                                         {
1304                                                 AliAODMCParticle *mcMother = (AliAODMCParticle *)stack->UncheckedAt(motherLabel);
1305                                                 motherType = mcMother->GetPdgCode();
1306                                         
1307                                         // this block of code is used to include primary Sigma0 decays as primary lambda/antilambda
1308                                         
1309                                                 if ((motherLabel >= isInjected && isInjected >= 0 && isMCtype == 1) || (motherLabel < isInjected && isInjected >= 0 && isMCtype == -1)) 
1310                                                 {
1311                                                         lambdaCandidate = false;
1312                                                         k0Candidate = false;
1313                                                         antilambdaCandidate = false;
1314                                                 }
1315                                                 if(motherType == 3212 || motherType == -3212)
1316                                                 {
1317                                                         if(mcMother->IsPhysicalPrimary())
1318                                                         {sigma0MC2 = true;}
1319                                                 }
1320                                                 if(motherType == 3322 || motherType == -3322 || motherType == 3312 || motherType == -3312 )
1321                                                 {
1322                                                         if(mcMother->IsPhysicalPrimary())
1323                                                         {feeddown = true;}
1324                                                 }
1325                                         }
1326                                         
1327                                         if(!sigma0MC2 && !mcv0->IsPhysicalPrimary() && !feeddown)
1328                                         {
1329                                                 lambdaCandidate = false;
1330                                                 k0Candidate = false;
1331                                                 antilambdaCandidate = false;
1332                                         }
1333                                 }
1334                                 }
1335                         }
1336                         
1337                         if(passedTests == false)
1338                         {
1339                                 lambdaCandidate = false;
1340                                 k0Candidate = false;
1341                                 antilambdaCandidate = false;
1342                         }
1343                 
1344                 }
1345                 
1346                 
1347                 
1348                 if(lambdaCandidate)
1349                 {
1350                         
1351                         if(!feeddown)
1352                         {
1353                         fHistMLaPt->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());
1354                         if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1355                         {fHistMLaPtCent0005->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1356                         if(centPercentile > 5.0 && centPercentile <= 10.0)
1357                         {fHistMLaPtCent0510->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1358                         if(centPercentile > 10.0 && centPercentile <= 20.0)
1359                         {fHistMLaPtCent1020->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1360                         if(centPercentile > 20.0 && centPercentile <= 40.0)
1361                         {fHistMLaPtCent2040->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1362                         if(centPercentile > 40.0 && centPercentile <= 60.0)
1363                         {fHistMLaPtCent4060->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1364                         if(centPercentile > 60.0 && centPercentile <= 90.0)
1365                         {fHistMLaPtCent6090->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1366                         }
1367                         
1368                         if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1369                         {
1370                                 if(!feeddown)
1371                                 {
1372                                 fHistMLaPtCent0090->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());
1373                                 fHistBBLaPos->Fill(pid_p1->GetTPCmomentum(),pid_p1->GetTPCsignal());
1374                                 fHistBBLaNeg->Fill(pid_n1->GetTPCmomentum(),pid_n1->GetTPCsignal());
1375                                 }
1376                                 if(feeddown)
1377                                 {fHistMcFMLaPt->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassLambda());}
1378                         }
1379                         if(!feeddown)
1380                         {
1381                         fHistCosPaLaPt->Fill(cosPA,v0->MassLambda()); 
1382                         fHistcTauLaPt->Fill(decayL*(TMath::Sqrt(v0->Pt2V0()))/(v0->P()),v0->MassLambda()); 
1383                         fHistDcaLaPt->Fill(dca,v0->MassLambda());       
1384                         fHistNSigmaLaPt->Fill(1.0,v0->MassLambda());    
1385                         fHistEtaLaPt->Fill(eta,v0->MassLambda()); 
1386                         fHistRapLaPt->Fill(v0->RapLambda(),v0->MassLambda()); 
1387                         
1388                         
1389                         if(isMonteCarlo) 
1390                         {
1391                                 fHistMcCosPaFoundLaPt->Fill(1.0,v0->MassLambda()); 
1392                                 fHistMccTauFoundLaPt->Fill(1.0,v0->MassLambda()); 
1393                                 fHistMcDcaFoundLaPt->Fill(1.0,v0->MassLambda());        
1394                                 fHistMcNSigmaFoundLaPt->Fill(1.0,v0->MassLambda()); 
1395                                 fHistMcEtaFoundLaPt->Fill(1.0,v0->MassLambda());        
1396                                 fHistMcRapFoundLaPt->Fill(1.0,v0->MassLambda()); 
1397                         }
1398                         }
1399                         
1400                 }
1401                 if(antilambdaCandidate)
1402                 {
1403                         if(!feeddown)
1404                         {
1405                         fHistMLbPt->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());  
1406                         
1407                         if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1408                         {fHistMLbPtCent0005->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());}
1409                         if(centPercentile > 5.0 && centPercentile <= 10.0)
1410                         {fHistMLbPtCent0510->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());}
1411                         if(centPercentile > 10.0 && centPercentile <= 20.0)
1412                         {fHistMLbPtCent1020->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());}
1413                         if(centPercentile > 20.0 && centPercentile <= 40.0)
1414                         {fHistMLbPtCent2040->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());}
1415                         if(centPercentile > 40.0 && centPercentile <= 60.0)
1416                         {fHistMLbPtCent4060->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());}
1417                         if(centPercentile > 60.0 && centPercentile <= 90.0)
1418                         {fHistMLbPtCent6090->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());}
1419                         
1420                         if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1421                         {
1422                                 fHistMLbPtCent0090->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassAntiLambda());
1423                                 fHistBBLbPos->Fill(pid_p1->GetTPCmomentum(),pid_p1->GetTPCsignal());
1424                                 fHistBBLbNeg->Fill(pid_n1->GetTPCmomentum(),pid_n1->GetTPCsignal());
1425                         }
1426                         
1427                         
1428                         fHistCosPaLbPt->Fill(cosPA,v0->MassAntiLambda()); 
1429                         fHistcTauLbPt->Fill(decayL*(v0->MassAntiLambda())/(v0->P()),v0->MassAntiLambda()); 
1430                         fHistDcaLbPt->Fill(dca,v0->MassAntiLambda());   
1431                         fHistNSigmaLbPt->Fill(1.0,v0->MassAntiLambda());        
1432                         fHistEtaLbPt->Fill(eta,v0->MassAntiLambda());   
1433                         fHistRapLbPt->Fill(v0->RapLambda(),v0->MassAntiLambda()); 
1434                         
1435                         if(isMonteCarlo) 
1436                         {
1437                                 fHistMcCosPaFoundLbPt->Fill(1.0,v0->MassAntiLambda()); 
1438                                 fHistMccTauFoundLbPt->Fill(1.0,v0->MassAntiLambda());   
1439                                 fHistMcDcaFoundLbPt->Fill(1.0,v0->MassAntiLambda());    
1440                                 fHistMcNSigmaFoundLbPt->Fill(1.0,v0->MassAntiLambda());         
1441                                 fHistMcEtaFoundLbPt->Fill(1.0,v0->MassAntiLambda());    
1442                                 fHistMcRapFoundLbPt->Fill(1.0,v0->MassAntiLambda()); 
1443                         }
1444                         }
1445                 }
1446                 if(k0Candidate)
1447                 {
1448                         if(!feeddown)
1449                         {
1450                         fHistMK0Pt->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());  
1451                         
1452                         if(centPercentile >= 0.0001 && centPercentile <= 5.0)
1453                         {fHistMK0PtCent0005->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());}
1454                         if(centPercentile > 5.0 && centPercentile <= 10.0)
1455                         {fHistMK0PtCent0510->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());}
1456                         if(centPercentile > 10.0 && centPercentile <= 20.0)
1457                         {fHistMK0PtCent1020->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());}
1458                         if(centPercentile > 20.0 && centPercentile <= 40.0)
1459                         {fHistMK0PtCent2040->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());}
1460                         if(centPercentile > 40.0 && centPercentile <= 60.0)
1461                         {fHistMK0PtCent4060->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());}
1462                         if(centPercentile > 60.0 && centPercentile <= 90.0)
1463                         {fHistMK0PtCent6090->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());}
1464                         
1465                         if(centPercentile >= 0.0001 && centPercentile <= 90.0)
1466                         {
1467                                 fHistMK0PtCent0090->Fill(TMath::Sqrt(v0->Pt2V0()),v0->MassK0Short());
1468                                 fHistBBK0Pos->Fill(pid_p1->GetTPCmomentum(),pid_p1->GetTPCsignal());
1469                                 fHistBBK0Neg->Fill(pid_n1->GetTPCmomentum(),pid_n1->GetTPCsignal());
1470                         }
1471                         
1472                         
1473                         fHistCosPaK0Pt->Fill(cosPA,v0->MassK0Short()); 
1474                         fHistcTauK0Pt->Fill(decayL*(v0->MassK0Short())/(v0->P()),v0->MassK0Short());    
1475                         fHistDcaK0Pt->Fill(dca,v0->MassK0Short());      
1476                         fHistNSigmaK0Pt->Fill(1.0,v0->MassK0Short());   
1477                         fHistEtaK0Pt->Fill(eta,v0->MassK0Short()); 
1478                         fHistRapK0Pt->Fill(v0->RapK0Short(),v0->MassK0Short()); 
1479                         
1480                         if(isMonteCarlo) 
1481                         {
1482                                 fHistMcCosPaAFoundK0Pt->Fill(1.0,v0->MassK0Short()); 
1483                                 fHistMccTauAFoundK0Pt->Fill(1.0,v0->MassK0Short()); 
1484                                 fHistMcDcaAFoundK0Pt->Fill(1.0,v0->MassK0Short()); 
1485                                 fHistMcNSigmaAFoundK0Pt->Fill(1.0,v0->MassK0Short()); 
1486                                 fHistMcEtaAFoundK0Pt->Fill(1.0,v0->MassK0Short()); 
1487                                 fHistMcRapAFoundK0Pt->Fill(1.0,v0->MassK0Short()); 
1488                         }
1489                         }
1490                 }
1491     }
1492         
1493         /********End of V0 loop for reconstructed event*****************************/
1494         
1495         
1496         
1497         
1498         fHistLog->Fill(9);
1499     // NEW HISTO should be filled before this point, as PostData puts the
1500     // information for this iteration of the UserExec in the container
1501     PostData(1, fOutput);
1502 }
1503
1504
1505 //________________________________________________________________________
1506 void AliAnalysisTaskLukeAOD::Terminate(Option_t *) 
1507 {
1508     // Draw result to screen, or perform fitting, normalizations
1509     // Called once at the end of the query
1510         
1511     fOutput = dynamic_cast<TList*> (GetOutputData(1));
1512     if(!fOutput) { Printf("ERROR: could not retrieve TList fOutput"); return; }
1513         
1514     fHistPt = dynamic_cast<TH1F*> (fOutput->FindObject("fHistPt"));
1515     if (!fHistPt) { Printf("ERROR: could not retrieve fHistPt"); return;}
1516     fHistEta = dynamic_cast<TH1F*> (fOutput->FindObject("fHistEta"));
1517     if (!fHistEta) { Printf("ERROR: could not retrieve fHistEta"); return;}
1518         
1519     // Get the physics selection histograms with the selection statistics
1520     //AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1521     //AliESDInputHandler *inputH = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
1522     //TH2F *histStat = (TH2F*)inputH->GetStatistics();
1523         
1524         
1525     // NEW HISTO should be retrieved from the TList container in the above way,
1526     // so it is available to draw on a canvas such as below
1527         
1528     TCanvas *c = new TCanvas("AliAnalysisTaskLukeAOD","P_{T} & #eta",10,10,1020,510);
1529     c->Divide(2,1);
1530     c->cd(1)->SetLogy();
1531     fHistPt->DrawCopy("E");
1532     c->cd(2);
1533     fHistEta->DrawCopy("E");
1534 }