Memory leak fixes in the AOD and MC loops (M. Putis)
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / LambdaK0PbPb / AliAnalysisTaskPerformanceStrange.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2009, 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 //-----------------------------------------------------------------
17 //              AliAnalysisTaskPerformanceStrange class
18 //    This task is for a performance study of V0 identification.
19 //                It works with MC info and ESD tree.
20 //                 Author: H.Ricaud, H.Ricaud@gsi.de
21 //-----------------------------------------------------------------
22
23 #include <Riostream.h>
24
25 #include <stdio.h>
26 #include <iostream>
27 #include "TChain.h"
28 #include "TTree.h"
29 #include "TH1F.h"
30 #include "TH2F.h"
31 //#include "TH3F.h"
32 #include "TF1.h"
33 #include "TList.h"
34 #include "TMath.h"
35 #include "TCanvas.h"
36
37 #include "AliAnalysisManager.h"
38
39 #include "AliPhysicsSelection.h"
40 #include "AliBackgroundSelection.h"
41
42 #include "AliESDVertex.h"
43 #include "AliESDEvent.h"
44 #include "AliESDInputHandler.h"
45 #include "AliESDtrack.h"
46 #include "AliESDv0.h"
47 #include "AliESDtrackCuts.h"
48 #include "AliESDpid.h"
49 #include "AliMultiplicity.h"
50
51 #include "AliAODEvent.h"
52 #include "AliAODVertex.h"
53 #include "AliAODTrack.h"
54 #include "AliAODv0.h"
55 #include "AliAODMCHeader.h"
56 #include "AliAODInputHandler.h"
57
58 //#include "AliV0vertexer.h"
59
60 #include "AliAODMCParticle.h"
61
62 #include "AliMCEventHandler.h"
63 #include "AliMCEvent.h"
64 #include "AliStack.h"
65 #include "AliGenEventHeader.h"
66
67 #include "AliLog.h"
68
69 #include "AliKFVertex.h"
70 #include "AliVertexerTracks.h"
71
72 #include "AliAnalysisTaskPerformanceStrange.h"
73 #include "AliAnalysisCentralitySelector.h"
74
75
76 ClassImp(AliAnalysisTaskPerformanceStrange)
77
78
79 //________________________________________________________________________
80 AliAnalysisTaskPerformanceStrange::AliAnalysisTaskPerformanceStrange()
81 : AliAnalysisTaskSE("TaskStrange"), fAnalysisMC(0), fAnalysisType("infoType"),  fCollidingSystems(0), fUsePID("infoPID"), fUseCut("infoCut"), fESD(0), fListHist(0), fCentrSelector(0),
82
83     fHistMCPrimaryVertexX(0),
84     fHistMCPrimaryVertexY(0),
85     fHistMCPrimaryVertexZ(0),
86     fHistMCMultiplicityPrimary(0),
87     fHistMCMultiplicityTracks(0),
88     fHistMCtracksProdRadiusK0s(0),
89     fHistMCtracksProdRadiusLambda(0),
90     fHistMCtracksProdRadiusAntiLambda(0),
91     fHistMCtracksDecayRadiusK0s(0),
92     fHistMCtracksDecayRadiusLambda(0),
93     fHistMCtracksDecayRadiusAntiLambda(0),
94     fHistMCPtAllK0s(0),
95     fHistMCPtAllLambda(0),
96     fHistMCPtAllAntiLambda(0),
97     fHistMCProdRadiusK0s(0),
98     fHistMCProdRadiusLambda(0),
99     fHistMCProdRadiusAntiLambda(0),
100     fHistMCRapK0s(0),
101     fHistMCRapInPtRangeK0s(0),
102     fHistMCRapLambda(0),
103     fHistMCRapInPtRangeLambda(0),
104     fHistMCRapAntiLambda(0),
105     fHistMCRapInPtRangeAntiLambda(0),
106     fHistMCRapXi(0),
107     fHistMCRapInPtRangeXi(0),
108     fHistMCRapPhi(0),
109     fHistMCRapInPtRangePhi(0),
110 ////////////////////////////////////////
111     fHistMCPtK0s(0),
112
113
114     fHistMCPtLambda(0),
115 ///////////////////////////////////////////
116
117     fHistMCPtLambdaFromSigma(0),
118     fHistMCPtAntiLambdaFromSigma(0),
119     fHistNTimesRecK0s(0),
120 //    fHistNTimesRecK0sMI(0),
121     fHistNTimesRecLambda(0),
122 //    fHistNTimesRecLambdaMI(0),
123     fHistNTimesRecAntiLambda(0),
124 //    fHistNTimesRecAntiLambdaMI(0),
125     fHistNTimesRecK0sVsPt(0),
126 //    fHistNTimesRecK0sVsPtMI(0),
127     fHistNTimesRecLambdaVsPt(0),
128 //    fHistNTimesRecLambdaVsPtMI(0),
129     fHistNTimesRecAntiLambdaVsPt(0),
130 //    fHistNTimesRecAntiLambdaVsPtMI(0),
131     fHistNumberEvents(0),
132     fHistTrackPerEvent(0),
133     fHistTrackletPerEvent(0),
134     fHistMCDaughterTrack(0),
135     fHistSPDPrimaryVertexZ(0),
136     fHistPrimaryVertexX(0),
137     fHistPrimaryVertexY(0),
138     fHistPrimaryVertexZ(0),
139     fHistPrimaryVertexResX(0),
140     fHistPrimaryVertexResY(0),
141     fHistPrimaryVertexResZ(0),
142     fHistPrimaryVertexPosXV0events(0), 
143     fHistPrimaryVertexPosYV0events(0), 
144     fHistPrimaryVertexPosZV0events(0),
145     fHistDaughterPt(0),
146     fHistDcaPosToPrimVertex(0),
147     fHistDcaNegToPrimVertex(0),
148     fHistDcaPosToPrimVertexZoom(0),
149     fHistDcaNegToPrimVertexZoom(0),
150     fHistRadiusV0(0),
151     fHistDecayLengthV0(0),
152     fHistDcaV0Daughters(0),
153     fHistChi2(0),
154     fHistCosPointAngle(0),
155     fHistCosPointAngleZoom(0),
156     fHistProdRadius(0),
157 //    fHistProdRadiusMI(0),
158     fHistV0Multiplicity(0),
159 //    fHistV0MultiplicityMI(0),
160     fHistChi2KFBeforeCutK0s(0), 
161     fHistChi2KFBeforeCutLambda(0), 
162     fHistChi2KFBeforeCutAntiLambda(0),
163     fHistChi2KFAfterCutK0s(0), 
164     fHistChi2KFAfterCutLambda(0), 
165     fHistChi2KFAfterCutAntiLambda(0),
166     fHistMassK0(0),
167 //    fHistMassK0MI(0),
168     fHistMassLambda(0),
169 //    fHistMassLambdaMI(0),
170     fHistMassAntiLambda(0),
171 //    fHistMassAntiLambdaMI(0),
172     fHistMassVsRadiusK0(0),
173 //    fHistMassVsRadiusK0MI(0),
174     fHistMassVsRadiusLambda(0),
175 //    fHistMassVsRadiusLambdaMI(0),
176     fHistMassVsRadiusAntiLambda(0),
177 //    fHistMassVsRadiusAntiLambdaMI(0),
178
179 ///////////////////////////////////////
180     fHistPtVsMassK0(0),
181 //    fHistPtVsMassK0MI(0),
182     fHistPtVsMassLambda(0),
183 ////////////////////////////////////////
184         fHistPzPtBeforeK0s(0),
185         fHistPzPtAfterK0s(0),
186         fHistPzPtBeforeLambda(0),
187         fHistPzPtAfterLambda(0),
188
189 //////////////////////////////////////////
190 //    fHistPtVsMassLambdaMI(0),
191 //    fHistPtVsMassAntiLambda(0),
192 //    fHistPtVsMassAntiLambdaMI(0),
193
194
195
196 //    fHistMultVsPtVsMassK0(0),
197 //    fHistMultVsPtVsMassLambda(0),
198 //    fHistMultVsPtVsMassAntiLambda(0),
199
200
201     fHistArmenterosPodolanski(0),
202 //    fHistArmenterosPodolanskiMI(0),
203     fHistNsigmaPosPionAntiLambda(0),
204     fHistNsigmaNegProtonAntiLambda(0),
205     fHistNsigmaPosProtonLambda(0),
206     fHistNsigmaNegPionLambda(0),
207     fHistNsigmaPosPionK0(0),
208     fHistNsigmaNegPionK0(0),
209     fHistAsMcRapK0(0),
210 //    fHistAsMcRapK0MI(0),
211     fHistAsMcRapLambda(0),
212 //    fHistAsMcRapLambdaMI(0),
213     fHistAsMcRapAntiLambda(0),
214 //    fHistAsMcRapAntiLambdaMI(0),
215
216 /////////////////////////////////////////////
217     fHistAsMcPtK0(0),
218
219 //    fHistAsMcPtK0MI(0),
220     fHistAsMcPtLambda(0),
221 //////////////////////////////////////////////
222
223
224 //    fHistAsMcPtAntiLambdaMI(0),
225     fHistAsMcPtZoomK0(0),
226 //    fHistAsMcPtZoomK0MI(0),
227     fHistAsMcPtZoomLambda(0),
228 //    fHistAsMcPtZoomLambdaMI(0),
229     fHistAsMcProdRadiusK0(0),
230 //    fHistAsMcProdRadiusK0MI(0),
231     fHistAsMcProdRadiusLambda(0),
232 //    fHistAsMcProdRadiusLambdaMI(0),
233     fHistAsMcProdRadiusAntiLambda(0),
234 //    fHistAsMcProdRadiusAntiLambdaMI(0),
235     fHistAsMcProdRadiusXvsYK0s(0),
236 //    fHistAsMcProdRadiusXvsYK0sMI(0),
237     fHistAsMcProdRadiusXvsYLambda(0),
238 //    fHistAsMcProdRadiusXvsYLambdaMI(0),
239     fHistAsMcProdRadiusXvsYAntiLambda(0),
240 //    fHistAsMcProdRadiusXvsYAntiLambdaMI(0),
241     fHistPidMcMassK0(0),
242 //    fHistPidMcMassK0MI(0),
243     fHistPidMcMassLambda(0),
244 //    fHistPidMcMassLambdaMI(0),
245     fHistPidMcMassAntiLambda(0),
246 //    fHistPidMcMassAntiLambdaMI(0),
247     fHistAsMcMassK0(0),
248 //    fHistAsMcMassK0MI(0),
249     fHistAsMcMassLambda(0),
250 //    fHistAsMcMassLambdaMI(0),
251     fHistAsMcMassAntiLambda(0),
252 //    fHistAsMcMassAntiLambdaMI(0),
253     fHistAsMcPtVsMassK0(0),
254 //    fHistAsMcPtVsMassK0MI(0),
255     fHistAsMcPtVsMassLambda(0),
256 //    fHistAsMcPtVsMassLambdaMI(0),
257     fHistAsMcPtVsMassAntiLambda(0),
258 //    fHistAsMcPtVsMassAntiLambdaMI(0),
259     fHistAsMcMassVsRadiusK0(0),
260 //    fHistAsMcMassVsRadiusK0MI(0),
261     fHistAsMcMassVsRadiusLambda(0),
262 //    fHistAsMcMassVsRadiusLambdaMI(0),
263     fHistAsMcMassVsRadiusAntiLambda(0),
264 //    fHistAsMcMassVsRadiusAntiLambdaMI(0),
265     fHistAsMcResxK0(0),
266     fHistAsMcResyK0(0),
267     fHistAsMcReszK0(0),
268     fHistAsMcResrVsRadiusK0(0),
269     fHistAsMcReszVsRadiusK0(0),
270 //    fHistAsMcResxK0MI(0),
271 //    fHistAsMcResyK0MI(0),
272  //   fHistAsMcReszK0MI(0),
273 //    fHistAsMcResrVsRadiusK0MI(0),
274 //    fHistAsMcReszVsRadiusK0MI(0),
275     fHistAsMcResxLambda(0),
276     fHistAsMcResyLambda(0),
277     fHistAsMcReszLambda(0),
278     fHistAsMcResrVsRadiusLambda(0),
279     fHistAsMcReszVsRadiusLambda(0),
280 //    fHistAsMcResxLambdaMI(0),
281 //    fHistAsMcResyLambdaMI(0),
282 //    fHistAsMcReszLambdaMI(0),
283 //    fHistAsMcResrVsRadiusLambdaMI(0),
284 //    fHistAsMcReszVsRadiusLambdaMI(0),
285     fHistAsMcResxAntiLambda(0),
286     fHistAsMcResyAntiLambda(0),
287     fHistAsMcReszAntiLambda(0),
288     fHistAsMcResrVsRadiusAntiLambda(0),
289     fHistAsMcReszVsRadiusAntiLambda(0),
290 //    fHistAsMcResxAntiLambdaMI(0),
291 //    fHistAsMcResyAntiLambdaMI(0),
292 //    fHistAsMcReszAntiLambdaMI(0),
293 //    fHistAsMcResrVsRadiusAntiLambdaMI(0),
294 //    fHistAsMcReszVsRadiusAntiLambdaMI(0),
295     fHistAsMcResPtK0(0),
296 //    fHistAsMcResPtK0MI(0),
297     fHistAsMcResPtLambda(0),
298 //    fHistAsMcResPtLambdaMI(0),
299     fHistAsMcResPtAntiLambda(0),
300 //    fHistAsMcResPtAntiLambdaMI(0),
301     fHistAsMcResPtVsRapK0(0),
302 //    fHistAsMcResPtVsRapK0MI(0),
303     fHistAsMcResPtVsRapLambda(0),
304 //    fHistAsMcResPtVsRapLambdaMI(0),
305     fHistAsMcResPtVsRapAntiLambda(0),
306 //    fHistAsMcResPtVsRapAntiLambdaMI(0),
307     fHistAsMcResPtVsPtK0(0),
308 //    fHistAsMcResPtVsPtK0MI(0),
309     fHistAsMcResPtVsPtLambda(0),
310 //    fHistAsMcResPtVsPtLambdaMI(0),
311     fHistAsMcResPtVsPtAntiLambda(0),
312 //    fHistAsMcResPtVsPtAntiLambdaMI(0),
313     fHistAsMcMotherPdgCodeK0s(0),
314 //    fHistAsMcMotherPdgCodeK0sMI(0),
315     fHistAsMcMotherPdgCodeLambda(0),
316 //    fHistAsMcMotherPdgCodeLambdaMI(0),
317     fHistAsMcMotherPdgCodeAntiLambda(0),
318 //    fHistAsMcMotherPdgCodeAntiLambdaMI(0),
319     fHistAsMcPtLambdaFromSigma(0),
320 //    fHistAsMcPtLambdaFromSigmaMI(0),
321     fHistAsMcPtAntiLambdaFromSigma(0),
322 //    fHistAsMcPtAntiLambdaFromSigmaMI(0),
323     fHistAsMcSecondaryPtVsRapK0s(0),
324 //    fHistAsMcSecondaryPtVsRapK0sMI(0),
325     fHistAsMcSecondaryPtVsRapLambda(0),
326 //    fHistAsMcSecondaryPtVsRapLambdaMI(0),
327     fHistAsMcSecondaryPtVsRapAntiLambda(0),
328 //    fHistAsMcSecondaryPtVsRapAntiLambdaMI(0),
329     fHistAsMcSecondaryProdRadiusK0s(0),
330 //    fHistAsMcSecondaryProdRadiusK0sMI(0),
331     fHistAsMcSecondaryProdRadiusLambda(0),
332 //    fHistAsMcSecondaryProdRadiusLambdaMI(0),
333     fHistAsMcSecondaryProdRadiusAntiLambda(0),
334 //    fHistAsMcSecondaryProdRadiusAntiLambdaMI(0),
335     fHistAsMcSecondaryProdRadiusXvsYK0s(0),
336 //    fHistAsMcSecondaryProdRadiusXvsYK0sMI(0),
337     fHistAsMcSecondaryProdRadiusXvsYLambda(0),
338 //    fHistAsMcSecondaryProdRadiusXvsYLambdaMI(0),
339     fHistAsMcSecondaryProdRadiusXvsYAntiLambda(0),
340 //    fHistAsMcSecondaryProdRadiusXvsYAntiLambdaMI(0),
341     fHistAsMcSecondaryMotherPdgCodeK0s(0),
342 //    fHistAsMcSecondaryMotherPdgCodeK0sMI(0),
343     fHistAsMcSecondaryMotherPdgCodeLambda(0),
344 //    fHistAsMcSecondaryMotherPdgCodeLambdaMI(0),
345     fHistAsMcSecondaryMotherPdgCodeAntiLambda(0),
346 //    fHistAsMcSecondaryMotherPdgCodeAntiLambdaMI(0),
347     fHistAsMcSecondaryPtLambdaFromSigma(0),
348 //    fHistAsMcSecondaryPtLambdaFromSigmaMI(0),
349     fHistAsMcSecondaryPtAntiLambdaFromSigma(0)
350 //    fHistAsMcSecondaryPtAntiLambdaFromSigmaMI(0)
351     
352 {
353   // Constructor
354
355   // New V0 cuts
356 /*  fCuts[0]=33;    // max allowed chi2
357   fCuts[1]=0.05;  // min allowed impact parameter for the 1st daughter
358   fCuts[2]=0.05;  // min allowed impact parameter for the 2nd daughter
359   fCuts[3]=0.5;   // max allowed DCA between the daughter tracks
360   fCuts[4]=0.00;  // max allowed cosine of V0's pointing angle
361   fCuts[5]=0.2;   // min radius of the fiducial volume
362   fCuts[6]=100;   // max radius of the fiducial volume
363 */
364 }
365
366
367
368
369
370 //________________________________________________________________________
371 AliAnalysisTaskPerformanceStrange::AliAnalysisTaskPerformanceStrange(const char *name)
372   : AliAnalysisTaskSE(name), fAnalysisMC(0), fAnalysisType("infoType"), fCollidingSystems(0), fUsePID("infoPID"), fUseCut("infocut"), fESD(0), fListHist(),fCentrSelector(0),
373     fHistMCPrimaryVertexX(0),
374     fHistMCPrimaryVertexY(0),
375     fHistMCPrimaryVertexZ(0),
376     fHistMCMultiplicityPrimary(0),
377     fHistMCMultiplicityTracks(0),
378     fHistMCtracksProdRadiusK0s(0),
379     fHistMCtracksProdRadiusLambda(0),
380     fHistMCtracksProdRadiusAntiLambda(0),
381     fHistMCtracksDecayRadiusK0s(0),
382     fHistMCtracksDecayRadiusLambda(0),
383     fHistMCtracksDecayRadiusAntiLambda(0),
384     fHistMCPtAllK0s(0),
385     fHistMCPtAllLambda(0),
386     fHistMCPtAllAntiLambda(0),
387     fHistMCProdRadiusK0s(0),
388     fHistMCProdRadiusLambda(0),
389     fHistMCProdRadiusAntiLambda(0),
390     fHistMCRapK0s(0),
391     fHistMCRapInPtRangeK0s(0),
392     fHistMCRapLambda(0),
393     fHistMCRapInPtRangeLambda(0),
394     fHistMCRapAntiLambda(0),
395     fHistMCRapInPtRangeAntiLambda(0),
396     fHistMCRapXi(0),
397     fHistMCRapInPtRangeXi(0),
398     fHistMCRapPhi(0),
399     fHistMCRapInPtRangePhi(0),
400
401 ////////////////////////////////////////////////
402     fHistMCPtK0s(0),
403
404     fHistMCPtLambda(0),
405 /////////////////////////////////////////////////
406
407     fHistMCPtLambdaFromSigma(0),
408     fHistMCPtAntiLambdaFromSigma(0),
409     fHistNTimesRecK0s(0),
410 //    fHistNTimesRecK0sMI(0),
411     fHistNTimesRecLambda(0),
412 //    fHistNTimesRecLambdaMI(0),
413     fHistNTimesRecAntiLambda(0),
414 //    fHistNTimesRecAntiLambdaMI(0),
415     fHistNTimesRecK0sVsPt(0),
416 //    fHistNTimesRecK0sVsPtMI(0),
417     fHistNTimesRecLambdaVsPt(0),
418 //    fHistNTimesRecLambdaVsPtMI(0),
419     fHistNTimesRecAntiLambdaVsPt(0),
420 //    fHistNTimesRecAntiLambdaVsPtMI(0),
421     fHistNumberEvents(0),
422     fHistTrackPerEvent(0),
423     fHistTrackletPerEvent(0),
424     fHistMCDaughterTrack(0),
425     fHistSPDPrimaryVertexZ(0),
426     fHistPrimaryVertexX(0),
427     fHistPrimaryVertexY(0),
428     fHistPrimaryVertexZ(0),
429     fHistPrimaryVertexResX(0),
430     fHistPrimaryVertexResY(0),
431     fHistPrimaryVertexResZ(0),
432     fHistPrimaryVertexPosXV0events(0), 
433     fHistPrimaryVertexPosYV0events(0), 
434     fHistPrimaryVertexPosZV0events(0),
435     fHistDaughterPt(0),
436     fHistDcaPosToPrimVertex(0),
437     fHistDcaNegToPrimVertex(0),
438     fHistDcaPosToPrimVertexZoom(0),
439     fHistDcaNegToPrimVertexZoom(0),
440     fHistRadiusV0(0),
441     fHistDecayLengthV0(0),
442     fHistDcaV0Daughters(0),
443     fHistChi2(0),
444     fHistCosPointAngle(0),
445     fHistCosPointAngleZoom(0),
446     fHistProdRadius(0),
447 //    fHistProdRadiusMI(0),
448     fHistV0Multiplicity(0),
449 //    fHistV0MultiplicityMI(0),
450     fHistChi2KFBeforeCutK0s(0), 
451     fHistChi2KFBeforeCutLambda(0), 
452     fHistChi2KFBeforeCutAntiLambda(0),
453     fHistChi2KFAfterCutK0s(0), 
454     fHistChi2KFAfterCutLambda(0), 
455     fHistChi2KFAfterCutAntiLambda(0),
456     fHistMassK0(0),
457 //    fHistMassK0MI(0),
458     fHistMassLambda(0),
459 //    fHistMassLambdaMI(0),
460     fHistMassAntiLambda(0),
461 //    fHistMassAntiLambdaMI(0),
462     fHistMassVsRadiusK0(0),
463 //    fHistMassVsRadiusK0MI(0),
464     fHistMassVsRadiusLambda(0),
465 //    fHistMassVsRadiusLambdaMI(0),
466     fHistMassVsRadiusAntiLambda(0),
467 //    fHistMassVsRadiusAntiLambdaMI(0),
468
469 /////////////////////////////////////////////
470     fHistPtVsMassK0(0),
471 //    fHistPtVsMassK0MI(0),
472     fHistPtVsMassLambda(0),
473 //    fHistPtVsMassLambdaMI(0),
474 ///////////////////////////////////////////////////
475         fHistPzPtBeforeK0s(0),
476         fHistPzPtAfterK0s(0),
477         fHistPzPtBeforeLambda(0),
478         fHistPzPtAfterLambda(0),
479
480 //////////////////////////////////////////
481
482 //    fHistMultVsPtVsMassK0(0),
483 //    fHistMultVsPtVsMassLambda(0),
484 //    fHistMultVsPtVsMassAntiLambda(0),
485
486
487     fHistArmenterosPodolanski(0),
488 //    fHistArmenterosPodolanskiMI(0),
489     fHistNsigmaPosPionAntiLambda(0),
490     fHistNsigmaNegProtonAntiLambda(0),
491     fHistNsigmaPosProtonLambda(0),
492     fHistNsigmaNegPionLambda(0),
493     fHistNsigmaPosPionK0(0),
494     fHistNsigmaNegPionK0(0),
495     fHistAsMcRapK0(0),
496 //    fHistAsMcRapK0MI(0),
497     fHistAsMcRapLambda(0),
498 //    fHistAsMcRapLambdaMI(0),
499     fHistAsMcRapAntiLambda(0),
500 //    fHistAsMcRapAntiLambdaMI(0),
501
502 ///////////////////////////////////
503     fHistAsMcPtK0(0),
504
505
506 //    fHistAsMcPtK0MI(0),
507     fHistAsMcPtLambda(0),
508
509 /////////////////////////////////////
510
511
512 //    fHistAsMcPtAntiLambdaMI(0),
513     fHistAsMcPtZoomK0(0),
514 //    fHistAsMcPtZoomK0MI(0),
515     fHistAsMcPtZoomLambda(0),
516 //    fHistAsMcPtZoomLambdaMI(0),
517     fHistAsMcProdRadiusK0(0),
518 //    fHistAsMcProdRadiusK0MI(0),
519     fHistAsMcProdRadiusLambda(0),
520 //    fHistAsMcProdRadiusLambdaMI(0),
521     fHistAsMcProdRadiusAntiLambda(0),
522 //    fHistAsMcProdRadiusAntiLambdaMI(0),
523     fHistAsMcProdRadiusXvsYK0s(0),
524 //    fHistAsMcProdRadiusXvsYK0sMI(0),
525     fHistAsMcProdRadiusXvsYLambda(0),
526 //    fHistAsMcProdRadiusXvsYLambdaMI(0),
527     fHistAsMcProdRadiusXvsYAntiLambda(0),
528 //    fHistAsMcProdRadiusXvsYAntiLambdaMI(0),
529     fHistPidMcMassK0(0),
530 //    fHistPidMcMassK0MI(0),
531     fHistPidMcMassLambda(0),
532 //    fHistPidMcMassLambdaMI(0),
533     fHistPidMcMassAntiLambda(0),
534 //    fHistPidMcMassAntiLambdaMI(0),
535     fHistAsMcMassK0(0),
536 //    fHistAsMcMassK0MI(0),
537     fHistAsMcMassLambda(0),
538 //    fHistAsMcMassLambdaMI(0),
539     fHistAsMcMassAntiLambda(0),
540 //    fHistAsMcMassAntiLambdaMI(0),
541     fHistAsMcPtVsMassK0(0),
542 //    fHistAsMcPtVsMassK0MI(0),
543     fHistAsMcPtVsMassLambda(0),
544 //    fHistAsMcPtVsMassLambdaMI(0),
545     fHistAsMcPtVsMassAntiLambda(0),
546 //    fHistAsMcPtVsMassAntiLambdaMI(0),
547     fHistAsMcMassVsRadiusK0(0),
548 //    fHistAsMcMassVsRadiusK0MI(0),
549     fHistAsMcMassVsRadiusLambda(0),
550 //    fHistAsMcMassVsRadiusLambdaMI(0),
551     fHistAsMcMassVsRadiusAntiLambda(0),
552 //    fHistAsMcMassVsRadiusAntiLambdaMI(0),
553     fHistAsMcResxK0(0),
554     fHistAsMcResyK0(0),
555     fHistAsMcReszK0(0),
556     fHistAsMcResrVsRadiusK0(0),
557     fHistAsMcReszVsRadiusK0(0),
558 //    fHistAsMcResxK0MI(0),
559 //    fHistAsMcResyK0MI(0),
560  //   fHistAsMcReszK0MI(0),
561 //    fHistAsMcResrVsRadiusK0MI(0),
562 //    fHistAsMcReszVsRadiusK0MI(0),
563     fHistAsMcResxLambda(0),
564     fHistAsMcResyLambda(0),
565     fHistAsMcReszLambda(0),
566     fHistAsMcResrVsRadiusLambda(0),
567     fHistAsMcReszVsRadiusLambda(0),
568 //    fHistAsMcResxLambdaMI(0),
569 //    fHistAsMcResyLambdaMI(0),
570 //    fHistAsMcReszLambdaMI(0),
571 //    fHistAsMcResrVsRadiusLambdaMI(0),
572 //    fHistAsMcReszVsRadiusLambdaMI(0),
573     fHistAsMcResxAntiLambda(0),
574     fHistAsMcResyAntiLambda(0),
575     fHistAsMcReszAntiLambda(0),
576     fHistAsMcResrVsRadiusAntiLambda(0),
577     fHistAsMcReszVsRadiusAntiLambda(0),
578 //    fHistAsMcResxAntiLambdaMI(0),
579 //    fHistAsMcResyAntiLambdaMI(0),
580 //    fHistAsMcReszAntiLambdaMI(0),
581 //    fHistAsMcResrVsRadiusAntiLambdaMI(0),
582 //    fHistAsMcReszVsRadiusAntiLambdaMI(0),
583     fHistAsMcResPtK0(0),
584 //    fHistAsMcResPtK0MI(0),
585     fHistAsMcResPtLambda(0),
586 //    fHistAsMcResPtLambdaMI(0),
587     fHistAsMcResPtAntiLambda(0),
588 //    fHistAsMcResPtAntiLambdaMI(0),
589     fHistAsMcResPtVsRapK0(0),
590 //    fHistAsMcResPtVsRapK0MI(0),
591     fHistAsMcResPtVsRapLambda(0),
592 //    fHistAsMcResPtVsRapLambdaMI(0),
593     fHistAsMcResPtVsRapAntiLambda(0),
594 //    fHistAsMcResPtVsRapAntiLambdaMI(0),
595     fHistAsMcResPtVsPtK0(0),
596 //    fHistAsMcResPtVsPtK0MI(0),
597     fHistAsMcResPtVsPtLambda(0),
598 //    fHistAsMcResPtVsPtLambdaMI(0),
599     fHistAsMcResPtVsPtAntiLambda(0),
600 //    fHistAsMcResPtVsPtAntiLambdaMI(0),
601     fHistAsMcMotherPdgCodeK0s(0),
602 //    fHistAsMcMotherPdgCodeK0sMI(0),
603     fHistAsMcMotherPdgCodeLambda(0),
604 //    fHistAsMcMotherPdgCodeLambdaMI(0),
605     fHistAsMcMotherPdgCodeAntiLambda(0),
606 //    fHistAsMcMotherPdgCodeAntiLambdaMI(0),
607     fHistAsMcPtLambdaFromSigma(0),
608 //    fHistAsMcPtLambdaFromSigmaMI(0),
609     fHistAsMcPtAntiLambdaFromSigma(0),
610 //    fHistAsMcPtAntiLambdaFromSigmaMI(0),
611     fHistAsMcSecondaryPtVsRapK0s(0),
612 //    fHistAsMcSecondaryPtVsRapK0sMI(0),
613     fHistAsMcSecondaryPtVsRapLambda(0),
614 //    fHistAsMcSecondaryPtVsRapLambdaMI(0),
615     fHistAsMcSecondaryPtVsRapAntiLambda(0),
616 //    fHistAsMcSecondaryPtVsRapAntiLambdaMI(0),
617     fHistAsMcSecondaryProdRadiusK0s(0),
618 //    fHistAsMcSecondaryProdRadiusK0sMI(0),
619     fHistAsMcSecondaryProdRadiusLambda(0),
620 //    fHistAsMcSecondaryProdRadiusLambdaMI(0),
621     fHistAsMcSecondaryProdRadiusAntiLambda(0),
622 //    fHistAsMcSecondaryProdRadiusAntiLambdaMI(0),
623     fHistAsMcSecondaryProdRadiusXvsYK0s(0),
624 //    fHistAsMcSecondaryProdRadiusXvsYK0sMI(0),
625     fHistAsMcSecondaryProdRadiusXvsYLambda(0),
626 //    fHistAsMcSecondaryProdRadiusXvsYLambdaMI(0),
627     fHistAsMcSecondaryProdRadiusXvsYAntiLambda(0),
628 //    fHistAsMcSecondaryProdRadiusXvsYAntiLambdaMI(0),
629     fHistAsMcSecondaryMotherPdgCodeK0s(0),
630 //    fHistAsMcSecondaryMotherPdgCodeK0sMI(0),
631     fHistAsMcSecondaryMotherPdgCodeLambda(0),
632 //    fHistAsMcSecondaryMotherPdgCodeLambdaMI(0),
633     fHistAsMcSecondaryMotherPdgCodeAntiLambda(0),
634 //    fHistAsMcSecondaryMotherPdgCodeAntiLambdaMI(0),
635     fHistAsMcSecondaryPtLambdaFromSigma(0),
636 //    fHistAsMcSecondaryPtLambdaFromSigmaMI(0),
637     fHistAsMcSecondaryPtAntiLambdaFromSigma(0)
638 //    fHistAsMcSecondaryPtAntiLambdaFromSigmaMI(0)
639     
640 {
641   // Constructor
642
643   //New V0 cuts
644 /*  fCuts[0]=33;    // max allowed chi2
645   fCuts[1]=0.05;  // min allowed impact parameter for the 1st daughter
646   fCuts[2]=0.05;  // min allowed impact parameter for the 2nd daughter
647   fCuts[3]=0.5;   // max allowed DCA between the daughter tracks
648   fCuts[4]=0.00;  // max allowed cosine of V0's pointing angle
649   fCuts[5]=0.2;   // min radius of the fiducial volume
650   fCuts[6]=100;   // max radius of the fiducial volume
651 */
652   // Define output slots only here
653   // Output slot #1 writes into a TList container
654   DefineOutput(1, TList::Class());
655   DefineOutput(2, AliAnalysisCentralitySelector::Class());
656
657 }
658
659 //________________________________________________________________________
660 void AliAnalysisTaskPerformanceStrange::UserCreateOutputObjects() 
661 {
662
663   //******************
664   // Create histograms
665   //*******************
666   fListHist = new TList();
667   fListHist->SetOwner();
668
669   // Bo: tbd: condition before allocation (i.e. if (!fHistMCMultiplicityPrimary){...} for each histo...
670
671
672
673   //***************
674   // MC histograms
675   //***************
676  
677   // Primary Vertex:
678   fHistMCPrimaryVertexX          = new TH1F("h1MCPrimaryVertexX", "MC Primary Vertex Position X;Primary Vertex Position X (cm);Events",100,-0.5,0.5);
679   fListHist->Add(fHistMCPrimaryVertexX);
680
681   fHistMCPrimaryVertexY          = new TH1F("h1MCPrimaryVertexY", "MC Primary Vertex Position Y;Primary Vertex Position Y (cm);Events",100,-0.5,0.5);
682   fListHist->Add(fHistMCPrimaryVertexY);
683
684   fHistMCPrimaryVertexZ          = new TH1F("h1MCPrimaryVertexZ", "MC Primary Vertex Position Z;Primary Vertex Position Z (cm);Events",200,-20,20);
685   fListHist->Add(fHistMCPrimaryVertexZ);
686   
687   // Multiplicity
688   fHistMCMultiplicityPrimary           = new TH1F("h1MCMultiplicityPrimary", "MC Primary Particles;NPrimary;Count", 201, -0.5, 200.5);
689   fListHist->Add(fHistMCMultiplicityPrimary);
690
691   fHistMCMultiplicityTracks            = new TH1F("h1MCMultiplicityTracks", "MC Tracks;Ntracks;Count", 201, -0.5, 200.5);
692   fListHist->Add(fHistMCMultiplicityTracks);
693
694   // Production Radius of non-primary particles:
695   fHistMCtracksProdRadiusK0s           = new TH2F("h2MCtracksProdRadiusK0s","Non-primary MC K^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
696   fListHist->Add(fHistMCtracksProdRadiusK0s);
697
698   fHistMCtracksProdRadiusLambda        = new TH2F("h2MCtracksProdRadiusLambda","Non-primary MC #Lambda^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
699   fListHist->Add(fHistMCtracksProdRadiusLambda);
700
701   fHistMCtracksProdRadiusAntiLambda    = new TH2F("h2MCtracksProdRadiusAntiLambda","Non-primary MC #bar{#Lambda}^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
702   fListHist->Add(fHistMCtracksProdRadiusAntiLambda);
703
704   // Decay Radius of non-primary particles:
705   fHistMCtracksDecayRadiusK0s          = new TH1F("h1MCtracksDecayRadiusK0s","Non-primary MC K^{0} Decay Radius;r (cm)",101,-1,100);
706   fListHist->Add(fHistMCtracksDecayRadiusK0s);
707
708   fHistMCtracksDecayRadiusLambda       = new TH1F("h1MCtracksDecayRadiusLambda","Non-primary MC #Lambda^{0} Decay Radius;r (cm)",101,-1,100);
709   fListHist->Add(fHistMCtracksDecayRadiusLambda);
710
711   fHistMCtracksDecayRadiusAntiLambda   = new TH1F("h1MCtracksDecayRadiusAntiLambda","Non-primary #bar{#Lambda}^{0} Decay Radius;r (cm)",100,1,101);
712   fListHist->Add(fHistMCtracksDecayRadiusAntiLambda);
713
714   // Pt Distribution of non-primary particles:
715   fHistMCPtAllK0s                      = new TH1F("h1MCPtAllK0s", "Non-primary MC K^{0};p_{t} (GeV/c);Counts",240,0,12);
716   fListHist->Add(fHistMCPtAllK0s);
717
718   fHistMCPtAllLambda                   = new TH1F("h1MCPtAllLambda", "Non-primary MC #Lambda^{0};p_{t} (GeV/c);Counts",240,0,12);
719   fListHist->Add(fHistMCPtAllLambda);
720
721   fHistMCPtAllAntiLambda               = new TH1F("h1MCPtAllAntiLambda", "Non-primary MC #bar{#Lambda}^{0};p_{t} (GeV/c);Counts",240,0,12);
722   fListHist->Add(fHistMCPtAllAntiLambda);
723
724   // Production Radius
725   fHistMCProdRadiusK0s                 = new TH1F("h1MCProdRadiusK0s", "MC K^{0} Production Radius;r (cm);Count", 400, -2, 2);
726   fListHist->Add(fHistMCProdRadiusK0s);
727
728   fHistMCProdRadiusLambda              = new TH1F("h1MCProdRadiusLambda", "MC #Lambda^{0} Production Radius;r (cm);Count", 400, -2, 2);
729   fListHist->Add(fHistMCProdRadiusLambda);
730
731    fHistMCProdRadiusAntiLambda         = new TH1F("h1MCProdRadiusAntiLambda", "MC #bar{#Lambda}^{0} Production Radius;r (cm);Count", 400, -2, 2);
732   fListHist->Add(fHistMCProdRadiusAntiLambda);
733
734
735   // Rapidity distribution:
736   fHistMCRapK0s                 = new TH1F("h1MCRapK0s", "K^{0};y",160,-4,4);
737   fListHist->Add(fHistMCRapK0s);
738
739   fHistMCRapInPtRangeK0s        = new TH1F("h1MCRapInPtRangeK0s", "K^{0};y",160,-4,4);
740   fListHist->Add(fHistMCRapInPtRangeK0s);
741
742   fHistMCRapLambda              = new TH1F("h1MCRapLambda", "#Lambda;y",160,-4,4);
743   fListHist->Add(fHistMCRapLambda);
744
745   fHistMCRapInPtRangeLambda     = new TH1F("h1MCRapInPtRangeLambda", "#Lambda;y",160,-4,4);
746   fListHist->Add(fHistMCRapInPtRangeLambda);
747
748   fHistMCRapAntiLambda          = new TH1F("h1MCRapAntiLambda", "#bar{#Lambda};y",160,-4,4);
749   fListHist->Add(fHistMCRapAntiLambda);
750
751   fHistMCRapInPtRangeAntiLambda = new TH1F("h1MCRapInPtRangeAntiLambda", "#bar{#Lambda};y",160,-4,4);
752   fListHist->Add(fHistMCRapInPtRangeAntiLambda);
753
754   fHistMCRapXi                  = new TH1F("h1MCRapXi", "Xi;y",160,-4,4);
755   fListHist->Add(fHistMCRapXi);
756
757   fHistMCRapInPtRangeXi         = new TH1F("h1MCRapInPtRangeXi", "Xi;y",160,-4,4);
758   fListHist->Add(fHistMCRapInPtRangeXi);
759
760   fHistMCRapPhi                  = new TH1F("h1MCRapPhi", "Phi;y",160,-4,4);
761   fListHist->Add(fHistMCRapPhi);
762
763   fHistMCRapInPtRangePhi         = new TH1F("h1MCRapInPtRangePhi", "Phi;y",160,-4,4);
764   fListHist->Add(fHistMCRapInPtRangePhi);
765
766
767   // Pt distribution:
768   fHistMCPtK0s               = new TH1F("h1MCPtK0s", "K^{0};p_{t} (GeV/c)",240,0,12);
769   fListHist->Add(fHistMCPtK0s);
770
771
772
773
774   fHistMCPtLambda            = new TH1F("h1MCPtLambda", "#Lambda^{0};p_{t} (GeV/c)",240,0,12);
775   fListHist->Add(fHistMCPtLambda);
776
777
778
779
780   // Pt distribution of Lambda coming from Sigma decay
781   fHistMCPtLambdaFromSigma      = new TH1F("h1MCPtLambdaFromSigma", "#Lambda^{0};p_{t} (GeV/c)",240,0,12);
782   fListHist->Add(fHistMCPtLambdaFromSigma);
783
784   fHistMCPtAntiLambdaFromSigma  = new TH1F("h1MCPtAntiLambdaFromSigma", "#Lambda^{0};p_{t} (GeV/c)",240,0,12);
785   fListHist->Add(fHistMCPtAntiLambdaFromSigma);
786  
787   // Multiple reconstruction studies
788   fHistNTimesRecK0s             = new TH1F("h1NTimesRecK0s","number of times a K0s is reconstructed in -1<y<1;number of times;counts",500,-0.5,4.5);
789   fListHist->Add(fHistNTimesRecK0s);
790 //  fHistNTimesRecK0sMI           = new TH1F("h1NTimesRecK0sMI","number of times a K0s MI is reconstructed in -1<y<1;number of times;counts",500,-0.5,4.5);
791 //  fListHist->Add(fHistNTimesRecK0sMI);
792
793   fHistNTimesRecLambda          = new TH1F("h1NTimesRecLambda","number of times a Lambda is reconstructed in -1<y<1;number of times;counts",500,-0.5,4.5);
794   fListHist->Add(fHistNTimesRecLambda);
795 //  fHistNTimesRecLambdaMI        = new TH1F("h1NTimesRecLambdaMI","number of times a Lambda MI is reconstructed in -1<y<1;number of times;counts",500,-0.5,4.5);
796 //  fListHist->Add(fHistNTimesRecLambdaMI);
797
798   fHistNTimesRecAntiLambda      = new TH1F("h1NTimesRecAntiLambda","number of times an AntiLambda is reconstructed in -1<y<1;number of times;counts",500,-0.5,4.5);
799   fListHist->Add(fHistNTimesRecAntiLambda);
800 //  fHistNTimesRecAntiLambdaMI    = new TH1F("h1NTimesRecAntiLambdaMI","number of times an AntiLambda  MI is reconstructed in -1<y<1;number of times;counts",500,-0.5,4.5);
801 //  fListHist->Add(fHistNTimesRecAntiLambdaMI);
802
803   fHistNTimesRecK0sVsPt         = new TH2F("h2NTimesRecK0sVsPt","NTimes versus Pt, K^{0} in -1<y<1;p_{t} (GeV/c);number of times",75,0,15,5,-0.5,4.5);
804   fListHist->Add(fHistNTimesRecK0sVsPt);
805 //  fHistNTimesRecK0sVsPtMI       = new TH2F("h2NTimesRecK0sVsPtMI","NTimes versus Pt, K^{0}, on-the-fly finder, in -1<y<1;p_{t} (GeV/c);number of times",75,0,15,5,-0.5,4.5);
806 //  fListHist->Add(fHistNTimesRecK0sVsPtMI);
807
808   fHistNTimesRecLambdaVsPt      = new TH2F("h2NTimesRecLambdaVsPt","NTimes versus Pt, #Lambda^{0} in -1<y<1;p_{t} (GeV/c);number of times",75,0,15,5,-0.5,4.5);
809   fListHist->Add(fHistNTimesRecLambdaVsPt);
810 //  fHistNTimesRecLambdaVsPtMI    = new TH2F("h2NTimesRecLambdaVsPtMI","NTimes versus Pt, #Lambda^{0} on-the-fly finder in -1<y<1;p_{t} (GeV/c);number of times",75,0,15,5,-0.5,4.5);
811 //  fListHist->Add(fHistNTimesRecLambdaVsPtMI);
812
813   fHistNTimesRecAntiLambdaVsPt  = new TH2F("h2NTimesRecAntiLambdaVsPt","NTimes versus Pt, #bar{#Lambda}^{0} in -1<y<1;p_{t} (GeV/c);number of times",75,0,15,5,-0.5,4.5);
814   fListHist->Add(fHistNTimesRecAntiLambdaVsPt);
815 //  fHistNTimesRecAntiLambdaVsPtMI= new TH2F("h2NTimesRecAntiLambdaVsPtMI","NTimes versus Pt, #bar{#Lambda}^{0}, on-the-fly finder in -1<y<1;p_{t} (GeV/c);number of times",75,0,15,5,-0.5,4.5);
816 //  fListHist->Add(fHistNTimesRecAntiLambdaVsPtMI);
817
818   
819
820   //***********************************
821   // Reconstructed particles histograms
822   //***********************************
823
824   // Number of events;
825   fHistNumberEvents           = new TH1F("h1NumberEvents", "Number of events; index;Number of Events",10,0,10);
826   fListHist->Add(fHistNumberEvents);
827
828   // multiplicity
829   fHistTrackPerEvent           = new TH1F("h1TrackPerEvent", "Tracks per event;Number of Tracks;Number of Events",1000,0,1000);
830   fListHist->Add(fHistTrackPerEvent);
831
832   fHistTrackletPerEvent       = new TH1F("h1TrackletPerEvent", "Number of tracklets;Number of tracklets per events;Number of events",1000,0,1000);
833   fListHist->Add(fHistTrackletPerEvent);
834
835   fHistMCDaughterTrack         = new TH1F("h1MCDaughterTrack","Distribution of mc id for daughters;id tags;Counts",15,0,15);
836   fListHist->Add(fHistMCDaughterTrack);
837
838   // Primary Vertex:
839   fHistSPDPrimaryVertexZ          = new TH1F("h1SPDPrimaryVertexZ", "SPD Primary Vertex Position Z;Primary Vertex Position Z (cm);Events",200,-20,20);
840   fListHist->Add(fHistSPDPrimaryVertexZ);
841
842   fHistPrimaryVertexX          = new TH1F("h1PrimaryVertexX", "Primary Vertex Position X;Primary Vertex Position X (cm);Events",100,-0.5,0.5);
843   fListHist->Add(fHistPrimaryVertexX);
844
845   fHistPrimaryVertexY          = new TH1F("h1PrimaryVertexY", "Primary Vertex Position Y;Primary Vertex Position Y (cm);Events",100,-0.5,0.5);
846   fListHist->Add(fHistPrimaryVertexY);
847
848   fHistPrimaryVertexZ          = new TH1F("h1PrimaryVertexZ", "Primary Vertex Position Z;Primary Vertex Position Z (cm);Events",200,-20,20);
849   fListHist->Add(fHistPrimaryVertexZ);
850
851
852   // Primary vertex resolution
853   fHistPrimaryVertexResX          = new TH1F("h1PrimaryVertexResX", "Primary Vertex Resolution X;Primary Vertex Resolution X (cm);Events",100,-0.25,0.25);
854   fListHist->Add(fHistPrimaryVertexResX);
855
856   fHistPrimaryVertexResY          = new TH1F("h1PrimaryVertexResY", "Primary Vertex Resolution Y;Primary Vertex Resolution Y (cm);Events",100,-0.25,0.25);
857   fListHist->Add(fHistPrimaryVertexResY);
858
859   fHistPrimaryVertexResZ          = new TH1F("h1PrimaryVertexResZ", "Primary Vertex Resolution Z;Primary Vertex Resolution Z (cm);Events",200,-0.25,0.25);
860   fListHist->Add(fHistPrimaryVertexResZ);
861   
862
863   // Primary Vertex in events with V0 candidates:
864   fHistPrimaryVertexPosXV0events       = new TH1F("h1PrimaryVertexPosXV0events", "Primary Vertex Position X;Primary Vertex Position X (cm);Events",100,-0.5,0.5);
865   fListHist->Add(fHistPrimaryVertexPosXV0events);
866   fHistPrimaryVertexPosYV0events       = new TH1F("h1PrimaryVertexPosYV0events", "Primary Vertex Position Y;Primary Vertex Position Y (cm);Events",100,-0.5,0.5);
867   fListHist->Add(fHistPrimaryVertexPosYV0events);
868   fHistPrimaryVertexPosZV0events       = new TH1F("h1PrimaryVertexPosZV0events", "Primary Vertex Position Z;Primary Vertex Position Z (cm);Events",200,-20.0,20.0);
869   fListHist->Add(fHistPrimaryVertexPosZV0events);
870
871   // Daughters Pt:
872   fHistDaughterPt              = new TH2F("h2DaughterPt", "Daughter Pt;Positive Daughter Pt; Negative Daughter Pt",200,0,2,200,0,2);
873   fListHist->Add(fHistDaughterPt);
874
875   // Cut checks:
876   fHistDcaPosToPrimVertex      = new TH2F("h2DcaPosToPrimVertex", "Positive V0 daughter;dca(cm);Status",500,0,5,2,-0.5,1.5);
877   fListHist->Add(fHistDcaPosToPrimVertex);
878
879   fHistDcaNegToPrimVertex      = new TH2F("h2DcaNegToPrimVertex", "Negative V0 daughter;dca(cm);Status",500,0,5,2,-0.5,1.5);
880   fListHist->Add(fHistDcaNegToPrimVertex);
881
882   fHistDcaPosToPrimVertexZoom  = new TH2F("h2DcaPosToPrimVertexZoom", "Positive V0 daughter;dca(cm);Status",100,0,0.1,2,-0.5,1.5);
883   fListHist->Add(fHistDcaPosToPrimVertexZoom);
884
885   fHistDcaNegToPrimVertexZoom  = new TH2F("h2DcaNegToPrimVertexZoom", "Negative V0 daughter;dca(cm);Status",100,0,0.1,2,-0.5,1.5);
886   fListHist->Add(fHistDcaNegToPrimVertexZoom);
887
888   fHistRadiusV0                = new TH2F("h2RadiusV0", "Radius;Radius(cm);Status",1200,0,120,2,-0.5,1.5);
889   fListHist->Add(fHistRadiusV0);
890
891   fHistDecayLengthV0           = new TH2F("h2DecayLengthV0", "V0s decay Length;decay length(cm);Status", 240, 0, 120,2,-0.5,1.5);
892   fListHist->Add(fHistDecayLengthV0);
893
894   fHistDcaV0Daughters          = new TH2F("h2DcaV0Daughters", "DCA between daughters;dca(cm);Status", 160, 0, 4,2,-0.5,1.5);
895   fListHist->Add(fHistDcaV0Daughters);
896
897   fHistChi2                    = new TH2F("h2Chi2", "V0s chi2;chi2;Status", 33, 0, 33,2,-0.5,1.5);
898   fListHist->Add(fHistChi2);
899
900   fHistCosPointAngle           = new TH2F("h2CosPointAngle", "Cosine of V0's pointing angle", 100,0,1,2,-0.5,1.5);
901   fListHist->Add(fHistCosPointAngle);
902
903   fHistCosPointAngleZoom       = new TH2F("h2CosPointAngleZoom", "Cosine of V0's pointing angle", 100,0.9,1,2,-0.5,1.5);
904   fListHist->Add(fHistCosPointAngleZoom);
905
906   fHistProdRadius              = new TH2F("h2ProdRadius", "Production position;x (cm);y (cm)", 100,-50,50,100,-50,50);
907   fListHist->Add(fHistProdRadius);
908
909 //  fHistProdRadiusMI            = new TH2F("h2ProdRadiusMI", "Production position, V0s MI;x (cm);y (cm)", 100,-50,50,100,-50,50);
910 //  fListHist->Add(fHistProdRadiusMI);
911
912   // V0 Multiplicity
913   if (!fHistV0Multiplicity) {
914     if (fCollidingSystems)
915       fHistV0Multiplicity = new TH1F("fHistV0Multiplicity", "Multiplicity distribution;Number of Offline V0s;Events", 200, 0, 40000);
916     else
917       fHistV0Multiplicity = new TH1F("fHistV0Multiplicity", "Multiplicity distribution;Number of Offline V0s;Events", 10, 0, 10); 
918     fListHist->Add(fHistV0Multiplicity);
919   }
920
921 /*  if (!fHistV0MultiplicityMI) {
922     if (fCollidingSystems)
923       fHistV0MultiplicityMI = new TH1F("fHistV0MultiplicityMI", "Multiplicity distribution;Number of On-the-fly V0s;Events", 200, 0, 40000);
924     else
925       fHistV0MultiplicityMI = new TH1F("fHistV0MultiplicityMI", "Multiplicity distribution;Number of On-the-fly V0s;Events", 10, 0, 10); 
926     fListHist->Add(fHistV0MultiplicityMI);
927   }
928 */
929   // AliKF Chi2
930   fHistChi2KFBeforeCutK0s               = new TH2F("h1Chi2KFBeforeCutK0s", "K^{0}  candidates;#Chi^{2});Counts", 250, 0, 50, 2,-0.5,1.5);
931   fListHist->Add(fHistChi2KFBeforeCutK0s);
932   fHistChi2KFBeforeCutLambda            = new TH2F("h1Chi2KFBeforeCutLambda", "#Lambda^{0}  candidates;#Chi^{2};Counts", 250, 0, 50, 2,-0.5,1.5);
933   fListHist->Add(fHistChi2KFBeforeCutLambda);
934   fHistChi2KFBeforeCutAntiLambda        = new TH2F("h1Chi2KFBeforeCutAntiLambda", "#bar{#Lambda}^{0}  candidates;#Chi^{2};Counts", 250, 0, 50, 2,-0.5,1.5);
935   fListHist->Add(fHistChi2KFBeforeCutAntiLambda);
936
937   fHistChi2KFAfterCutK0s               = new TH2F("h1Chi2KFAfterCutK0s", "K^{0}  candidates;#Chi^{2});Counts", 250, 0, 50, 2,-0.5,1.5);
938   fListHist->Add(fHistChi2KFAfterCutK0s);
939   fHistChi2KFAfterCutLambda            = new TH2F("h1Chi2KFAfterCutLambda", "#Lambda^{0}  candidates;#Chi^{2};Counts", 250, 0, 50, 2,-0.5,1.5);
940   fListHist->Add(fHistChi2KFAfterCutLambda);
941   fHistChi2KFAfterCutAntiLambda        = new TH2F("h1Chi2KFAfterCutAntiLambda", "#bar{#Lambda}^{0} candidates;#Chi^{2};Counts", 250, 0, 50, 2,-0.5,1.5);
942   fListHist->Add(fHistChi2KFAfterCutAntiLambda);
943
944   // Mass:
945   fHistMassK0                   = new TH1F("h1MassK0", "K^{0} candidates;M(#pi^{+}#pi^{-}) (GeV/c^{2});Counts", 100, 0.4, 0.6);
946   fListHist->Add(fHistMassK0);
947 //  fHistMassK0MI                 = new TH1F("h1MassK0MI", "K^{0} candidates;M(#pi^{+}#pi^{-}) (GeV/c^{2});Counts", 100, 0.4, 0.6);
948 //  fListHist->Add(fHistMassK0MI);
949
950   fHistMassLambda               = new TH1F("h1MassLambda", "#Lambda^{0} candidates;M(p#pi^{-}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
951   fListHist->Add(fHistMassLambda);
952 //  fHistMassLambdaMI             = new TH1F("h1MassLambdaMI", "#Lambda^{0} candidates;M(p#pi^{-}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
953 //  fListHist->Add(fHistMassLambdaMI);
954
955   fHistMassAntiLambda           = new TH1F("h1MassAntiLambda", "#bar{#Lambda}^{0} candidates;M(#bar{p}#pi^{+}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
956   fListHist->Add(fHistMassAntiLambda);
957 //  fHistMassAntiLambdaMI         = new TH1F("h1MassAntiLambdaMI", "#bar{#Lambda}^{0} candidates;M(#bar{p}#pi^{+}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
958 //  fListHist->Add(fHistMassAntiLambdaMI);
959
960   // invariant mass vs radius
961   const Double_t radius[10] = {0.0,2.5,2.9,3.9,7.6,15.0,23.9,37.8,42.8,100.0};
962   Int_t lNbinRadius        = 9;
963   Int_t lNbinInvMassLambda = 300;
964
965   fHistMassVsRadiusK0           = new TH2F("h2MassVsRadiusK0", "K^{0} candidates;radius (cm);M(#pi^{+}#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, 200, 0.4, 0.6);
966   fListHist->Add(fHistMassVsRadiusK0);
967
968 //  fHistMassVsRadiusK0MI         = new TH2F("h2MassVsRadiusK0MI", "K^{0} MI candidates;radius (cm);M(#pi^{+}#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, 200, 0.4, 0.6);
969 //  fListHist->Add(fHistMassVsRadiusK0MI);
970   
971   fHistMassVsRadiusLambda       = new TH2F("h2MassVsRadiusLambda", "#Lambda candidates;radius (cm);M(p#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, 140, 1.06, 1.2);
972   fListHist->Add(fHistMassVsRadiusLambda);
973
974 //  fHistMassVsRadiusLambdaMI     = new TH2F("h2MassVsRadiusLambdaMI", "#Lambda MI candidates;radius (cm);M(p#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, 140, 1.06, 1.2);
975 //  fListHist->Add(fHistMassVsRadiusLambdaMI);
976
977   fHistMassVsRadiusAntiLambda   = new TH2F("h2MassVsRadiusAntiLambda", "#bar{#Lambda} candidates;radius (cm);M(#bar{p}#pi^{+}) (GeV/c^{2})",lNbinRadius,radius, 140, 1.06, 1.2);
978   fListHist->Add(fHistMassVsRadiusAntiLambda);
979
980 //  fHistMassVsRadiusAntiLambdaMI = new TH2F("h2MassVsRadiusAntiLambdaMI", "#bar{#Lambda} candidates;radius (cm);M(#bar{p}#pi^{+}) (GeV/c^{2})",lNbinRadius,radius, 140, 1.06, 1.2);
981 //  fListHist->Add(fHistMassVsRadiusAntiLambdaMI);
982
983   // Pt Vs Mass
984   fHistPtVsMassK0               = new TH2F("h2PtVsMassK0","K^{0} candidates;M(#pi^{+}#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",200, 0.4, 0.6,240,0,12);
985   fListHist->Add(fHistPtVsMassK0);
986 //  fHistPtVsMassK0MI             = new TH2F("h2PtVsMassK0MI","K^{0} MIcandidates;M(#pi^{+}#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",200, 0.4, 0.6,240,0,12);
987 //  fListHist->Add(fHistPtVsMassK0MI);
988
989   fHistPtVsMassLambda           = new TH2F("h2PtVsMassLambda","#Lambda^{0} candidates;M(p#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",140, 1.06, 1.2,240,0,12);
990   fListHist->Add(fHistPtVsMassLambda);
991 //  fHistPtVsMassLambdaMI         = new TH2F("h2PtVsMassLambdaMI","#Lambda^{0} candidates;M(p#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",140, 1.06, 1.2,240,0,12);
992 //  fListHist->Add(fHistPtVsMassLambdaMI);
993 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
994 fHistPzPtBeforeK0s      = new TH1F("h1PzPtBeforeK0s","K0s; Abs(pz/pt); count",1000,0,10);
995   fListHist->Add(fHistPzPtBeforeK0s);
996
997 fHistPzPtAfterK0s       = new TH1F("h1PzPtAfterK0s","K0s; Abs(pz/pt); count",1000,0,10);
998   fListHist->Add(fHistPzPtAfterK0s);
999
1000 fHistPzPtBeforeLambda   = new TH1F("h1PzPtBeforeLambda","#Lambda^{0}; Abs(pz/pt); count",1000,0,10);
1001   fListHist->Add(fHistPzPtBeforeLambda);
1002
1003 fHistPzPtAfterLambda    = new TH1F("h1PzPtAfterLambda","#Lambda^{0}; Abs(pz/pt); count",1000,0,10);
1004   fListHist->Add(fHistPzPtAfterLambda);
1005 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1006
1007   fHistArmenterosPodolanski     = new TH2F("h2ArmenterosPodolanski","Armenteros-Podolanski phase space;#alpha;p_{t} arm",100,-1.0,1.0,50,0,0.5);
1008 //  fHistArmenterosPodolanskiMI   = new TH2F("h2ArmenterosPodolanskiMI","Armenteros-Podolanski phase space;#alpha;p_{t} arm",100,-1.0,1.0,50,0,0.5);
1009
1010
1011   //PID
1012   fHistNsigmaPosPionAntiLambda   = new TH1F("h1NsigmaPosPionAntiLambda", "Positive daughter of Antilambda;NsigmaPion;Counts",25,0,5);
1013   fListHist->Add(fHistNsigmaPosPionAntiLambda);
1014
1015   fHistNsigmaNegProtonAntiLambda = new TH1F("h1NsigmaNegProtonAntiLambda", "Negative daughter of Antilambda;NsigmaProton;Counts",25,0,5);
1016   fListHist->Add(fHistNsigmaNegProtonAntiLambda);
1017   
1018   fHistNsigmaPosProtonLambda     = new TH1F("h1NsigmaPosProtonLambda", "Positive daughter of Lambda;NsigmaProton;Counts",25,0,5); 
1019   fListHist->Add(fHistNsigmaPosProtonLambda);
1020   
1021   fHistNsigmaNegPionLambda       = new TH1F("h1NsigmaNegPionLambda", "Negative daughter of Lambda;NsigmaPion;Counts",25,0,5);
1022   fListHist->Add(fHistNsigmaNegPionLambda);
1023   
1024   fHistNsigmaPosPionK0           = new TH1F("h1NsigmaPosPionK0", "Positive daughter of K0s;NsigmaPion;Counts",25,0,5);
1025   fListHist->Add(fHistNsigmaPosPionK0);
1026   
1027   fHistNsigmaNegPionK0           = new TH1F("h1NsigmaNegPionK0", "Negative daughter of K0s;NsigmaPion;Counts",25,0,5);
1028   fListHist->Add(fHistNsigmaNegPionK0);
1029
1030
1031   //********************************
1032   // Associated particles histograms
1033   //********************************
1034
1035   // Rap distribution
1036   fHistAsMcRapK0                = new TH1F("h1AsMcRapK0", "K^{0} associated;eta;Counts", 60, -1.5, 1.5);
1037   fListHist->Add(fHistAsMcRapK0);
1038 //  fHistAsMcRapK0MI              = new TH1F("h1AsMcRapK0MI", "K^{0} associated;eta;Counts", 60, -1.5, 1.5);
1039 //  fListHist->Add(fHistAsMcRapK0MI);
1040
1041   fHistAsMcRapLambda            = new TH1F("h1AsMcRapLambda", "#Lambda^{0} associated;eta;Counts", 60, -1.5, 1.5);
1042   fListHist->Add(fHistAsMcRapLambda);
1043 //  fHistAsMcRapLambdaMI          = new TH1F("h1AsMcRapLambdaMI", "#Lambda^{0} associated;eta;Counts", 60, -1.5, 1.5);
1044 //  fListHist->Add(fHistAsMcRapLambdaMI);
1045
1046   fHistAsMcRapAntiLambda        = new TH1F("h1AsMcRapAntiLambda", "#bar{#Lambda}^{0} associated;eta;Counts", 60, -1.5, 1.5);
1047   fListHist->Add(fHistAsMcRapAntiLambda);
1048  // fHistAsMcRapAntiLambdaMI      = new TH1F("h1AsMcRapAntiLambdaMI", "#bar{#Lambda}^{0} associated;eta;Counts", 60, -1.5, 1.5);
1049 //  fListHist->Add(fHistAsMcRapAntiLambdaMI);
1050
1051
1052   //Pt distribution
1053   fHistAsMcPtK0                = new TH1F("h1AsMcPtK0", "K^{0} associated;p_{t} (GeV/c);Counts", 240,0,12);
1054   fListHist->Add(fHistAsMcPtK0);
1055
1056
1057 //  fHistAsMcPtK0MI              = new TH1F("h1AsMcPtK0MI", "K^{0} associated;p_{t} (GeV/c);Counts", 240,0,12);
1058 //  fListHist->Add(fHistAsMcPtK0MI);
1059
1060   fHistAsMcPtLambda            = new TH1F("h1AsMcPtLambda", "#Lambda^{0} associated;p_{t} (GeV/c);Counts", 240,0,12);
1061   fListHist->Add(fHistAsMcPtLambda);
1062
1063
1064
1065 //  fHistAsMcPtAntiLambdaMI      = new TH1F("h1AsMcPtAntiLambdaMI", "#bar{#Lambda}^{0} associated;p_{t} (GeV/c);Counts", 240,0,12);
1066 //  fListHist->Add(fHistAsMcPtAntiLambdaMI);
1067
1068   fHistAsMcPtZoomK0            = new TH1F("h1AsMcPtZoomK0", "K^{0} candidates in -1 <y<1;p_{t} (GeV/c);Counts",20,0,1);
1069   fListHist->Add(fHistAsMcPtZoomK0);
1070 //  fHistAsMcPtZoomK0MI          = new TH1F("h1AsMcPtZoomK0MI", "K^{0} MI candidates in -1 <y<1;p_{t} (GeV/c);Counts",20,0,1);
1071 //  fListHist->Add(fHistAsMcPtZoomK0MI);
1072
1073   fHistAsMcPtZoomLambda        = new TH1F("h1AsMcPtZoomLambda", "#Lambda^{0} candidates in -1 <y<1;p_{t} (GeV/c);Counts",20,0,1);
1074   fListHist->Add(fHistAsMcPtZoomLambda);
1075 //  fHistAsMcPtZoomLambdaMI      = new TH1F("h1AsMcPtZoomLambdaMI", "#Lambda^{0} MI candidates in -1 <y<1;p_{t} (GeV/c);Counts",20,0,1);
1076 //  fListHist->Add(fHistAsMcPtZoomLambdaMI);
1077
1078
1079   // Radius distribution
1080   fHistAsMcProdRadiusK0               = new TH1F("h1AsMcProdRadiusK0", "K^{0} associated;r (cm);Counts", 500, 0, 100);
1081   fListHist->Add(fHistAsMcProdRadiusK0);
1082 //  fHistAsMcProdRadiusK0MI             = new TH1F("h1AsMcProdRadiusK0MI", "K^{0} associated;r (cm);Counts", 500, 0, 100);
1083 //  fListHist->Add(fHistAsMcProdRadiusK0MI);
1084
1085   fHistAsMcProdRadiusLambda           = new TH1F("h1AsMcProdRadiusLambda", "#Lambda^{0} associated;r (cm);Counts", 500, 0, 100);
1086   fListHist->Add(fHistAsMcProdRadiusLambda);
1087 //  fHistAsMcProdRadiusLambdaMI         = new TH1F("h1AsMcProdRadiusLambdaMI", "#Lambda^{0} associated;r (cm);Counts", 500, 0, 100);
1088 //  fListHist->Add(fHistAsMcProdRadiusLambdaMI);
1089
1090   fHistAsMcProdRadiusAntiLambda       = new TH1F("h1AsMcProdRadiusAntiLambda", "#bar{#Lambda}^{0} associated;r (cm);Counts", 500, 0, 100);
1091   fListHist->Add(fHistAsMcProdRadiusAntiLambda);
1092 //  fHistAsMcProdRadiusAntiLambdaMI     = new TH1F("h1AsMcProdRadiusAntiLambdaMI", "#bar{#Lambda}^{0} associated;r (cm);Counts", 500, 0, 100);
1093 //  fListHist->Add(fHistAsMcProdRadiusAntiLambdaMI);
1094
1095   fHistAsMcProdRadiusXvsYK0s          = new TH2F("h2AsMcProdRadiusXvsYK0s","Associated Secondary K^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
1096   fListHist->Add(fHistAsMcProdRadiusXvsYK0s);
1097 //  fHistAsMcProdRadiusXvsYK0sMI        = new TH2F("h2AsMcProdRadiusXvsYK0sMI","Associated Secondary K^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
1098 //  fListHist->Add(fHistAsMcProdRadiusXvsYK0sMI);
1099
1100   fHistAsMcProdRadiusXvsYLambda       = new TH2F("h2AsMcProdRadiusXvsYLambda","Associated Secondary #Lambda^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
1101   fListHist->Add(fHistAsMcProdRadiusXvsYLambda);
1102 //  fHistAsMcProdRadiusXvsYLambdaMI     = new TH2F("h2AsMcProdRadiusXvsYLambdaMI","Associated Secondary #Lambda^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
1103 //  fListHist->Add(fHistAsMcProdRadiusXvsYLambdaMI);
1104
1105   fHistAsMcProdRadiusXvsYAntiLambda   = new TH2F("h2AsMcProdRadiusXvsYAntiLambda","Associated Secondary #bar{#Lambda}^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
1106   fListHist->Add(fHistAsMcProdRadiusXvsYAntiLambda);
1107 //  fHistAsMcProdRadiusXvsYAntiLambdaMI = new TH2F("h2AsMcProdRadiusXvsYAntiLambdaMI","Associated Secondary #bar{#Lambda}^{0} Production Radius;x (cm); y (cm)",200,-50,50,200,-50,50);
1108 //  fListHist->Add(fHistAsMcProdRadiusXvsYAntiLambdaMI);
1109
1110
1111
1112   // Mass
1113   fHistPidMcMassK0             = new TH1F("h1PidMcMassK0", "K^{0} MC PId checked;M(#pi^{+}#pi^{-}) (GeV/c^{2});Counts", 100, 0.4, 0.6);
1114   fListHist->Add(fHistPidMcMassK0);
1115 //  fHistPidMcMassK0MI           = new TH1F("h1PidMcMassK0MI", "K^{0} MC PId checked;M(#pi^{+}#pi^{-}) (GeV/c^{2});Counts", 100, 0.4, 0.6);
1116 //  fListHist->Add(fHistPidMcMassK0MI);
1117
1118   fHistPidMcMassLambda         = new TH1F("h1PidMcMassLambda", "#Lambda^{0} MC PId checked;M(p#pi^{-}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1119   fListHist->Add(fHistPidMcMassLambda);
1120 //  fHistPidMcMassLambdaMI       = new TH1F("h1PidMcMassLambdaMI", "#Lambda^{0} MC PId checked;M(p#pi^{-}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1121 //  fListHist->Add(fHistPidMcMassLambdaMI);
1122   
1123   fHistPidMcMassAntiLambda     = new TH1F("h1PidMcMassAntiLambda", "#bar{#Lambda}^{0} MC PId checked;M(#bar{p}#pi^{+}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1124   fListHist->Add(fHistPidMcMassAntiLambda);
1125 //  fHistPidMcMassAntiLambdaMI   = new TH1F("h1PidMcMassAntiLambdaMI", "#bar{#Lambda}^{0} MC PId checked;M(#bar{p}#pi^{+}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1126 //  fListHist->Add(fHistPidMcMassAntiLambdaMI);
1127
1128   fHistAsMcMassK0              = new TH1F("h1AsMcMassK0", "K^{0} associated;M(#pi^{+}#pi^{-}) (GeV/c^{2});Counts", 100, 0.4, 0.6);
1129   fListHist->Add(fHistAsMcMassK0);
1130 //  fHistAsMcMassK0MI            = new TH1F("h1AsMcMassK0MI", "K^{0} associated;M(#pi^{+}#pi^{-}) (GeV/c^{2});Counts", 100, 0.4, 0.6);
1131 //  fListHist->Add(fHistAsMcMassK0MI);
1132   
1133   fHistAsMcMassLambda          = new TH1F("h1AsMcMassLambda", "#Lambda^{0} associated;M(p#pi^{-}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1134   fListHist->Add(fHistAsMcMassLambda);
1135 //  fHistAsMcMassLambdaMI        = new TH1F("h1AsMcMassLambdaMI", "#Lambda^{0} associated;M(p#pi^{-}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1136 //  fListHist->Add(fHistAsMcMassLambdaMI);
1137
1138   fHistAsMcMassAntiLambda      = new TH1F("h1AsMcMassAntiLambda", "#bar{#Lambda}^{0} associated;M(#bar{p}#pi^{+}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1139   fListHist->Add(fHistAsMcMassAntiLambda);
1140 //  fHistAsMcMassAntiLambdaMI    = new TH1F("h1AsMcMassAntiLambdaMI", "#bar{#Lambda}^{0} associated;M(#bar{p}#pi^{+}) (GeV/c^{2});Counts", 75, 1.05, 1.2);
1141 //  fListHist->Add(fHistAsMcMassAntiLambdaMI);
1142
1143   //Pt versus Mass
1144   fHistAsMcPtVsMassK0               = new TH2F("h2AsMcPtVsMassK0","K^{0} associated;M(#pi^{+}#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",200, 0.4, 0.6,240,0,12);
1145   fListHist->Add(fHistAsMcPtVsMassK0);
1146 //  fHistAsMcPtVsMassK0MI             = new TH2F("h2AsMcPtVsMassK0MI","K^{0} MIassociated;M(#pi^{+}#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",200, 0.4, 0.6,240,0,12);
1147 //  fListHist->Add(fHistAsMcPtVsMassK0MI);
1148
1149   fHistAsMcPtVsMassLambda           = new TH2F("h2AsMcPtVsMassLambda","#Lambda^{0} associated;M(p#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",140, 1.06, 1.2,240,0,12);
1150   fListHist->Add(fHistAsMcPtVsMassLambda);
1151 //  fHistAsMcPtVsMassLambdaMI         = new TH2F("h2AsMcPtVsMassLambdaMI","#Lambda^{0} associated;M(p#pi^{-}) (GeV/c^{2});p_{t} (GeV/c)",140, 1.06, 1.2,240,0,12);
1152 //  fListHist->Add(fHistAsMcPtVsMassLambdaMI);
1153
1154   fHistAsMcPtVsMassAntiLambda       = new TH2F("h2AsMcPtVsMassAntiLambda","#bar{#Lambda}^{0} associated;M(#bar{p}#pi^{+}) (GeV/c^{2});p_{t} (GeV/c)",140, 1.06, 1.2,240,0,12);
1155   fListHist->Add(fHistAsMcPtVsMassAntiLambda);
1156 //  fHistAsMcPtVsMassAntiLambdaMI     = new TH2F("h2AsMcPtVsMassAntiLambdaMI","#bar{#Lambda}^{0} associated;M(#bar{p}#pi^{+}) (GeV/c^{2});p_{t} (GeV/c)",140, 1.06, 1.2,240,0,12);
1157 //  fListHist->Add(fHistAsMcPtVsMassAntiLambdaMI);
1158
1159
1160   // invariant mass vs radius
1161   fHistAsMcMassVsRadiusK0             = new TH2F("h2AsMcMassVsRadiusK0", "K^{0} associated;radius (cm);M(#pi^{+}#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, 500, 0.47, 0.52);
1162   fListHist->Add(fHistAsMcMassVsRadiusK0);
1163
1164 //  fHistAsMcMassVsRadiusK0MI           = new TH2F("h2AsMcMassVsRadiusK0MI", "K^{0} MI associated;radius (cm);M(#pi^{+}#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, 500, 0.47, 0.52);
1165 //  fListHist->Add(fHistAsMcMassVsRadiusK0MI);
1166   
1167   fHistAsMcMassVsRadiusLambda         = new TH2F("h2AsMcMassVsRadiusLambda", "#Lambda associated;radius (cm);M(p#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, lNbinInvMassLambda, 1.10, 1.13);
1168   fListHist->Add(fHistAsMcMassVsRadiusLambda);
1169
1170 //  fHistAsMcMassVsRadiusLambdaMI       = new TH2F("h2AsMcMassVsRadiusLambdaMI", "#Lambda MI associated;radius (cm);M(p#pi^{-}) (GeV/c^{2})",lNbinRadius,radius, lNbinInvMassLambda, 1.10, 1.13);
1171 //  fListHist->Add(fHistAsMcMassVsRadiusLambdaMI);
1172
1173   fHistAsMcMassVsRadiusAntiLambda     = new TH2F("h2AsMcMassVsRadiusAntiLambda", "#bar{#Lambda} associated;radius (cm);M(#bar{p}#pi^{+}) (GeV/c^{2})",lNbinRadius,radius,lNbinInvMassLambda , 1.10, 1.13);
1174   fListHist->Add(fHistAsMcMassVsRadiusAntiLambda);
1175   
1176 //  fHistAsMcMassVsRadiusAntiLambdaMI   = new TH2F("h2AsMcMassVsRadiusAntiLambdaMI", "#bar{#Lambda} MI associated;radius (cm);M(#bar{p}#pi^{+}) (GeV/c^{2})",lNbinRadius,radius,lNbinInvMassLambda , 1.10, 1.13);
1177 //  fListHist->Add(fHistAsMcMassVsRadiusAntiLambdaMI);
1178     
1179
1180   // Position Resolution
1181   fHistAsMcResxK0                     = new TH1F("h1AsMcResxK0", "K^{0} associated;#Delta x (cm);Counts", 50, -0.25, 0.25);
1182   fListHist->Add(fHistAsMcResxK0);
1183   fHistAsMcResyK0                     = new TH1F("h1AsMcResyK0", "K^{0} associated;#Delta y (cm);Counts", 50, -0.25, 0.25);
1184   fListHist->Add(fHistAsMcResyK0);
1185   fHistAsMcReszK0                     = new TH1F("h1AsMcReszK0", "K^{0} associated;#Delta z (cm);Counts", 50, -0.25, 0.25);
1186   fListHist->Add(fHistAsMcReszK0);
1187   fHistAsMcResrVsRadiusK0             = new TH2F("h2AsMcResrVsRadiusK0", "K^{0} associated;Radius (cm);#Delta r (cm)",200,0.0,50., 50, -0.25, 0.25);
1188   fListHist->Add(fHistAsMcResrVsRadiusK0);
1189   fHistAsMcReszVsRadiusK0             = new TH2F("h2AsMcReszVsRadiusK0", "K^{0} associated;Radius (cm);#Delta z (cm)",200,0.0,50.0, 50, -0.25, 0.25);
1190   fListHist->Add(fHistAsMcReszVsRadiusK0);
1191
1192 //  fHistAsMcResxK0MI                   = new TH1F("h1AsMcResxK0MI", "K^{0} MI associated;#Delta x (cm);Counts", 50, -0.25, 0.25);
1193 //  fListHist->Add(fHistAsMcResxK0MI);
1194 //  fHistAsMcResyK0MI                   = new TH1F("h1AsMcResyK0MI", "K^{0} MI associated;#Delta y (cm);Counts", 50, -0.25, 0.25);
1195 //  fListHist->Add(fHistAsMcResyK0MI);
1196 //  fHistAsMcReszK0MI                   = new TH1F("h1AsMcReszK0MI", "K^{0} MI associated;#Delta z (cm);Counts", 50, -0.25, 0.25);
1197 //  fListHist->Add(fHistAsMcReszK0MI);
1198 //  fHistAsMcResrVsRadiusK0MI           = new TH2F("h2AsMcResrVsRadiusK0MI", "K^{0} MI associated;Radius (cm);#Delta r (cm)",8,radius, 50, -0.25, 0.25);
1199 //  fListHist->Add(fHistAsMcResrVsRadiusK0MI);
1200 //  fHistAsMcReszVsRadiusK0MI           = new TH2F("h2AsMcReszVsRadiusK0MI", "K^{0} MI associated;Radius (cm);#Delta z (cm)",8,radius, 50, -0.25, 0.25);
1201 //  fListHist->Add(fHistAsMcReszVsRadiusK0MI);
1202
1203   fHistAsMcResxLambda                 = new TH1F("h1AsMcResxLambda", "#Lambda^{0} associated;#Delta x (cm);Counts", 50, -0.25, 0.25);
1204   fListHist->Add(fHistAsMcResxLambda);
1205   fHistAsMcResyLambda                 = new TH1F("h1AsMcResyLambda", "#Lambda^{0} associated;#Delta y (cm);Counts", 50, -0.25, 0.25);
1206   fListHist->Add(fHistAsMcResyLambda);
1207   fHistAsMcReszLambda                 = new TH1F("h1AsMcReszLambda", "#Lambda^{0} associated;#Delta z (cm);Counts", 50, -0.25, 0.25);
1208   fListHist->Add(fHistAsMcReszLambda);
1209   fHistAsMcResrVsRadiusLambda         = new TH2F("h2AsMcResrVsRadiusLambda", "#Lambda^{0} associated;Radius (cm);#Delta r (cm)",200,0.0,50.0, 50, -0.25, 0.25);
1210   fListHist->Add(fHistAsMcResrVsRadiusLambda);
1211   fHistAsMcReszVsRadiusLambda         = new TH2F("h2AsMcReszVsRadiusLambda", "#Lambda^{0} associated;Radius (cm);#Delta z (cm)",200,0.0,50.0, 50, -0.25, 0.25);
1212   fListHist->Add(fHistAsMcReszVsRadiusLambda);
1213
1214 //  fHistAsMcResxLambdaMI               = new TH1F("h1AsMcResxLambdaMI", "#Lambda^{0} MI associated;#Delta x (cm);Counts", 50, -0.25, 0.25);
1215 //  fListHist->Add(fHistAsMcResxLambdaMI);
1216 //  fHistAsMcResyLambdaMI               = new TH1F("h1AsMcResyLambdaMI", "#Lambda^{0} MI associated;#Delta y (cm);Counts", 50, -0.25, 0.25);
1217 //  fListHist->Add(fHistAsMcResyLambdaMI);
1218 //  fHistAsMcReszLambdaMI               = new TH1F("h1AsMcReszLambdaMI", "#Lambda^{0} MI associated;#Delta z (cm);Counts", 50, -0.25, 0.25);
1219 //  fListHist->Add(fHistAsMcReszLambdaMI);
1220 //  fHistAsMcResrVsRadiusLambdaMI       = new TH2F("h2AsMcResrVsRadiusLambdaMI", "#Lambda^{0} MI associated;Radius (cm);#Delta r (cm)",8,radius, 50, -0.25, 0.25);
1221 //  fListHist->Add(fHistAsMcResrVsRadiusLambdaMI);
1222 //  fHistAsMcReszVsRadiusLambdaMI       = new TH2F("h2AsMcReszVsRadiusLambdaMI", "#Lambda^{0} MI associated;Radius (cm);#Delta z (cm)",8,radius, 50, -0.25, 0.25);
1223 //  fListHist->Add(fHistAsMcReszVsRadiusLambdaMI);
1224
1225   fHistAsMcResxAntiLambda             = new TH1F("h1AsMcResxAntiLambda", "#bar{#Lambda}^{0} associated;#Delta x (cm);Counts", 50, -0.25, 0.25);
1226   fListHist->Add(fHistAsMcResxAntiLambda);
1227   fHistAsMcResyAntiLambda             = new TH1F("h1AsMcResyAntiLambda", "#bar{#Lambda}^{0} associated;#Delta y (cm);Counts", 50, -0.25, 0.25);
1228   fListHist->Add(fHistAsMcResyAntiLambda);
1229   fHistAsMcReszAntiLambda             = new TH1F("h1AsMcReszAntiLambda", "#bar{#Lambda}^{0} associated;#Delta z (cm);Counts", 50, -0.25, 0.25);
1230   fListHist->Add(fHistAsMcReszAntiLambda);
1231   fHistAsMcResrVsRadiusAntiLambda     = new TH2F("h2AsMcResrVsRadiusAntiLambda", "#bar{#Lambda}^{0} associated;Radius (cm);#Delta r (cm)",200,0.0,50.0, 50, -0.25, 0.25);
1232   fListHist->Add(fHistAsMcResrVsRadiusAntiLambda);
1233   fHistAsMcReszVsRadiusAntiLambda     = new TH2F("h2AsMcReszVsRadiusAntiLambda", "#bar{#Lambda}^{0} associated;Radius (cm);#Delta z (cm)",200,0.0,50.0, 50, -0.25, 0.25);
1234   fListHist->Add(fHistAsMcReszVsRadiusAntiLambda);
1235
1236 //  fHistAsMcResxAntiLambdaMI           = new TH1F("h1AsMcResxAntiLambdaMI", "#bar{#Lambda}^{0} MI associated;#Delta x (cm);Counts", 50, -0.25, 0.25);
1237 //  fListHist->Add(fHistAsMcResxAntiLambdaMI);
1238 //  fHistAsMcResyAntiLambdaMI           = new TH1F("h1AsMcResyAntiLambdaMI", "#bar{#Lambda}^{0} MI associated;#Delta y (cm);Counts", 50, -0.25, 0.25);
1239 //  fListHist->Add(fHistAsMcResyAntiLambdaMI);
1240 //  fHistAsMcReszAntiLambdaMI           = new TH1F("h1AsMcReszAntiLambdaMI", "#bar{#Lambda}^{0} MI associated;#Delta z (cm);Counts", 50, -0.25, 0.25);
1241 //  fListHist->Add(fHistAsMcReszAntiLambdaMI);
1242 //  fHistAsMcResrVsRadiusAntiLambdaMI   = new TH2F("h2AsMcResrVsRadiusAntiLambdaMI", "#bar{#Lambda}^{0} MI associated;Radius (cm);#Delta r (cm)",8,radius, 50, -0.25, 0.25);
1243 //  fListHist->Add(fHistAsMcResrVsRadiusAntiLambdaMI);
1244 //  fHistAsMcReszVsRadiusAntiLambdaMI   = new TH2F("h2AsMcReszVsRadiusAntiLambdaMI", "#bar{#Lambda}^{0} MI associated;Radius (cm);#Delta z (cm)",8,radius, 50, -0.25, 0.25);
1245 //  fListHist->Add(fHistAsMcReszVsRadiusAntiLambdaMI);
1246
1247   // Pt Resolution
1248   fHistAsMcResPtK0                   = new TH1F("h1AsMcResPtK0","Pt Resolution K^{0};#Delta Pt;Counts",200,-1,1);
1249   fListHist->Add(fHistAsMcResPtK0);
1250 //  fHistAsMcResPtK0MI                 = new TH1F("h1AsMcResPtK0MI","Pt Resolution K^{0} MI;#Delta Pt;Counts",200,-1,1);
1251 //  fListHist->Add(fHistAsMcResPtK0MI);
1252   
1253   fHistAsMcResPtLambda               = new TH1F("h1AsMcResPtLambda","Pt Resolution #Lambda^{0};#Delta Pt;Counts",200,-1,1);
1254   fListHist->Add(fHistAsMcResPtLambda);
1255 //  fHistAsMcResPtLambdaMI             = new TH1F("h1AsMcResPtLambdaMI","Pt Resolution #Lambda^{0} MI;#Delta Pt;Counts",200,-1,1);
1256 //  fListHist->Add(fHistAsMcResPtLambdaMI);
1257
1258   fHistAsMcResPtAntiLambda           = new TH1F("h1AsMcResPtAntiLambda","Pt Resolution #bar{#Lambda}^{0};#Delta Pt;Counts",200,-1,1);
1259   fListHist->Add(fHistAsMcResPtAntiLambda);
1260 //  fHistAsMcResPtAntiLambdaMI         = new TH1F("h1AsMcResPtAntiLambdaMI","Pt Resolution #bar{#Lambda}^{0} MI;#Delta Pt;Counts",200,-1,1);
1261 ///  fListHist->Add(fHistAsMcResPtAntiLambdaMI);
1262
1263
1264   fHistAsMcResPtVsRapK0              = new TH2F("h2AsMcResPtVsRapK0","Pt Resolution K^{0};#Delta Pt;Rap",200,-1,1,20,-1,1);
1265   fListHist->Add(fHistAsMcResPtVsRapK0);
1266 //  fHistAsMcResPtVsRapK0MI            = new TH2F("h2AsMcResPtVsRapK0MI","Pt Resolution K^{0} MI;#Delta Pt;Rap",200,-1,1,20,-1,1);
1267 //  fListHist->Add(fHistAsMcResPtVsRapK0MI);
1268   
1269   fHistAsMcResPtVsRapLambda          = new TH2F("h2AsMcResPtVsRapLambda","Pt Resolution #Lambda^{0};#Delta Pt;Rap",200,-1,1,20,-1,1);
1270   fListHist->Add(fHistAsMcResPtVsRapLambda);
1271 //  fHistAsMcResPtVsRapLambdaMI        = new TH2F("h2AsMcResPtVsRapLambdaMI","Pt Resolution #Lambda^{0} MI;#Delta Pt;Rap",200,-1,1,20,-1,1);
1272 //  fListHist->Add(fHistAsMcResPtVsRapLambdaMI);
1273
1274   fHistAsMcResPtVsRapAntiLambda      = new TH2F("h2AsMcResPtVsRapAntiLambda","Pt Resolution #bar{#Lambda}^{0};#Delta Pt;Rap",200,-1,1,20,-1,1);
1275   fListHist->Add(fHistAsMcResPtVsRapAntiLambda);
1276 //  fHistAsMcResPtVsRapAntiLambdaMI    = new TH2F("h2AsMcResPtVsRapAntiLambdaMI","Pt Resolution #bar{#Lambda}^{0} MI;#Delta Pt;Rap",200,-1,1,20,-1,1);
1277 //  fListHist->Add(fHistAsMcResPtVsRapAntiLambdaMI);
1278
1279
1280   fHistAsMcResPtVsPtK0               = new TH2F("h2AsMcResPtVsPtK0","Pt Resolution K^{0};#Delta Pt;Pt",600,-0.15,0.15,240,0,12);
1281   fListHist->Add(fHistAsMcResPtVsPtK0);
1282 //  fHistAsMcResPtVsPtK0MI             = new TH2F("h2AsMcResPtVsPtK0MI","Pt Resolution K^{0} MI;#Delta Pt;Pt",600,-0.15,0.15,240,0,12);
1283 //  fListHist->Add(fHistAsMcResPtVsPtK0MI);
1284     
1285   fHistAsMcResPtVsPtLambda           = new TH2F("h2AsMcResPtVsPtLambda","Pt Resolution #Lambda^{0};#Delta Pt;Pt",600,-0.15,0.15,240,0,12);
1286   fListHist->Add(fHistAsMcResPtVsPtLambda);
1287 //  fHistAsMcResPtVsPtLambdaMI         = new TH2F("h2AsMcResPtVsPtLambdaMI","Pt Resolution #Lambda^{0} MI;#Delta Pt;Pt",600,-0.15,0.15,240,0,12);
1288 //  fListHist->Add(fHistAsMcResPtVsPtLambdaMI);
1289
1290   fHistAsMcResPtVsPtAntiLambda       = new TH2F("h2AsMcResPtVsPtAntiLambda","Pt Resolution #bar{#Lambda}^{0};#Delta Pt;Pt",300,-0.15,0.15,240,0,12);
1291   fListHist->Add(fHistAsMcResPtVsPtAntiLambda);
1292 //  fHistAsMcResPtVsPtAntiLambdaMI     = new TH2F("h2AsMcResPtVsPtAntiLambdaMI","Pt Resolution #bar{#Lambda}^{0} MI;#Delta Pt;Pt",300,-0.15,0.15,240,0,12);
1293 //  fListHist->Add(fHistAsMcResPtVsPtAntiLambdaMI);
1294
1295
1296   // pdgcode of mother
1297   fHistAsMcMotherPdgCodeK0s           = new TH1F("h1AsMcMotherPdgCodeK0s","Mother of Associated K^{0};mother;counts",11,0,11);
1298   fListHist->Add(fHistAsMcMotherPdgCodeK0s);
1299 //  fHistAsMcMotherPdgCodeK0sMI         = new TH1F("h1AsMcMotherPdgCodeK0sMI","Mother of Associated K^{0} MI;mother;counts",11,0,11);
1300 //  fListHist->Add(fHistAsMcMotherPdgCodeK0sMI);
1301
1302   fHistAsMcMotherPdgCodeLambda        = new TH1F("h1AsMcMotherPdgCodeLambda","Mother of Associated #Lambda^{0};mother;counts",11,0,11);
1303   fListHist->Add(fHistAsMcMotherPdgCodeLambda);
1304 //  fHistAsMcMotherPdgCodeLambdaMI      = new TH1F("h1AsMcMotherPdgCodeLambdaMI","Mother of Associated #Lambda^{0} MI;mother;counts",11,0,11);
1305 //  fListHist->Add(fHistAsMcMotherPdgCodeLambdaMI);
1306
1307   fHistAsMcMotherPdgCodeAntiLambda    = new TH1F("h1AsMcMotherPdgCodeAntiLambda","Mother of Associated #bar{#Lambda}^{0};mother;counts",11,0,11);
1308   fListHist->Add(fHistAsMcMotherPdgCodeAntiLambda);
1309 //  fHistAsMcMotherPdgCodeAntiLambdaMI  = new TH1F("h1AsMcMotherPdgCodeAntiLambdaMI","Mother of Associated #bar{Lambda}^{0} MI;mother;counts",11,0,11);
1310 //  fListHist->Add(fHistAsMcMotherPdgCodeAntiLambdaMI);
1311
1312
1313   // Pt distribution Lambda from Sigma
1314   fHistAsMcPtLambdaFromSigma          = new TH1F("h1AsMcPtLambdaFromSigma","#Lambda}^{0} associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1315   fListHist->Add(fHistAsMcPtLambdaFromSigma);
1316 //  fHistAsMcPtLambdaFromSigmaMI        = new TH1F("h1AsMcPtLambdaFromSigmaMI","#Lambda^{0} MI associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1317 //  fListHist->Add(fHistAsMcPtLambdaFromSigmaMI);
1318
1319   fHistAsMcPtAntiLambdaFromSigma      = new TH1F("h1AsMcPtAntiLambdaFromSigma","#bar{#Lambda}^{0} associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1320   fListHist->Add(fHistAsMcPtAntiLambdaFromSigma);
1321 //  fHistAsMcPtAntiLambdaFromSigmaMI    = new TH1F("h1AsMcPtAntiLambdaFromSigmaMI","#bar{#Lambda}^{0} MI associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1322 //  fListHist->Add(fHistAsMcPtAntiLambdaFromSigmaMI);
1323
1324
1325   // Associated secondary particles:
1326   // Pt and rapidity distribution
1327   fHistAsMcSecondaryPtVsRapK0s          = new TH2F("h2AsMcSecondaryPtVsRapK0s", "K^{0} associated secondary;p_{t} (GeV/c);rapidity",240,0,12,30,-1.5,1.5);
1328   fListHist->Add(fHistAsMcSecondaryPtVsRapK0s);
1329 //  fHistAsMcSecondaryPtVsRapK0sMI        = new TH2F("h2AsMcSecondaryPtVsRapK0sMI", "K^{0} MI associated secondary;p_{t} (GeV/c);rapidity",240,0,12,30,-1.5,1.5);
1330 //  fListHist->Add(fHistAsMcSecondaryPtVsRapK0sMI);
1331
1332   fHistAsMcSecondaryPtVsRapLambda       = new TH2F("h2AsMcSecondaryPtVsRapLambda", "#Lambda^{0} associated secondary;p_{t} (GeV/c);rapidity",240,0,12,30,-1.5,1.5);
1333   fListHist->Add(fHistAsMcSecondaryPtVsRapLambda);
1334 //  fHistAsMcSecondaryPtVsRapLambdaMI     = new TH2F("h2AsMcSecondaryPtVsRapLambdaMI", "#Lambda^{0} MI associated secondary;p_{t} (GeV/c);rapidity",240,0,12,30,-1.5,1.5);
1335 //  fListHist->Add(fHistAsMcSecondaryPtVsRapLambdaMI);
1336
1337   fHistAsMcSecondaryPtVsRapAntiLambda   = new TH2F("h2AsMcSecondaryPtVsRapAntiLambda", "#bar{#Lambda}^{0} associated secondary;p_{t} (GeV/c);rapidity",240,0,12,30,-1.5,1.5);
1338   fListHist->Add(fHistAsMcSecondaryPtVsRapAntiLambda);
1339 //  fHistAsMcSecondaryPtVsRapAntiLambdaMI = new TH2F("h2AsMcSecondaryPtVsRapAntiLambdaMI", "#bar{#Lambda}^{0} MI associated secondary;p_{t} (GeV/c);rapidity",240,0,12,30,-1.5,1.5);
1340 //  fListHist->Add(fHistAsMcSecondaryPtVsRapAntiLambdaMI);
1341
1342   // Production radius
1343   fHistAsMcSecondaryProdRadiusK0s              = new TH1F("h1AsMcSecondaryProdRadiusK0s", "K^{0} Production Radius;r (cm);Count", 170, -2, 15);
1344   fListHist->Add(fHistAsMcSecondaryProdRadiusK0s);
1345 //  fHistAsMcSecondaryProdRadiusK0sMI            = new TH1F("h1AsMcSecondaryProdRadiusK0sMI", "K^{0} MI Production Radius;r (cm);Count", 170, -2, 15);
1346 //  fListHist->Add(fHistAsMcSecondaryProdRadiusK0sMI);
1347
1348   fHistAsMcSecondaryProdRadiusLambda           = new TH1F("h1AsMcSecondaryProdRadiusLambda", "#Lambda^{0} Production Radius;r (cm);Count", 170, -2, 15);
1349   fListHist->Add(fHistAsMcSecondaryProdRadiusLambda);
1350 //  fHistAsMcSecondaryProdRadiusLambdaMI         = new TH1F("h1AsMcSecondaryProdRadiusLambdaMI", "#Lambda^{0} MI Production Radius;r (cm);Count", 170, -2, 15);
1351 //  fListHist->Add(fHistAsMcSecondaryProdRadiusLambdaMI);
1352
1353   fHistAsMcSecondaryProdRadiusAntiLambda       = new TH1F("h1AsMcSecondaryProdRadiusAntiLambda", "#bar{#Lambda}^{0} Production Radius;r (cm);Count", 170, -2, 15);
1354   fListHist->Add(fHistAsMcSecondaryProdRadiusAntiLambda);  
1355 //  fHistAsMcSecondaryProdRadiusAntiLambdaMI     = new TH1F("h1AsMcSecondaryProdRadiusAntiLambdaMI", "#bar{#Lambda}^{0} MI Production Radius;r (cm);Count", 170, -2, 15);
1356 //  fListHist->Add(fHistAsMcSecondaryProdRadiusAntiLambdaMI);
1357
1358   fHistAsMcSecondaryProdRadiusXvsYK0s          = new TH2F("h2AsMcSecondaryProdRadiusXvsYK0s","Associated Secondary K^{0} Production Radius;x (cm); y (cm)",200,-20,20,200,-20,20);
1359   fListHist->Add(fHistAsMcSecondaryProdRadiusXvsYK0s);
1360 //  fHistAsMcSecondaryProdRadiusXvsYK0sMI        = new TH2F("h2AsMcSecondaryProdRadiusXvsYK0sMI","Associated Secondary K^{0} Production Radius;x (cm); y (cm)",200,-20,20,200,-20,20);
1361 //  fListHist->Add(fHistAsMcSecondaryProdRadiusXvsYK0sMI);
1362
1363   fHistAsMcSecondaryProdRadiusXvsYLambda       = new TH2F("h2AsMcSecondaryProdRadiusXvsYLambda","Associated Secondary #Lambda^{0} Production Radius;x (cm); y (cm)",200,-20,20,200,-20,20);
1364   fListHist->Add(fHistAsMcSecondaryProdRadiusXvsYLambda);
1365 //  fHistAsMcSecondaryProdRadiusXvsYLambdaMI     = new TH2F("h2AsMcSecondaryProdRadiusXvsYLambdaMI","Associated Secondary #Lambda^{0} Production Radius;x (cm); y (cm)",200,-20,20,200,-20,20);
1366 //  fListHist->Add(fHistAsMcSecondaryProdRadiusXvsYLambdaMI);
1367
1368   fHistAsMcSecondaryProdRadiusXvsYAntiLambda   = new TH2F("h2AsMcSecondaryProdRadiusXvsYAntiLambda","Associated Secondary #bar{#Lambda}^{0} Production Radius;x (cm); y (cm)",200,-20,20,200,-20,20);
1369   fListHist->Add(fHistAsMcSecondaryProdRadiusXvsYAntiLambda);
1370 //  fHistAsMcSecondaryProdRadiusXvsYAntiLambdaMI = new TH2F("h2AsMcSecondaryProdRadiusXvsYAntiLambdaMI","Associated Secondary #bar{#Lambda}^{0} Production Radius;x (cm); y (cm)",200,-20,20,200,-20,20);
1371 //  fListHist->Add(fHistAsMcSecondaryProdRadiusXvsYAntiLambdaMI);
1372
1373   fHistAsMcSecondaryMotherPdgCodeK0s           = new TH1F("h1AsMcSecondaryMotherPdgCodeK0s","Mother of Associated Secondary K^{0};mother;counts",11,0,11);
1374   fListHist->Add(fHistAsMcSecondaryMotherPdgCodeK0s);
1375 //  fHistAsMcSecondaryMotherPdgCodeK0sMI         = new TH1F("h1AsMcSecondaryMotherPdgCodeK0sMI","Mother of Associated Secondary K^{0} MI;mother;counts",11,0,11);
1376 //  fListHist->Add(fHistAsMcSecondaryMotherPdgCodeK0sMI);
1377
1378   fHistAsMcSecondaryMotherPdgCodeLambda        = new TH1F("h1AsMcSecondaryMotherPdgCodeLambda","Mother of Associated Secondary #Lambda^{0};mother;counts",11,0,11);
1379   fListHist->Add(fHistAsMcSecondaryMotherPdgCodeLambda);
1380 //  fHistAsMcSecondaryMotherPdgCodeLambdaMI      = new TH1F("h1AsMcSecondaryMotherPdgCodeLambdaMI","Mother of Associated Secondary #Lambda^{0} MI;mother;counts",11,0,11);
1381 //  fListHist->Add(fHistAsMcSecondaryMotherPdgCodeLambdaMI);
1382
1383   fHistAsMcSecondaryMotherPdgCodeAntiLambda    = new TH1F("h1AsMcSecondaryMotherPdgCodeAntiLambda","Mother of Associated Secondary #bar{#Lambda}^{0};mother;counts",11,0,11);
1384   fListHist->Add(fHistAsMcSecondaryMotherPdgCodeAntiLambda);
1385 //  fHistAsMcSecondaryMotherPdgCodeAntiLambdaMI  = new TH1F("h1AsMcSecondaryMotherPdgCodeAntiLambdaMI","Mother of Associated Secondary #bar{Lambda}^{0} MI;mother;counts",11,0,11);
1386 //  fListHist->Add(fHistAsMcSecondaryMotherPdgCodeAntiLambdaMI);
1387
1388   // Pt distribution Lambda from Sigma
1389   fHistAsMcSecondaryPtLambdaFromSigma          = new TH1F("h1AsMcSecondaryPtLambdaFromSigma","#Lambda}^{0} associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1390   fListHist->Add(fHistAsMcSecondaryPtLambdaFromSigma);
1391 //  fHistAsMcSecondaryPtLambdaFromSigmaMI        = new TH1F("h1AsMcSecondaryPtLambdaFromSigmaMI","#Lambda^{0} MI associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1392 //  fListHist->Add(fHistAsMcSecondaryPtLambdaFromSigmaMI);
1393
1394   fHistAsMcSecondaryPtAntiLambdaFromSigma      = new TH1F("h1AsMcSecondaryPtAntiLambdaFromSigma","#bar{#Lambda}^{0} associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1395   fListHist->Add(fHistAsMcSecondaryPtAntiLambdaFromSigma);
1396 //  fHistAsMcSecondaryPtAntiLambdaFromSigmaMI    = new TH1F("h1AsMcSecondaryPtAntiLambdaFromSigmaMI","#bar{#Lambda}^{0} MI associated from Sigma;p_{t} (GeV/c);Count",240,0,12);
1397 //  fListHist->Add(fHistAsMcSecondaryPtAntiLambdaFromSigmaMI);
1398
1399   PostData(1, fListHist);
1400   PostData(2, fCentrSelector);
1401
1402 }
1403
1404 //________________________________________________________________________
1405 void AliAnalysisTaskPerformanceStrange::UserExec(Option_t *) 
1406 {
1407   // Main loop
1408   // Called for each event
1409
1410   AliStack* stack = NULL;
1411   TClonesArray *mcArray = NULL;
1412   TArrayF mcPrimaryVtx;
1413
1414   fESD=(AliESDEvent *)InputEvent();
1415
1416   if (!fESD) {
1417     Printf("ERROR: fESD not available");
1418     return;
1419   }
1420
1421
1422   AliVEvent* lEvent = InputEvent();
1423   
1424   if (!lEvent) {
1425     Printf("ERROR: Event not available");
1426     return;
1427   }
1428
1429   fHistNumberEvents->Fill(0.5);
1430
1431   //******************
1432   // Trigger Selection ! Warning Works only for ESD, add protection in case of AOD loop
1433   //******************
1434
1435   Bool_t isSelected = 
1436     (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() 
1437      & AliVEvent::kMB);
1438   if (!isSelected) return;
1439   
1440   // Centrality selection
1441   static AliESDtrackCuts * trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); // FIXME: make it a data member
1442   Bool_t isCentralitySelected = fCentrSelector->IsCentralityBinSelected(fESD,trackCuts); // FIXME esd track cuts if needed  
1443   if(!isCentralitySelected) return;
1444   // FIXME: add to hist number events another entry for centrality.
1445
1446  // Done by the AliPhysicsSelection Task ! Only the selected events are passed to this task
1447
1448   fHistNumberEvents->Fill(1.5);
1449
1450
1451   //*************************
1452   //End track multiplicity
1453   //*************************
1454
1455
1456   // Remove Events with no tracks
1457   //if (!(fESD->GetNumberOfTracks()))  return;
1458
1459   fHistNumberEvents->Fill(2.5);
1460   fHistTrackPerEvent->Fill(fESD->GetNumberOfTracks());
1461
1462   //*************************************
1463   // Cut used:
1464   //*************************************
1465       
1466   // Cut Rapidity:
1467   Double_t lCutRap  = 0.75;
1468
1469   // Cut AliKF Chi2 for Reconstructed particles
1470   Double_t cutChi2KF  = 1E3;
1471
1472   // If PID is used:
1473   Double_t lLimitPPID    = 0.7;
1474   Float_t cutNSigmaLowP  = 1E3;
1475   Float_t cutNSigmaHighP = 1E3;
1476   if (fUsePID.Contains("withPID")) {
1477     cutNSigmaLowP  = 5.0;
1478     cutNSigmaHighP = 3.0;
1479   }
1480
1481
1482   // Cut Daughters pt (GeV/c):
1483   Double_t cutMinPtDaughter = 0.160;
1484
1485   // Cut primary vertex:
1486   Double_t cutPrimVertex = 10.0;
1487
1488   // Min number of TPC clusters:
1489   Int_t nbMinTPCclusters = 80;
1490
1491   //*******************
1492   // PID parameters:
1493   //*******************
1494       
1495   Double_t fAlephParameters[5] = {0,0,0,0,0,};
1496
1497   fAlephParameters[0] = 0.0283086;
1498   fAlephParameters[1] = 2.63394e+01;
1499   fAlephParameters[2] = 5.04114e-11;
1500   fAlephParameters[3] = 2.12543e+00;
1501   fAlephParameters[4] = 4.88663e+00; 
1502
1503
1504   //*******************
1505   // Access MC:
1506   //*******************
1507   if (fAnalysisMC) {
1508     if(fAnalysisType == "ESD") {
1509       AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
1510       if (!eventHandler) {
1511         Printf("ERROR: Could not retrieve MC event handler");
1512         return;
1513       }    
1514       AliMCEvent* mcEvent = eventHandler->MCEvent();
1515       if (!mcEvent) {
1516         Printf("ERROR: Could not retrieve MC event");
1517         return;
1518       }    
1519       stack = mcEvent->Stack();
1520       if (!stack) {
1521         Printf("ERROR: Could not retrieve stack");
1522         return;
1523       }
1524       
1525       AliGenEventHeader* mcHeader=mcEvent->GenEventHeader();
1526       if(!mcHeader) return;
1527       mcHeader->PrimaryVertex(mcPrimaryVtx);
1528       
1529     }
1530     
1531     else if(fAnalysisType == "AOD") {
1532       
1533       // load MC particles
1534       mcArray = (TClonesArray*)fESD->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1535       if(!mcArray) {
1536         Printf("strange analysis::UserExec: MC particles branch not found!\n");
1537         return;
1538       }
1539       
1540       // load MC header
1541       AliAODMCHeader *mcHeader = 
1542         (AliAODMCHeader*)fESD->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1543       if(!mcHeader) {
1544         Printf("strange analysis::UserExec: MC header branch not found!\n");
1545         return;
1546       }
1547     }
1548
1549     // PID parameters for MC simulations:
1550     fAlephParameters[0] = 2.15898e+00/50.;
1551     fAlephParameters[1] = 1.75295e+01;
1552     fAlephParameters[2] = 3.40030e-09;
1553     fAlephParameters[3] = 1.96178e+00;
1554     fAlephParameters[4] = 3.91720e+00; 
1555   }
1556
1557
1558   //**********************************************
1559   // MC loop
1560   //**********************************************
1561
1562   Double_t lmcPrimVtxR      = 0;
1563
1564   Int_t lNbMCPrimary        = 0;
1565   Int_t lNbMCPart           = 0;
1566
1567   Int_t lPdgcodeCurrentPart = 0;
1568   Double_t lRapCurrentPart  = 0;
1569   Double_t lPtCurrentPart   = 0;
1570   
1571   Int_t lComeFromSigma      = 0;
1572
1573   
1574   // Production Radius
1575   Double_t mcPosX     = 0.0,  mcPosY      = 0.0,  mcPosZ      = 0.0;
1576   Double_t mcPosR     = 0.0;
1577
1578   // Decay Radius
1579   Double_t mcDecayPosX = 0, mcDecayPosY = 0, mcDecayPosR = 0;
1580
1581   // current mc particle 's mother
1582   Int_t iCurrentMother  = 0, lPdgCurrentMother    = 0;
1583   Bool_t lCurrentMotherIsPrimary;
1584
1585   // current mc particles 's daughter:
1586   Int_t lPdgCurrentDaughter0 = 0, lPdgCurrentDaughter1 = 0; 
1587
1588   // variables for multiple reconstruction studies:
1589   Int_t id0           = 0, id1          = 0;
1590   //Int_t lLabelTrackN  = 0, lLabelTrackP = 0;
1591   //Int_t lPartNMother  = 0, lPartPMother = 0;
1592   //Int_t lPartPMotherPDGcode      = 0;
1593   Int_t lNtimesReconstructedK0s   = 0, lNtimesReconstructedLambda   = 0, lNtimesReconstructedAntiLambda   = 0;
1594  // Int_t lNtimesReconstructedK0sMI = 0, lNtimesReconstructedLambdaMI = 0, lNtimesReconstructedAntiLambdaMI = 0;
1595
1596   //****************************
1597   // Start loop over MC particles
1598   if (fAnalysisMC) {
1599
1600     // Primary vertex
1601     fHistMCPrimaryVertexX->Fill(mcPrimaryVtx.At(0));
1602     fHistMCPrimaryVertexY->Fill(mcPrimaryVtx.At(1));
1603     fHistMCPrimaryVertexZ->Fill(mcPrimaryVtx.At(2));
1604     
1605     lmcPrimVtxR = TMath::Sqrt(mcPrimaryVtx.At(0)*mcPrimaryVtx.At(0)+mcPrimaryVtx.At(1)*mcPrimaryVtx.At(1));
1606   
1607
1608     if(fAnalysisType == "ESD") {
1609       
1610       lNbMCPrimary = stack->GetNprimary();
1611       lNbMCPart    = stack->GetNtrack();
1612       
1613       fHistMCMultiplicityPrimary->Fill(lNbMCPrimary);
1614       fHistMCMultiplicityTracks->Fill(lNbMCPart);
1615       
1616       
1617       for (Int_t iMc = 0; iMc < (stack->GetNtrack()); iMc++) {  
1618         TParticle *p0 = stack->Particle(iMc);
1619         if (!p0) {
1620           //Printf("ERROR: particle with label %d not found in stack (mc loop)", iMc);
1621           continue;
1622         }
1623         lPdgcodeCurrentPart = p0->GetPdgCode();
1624         
1625         // Keep only K0s, Lambda and AntiLambda, Xi and Phi:
1626         if ( (lPdgcodeCurrentPart != 310 ) && (lPdgcodeCurrentPart != 3122 ) && (lPdgcodeCurrentPart != -3122 ) && (lPdgcodeCurrentPart != 3312 ) && (lPdgcodeCurrentPart != -3312) && (lPdgcodeCurrentPart != -333) ) continue;
1627         
1628         lRapCurrentPart   = MyRapidity(p0->Energy(),p0->Pz());
1629         //lEtaCurrentPart   = p0->Eta();
1630         lPtCurrentPart    = p0->Pt();
1631
1632         iCurrentMother    = p0->GetFirstMother();
1633
1634 //      lPdgCurrentMother = stack->Particle(iCurrentMother)->GetPdgCode();
1635         if (iCurrentMother == -1){lPdgCurrentMother=0; } else {lPdgCurrentMother = stack->Particle(iCurrentMother)->GetPdgCode();}      
1636
1637         mcPosX = p0->Vx();
1638         mcPosY = p0->Vy();
1639         mcPosZ = p0->Vz();
1640         mcPosR = TMath::Sqrt(mcPosX*mcPosX+mcPosY*mcPosY);
1641         
1642         id0  = p0->GetDaughter(0);
1643         id1  = p0->GetDaughter(1);
1644
1645         // Decay Radius and Production Radius
1646         if ( id0 <= lNbMCPart && id0 > 0 && id1 <= lNbMCPart && id1 > 0) {
1647           TParticle *pDaughter0 = stack->Particle(id0);
1648           TParticle *pDaughter1 = stack->Particle(id1);
1649           lPdgCurrentDaughter0 = pDaughter0->GetPdgCode();
1650           lPdgCurrentDaughter1 = pDaughter1->GetPdgCode();
1651           
1652           mcDecayPosX = pDaughter0->Vx();
1653           mcDecayPosY = pDaughter0->Vy();
1654           mcDecayPosR = TMath::Sqrt(mcDecayPosX*mcDecayPosX+mcDecayPosY*mcDecayPosY);
1655         }
1656         else  {
1657           //FIXME: shouldn't this be a fatal?
1658           //Printf("ERROR: particle with label %d and/or %d not found in stack (mc loop)", id0,id1);
1659           mcDecayPosR = -1.0;
1660         }
1661         
1662         if (lPdgcodeCurrentPart==310)   {
1663           fHistMCtracksProdRadiusK0s->Fill(mcPosX,mcPosY);
1664           fHistMCtracksDecayRadiusK0s->Fill(mcDecayPosR);
1665           if (TMath::Abs(lRapCurrentPart) < lCutRap) fHistMCPtAllK0s->Fill(lPtCurrentPart);
1666         }
1667         else if (lPdgcodeCurrentPart==3122)  {
1668           fHistMCtracksProdRadiusLambda->Fill(mcPosX,mcPosY);
1669           fHistMCtracksDecayRadiusLambda->Fill(mcDecayPosR);
1670           if (TMath::Abs(lRapCurrentPart) < lCutRap) fHistMCPtAllLambda->Fill(lPtCurrentPart);
1671         }
1672         else if (lPdgcodeCurrentPart==-3122) {
1673           fHistMCtracksProdRadiusAntiLambda->Fill(mcPosX,mcPosY);
1674           fHistMCtracksDecayRadiusAntiLambda->Fill(mcDecayPosR);
1675           if (TMath::Abs(lRapCurrentPart) < lCutRap) fHistMCPtAllAntiLambda->Fill(lPtCurrentPart);
1676         }
1677         
1678           // FIXME: not sure if I understand this: is it correct?
1679         if ( ( ( TMath::Abs(lPdgCurrentMother) == 3212)  ||
1680                ( TMath::Abs(lPdgCurrentMother) == 3224)  ||
1681                ( TMath::Abs(lPdgCurrentMother) == 3214)  ||
1682                ( TMath::Abs(lPdgCurrentMother) == 3114) )
1683              && ( iCurrentMother <= lNbMCPrimary )
1684              ) lComeFromSigma = 1;
1685         else lComeFromSigma = 0;
1686         
1687         //*********************************************
1688         // Now keep only primary particles   
1689         if ( ( iMc > lNbMCPrimary ) && (!lComeFromSigma) ) continue;
1690
1691         //********************************************
1692         //check if V0 is reconstructed several times  
1693      
1694         lNtimesReconstructedK0s   = 0; lNtimesReconstructedLambda   = 0; lNtimesReconstructedAntiLambda   = 0;
1695         //lNtimesReconstructedK0sMI = 0; lNtimesReconstructedLambdaMI = 0; lNtimesReconstructedAntiLambdaMI = 0;
1696
1697         //for (Int_t jV0 = 0; jV0 < fESD->GetNumberOfV0s(); jV0++) {
1698         
1699         //lLabelTrackN  = 0; lLabelTrackP = 0;
1700         //lPartNMother  = 0; lPartPMother = 0;
1701         
1702         //AliESDv0    *vertexESD = ((AliESDEvent*)fESD)->GetV0(jV0);
1703         //if (!vertexESD) continue;
1704         
1705         //AliESDtrack *trackNESD = ((AliESDEvent*)fESD)->GetTrack(TMath::Abs(vertexESD->GetNindex()));
1706         //lLabelTrackN = (UInt_t)TMath::Abs(trackNESD->GetLabel());
1707         //if (lLabelTrackN!=id0 && lLabelTrackN!=id1) continue;
1708         
1709         //AliESDtrack *trackPESD = ((AliESDEvent*)fESD)->GetTrack(TMath::Abs(vertexESD->GetPindex()));
1710         //lLabelTrackP = (UInt_t)TMath::Abs(trackPESD->GetLabel());
1711         //if (lLabelTrackP!=id0 && lLabelTrackP!=id1) continue;
1712         
1713         //TParticle   *lPartNESD = stack->Particle(lLabelTrackN);
1714         //TParticle   *lPartPESD = stack->Particle(lLabelTrackP);
1715         //lPartNMother = lPartNESD->GetFirstMother();
1716         //lPartPMother = lPartPESD->GetFirstMother();
1717         
1718         //lPartPMotherPDGcode = stack->Particle(lPartPMother)->GetPdgCode();
1719         
1720         //switch (vertexESD->GetOnFlyStatus()){
1721         
1722         //case 0 : 
1723         //if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==310) ) lNtimesReconstructedK0s++;
1724         //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==3122) ) lNtimesReconstructedLambda++;
1725         //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==-3122) ) lNtimesReconstructedAntiLambda++;
1726         //break;
1727         
1728         //case 1 :
1729         //if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==310) ) lNtimesReconstructedK0sMI++;
1730         //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==3122) ) lNtimesReconstructedLambdaMI++;
1731         //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==-3122) ) lNtimesReconstructedAntiLambdaMI++;
1732         //break;
1733         
1734         //}     
1735         //} // end loop over reconstructed V0s inside MC loop
1736 ;
1737  
1738         // Rap distribution
1739         if (lPdgcodeCurrentPart==310) {
1740           fHistMCRapK0s->Fill(lRapCurrentPart);
1741           if (lPtCurrentPart < 0.2 && lPtCurrentPart < 3.0)
1742             fHistMCRapInPtRangeK0s->Fill(lRapCurrentPart);
1743         }
1744
1745         if (lPdgcodeCurrentPart==3122) {
1746           fHistMCRapLambda->Fill(lRapCurrentPart);
1747           if (lPtCurrentPart < 0.6 && lPtCurrentPart < 3.5)
1748             fHistMCRapInPtRangeLambda->Fill(lRapCurrentPart);
1749         }
1750
1751         if (lPdgcodeCurrentPart==-3122) {
1752           fHistMCRapAntiLambda->Fill(lRapCurrentPart);
1753           if (lPtCurrentPart < 0.6 && lPtCurrentPart < 3.5)
1754             fHistMCRapInPtRangeAntiLambda->Fill(lRapCurrentPart);
1755         }
1756
1757         if (lPdgcodeCurrentPart==3312 || lPdgcodeCurrentPart==-3312) {
1758           fHistMCRapXi->Fill(lRapCurrentPart);
1759           if (lPtCurrentPart < 0.6 && lPtCurrentPart < 3.0)
1760             fHistMCRapInPtRangeXi->Fill(lRapCurrentPart);
1761         }
1762
1763         if (lPdgcodeCurrentPart==333) {
1764           fHistMCRapPhi->Fill(lRapCurrentPart);
1765           if (lPtCurrentPart < 0.7 && lPtCurrentPart < 3.0)
1766             fHistMCRapInPtRangePhi->Fill(lRapCurrentPart);
1767         }
1768  
1769         // Rapidity Cut
1770         if (TMath::Abs(lRapCurrentPart) > lCutRap) continue;
1771  
1772         if (lPdgcodeCurrentPart==310) {
1773           fHistMCProdRadiusK0s->Fill(mcPosR);
1774
1775           fHistMCPtK0s->Fill(lPtCurrentPart);
1776
1777
1778
1779           fHistNTimesRecK0s->Fill(lNtimesReconstructedK0s);
1780         //  fHistNTimesRecK0sMI->Fill(lNtimesReconstructedK0s);
1781           fHistNTimesRecK0sVsPt->Fill(lPtCurrentPart,lNtimesReconstructedK0s);
1782         //  fHistNTimesRecK0sVsPtMI->Fill(lPtCurrentPart,lNtimesReconstructedK0sMI);
1783         }
1784         else 
1785         if (lPdgcodeCurrentPart==3122) {
1786           fHistMCProdRadiusLambda->Fill(mcPosR);
1787
1788           fHistMCPtLambda->Fill(lPtCurrentPart);          
1789
1790
1791           fHistNTimesRecLambda->Fill(lNtimesReconstructedLambda);
1792         //  fHistNTimesRecLambdaMI->Fill(lNtimesReconstructedLambdaMI);
1793           fHistNTimesRecLambdaVsPt->Fill(lPtCurrentPart,lNtimesReconstructedLambda);
1794          // fHistNTimesRecLambdaVsPtMI->Fill(lPtCurrentPart,lNtimesReconstructedLambdaMI);
1795           if (lComeFromSigma) fHistMCPtLambdaFromSigma->Fill(lPtCurrentPart);
1796
1797           //printf("found Lambda MC pT=%e\n",lPtCurrentPart);
1798           //printf("found Lambda MC Plabel=%d PPDGcode=%d Nlabel=%d NPDGcode=%d\n\n",id0,lPdgCurrentDaughter0,id1,lPdgCurrentDaughter1); 
1799           
1800         }
1801
1802         
1803       } // end loop ESD MC
1804       
1805     } // end ESD condition
1806
1807     else if(fAnalysisType == "AOD") {
1808       lNbMCPart = mcArray->GetEntriesFast();
1809       lNbMCPrimary = 0;
1810       
1811       fHistMCMultiplicityTracks->Fill(lNbMCPart);
1812       
1813       for (Int_t iMc = 0; iMc < lNbMCPart; iMc++) {  
1814         
1815         // Primary vertex TO DO !!
1816         //
1817         
1818         AliAODMCParticle *mcAODPart = (AliAODMCParticle*)mcArray->At(iMc);
1819         if (!mcAODPart) {
1820           //Printf("Strange analysis task (mc loop): particle with label %d not found", iMc);
1821           continue;
1822         }
1823         lPdgcodeCurrentPart = mcAODPart->GetPdgCode();
1824         if (mcAODPart->IsPhysicalPrimary()) {lNbMCPrimary = lNbMCPrimary +1;}
1825         
1826         // Keep only K0s, Lambda and AntiLambda:
1827         if ( (lPdgcodeCurrentPart != 310 ) && (lPdgcodeCurrentPart != 3122 ) && (lPdgcodeCurrentPart != -3122 ) ) continue;
1828         
1829         //lEtaCurrentPart   = mcAODPart->Eta();
1830         lRapCurrentPart   = mcAODPart->Y();
1831         lPtCurrentPart    = mcAODPart->Pt();
1832         iCurrentMother    = mcAODPart->GetMother();
1833         lPdgCurrentMother = ((AliAODMCParticle*)mcArray->At(iCurrentMother))->GetPdgCode();
1834         lCurrentMotherIsPrimary = ((AliAODMCParticle*)mcArray->At(iCurrentMother))->IsPhysicalPrimary();
1835         
1836         mcPosX = mcAODPart->Xv();
1837         mcPosY = mcAODPart->Yv();
1838         mcPosZ = mcAODPart->Zv();
1839         mcPosR = TMath::Sqrt(mcPosX*mcPosX+mcPosY*mcPosY);
1840         
1841         id0  = mcAODPart->GetDaughter(0);
1842         id1  = mcAODPart->GetDaughter(1);
1843         
1844         // Decay Radius and Production Radius
1845         if ( id0 <= lNbMCPart && id0 > 0 && id1 <= lNbMCPart && id1 > 0) {
1846           AliAODMCParticle *mcAODDaughter1 = (AliAODMCParticle*)mcArray->At(id1);
1847           if (!mcAODPart) {
1848             //Printf("Strange analysis task (mc loop): daughter not found");
1849             continue;
1850           }
1851           mcDecayPosX = mcAODDaughter1->Xv();
1852           mcDecayPosY = mcAODDaughter1->Yv();
1853           mcDecayPosR = TMath::Sqrt(mcDecayPosX*mcDecayPosX+mcDecayPosY*mcDecayPosY);
1854         }
1855         else  {
1856           //Printf("ERROR: particle with label %d and/or %d not found in stack (mc loop)", id0,id1);
1857           mcDecayPosR = -1.0;
1858         }
1859         
1860         if (lPdgcodeCurrentPart==310)   {
1861           fHistMCtracksProdRadiusK0s->Fill(mcPosX,mcPosY);
1862           fHistMCtracksDecayRadiusK0s->Fill(mcDecayPosR);
1863           if (TMath::Abs(lRapCurrentPart) < lCutRap) fHistMCPtAllK0s->Fill(lPtCurrentPart);
1864         }
1865         else if (lPdgcodeCurrentPart==3122)  {
1866           fHistMCtracksProdRadiusLambda->Fill(mcPosX,mcPosY);
1867           fHistMCtracksDecayRadiusLambda->Fill(mcDecayPosR);
1868           if (TMath::Abs(lRapCurrentPart) < lCutRap) fHistMCPtAllLambda->Fill(lPtCurrentPart);
1869         }
1870         else if (lPdgcodeCurrentPart==-3122) {
1871           fHistMCtracksProdRadiusAntiLambda->Fill(mcPosX,mcPosY);
1872           fHistMCtracksDecayRadiusAntiLambda->Fill(mcDecayPosR);
1873           if (TMath::Abs(lRapCurrentPart) < lCutRap) fHistMCPtAllAntiLambda->Fill(lPtCurrentPart);
1874         }
1875         
1876         if ( ( ( TMath::Abs(lPdgCurrentMother) == 3212)  ||
1877                ( TMath::Abs(lPdgCurrentMother) == 3224)  ||
1878                ( TMath::Abs(lPdgCurrentMother) == 3214)  ||
1879                ( TMath::Abs(lPdgCurrentMother) == 3114) )
1880              && (lCurrentMotherIsPrimary)
1881              ) lComeFromSigma = 1;
1882         else lComeFromSigma = 0;
1883       
1884         //*********************************************
1885         // Now keep only primary particles 
1886          
1887         // FIX IT !!!!    iMC is not defined !!!! FIX IT also in ESD/AOD loop !!
1888         if ( ( iMc > lNbMCPrimary ) && (!lComeFromSigma) ) continue;
1889
1890         //********************************************
1891         // check if V0 is reconstructed several times  
1892         
1893         //lNtimesReconstructedK0s   = 0; lNtimesReconstructedLambda   = 0; lNtimesReconstructedAntiLambda   = 0;
1894         //lNtimesReconstructedK0sMI = 0; lNtimesReconstructedLambdaMI = 0; lNtimesReconstructedAntiLambdaMI = 0;
1895             
1896         //for (Int_t jV0 = 0; jV0 < fESD->GetNumberOfV0s(); jV0++) {
1897         
1898         //lLabelTrackN  = 0; lLabelTrackP = 0;
1899         //lPartNMother  = 0; lPartPMother = 0;
1900
1901         //AliAODv0    *vertexAOD= ((AliAODEvent*)fESD)->GetV0(jV0);
1902         //if (!vertexAOD) continue;
1903         //printf("enter!!");
1904         //AliVParticle  *trackP  = ((AliVEvent*)fESD)->GetTrack(vertexAOD->GetPosID());
1905         //if (!trackP) continue;
1906         //lLabelTrackP = TMath::Abs(trackP->GetLabel());
1907         //if (lLabelTrackP!=id0 && lLabelTrackP!=id1) continue;
1908        
1909         //AliVParticle  *trackN  = ((AliVEvent*)fESD)->GetTrack(vertexAOD->GetNegID());
1910         //if (!trackN) continue;
1911         //lLabelTrackN = TMath::Abs(trackN->GetLabel());
1912         //if (lLabelTrackN!=id0 && lLabelTrackN!=id1) continue;
1913         
1914         //AliAODMCParticle *lPartNAOD = (AliAODMCParticle*)mcArray->At(lLabelTrackN);
1915         //if (!lPartNAOD) continue;
1916         //AliAODMCParticle *lPartPAOD = (AliAODMCParticle*)mcArray->At(lLabelTrackP);
1917         //if (!lPartPAOD) continue;
1918         
1919         //lPartNMother = lPartNAOD->GetMother();
1920         //lPartPMother = lPartPAOD->GetMother();
1921
1922         //lPartPMotherPDGcode = ((AliAODMCParticle*)mcArray->At(lPartPMother))->GetPdgCode();
1923         
1924         //switch (vertexAOD->GetOnFlyStatus()){
1925           
1926         //case 0 : 
1927           //if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==310) ) lNtimesReconstructedK0s++;
1928           //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==3122) ) lNtimesReconstructedLambda++;
1929           //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==-3122) ) lNtimesReconstructedAntiLambda++;
1930           //break;
1931           
1932         //case 1 :
1933           //if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==310) ) lNtimesReconstructedK0sMI++;
1934           //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==3122) ) lNtimesReconstructedLambdaMI++;
1935           //else if ( (lPartPMother==lPartNMother) && (lPartPMotherPDGcode==-3122) ) lNtimesReconstructedAntiLambdaMI++;
1936           //break;
1937           
1938        ///}     
1939       //} // end loop over reconstructed V0s inside MC loop
1940     
1941         if (TMath::Abs(lRapCurrentPart) > lCutRap) continue;
1942  
1943         if (lPdgcodeCurrentPart==310) {
1944           fHistMCProdRadiusK0s->Fill(mcPosR);
1945           fHistMCPtK0s->Fill(lPtCurrentPart);
1946           fHistNTimesRecK0s->Fill(lNtimesReconstructedK0s);
1947         //  fHistNTimesRecK0sMI->Fill(lNtimesReconstructedK0s);
1948           fHistNTimesRecK0sVsPt->Fill(lPtCurrentPart,lNtimesReconstructedK0s);
1949         //  fHistNTimesRecK0sVsPtMI->Fill(lPtCurrentPart,lNtimesReconstructedK0sMI);
1950         }
1951         else if (lPdgcodeCurrentPart==3122) {
1952           fHistMCProdRadiusLambda->Fill(mcPosR);
1953           fHistMCPtLambda->Fill(lPtCurrentPart);
1954           fHistNTimesRecLambda->Fill(lNtimesReconstructedLambda);
1955         //  fHistNTimesRecLambdaMI->Fill(lNtimesReconstructedLambdaMI);
1956           fHistNTimesRecLambdaVsPt->Fill(lPtCurrentPart,lNtimesReconstructedLambda);
1957         //  fHistNTimesRecLambdaVsPtMI->Fill(lPtCurrentPart,lNtimesReconstructedLambdaMI);
1958           if (lComeFromSigma) fHistMCPtLambdaFromSigma->Fill(lPtCurrentPart);
1959         }
1960         else if (lPdgcodeCurrentPart==-3122) {
1961           fHistMCProdRadiusAntiLambda->Fill(mcPosR);
1962           //fHistMCPtAntiLambda->Fill(lPtCurrentPart);
1963           fHistNTimesRecAntiLambda->Fill(lNtimesReconstructedAntiLambda);
1964         //  fHistNTimesRecAntiLambdaMI->Fill(lNtimesReconstructedAntiLambdaMI);
1965           fHistNTimesRecAntiLambdaVsPt->Fill(lPtCurrentPart,lNtimesReconstructedAntiLambda);
1966         //  fHistNTimesRecAntiLambdaVsPtMI->Fill(lPtCurrentPart,lNtimesReconstructedAntiLambdaMI);
1967           if (lComeFromSigma) fHistMCPtAntiLambdaFromSigma->Fill(lPtCurrentPart);
1968         }
1969
1970       } // end loop over AODMC particles 
1971       fHistMCMultiplicityPrimary->Fill(lNbMCPrimary);
1972       
1973     } // end AOD condition
1974
1975   } // End Loop over MC condition
1976
1977   
1978
1979
1980
1981   //************************************
1982   // ESD or AOD loop 
1983   //************************************
1984
1985   Double_t lMagneticField = 999;
1986
1987   //Multiplcity:
1988   Int_t    nv0sTot= 0, nv0s = 0;
1989 //  Int_t nv0sMI =0;   
1990   // Variables:
1991   Double_t  lV0Position[3];
1992  
1993   Double_t lDcaPosToPrimVertex = 0;
1994   Double_t lDcaNegToPrimVertex = 0;
1995   Double_t lDcaV0Daughters     = 0;
1996   Double_t lV0cosPointAngle    = 0;
1997   Double_t lChi2V0             = 0;
1998   Double_t lV0DecayLength      = 0;
1999   Double_t lV0Radius           = 0;
2000   Double_t lDcaV0ToPrimVertex  = 0;
2001   
2002   Int_t    lOnFlyStatus        = 0;
2003   //Float_t   tdcaPosToPrimVertexXYZ[2], tdcaNegToPrimVertexXYZ[2]; // ..[0] = Impact parameter in XY plane and ..[1] = Impact parameter in Z            
2004   //Double_t  tdcaDaughterToPrimVertex[2];                          // ..[0] = Pos and ..[1] = Neg
2005
2006   
2007
2008   Double_t lInvMassK0s = 0, lInvMassLambda = 0, lInvMassAntiLambda = 0;
2009   Double_t lPtK0s      = 0, lPtLambda      = 0, lPtAntiLambda      = 0;
2010   Double_t lRapK0s     = 0, lRapLambda     = 0, lRapAntiLambda     = 0;
2011   Double_t lEtaK0s     = 0, lEtaLambda     = 0, lEtaAntiLambda     = 0;
2012   Double_t lAlphaV0      = 0, lPtArmV0       = 0;
2013
2014   Double_t lPzK0s      = 0, lPzLambda      = 0, lPzAntiLambda      = 0;
2015
2016
2017   Double_t lV0Eta = 999;
2018   
2019   // to study Associated V0s:
2020   Int_t    lIndexTrackPos       = 0, lIndexTrackNeg         = 0;
2021   UInt_t   lLabelTrackPos       = 0, lLabelTrackNeg         = 0;
2022   Int_t    lCheckPIdK0Short     = 0, lCheckMcK0Short        = 0;
2023   Int_t    lCheckPIdLambda      = 0, lCheckMcLambda         = 0;
2024   Int_t    lCheckPIdAntiLambda  = 0, lCheckMcAntiLambda     = 0;
2025   Int_t    lCheckSecondaryK0s   = 0, lCheckSecondaryLambda  = 0, lCheckSecondaryAntiLambda  = 0;
2026   Int_t    lCheckGamma          = 0;
2027   Double_t mcPosMotherX         = 0, mcPosMotherY           = 0, mcPosMotherZ  = 0;
2028   Double_t mcPosMotherR         = 0;
2029   Double_t mcMotherPt           = 0;
2030
2031   Int_t lIndexPosMother        = 0;
2032   Int_t lIndexNegMother        = 0;
2033   Int_t lIndexMotherOfMother   = 0;
2034   Int_t lPDGCodePosDaughter    = 0;
2035   Int_t lPDGCodeNegDaughter    = 0;
2036   Int_t lPdgcodeMother         = 0;
2037   Int_t lPdgcodeMotherOfMother = 0;
2038
2039   // Reconstructed position
2040   Double_t rcPosXK0s        = 0,  rcPosYK0s        = 0, rcPosZK0s        = 0;
2041   Double_t rcPosRK0s        = 0;
2042   Double_t rcPosXLambda     = 0,  rcPosYLambda     = 0, rcPosZLambda     = 0;
2043   Double_t rcPosRLambda     = 0;
2044   Double_t rcPosXAntiLambda = 0,  rcPosYAntiLambda = 0, rcPosZAntiLambda = 0;
2045   Double_t rcPosRAntiLambda = 0;
2046
2047   // Pt resolution
2048   Double_t deltaPtK0s  = 0, deltaPtLambda  = 0, deltaPtAntiLambda  = 0;
2049
2050   // Daughters
2051   AliESDtrack  *myTrackPos  = NULL;
2052   AliESDtrack  *myTrackNeg  = NULL;
2053   AliVParticle *lVPartPos   = NULL;
2054   AliVParticle *lVPartNeg   = NULL;
2055
2056   // Daughters' momentum:
2057   Double_t  lMomPos[3] = {999,999,999};
2058   Double_t  lMomNeg[3] = {999,999,999};
2059   Double_t  lPtPos = 999, lPtNeg = 999;
2060   Double_t  lPPos = 999, lPNeg = 999;
2061
2062   // Inner Wall parameters:
2063   Double_t  lMomInnerWallPos =999, lMomInnerWallNeg = 999;
2064
2065   // AliKF Chi2 and Armenteros variables
2066   Double_t lChi2KFK0s  = 0, lChi2KFLambda = 0,  lChi2KFAntiLambda = 0;
2067   Double_t lAlphaV0K0s = 0, lAlphaV0Lambda = 0,  lAlphaV0AntiLambda = 0;
2068   Double_t lPtArmV0K0s = 0, lPtArmV0Lambda = 0,  lPtArmV0AntiLambda = 0;
2069   Double_t lQlPos   = 0, lQlNeg   = 0;
2070
2071
2072   // PID
2073   Float_t nSigmaPosPion   = 0;
2074   Float_t nSigmaNegPion   = 0;
2075
2076   Float_t nSigmaPosProton = 0;
2077   Float_t nSigmaNegProton = 0;
2078
2079   Int_t lCheckPIDK0sPosDaughter        = 0, lCheckPIDK0sNegDaughter        = 0;
2080   Int_t lCheckPIDLambdaPosDaughter     = 0, lCheckPIDLambdaNegDaughter     = 0;
2081   Int_t lCheckPIDAntiLambdaPosDaughter = 0, lCheckPIDAntiLambdaNegDaughter = 0;
2082
2083   
2084   
2085   //***********************
2086   // Primary Vertex cuts &
2087   // Magnetic field and Quality tracks cuts 
2088
2089   Double_t  lPrimaryVtxPosition[3];
2090   Double_t  lPrimaryVtxCov[6];
2091   Double_t  lPrimaryVtxChi2 = 999;
2092   Double_t  lResPrimaryVtxX = 999;
2093   Double_t  lResPrimaryVtxY = 999;
2094   Double_t  lResPrimaryVtxZ = 999;
2095      
2096   AliAODVertex *myPrimaryVertex = NULL;
2097   //const AliVVertex *mySPDPrimaryVertex = NULL;
2098
2099   AliESDtrackCuts *myTracksCuts = NULL;
2100      
2101   const AliMultiplicity *myMultiplicty = ((AliESDEvent*)fESD)->GetMultiplicity();
2102
2103   if(fAnalysisType == "ESD") {  
2104   
2105     // Best Primary Vertex:  
2106     const AliESDVertex *myBestPrimaryVertex = ((AliESDEvent*)fESD)->GetPrimaryVertex();
2107     myBestPrimaryVertex = ((AliESDEvent*)fESD)->GetPrimaryVertex();
2108     if (!myBestPrimaryVertex) return;
2109     if (!myBestPrimaryVertex->GetStatus()) return;
2110     fHistNumberEvents->Fill(3.5);
2111     myBestPrimaryVertex->GetXYZ(lPrimaryVtxPosition);
2112     myBestPrimaryVertex->GetCovMatrix(lPrimaryVtxCov);
2113     if ( ( TMath::Abs(lPrimaryVtxPosition[2]) ) > cutPrimVertex) return ;
2114     fHistNumberEvents->Fill(4.5);    
2115     lPrimaryVtxChi2 = myBestPrimaryVertex->GetChi2toNDF();
2116     lResPrimaryVtxX = myBestPrimaryVertex->GetXRes();
2117     lResPrimaryVtxY = myBestPrimaryVertex->GetYRes();
2118     lResPrimaryVtxZ = myBestPrimaryVertex->GetZRes();
2119
2120     // remove TPC-only primary vertex : retain only events with tracking + SPD vertex
2121     const AliESDVertex *mySPDPrimaryVertex = ((AliESDEvent*)fESD)->GetPrimaryVertexSPD();
2122     if (!mySPDPrimaryVertex) return;
2123     fHistSPDPrimaryVertexZ->Fill(mySPDPrimaryVertex->GetZ());
2124     const AliESDVertex *myPrimaryVertexTracking = ((AliESDEvent*)fESD)->GetPrimaryVertexTracks();
2125     if (!myPrimaryVertexTracking) return;
2126     if (!mySPDPrimaryVertex->GetStatus() && !myPrimaryVertexTracking->GetStatus() ) return;
2127     fHistNumberEvents->Fill(5.5);
2128
2129     
2130     myPrimaryVertex = new AliAODVertex(lPrimaryVtxPosition, lPrimaryVtxCov, lPrimaryVtxChi2, NULL, -1, AliAODVertex::kPrimary);
2131     if (!myPrimaryVertex) return;
2132
2133
2134      // Number of Tracklets:
2135     //const AliMultiplicity *myMultiplicty = ((AliESDEvent*)fESD)->GetMultiplicity();
2136     //if (myMultiplicty->GetNumberOfTracklets() < 10) return;
2137     fHistTrackletPerEvent->Fill(myMultiplicty->GetNumberOfTracklets());
2138
2139     lMagneticField = ((AliESDEvent*)fESD)->GetMagneticField();
2140
2141     myTracksCuts = new AliESDtrackCuts();
2142     // require TPC refit
2143     myTracksCuts->SetRequireTPCRefit(kTRUE);
2144     // minimum number of clusters in TPC
2145     myTracksCuts->SetMinNClustersTPC(nbMinTPCclusters);
2146
2147   }
2148   
2149   else if(fAnalysisType == "AOD") {
2150     printf("enter AOD!!");
2151     myPrimaryVertex = ((AliAODEvent*)fESD)->GetPrimaryVertex();
2152     if (!myPrimaryVertex) return;
2153
2154     lPrimaryVtxPosition[0] = myPrimaryVertex->GetX();
2155     lPrimaryVtxPosition[1] = myPrimaryVertex->GetY();
2156     lPrimaryVtxPosition[2] = myPrimaryVertex->GetZ();
2157
2158     // Cut on SPD vertex and fill histo Nevents: FIX it !
2159
2160      // Tracks cuts FIX IT !
2161
2162     // FIX it !!!
2163     lMagneticField = 999;   
2164
2165   }
2166
2167  
2168   fHistPrimaryVertexX->Fill(lPrimaryVtxPosition[0]);
2169   fHistPrimaryVertexY->Fill(lPrimaryVtxPosition[1]);
2170   fHistPrimaryVertexZ->Fill(lPrimaryVtxPosition[2]);
2171   //Double_t lrcPrimVtxR = TMath::Sqrt(lPrimaryVtxPosition[0]*lPrimaryVtxPosition[0]+lPrimaryVtxPosition[0]*lPrimaryVtxPosition[0]);
2172
2173   fHistPrimaryVertexResX->Fill(lResPrimaryVtxX);
2174   fHistPrimaryVertexResY->Fill(lResPrimaryVtxY);
2175   fHistPrimaryVertexResZ->Fill(lResPrimaryVtxZ);
2176
2177
2178   //***********************
2179   // AliKF Primary Vertex
2180
2181   AliKFVertex primaryVtxKF( *myPrimaryVertex );
2182   AliKFParticle::SetField(lMagneticField);
2183
2184
2185   //************************************
2186   // PID
2187
2188   AliESDpid *fESDpid = new AliESDpid(); // FIXME delete
2189   fESDpid->GetTPCResponse().SetBetheBlochParameters(fAlephParameters[0],fAlephParameters[1],fAlephParameters[2],fAlephParameters[3],fAlephParameters[4]); 
2190       
2191
2192
2193   //***Rerun the V0 finder
2194
2195 //  fESD->ResetV0s();
2196 //  AliV0vertexer v0Vertexer;
2197 //  v0Vertexer.SetCuts(fCuts);
2198 //  v0Vertexer.Tracks2V0vertices(fESD);
2199   
2200   //*************************
2201   // V0 loop
2202       
2203   nv0sTot = fESD->GetNumberOfV0s();
2204   if (!nv0sTot) fHistNumberEvents->Fill(6.5);
2205
2206   for (Int_t iV0 = 0; iV0 < nv0sTot; iV0++) {
2207     
2208     // ALiKF
2209     AliKFParticle* negPiKF = NULL;
2210     AliKFParticle* posPiKF = NULL;
2211     AliKFParticle* posPKF  = NULL;
2212     AliKFParticle* negAPKF = NULL;
2213
2214     
2215     lIndexPosMother     = 0; lIndexNegMother     = 0; lIndexMotherOfMother       = 0;
2216     lCheckPIdK0Short    = 0; lCheckMcK0Short     = 0; lCheckSecondaryK0s         = 0;
2217     lCheckPIdLambda     = 0; lCheckMcLambda      = 0; lCheckSecondaryLambda      = 0;
2218     lCheckPIdAntiLambda = 0; lCheckMcAntiLambda  = 0; lCheckSecondaryAntiLambda  = 0;       
2219     lComeFromSigma      = -1;
2220     
2221     
2222     if(fAnalysisType == "ESD") {
2223
2224
2225       AliESDv0 *v0 = ((AliESDEvent*)fESD)->GetV0(iV0);
2226       if (!v0) continue;
2227       
2228       // Primary vertex:
2229       fHistPrimaryVertexPosXV0events->Fill(lPrimaryVtxPosition[0]);
2230       fHistPrimaryVertexPosYV0events->Fill(lPrimaryVtxPosition[1]);
2231       fHistPrimaryVertexPosZV0events->Fill(lPrimaryVtxPosition[2]);
2232       
2233       // V0's Daughters
2234       lIndexTrackPos = TMath::Abs(v0->GetPindex());
2235       lIndexTrackNeg = TMath::Abs(v0->GetNindex());
2236       AliESDtrack *myTrackPosTest = ((AliESDEvent*)fESD)->GetTrack(lIndexTrackPos);
2237       AliESDtrack *myTrackNegTest = ((AliESDEvent*)fESD)->GetTrack(lIndexTrackNeg);
2238       if (!myTrackPosTest || !myTrackNegTest) {
2239         Printf("strange analysis::UserExec:: Error:Could not retreive one of the daughter track\n");
2240         continue;
2241       }
2242       // Remove like-sign
2243       if ( myTrackPosTest->GetSign() == myTrackNegTest->GetSign()){
2244         continue;
2245       } 
2246      
2247       // VO's main characteristics to check the reconstruction cuts
2248       lOnFlyStatus       = v0->GetOnFlyStatus();
2249       lChi2V0            = v0->GetChi2V0();
2250       lDcaV0Daughters    = v0->GetDcaV0Daughters();
2251       lDcaV0ToPrimVertex = v0->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lPrimaryVtxPosition[2]);
2252       lV0cosPointAngle   = v0->GetV0CosineOfPointingAngle(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1], lPrimaryVtxPosition[2]);
2253
2254       v0->GetXYZ(lV0Position[0], lV0Position[1], lV0Position[2]);
2255
2256       lV0Radius      = TMath::Sqrt(lV0Position[0]*lV0Position[0]+lV0Position[1]*lV0Position[1]);
2257       lV0DecayLength = TMath::Sqrt(TMath::Power(lV0Position[0] - lPrimaryVtxPosition[0],2) +
2258                                    TMath::Power(lV0Position[1] - lPrimaryVtxPosition[1],2) +
2259                                    TMath::Power(lV0Position[2] - lPrimaryVtxPosition[2],2 ));
2260
2261
2262       if( myTrackPosTest->GetSign() ==1){
2263         
2264         myTrackPos = ((AliESDEvent*)fESD)->GetTrack(lIndexTrackPos);
2265         myTrackNeg = ((AliESDEvent*)fESD)->GetTrack(lIndexTrackNeg);
2266
2267         // Daughters' momentum;
2268         v0->GetPPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]);
2269         v0->GetNPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
2270
2271         if (negPiKF) delete negPiKF; negPiKF=NULL;
2272         if (posPiKF) delete posPiKF; posPiKF=NULL;
2273         if (posPKF)  delete posPKF;  posPKF=NULL;
2274         if (negAPKF) delete negAPKF; negAPKF=NULL;
2275         
2276         negPiKF = new AliKFParticle( *(v0->GetParamN()) ,-211);
2277         posPiKF = new AliKFParticle( *(v0->GetParamP()) ,211);
2278         posPKF  = new AliKFParticle( *(v0->GetParamP()) ,2212);
2279         negAPKF = new AliKFParticle( *(v0->GetParamN()) ,-2212);
2280         
2281       }
2282            
2283       if( myTrackPosTest->GetSign() ==-1){
2284         
2285         myTrackPos = ((AliESDEvent*)fESD)->GetTrack(lIndexTrackNeg);
2286         myTrackNeg = ((AliESDEvent*)fESD)->GetTrack(lIndexTrackPos);
2287
2288         // Daughters' momentum;
2289         v0->GetPPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
2290         v0->GetNPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]);
2291
2292         if (negPiKF) delete negPiKF; negPiKF=NULL;
2293         if (posPiKF) delete posPiKF; posPiKF=NULL;
2294         if (posPKF)  delete posPKF;  posPKF=NULL;
2295         if (negAPKF) delete negAPKF; negAPKF=NULL;
2296         
2297         negPiKF = new AliKFParticle( *(v0->GetParamP()) ,-211);
2298         posPiKF = new AliKFParticle( *(v0->GetParamN()) ,211);
2299         posPKF  = new AliKFParticle( *(v0->GetParamN()) ,2212);
2300         negAPKF = new AliKFParticle( *(v0->GetParamP()) ,-2212);
2301
2302       }
2303
2304       lLabelTrackPos = (UInt_t)TMath::Abs(myTrackPos->GetLabel());
2305       lLabelTrackNeg = (UInt_t)TMath::Abs(myTrackNeg->GetLabel());
2306
2307       // Daughters Pt and P:
2308       lPtPos = TMath::Sqrt(lMomPos[0]*lMomPos[0] + lMomPos[1]*lMomPos[1]);
2309       lPtNeg = TMath::Sqrt(lMomNeg[0]*lMomNeg[0] + lMomNeg[1]*lMomNeg[1]);
2310
2311       lPPos = TMath::Sqrt(lMomPos[0]*lMomPos[0] + lMomPos[1]*lMomPos[1] + lMomPos[2]*lMomPos[2]);
2312       lPNeg = TMath::Sqrt(lMomNeg[0]*lMomNeg[0] + lMomNeg[1]*lMomNeg[1] + lMomNeg[2]*lMomNeg[2]);
2313
2314       // Inner Wall parameter:
2315       const AliExternalTrackParam *myInnerWallTrackPos = myTrackPos->GetInnerParam(); 
2316       if(myInnerWallTrackPos) lMomInnerWallPos = myInnerWallTrackPos->GetP(); 
2317       const AliExternalTrackParam *myInnerWallTrackNeg = myTrackNeg->GetInnerParam(); 
2318       if(myInnerWallTrackNeg) lMomInnerWallNeg = myInnerWallTrackNeg->GetP(); 
2319               
2320       // DCA between daughter and Primary Vertex:
2321       if (myTrackPos) lDcaPosToPrimVertex = TMath::Abs(myTrackPos->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lMagneticField) );
2322       
2323       if (myTrackNeg) lDcaNegToPrimVertex = TMath::Abs(myTrackNeg->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lMagneticField) );
2324       
2325       // Quality tracks cuts:
2326       if ( !(myTracksCuts->IsSelected(myTrackPos)) || !(myTracksCuts->IsSelected(myTrackNeg)) ) {
2327         if (negPiKF) delete negPiKF; negPiKF=NULL;
2328         if (posPiKF) delete posPiKF; posPiKF=NULL;
2329         if (posPKF)  delete posPKF;  posPKF=NULL;
2330         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2331         continue;
2332       }
2333       // Armenteros variables:
2334       lAlphaV0      =  v0->AlphaV0();
2335       lPtArmV0      =  v0->PtArmV0();
2336
2337       // Pseudorapidity:
2338       lV0Eta = v0->Eta();
2339       
2340       // PID
2341       if (fUsePID.Contains("withPID")) {
2342         nSigmaPosPion   = TMath::Abs(fESDpid->NumberOfSigmasTPC(myTrackPos,AliPID::kPion));
2343         
2344         nSigmaNegPion   = TMath::Abs(fESDpid->NumberOfSigmasTPC(myTrackNeg,AliPID::kPion));
2345
2346         nSigmaPosProton = TMath::Abs(fESDpid->NumberOfSigmasTPC(myTrackPos,AliPID::kProton));
2347         
2348         nSigmaNegProton = TMath::Abs(fESDpid->NumberOfSigmasTPC(myTrackNeg,AliPID::kProton));
2349       }
2350       else {
2351         nSigmaPosPion = 0; nSigmaNegPion =0; nSigmaPosProton = 0; nSigmaNegProton= 0;
2352       }
2353       
2354       
2355       
2356       // Monte-Carlo particle associated to reconstructed particles: 
2357       if (fAnalysisMC) {
2358         //if (lLabelTrackPos < 0 || lLabelTrackNeg < 0) continue;
2359         TParticle  *lMCESDPartPos  = stack->Particle(lLabelTrackPos);
2360         if(!lMCESDPartPos) { 
2361           Printf("no MC particle for positive and/or negative daughter\n");
2362           
2363         if (negPiKF) delete negPiKF; negPiKF=NULL;
2364         if (posPiKF) delete posPiKF; posPiKF=NULL;
2365         if (posPKF)  delete posPKF;  posPKF=NULL;
2366         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2367         continue;
2368     
2369         }
2370         TParticle  *lMCESDPartNeg  = stack->Particle(lLabelTrackNeg);
2371         if (!lMCESDPartNeg) {
2372         if (negPiKF) delete negPiKF; negPiKF=NULL;
2373         if (posPiKF) delete posPiKF; posPiKF=NULL;
2374         if (posPKF)  delete posPKF;  posPKF=NULL;
2375         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2376         continue;
2377     }
2378         lPDGCodePosDaughter = lMCESDPartPos->GetPdgCode();
2379         lPDGCodeNegDaughter = lMCESDPartNeg->GetPdgCode();
2380         lIndexPosMother = lMCESDPartPos->GetFirstMother();
2381         lIndexNegMother = lMCESDPartNeg->GetFirstMother();
2382         
2383         if (lIndexPosMother == -1) {
2384         if (negPiKF) delete negPiKF; negPiKF=NULL;
2385         if (posPiKF) delete posPiKF; posPiKF=NULL;
2386         if (posPKF)  delete posPKF;  posPKF=NULL;
2387         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2388         continue;
2389     }
2390         TParticle  *lMCESDMother    = stack->Particle(lIndexPosMother);
2391         if (!lMCESDMother) {
2392         if (negPiKF) delete negPiKF; negPiKF=NULL;
2393         if (posPiKF) delete posPiKF; posPiKF=NULL;
2394         if (posPKF)  delete posPKF;  posPKF=NULL;
2395         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2396         continue;
2397     }
2398         lPdgcodeMother         = lMCESDMother->GetPdgCode();
2399         lIndexMotherOfMother   = lMCESDMother->GetFirstMother();
2400         if (lIndexMotherOfMother ==-1) lPdgcodeMotherOfMother = 0;
2401         else {
2402           TParticle  *lMCESDMotherOfMother    = stack->Particle(lIndexMotherOfMother);
2403           if (!lMCESDMotherOfMother) {
2404         if (negPiKF) delete negPiKF; negPiKF=NULL;
2405         if (posPiKF) delete posPiKF; posPiKF=NULL;
2406         if (posPKF)  delete posPKF;  posPKF=NULL;
2407         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2408         continue;
2409     }
2410           lPdgcodeMotherOfMother = lMCESDMotherOfMother->GetPdgCode();
2411         }
2412         
2413         mcPosX = lMCESDPartPos->Vx();
2414         mcPosY = lMCESDPartPos->Vy();
2415         mcPosZ = lMCESDPartPos->Vz();
2416         mcPosR = TMath::Sqrt(mcPosX*mcPosX+mcPosY*mcPosY);
2417         mcPosMotherX = lMCESDMother->Vx();
2418         mcPosMotherY = lMCESDMother->Vy();
2419         mcPosMotherZ = lMCESDMother->Vz();
2420         mcPosMotherR = TMath::Sqrt(mcPosMotherX*mcPosMotherX+mcPosMotherY*mcPosMotherY);
2421         
2422         mcMotherPt   = lMCESDMother->Pt();
2423       }
2424
2425     } // end ESD condition
2426
2427
2428     
2429     else if(fAnalysisType == "AOD") { 
2430
2431       AliAODv0     *myAODv0 = ((AliAODEvent*)fESD)->GetV0(iV0);
2432       if (!myAODv0) continue;
2433
2434       // Primary vertex:
2435       fHistPrimaryVertexPosXV0events->Fill(lPrimaryVtxPosition[0]);
2436       fHistPrimaryVertexPosYV0events->Fill(lPrimaryVtxPosition[1]);
2437       fHistPrimaryVertexPosZV0events->Fill(lPrimaryVtxPosition[2]);
2438       
2439
2440       //Multiplicity:
2441       if(!lOnFlyStatus) nv0s++;
2442 //      else  if(lOnFlyStatus) nv0sMI++;
2443
2444       // V0's Daughters
2445       lIndexTrackPos = TMath::Abs(myAODv0->GetPosID());
2446       lIndexTrackNeg = TMath::Abs(myAODv0->GetNegID());
2447       
2448       AliVParticle  *lVPartPosTest  = ((AliVEvent*)fESD)->GetTrack(lIndexTrackPos);
2449       AliVParticle  *lVPartNegTest  = ((AliVEvent*)fESD)->GetTrack(lIndexTrackNeg);
2450       //AliAODTrack  *lVPartPos  = ((AliAODEvent*)fESD)->GetTrack(lIndexTrackPos);
2451       //AliAODTrack  *lVPartNeg  = ((AliAODEvent*)fESD)->GetTrack(lIndexTrackNeg);
2452
2453       if (!lVPartPosTest ||(!lVPartNegTest )) {
2454         Printf("strange analysis::UserExec:: Could not retreive one of the daughter track\n");
2455         continue;
2456       }
2457
2458       // Quality cuts:
2459       // TO DO !!!!!!!
2460
2461       // TPC refit condition (done during reconstruction for Offline but not for On-the-fly)
2462       //if( !(lVPartPosTest->GetStatus() & AliAODTrack::kTPCrefit)) continue;      
2463       //if( !(lVPartNegTest->GetStatus() & AliAODTrack::kTPCrefit)) continue;
2464       
2465
2466       lDcaPosToPrimVertex = myAODv0->DcaPosToPrimVertex();      
2467       lDcaNegToPrimVertex = myAODv0->DcaNegToPrimVertex();
2468       lOnFlyStatus        = myAODv0->GetOnFlyStatus();
2469       lChi2V0             = myAODv0->Chi2V0();
2470       lDcaV0Daughters     = myAODv0->DcaV0Daughters();
2471       lDcaV0ToPrimVertex  = myAODv0->DcaV0ToPrimVertex();
2472       lV0DecayLength      = myAODv0->DecayLengthV0(lPrimaryVtxPosition);
2473       lV0cosPointAngle    = myAODv0->CosPointingAngle(lPrimaryVtxPosition);
2474       lV0Radius           = myAODv0->RadiusV0();
2475
2476       if( lVPartPosTest->Charge() ==1){
2477         
2478         lVPartPos = ((AliVEvent*)fESD)->GetTrack(lIndexTrackPos);
2479         lVPartNeg = ((AliVEvent*)fESD)->GetTrack(lIndexTrackNeg);
2480         
2481         
2482         if (negPiKF) delete negPiKF; negPiKF=NULL;
2483         if (posPiKF) delete posPiKF; posPiKF=NULL;
2484         if (posPKF)  delete posPKF; posPKF=NULL;
2485         if (negAPKF) delete negAPKF; negAPKF=NULL;
2486         
2487         //negPiKF = new AliKFParticle( *(myAODv0->GetParamN()) ,-211);
2488         //posPiKF = new AliKFParticle( *(myAODv0->GetParamP()) ,211);
2489         //posPKF  = new AliKFParticle( *(myAODv0->GetParamP()) ,2212);
2490         //negAPKF = new AliKFParticle( *(myAODv0->GetParamN()) ,-2212);
2491         // TO DO !!!!!!
2492         negPiKF = NULL;
2493         posPiKF = NULL;
2494         posPKF  = NULL;
2495         negAPKF = NULL;
2496         
2497       }
2498            
2499       if( lVPartPosTest->Charge() ==-1){
2500         
2501         lVPartPos = ((AliVEvent*)fESD)->GetTrack(lIndexTrackNeg);
2502         lVPartNeg = ((AliVEvent*)fESD)->GetTrack(lIndexTrackPos);
2503         
2504         if (negPiKF) delete negPiKF; negPiKF=NULL;
2505         if (posPiKF) delete posPiKF; posPiKF=NULL;
2506         if (posPKF)  delete posPKF; posPKF=NULL;
2507         if (negAPKF) delete negAPKF; negAPKF=NULL;
2508         
2509         //negPiKF = new AliKFParticle( *(myAODv0->GetParamP()) ,-211);
2510         //posPiKF = new AliKFParticle( *(myAODv0->GetParamN()) ,211);
2511         //posPKF  = new AliKFParticle( *(myAODv0->GetParamN()) ,2212);
2512         //negAPKF = new AliKFParticle( *(myAODv0->GetParamP()) ,-2212);
2513         negPiKF = NULL;
2514         posPiKF = NULL;
2515         posPKF  = NULL;
2516         negAPKF = NULL;
2517       }
2518
2519       lLabelTrackPos  = TMath::Abs(lVPartPos->GetLabel());
2520       lLabelTrackNeg  = TMath::Abs(lVPartNeg->GetLabel());
2521       
2522       // Armenteros variables:
2523       lAlphaV0   = myAODv0->AlphaV0();
2524       lPtArmV0   = myAODv0->PtArmV0();
2525
2526       // Pseudorapidity:
2527       lV0Eta = myAODv0->PseudoRapV0();
2528       
2529       // PID not accessible with AOD !
2530       nSigmaPosPion = 0; nSigmaNegPion =0; nSigmaPosProton = 0; nSigmaNegProton= 0;
2531
2532       
2533       // Monte-Carlo particle associated to reconstructed particles:  
2534       if (fAnalysisMC) {
2535         AliAODMCParticle *lMCAODPartPos = (AliAODMCParticle*)mcArray->At(lLabelTrackPos);
2536         if (!lMCAODPartPos) {
2537         if (negPiKF) delete negPiKF; negPiKF=NULL;
2538         if (posPiKF) delete posPiKF; posPiKF=NULL;
2539         if (posPKF)  delete posPKF;  posPKF=NULL;
2540         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2541         continue;
2542     }
2543         AliAODMCParticle *lMCAODPartNeg = (AliAODMCParticle*)mcArray->At(lLabelTrackNeg);
2544         if(!lMCAODPartNeg)  
2545          // Printf("strange analysis::UserExec:no MC particle for negative daughter\n");
2546           {
2547         if (negPiKF) delete negPiKF; negPiKF=NULL;
2548         if (posPiKF) delete posPiKF; posPiKF=NULL;
2549         if (posPKF)  delete posPKF;  posPKF=NULL;
2550         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2551         continue;
2552     
2553         }
2554         lPDGCodePosDaughter = lMCAODPartPos->GetPdgCode();
2555         lPDGCodeNegDaughter = lMCAODPartNeg->GetPdgCode();
2556         lIndexPosMother = lMCAODPartPos->GetMother();
2557         lIndexNegMother = lMCAODPartNeg->GetMother();
2558         
2559         AliAODMCParticle *lMCAODMother = (AliAODMCParticle*)mcArray->At(lIndexPosMother);
2560         lPdgcodeMother = lMCAODMother->GetPdgCode();
2561         lIndexMotherOfMother  = lMCAODMother->GetMother();
2562         if (lIndexMotherOfMother ==-1) lPdgcodeMotherOfMother = 0;
2563         else {
2564           lPdgcodeMotherOfMother   = ((AliAODMCParticle*)mcArray->At(lIndexMotherOfMother))->GetPdgCode();
2565         }
2566         
2567         mcPosX = lMCAODPartPos->Xv();
2568         mcPosY = lMCAODPartPos->Yv();
2569         mcPosZ = lMCAODPartPos->Zv();
2570         mcPosR = TMath::Sqrt(mcPosX*mcPosX+mcPosY*mcPosY);
2571         mcPosMotherX = lMCAODMother->Xv();
2572         mcPosMotherY = lMCAODMother->Yv();
2573         mcPosMotherZ = lMCAODMother->Zv();
2574         mcPosMotherR = TMath::Sqrt(mcPosMotherX*mcPosMotherX+mcPosMotherY*mcPosMotherY);
2575         mcMotherPt   = lMCAODMother->Pt();
2576       }
2577             
2578     } // end AOD condition
2579     
2580     
2581     // Multiplicity:
2582     if(!lOnFlyStatus) nv0s++;
2583 //    else  if(lOnFlyStatus) nv0sMI++;
2584
2585     // Daughter momentum cut: ! FIX it in case of AOD !
2586     if ( (lPtPos  < cutMinPtDaughter ) ||
2587          (lPtNeg  < cutMinPtDaughter )
2588          ) {
2589       if (negPiKF) delete negPiKF; negPiKF=NULL;
2590       if (posPiKF) delete posPiKF; posPiKF=NULL;
2591       if (posPKF)  delete posPKF;  posPKF=NULL;
2592       if (negAPKF) delete negAPKF; negAPKF=NULL;        
2593       continue;
2594     }
2595     
2596     AliKFParticle v0K0sKF;
2597     v0K0sKF+=(*negPiKF);
2598     v0K0sKF+=(*posPiKF);
2599     v0K0sKF.SetProductionVertex(primaryVtxKF);
2600     
2601     AliKFParticle v0LambdaKF;
2602     v0LambdaKF+=(*negPiKF);
2603     v0LambdaKF+=(*posPKF);      
2604     v0LambdaKF.SetProductionVertex(primaryVtxKF);
2605     
2606     AliKFParticle v0AntiLambdaKF;
2607     v0AntiLambdaKF+=(*posPiKF);
2608     v0AntiLambdaKF+=(*negAPKF);
2609     v0AntiLambdaKF.SetProductionVertex(primaryVtxKF);
2610     
2611     // Invariant mass
2612     lInvMassK0s        = v0K0sKF.GetMass();
2613     lInvMassLambda     = v0LambdaKF.GetMass();
2614     lInvMassAntiLambda = v0AntiLambdaKF.GetMass();
2615     
2616     // Rapidity:
2617     lRapK0s        = 0.5*TMath::Log((v0K0sKF.GetE()+v0K0sKF.GetPz())/(v0K0sKF.GetE()-v0K0sKF.GetPz()+1.e-13));
2618     lRapLambda     = 0.5*TMath::Log((v0LambdaKF.GetE()+v0LambdaKF.GetPz())/(v0LambdaKF.GetE()-v0LambdaKF.GetPz()+1.e-13));
2619     lRapAntiLambda = 0.5*TMath::Log((v0AntiLambdaKF.GetE()+v0AntiLambdaKF.GetPz())/(v0AntiLambdaKF.GetE()-v0AntiLambdaKF.GetPz()+1.e-13));
2620
2621     // Pseudo-rapidity
2622     lEtaK0s     = v0K0sKF.GetEta();
2623     lEtaLambda  = v0LambdaKF.GetEta();
2624     lEtaAntiLambda  = v0AntiLambdaKF.GetEta();
2625
2626     // Pz:
2627     lPzK0s        = v0K0sKF.GetPz();
2628     lPzLambda     = v0LambdaKF.GetPz();
2629     lPzAntiLambda = v0AntiLambdaKF.GetPz();
2630     
2631     // Pt:
2632     lPtK0s        = v0K0sKF.GetPt();
2633     lPtLambda     = v0LambdaKF.GetPt();
2634     lPtAntiLambda = v0AntiLambdaKF.GetPt();
2635
2636     if (lPtK0s==0) {
2637         if (negPiKF) delete negPiKF; negPiKF=NULL;
2638         if (posPiKF) delete posPiKF; posPiKF=NULL;
2639         if (posPKF)  delete posPKF;  posPKF=NULL;
2640         if (negAPKF) delete negAPKF; negAPKF=NULL;  
2641         continue;
2642     }
2643     if (lPtLambda==0) {
2644       if (negPiKF) delete negPiKF; negPiKF=NULL;
2645       if (posPiKF) delete posPiKF; posPiKF=NULL;
2646       if (posPKF)  delete posPKF;  posPKF=NULL;
2647       if (negAPKF) delete negAPKF; negAPKF=NULL;  
2648       continue;
2649     }
2650     // Pt Resolution
2651     deltaPtK0s        = (lPtK0s - mcMotherPt)/mcMotherPt;
2652     deltaPtLambda     = (lPtLambda - mcMotherPt)/mcMotherPt;
2653     deltaPtAntiLambda = (lPtAntiLambda - mcMotherPt)/mcMotherPt;
2654
2655     // KF Chi2
2656     lChi2KFK0s        = v0K0sKF.GetChi2();
2657     lChi2KFLambda     = v0LambdaKF.GetChi2();
2658     lChi2KFAntiLambda = v0AntiLambdaKF.GetChi2();
2659     
2660     // Reconstructed Position
2661     rcPosXK0s = v0K0sKF.GetX();
2662     rcPosYK0s = v0K0sKF.GetY(); 
2663     rcPosZK0s = v0K0sKF.GetZ();
2664     rcPosRK0s = TMath::Sqrt(rcPosXK0s*rcPosXK0s+rcPosYK0s*rcPosYK0s);
2665
2666     rcPosXLambda = v0LambdaKF.GetX(); 
2667     rcPosYLambda = v0LambdaKF.GetY(); 
2668     rcPosZLambda = v0LambdaKF.GetZ();
2669     rcPosRLambda = TMath::Sqrt(rcPosXLambda*rcPosXLambda+rcPosYLambda*rcPosYLambda); 
2670
2671     rcPosXAntiLambda = v0AntiLambdaKF.GetX();
2672     rcPosYAntiLambda = v0AntiLambdaKF.GetY(); 
2673     rcPosZAntiLambda = v0AntiLambdaKF.GetZ();
2674     rcPosRAntiLambda = TMath::Sqrt(rcPosXAntiLambda*rcPosXAntiLambda+rcPosYAntiLambda*rcPosYAntiLambda); 
2675
2676     TVector3 momPos(lMomPos[0],lMomPos[1],lMomPos[2]);
2677     TVector3 momNeg(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
2678     TVector3 momTotK0s(v0K0sKF.GetPx(),v0K0sKF.GetPy(),v0K0sKF.GetPz());
2679     TVector3 momTotLambda(v0LambdaKF.GetPx(),v0LambdaKF.GetPy(),v0LambdaKF.GetPz());
2680     TVector3 momTotAntiLambda(v0AntiLambdaKF.GetPx(),v0AntiLambdaKF.GetPy(),v0AntiLambdaKF.GetPz());
2681     
2682     lQlPos = momPos.Dot(momTotK0s)/momTotK0s.Mag();
2683     lQlNeg = momNeg.Dot(momTotK0s)/momTotK0s.Mag();
2684     lAlphaV0K0s = 1.-2./(1.+lQlPos/lQlNeg);
2685     lQlPos = momPos.Dot(momTotLambda)/momTotLambda.Mag();
2686     lQlNeg = momNeg.Dot(momTotLambda)/momTotLambda.Mag();
2687     lAlphaV0Lambda = 1.-2./(1.+lQlPos/lQlNeg);
2688     lQlPos = momPos.Dot(momTotAntiLambda)/momTotAntiLambda.Mag();
2689     lQlNeg = momNeg.Dot(momTotAntiLambda)/momTotAntiLambda.Mag();
2690     lAlphaV0AntiLambda = 1.-2./(1.+lQlPos/lQlNeg);
2691     
2692     lPtArmV0K0s = momPos.Perp(momTotK0s);
2693     lPtArmV0Lambda = momPos.Perp(momTotLambda);
2694     lPtArmV0AntiLambda = momPos.Perp(momTotAntiLambda);
2695     
2696     // Look for associated particles:
2697     if (fAnalysisMC) {
2698       if( (lIndexPosMother==-1) || (lIndexNegMother==-1) ) {
2699         fHistMCDaughterTrack->Fill(1);
2700       }
2701       
2702       else if( ( (lPDGCodePosDaughter==+211) && (lPDGCodeNegDaughter==-211) )    
2703                ) {
2704         lCheckPIdK0Short    = 1;
2705         fHistMCDaughterTrack->Fill(3);
2706         if ( (lIndexPosMother==lIndexNegMother) &&
2707              (lPdgcodeMother==310) ) {
2708           if (lIndexPosMother <= lNbMCPrimary) lCheckMcK0Short  = 1;
2709           else lCheckSecondaryK0s = 1;
2710         }
2711       }
2712       else if( ( (lPDGCodePosDaughter==+2212) && (lPDGCodeNegDaughter==-211)  )  
2713                ) {
2714         lCheckPIdLambda     = 1;
2715         fHistMCDaughterTrack->Fill(5);
2716         if ( (lIndexPosMother==lIndexNegMother) &&
2717              (lPdgcodeMother==3122)  ){
2718           if ( ( TMath::Abs(lPdgcodeMotherOfMother) == 3212) ||
2719                ( TMath::Abs(lPdgcodeMotherOfMother) == 3224) ||
2720                ( TMath::Abs(lPdgcodeMotherOfMother) == 3214) ||
2721                ( TMath::Abs(lPdgcodeMotherOfMother) == 3114)
2722                ) lComeFromSigma = 1;
2723           else lComeFromSigma = 0; 
2724           if ( (lIndexPosMother <= lNbMCPrimary) || 
2725              ( ( lIndexPosMother > lNbMCPrimary) && (lComeFromSigma) )
2726              ) lCheckMcLambda  = 1; 
2727           else lCheckSecondaryLambda    = 1;
2728         }
2729       }
2730       else if( ( (lPDGCodePosDaughter==211)   && (lPDGCodeNegDaughter==-2212) )      
2731                ) {
2732         lCheckPIdAntiLambda = 1;
2733         fHistMCDaughterTrack->Fill(7);
2734         if ( (lIndexPosMother==lIndexNegMother) &&
2735              (lPdgcodeMother==-3122) ) {
2736           if ( ( TMath::Abs(lPdgcodeMotherOfMother) == 3212) ||
2737                ( TMath::Abs(lPdgcodeMotherOfMother) == 3224) ||
2738                ( TMath::Abs(lPdgcodeMotherOfMother) == 3214) ||
2739                ( TMath::Abs(lPdgcodeMotherOfMother) == 3114)
2740                ) lComeFromSigma = 1;
2741           else lComeFromSigma = 0;  
2742           if ( (lIndexPosMother <= lNbMCPrimary) || 
2743              ( ( lIndexPosMother > lNbMCPrimary) && (lComeFromSigma) )
2744              ) lCheckMcAntiLambda  = 1;
2745           else lCheckSecondaryAntiLambda = 1;
2746         }
2747       }
2748       
2749       // Gamma conversion
2750       else if ( (lPDGCodePosDaughter==11) &&
2751                 (lPDGCodeNegDaughter==-11) &&
2752                 (lPdgcodeMother==22 ) )
2753         lCheckGamma = 1;
2754     } // end "look for associated particles  
2755    
2756     
2757     // Cuts:
2758 /*    if (fUseCut.Contains("yes")) {
2759       if ( (lDcaPosToPrimVertex < 0.036 ) ||
2760            (lDcaNegToPrimVertex < 0.036 ) ||
2761            (lDcaV0Daughters     > 0.5   ) ||
2762            (lV0cosPointAngle    < 0.999 ) 
2763            )    
2764         continue;
2765     }
2766 */
2767
2768 /*
2769       if ( (lDcaV0Daughters     > 0.3   ) ||
2770            (lV0cosPointAngle    < 0.998 )
2771
2772            )    continue;
2773 */
2774     // PID condition:
2775     lCheckPIDK0sPosDaughter        = 0, lCheckPIDK0sNegDaughter        = 0;
2776     lCheckPIDLambdaPosDaughter     = 0, lCheckPIDLambdaNegDaughter     = 0;
2777     lCheckPIDAntiLambdaPosDaughter = 0, lCheckPIDAntiLambdaNegDaughter = 0;
2778
2779     if (lMomInnerWallPos < lLimitPPID) {
2780       if (nSigmaPosPion < cutNSigmaLowP)   {
2781         lCheckPIDK0sPosDaughter        = 1;
2782         lCheckPIDAntiLambdaPosDaughter = 1;
2783       }
2784       if (nSigmaPosProton < cutNSigmaLowP) lCheckPIDLambdaPosDaughter    = 1;      
2785     }
2786
2787     else if (lMomInnerWallPos > lLimitPPID) {
2788       if (nSigmaPosPion < cutNSigmaHighP)   {
2789         lCheckPIDK0sPosDaughter        = 1;
2790         lCheckPIDAntiLambdaPosDaughter = 1;
2791       }
2792       if (nSigmaPosProton < cutNSigmaHighP) lCheckPIDLambdaPosDaughter    = 1;
2793     }
2794
2795     if (lMomInnerWallNeg < lLimitPPID) {
2796       if (nSigmaNegPion < cutNSigmaLowP)    {
2797         lCheckPIDK0sNegDaughter       = 1;
2798         lCheckPIDLambdaNegDaughter    = 1;
2799       }
2800       if (nSigmaNegProton < cutNSigmaLowP)  lCheckPIDAntiLambdaNegDaughter = 1;
2801       
2802     }
2803     else if (lMomInnerWallNeg > lLimitPPID) {
2804       if (nSigmaNegPion < cutNSigmaHighP)   {
2805         lCheckPIDK0sNegDaughter       = 1;
2806         lCheckPIDLambdaNegDaughter    = 1;
2807       }
2808       if (nSigmaNegProton < cutNSigmaHighP) lCheckPIDAntiLambdaNegDaughter = 1;
2809     }
2810     
2811     
2812     //*****************************
2813     // filling histograms
2814
2815     fHistDcaPosToPrimVertex->Fill(lDcaPosToPrimVertex,lOnFlyStatus);
2816     fHistDcaNegToPrimVertex->Fill(lDcaNegToPrimVertex,lOnFlyStatus);
2817     fHistDcaPosToPrimVertexZoom->Fill(lDcaPosToPrimVertex,lOnFlyStatus);
2818     fHistDcaNegToPrimVertexZoom->Fill(lDcaNegToPrimVertex,lOnFlyStatus);
2819     fHistRadiusV0->Fill(lV0Radius,lOnFlyStatus);
2820     fHistDecayLengthV0->Fill(lV0DecayLength,lOnFlyStatus);
2821     fHistDcaV0Daughters->Fill(lDcaV0Daughters,lOnFlyStatus);
2822     fHistChi2->Fill(lChi2V0,lOnFlyStatus);
2823     fHistCosPointAngle->Fill(lV0cosPointAngle,lOnFlyStatus);
2824     if (lV0cosPointAngle >= 0.9) fHistCosPointAngleZoom->Fill(lV0cosPointAngle,lOnFlyStatus);
2825     fHistChi2KFBeforeCutK0s->Fill(lChi2KFK0s,lOnFlyStatus); 
2826     fHistChi2KFBeforeCutLambda->Fill(lChi2KFLambda,lOnFlyStatus);
2827     fHistChi2KFBeforeCutAntiLambda->Fill(lChi2KFAntiLambda,lOnFlyStatus);
2828
2829
2830     // Histo versus Rap and armenteros plot
2831     if (!lOnFlyStatus){
2832       if (lCheckMcK0Short) fHistAsMcRapK0->Fill(lRapK0s);
2833       if (lCheckMcLambda) fHistAsMcRapLambda->Fill(lRapLambda);
2834       if (lCheckMcAntiLambda) fHistAsMcRapLambda->Fill(lRapAntiLambda);
2835 //      fHistArmenterosPodolanski->Fill(lAlphaV0,lPtArmV0);
2836 //      fHistDaughterPt->Fill(lPtPos,lPtNeg);
2837     }
2838 /*    else {
2839       if (lCheckMcK0Short) fHistAsMcRapK0MI->Fill(lRapK0s);
2840       if (lCheckMcLambda) fHistAsMcRapLambdaMI->Fill(lRapLambda);
2841       if (lCheckMcAntiLambda) fHistAsMcRapLambdaMI->Fill(lRapAntiLambda);
2842       fHistArmenterosPodolanskiMI->Fill(lAlphaV0,lPtArmV0);
2843     }*/
2844     
2845     
2846     // K0s associated histograms in |rap| < lCutRap:
2847
2848 ////////////////////////////
2849     if ( lCheckPIDK0sPosDaughter && lCheckPIDK0sNegDaughter
2850          && (lChi2KFK0s < cutChi2KF)) fHistPzPtBeforeK0s->Fill(TMath::Abs(lPzK0s/lPtK0s));
2851 /////////////////////////////
2852
2853     if ( lCheckPIDK0sPosDaughter && lCheckPIDK0sNegDaughter
2854          && (lChi2KFK0s < cutChi2KF) && (TMath::Abs(lPzK0s/lPtK0s)<0.7) )     {
2855
2856
2857
2858         fHistPzPtAfterK0s->Fill(TMath::Abs(lPzK0s/lPtK0s));
2859
2860
2861       
2862       fHistChi2KFAfterCutK0s->Fill(lChi2KFK0s,lOnFlyStatus);
2863
2864       if (TMath::Abs(lRapK0s) < lCutRap) {
2865
2866         fHistNsigmaPosPionK0->Fill(nSigmaPosPion);
2867         fHistNsigmaNegPionK0->Fill(nSigmaNegPion);
2868         
2869         switch (lOnFlyStatus){
2870         case 0 : 
2871           fHistMassK0->Fill(lInvMassK0s);
2872           fHistMassVsRadiusK0->Fill(rcPosRK0s,lInvMassK0s);
2873          fHistPtVsMassK0->Fill(lInvMassK0s,lPtK0s);
2874
2875
2876 //        fHistMultVsPtVsMassK0->Fill(multiplicity ,lInvMassK0s,lPtK0s);
2877           if(lCheckPIdK0Short) fHistPidMcMassK0->Fill(lInvMassK0s);
2878           if(lCheckMcK0Short) {
2879             fHistAsMcMassK0->Fill(lInvMassK0s);
2880             fHistAsMcPtK0->Fill(lPtK0s);
2881
2882
2883             fHistAsMcPtVsMassK0->Fill(lInvMassK0s,lPtK0s);
2884             if (lPtK0s <= 1) fHistAsMcPtZoomK0->Fill(lPtK0s);
2885             fHistAsMcMassVsRadiusK0->Fill(rcPosRK0s,lInvMassK0s);
2886             fHistAsMcResxK0->Fill(rcPosXK0s-mcPosX);
2887             fHistAsMcResyK0->Fill(rcPosYK0s-mcPosY);
2888             fHistAsMcReszK0->Fill(rcPosZK0s-mcPosZ);
2889             fHistAsMcResrVsRadiusK0->Fill(rcPosRK0s,rcPosRK0s-mcPosR);
2890             fHistAsMcReszVsRadiusK0->Fill(rcPosZK0s,rcPosZK0s-mcPosZ);
2891             fHistAsMcProdRadiusK0->Fill(mcPosMotherR);
2892             fHistAsMcProdRadiusXvsYK0s->Fill(mcPosMotherX,mcPosMotherY);
2893             fHistAsMcResPtK0->Fill(deltaPtK0s);
2894             fHistAsMcResPtVsRapK0->Fill(deltaPtK0s,lRapK0s);
2895             fHistAsMcResPtVsPtK0->Fill(deltaPtK0s,lPtK0s);
2896           }
2897           else if (lCheckSecondaryK0s) {
2898             fHistAsMcSecondaryPtVsRapK0s->Fill(lPtK0s,lRapK0s);
2899             fHistAsMcSecondaryProdRadiusK0s->Fill(mcPosMotherR);
2900             fHistAsMcSecondaryProdRadiusXvsYK0s->Fill(mcPosMotherX,mcPosMotherY);
2901             switch (lPdgcodeMotherOfMother) {
2902             case 130   : fHistAsMcSecondaryMotherPdgCodeK0s->Fill(0.5);break; // K0L
2903             case 321   : fHistAsMcSecondaryMotherPdgCodeK0s->Fill(1.5);break; // K+
2904             case -321  : fHistAsMcSecondaryMotherPdgCodeK0s->Fill(2.5);break; // K-
2905             case -3122 : fHistAsMcSecondaryMotherPdgCodeK0s->Fill(3.5);break; //AntiLambda
2906             default    : fHistAsMcSecondaryMotherPdgCodeK0s->Fill(6.5);break;
2907             }
2908           }
2909           break;
2910           
2911 /*      case 1 :
2912           fHistMassK0MI->Fill(lInvMassK0s);
2913           fHistMassVsRadiusK0MI->Fill(rcPosRK0s,lInvMassK0s);
2914           fHistPtVsMassK0MI->Fill(lInvMassK0s,lPtK0s);
2915           if(lCheckPIdK0Short) fHistPidMcMassK0MI->Fill(lInvMassK0s);
2916           if(lCheckMcK0Short) {
2917             fHistAsMcMassK0MI->Fill(lInvMassK0s);
2918             fHistAsMcPtK0MI->Fill(lPtK0s);
2919             fHistAsMcPtVsMassK0MI->Fill(lInvMassK0s,lPtK0s);
2920             if (lPtK0s <= 1) fHistAsMcPtZoomK0MI->Fill(lPtK0s);
2921             fHistAsMcMassVsRadiusK0MI->Fill(rcPosRK0s,lInvMassK0s);
2922             fHistAsMcResxK0MI->Fill(rcPosXK0s-mcPosX);
2923             fHistAsMcResyK0MI->Fill(rcPosYK0s-mcPosY);
2924             fHistAsMcReszK0MI->Fill(rcPosZK0s-mcPosZ);
2925             fHistAsMcResrVsRadiusK0MI->Fill(rcPosRK0s,rcPosRK0s-mcPosR);
2926             fHistAsMcReszVsRadiusK0MI->Fill(rcPosZK0s,rcPosZK0s-mcPosZ);
2927             fHistAsMcProdRadiusK0MI->Fill(mcPosMotherR);
2928             fHistAsMcProdRadiusXvsYK0sMI->Fill(mcPosMotherX,mcPosMotherY);
2929             fHistAsMcResPtK0MI->Fill(deltaPtK0s);
2930             fHistAsMcResPtVsRapK0MI->Fill(deltaPtK0s,lRapK0s);
2931             fHistAsMcResPtVsPtK0MI->Fill(deltaPtK0s,lPtK0s);
2932           }
2933           else if (lCheckSecondaryK0s) {
2934             fHistAsMcSecondaryPtVsRapK0sMI->Fill(lPtK0s,lRapK0s);
2935             fHistAsMcSecondaryProdRadiusK0sMI->Fill(mcPosMotherR); 
2936             fHistAsMcSecondaryProdRadiusXvsYK0sMI->Fill(mcPosMotherX,mcPosMotherY);
2937             switch (lPdgcodeMotherOfMother) {
2938             case 130   : fHistAsMcSecondaryMotherPdgCodeK0sMI->Fill(0.5);break; // K0L
2939             case 321   : fHistAsMcSecondaryMotherPdgCodeK0sMI->Fill(1.5);break; // K+
2940             case -321  : fHistAsMcSecondaryMotherPdgCodeK0sMI->Fill(2.5);break; // K-
2941             case -3122 : fHistAsMcSecondaryMotherPdgCodeK0sMI->Fill(3.5);break; //AntiLambda
2942             default    : fHistAsMcSecondaryMotherPdgCodeK0sMI->Fill(6.5);break;
2943             }
2944           }
2945           break;        */
2946         }
2947       } // end rapidity condition
2948     } // end nsigma condition
2949     
2950
2951     // Associated Lambda histograms in |rap| < lCutRap
2952
2953 ////////////////////////len koly kontrole Abs(Pz/Pt)
2954     if ( lCheckPIDLambdaPosDaughter && lCheckPIDLambdaNegDaughter
2955          && (lChi2KFLambda < cutChi2KF)) fHistPzPtBeforeLambda->Fill(TMath::Abs(lPzLambda/lPtLambda)); 
2956 ////////////////////////
2957
2958     if ( lCheckPIDLambdaPosDaughter && lCheckPIDLambdaNegDaughter
2959          && (lChi2KFLambda < cutChi2KF) && (TMath::Abs(lPzLambda/lPtLambda)<0.7) )  {
2960
2961  
2962
2963
2964         fHistPzPtAfterLambda->Fill(TMath::Abs(lPzLambda/lPtLambda));      
2965
2966       fHistChi2KFAfterCutLambda->Fill(lChi2KFLambda,lOnFlyStatus);
2967
2968       if (TMath::Abs(lRapLambda) < lCutRap) {
2969
2970         fHistNsigmaPosProtonLambda->Fill(nSigmaPosProton);
2971         fHistNsigmaNegPionLambda->Fill(nSigmaNegPion);
2972         switch (lOnFlyStatus){
2973         case 0 : 
2974           fHistMassLambda->Fill(lInvMassLambda);
2975           fHistMassVsRadiusLambda->Fill(rcPosRLambda,lInvMassLambda);
2976          fHistPtVsMassLambda->Fill(lInvMassLambda,lPtLambda);
2977
2978
2979
2980
2981 //          fHistMultVsPtVsMassLambda->Fill(multiplicity ,lInvMassLambda,lPtLambda);
2982           if(lCheckPIdLambda) fHistPidMcMassLambda->Fill(lInvMassLambda);
2983           
2984           if(lCheckMcLambda) {
2985             fHistAsMcMassLambda->Fill(lInvMassLambda);
2986             fHistAsMcPtLambda->Fill(lPtLambda);
2987
2988
2989             fHistAsMcPtVsMassLambda->Fill(lInvMassLambda,lPtLambda);
2990             if (lPtLambda <= 1) fHistAsMcPtZoomLambda->Fill(lPtLambda);
2991             fHistAsMcMassVsRadiusLambda->Fill(rcPosRLambda,lInvMassLambda);
2992             fHistAsMcResxLambda->Fill(rcPosXLambda-mcPosX);
2993             fHistAsMcResyLambda->Fill(rcPosYLambda-mcPosY);
2994             fHistAsMcReszLambda->Fill(rcPosZLambda-mcPosZ);
2995             fHistAsMcResrVsRadiusLambda->Fill(rcPosRLambda,rcPosRLambda-mcPosR);
2996             fHistAsMcReszVsRadiusLambda->Fill(rcPosZLambda,rcPosZLambda-mcPosZ);
2997             fHistAsMcProdRadiusLambda->Fill(mcPosMotherR);
2998             fHistAsMcProdRadiusXvsYLambda->Fill(mcPosMotherX,mcPosMotherY);
2999             fHistAsMcResPtLambda->Fill(deltaPtLambda);