]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/Cascades/AliAnalysisTaskStrangenessVsMultiplicityMC.cxx
3fe91e6ff54b02a63d9cff303548600783df1839
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Cascades / AliAnalysisTaskStrangenessVsMultiplicityMC.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17 //
18 // This task is meant to explore the possibility of using a VZERO amplitude
19 // based multiplicity estimator for proton-proton collisions. For this, two 
20 // main operation methods for this task are foreseen: 
21 // 
22 //  1) (under development) it should act as an auxiliary task and provide a 
23 //     calibrated estimator 
24 //
25 //  2) "Debug mode" which will also create a ROOT TTree object with event 
26 //     by event info potentially used for exploration / calibration. This 
27 //     includes the following info: 
28 //    
29 //      --- All VZERO Amplitudes (saved as Float_t) 
30 //      --- (optional) time for each channel
31 //      --- (optional) time width for each channel 
32 //      --- GetReferenceMultiplicity Estimator, |eta|<0.5 
33 //      --- GetReferenceMultiplicity Estimator, |eta|<0.8 
34 //      --- (if MC) True Multiplicity, |eta|<0.5
35 //      --- (if MC) True Multiplicity,  2.8 < eta < 5.8 (VZEROA region)
36 //      --- (if MC) True Multiplicity, -3.7 < eta <-1.7 (VZEROC region)
37 //      --- Run Number
38 //
39 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40
41 class TTree;
42 class TParticle;
43 class TVector3;
44
45 //class AliMCEventHandler;
46 //class AliMCEvent;
47 //class AliStack;
48
49 class AliESDVertex;
50 class AliAODVertex;
51 class AliESDv0;
52 class AliAODv0;
53
54 #include <Riostream.h>
55 #include "TList.h"
56 #include "TH1.h"
57 #include "TH2.h"
58 #include "TH3.h"
59 #include "TFile.h"
60 #include "THnSparse.h"
61 #include "TVector3.h"
62 #include "TCanvas.h"
63 #include "TMath.h"
64 #include "TLegend.h"
65 //#include "AliLog.h"
66
67 #include "AliESDEvent.h"
68 #include "AliAODEvent.h"
69 #include "AliV0vertexer.h"
70 #include "AliCascadeVertexer.h"
71 #include "AliESDpid.h"
72 #include "AliESDtrack.h"
73 #include "AliESDtrackCuts.h"
74 #include "AliInputEventHandler.h"
75 #include "AliAnalysisManager.h"
76 #include "AliMCEventHandler.h"
77 #include "AliMCEvent.h"
78 #include "AliStack.h"
79 #include "AliCentrality.h"
80
81 #include "AliPWG0Helper.h"
82 #include "AliCFContainer.h"
83 #include "AliMultiplicity.h"
84 #include "AliAODMCParticle.h"
85 #include "AliESDcascade.h"
86 #include "AliAODcascade.h"
87 #include "AliESDUtils.h"
88 #include "AliGenEventHeader.h"
89 #include "AliAnalysisTaskSE.h"
90 #include "AliAnalysisUtils.h"
91 #include "AliAnalysisTaskStrangenessVsMultiplicityMC.h"
92
93 using std::cout;
94 using std::endl;
95
96 ClassImp(AliAnalysisTaskStrangenessVsMultiplicityMC)
97
98 AliAnalysisTaskStrangenessVsMultiplicityMC::AliAnalysisTaskStrangenessVsMultiplicityMC()
99   : AliAnalysisTaskSE(), fListHist(0), fTreeEvent(0), fTreeV0(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0), 
100   fkSaveV0Tree      ( kFALSE ),
101   fkSaveCascadeTree ( kTRUE  ),
102   fkRunVertexers    ( kTRUE  ),
103   fkSkipEventSelection( kFALSE ),
104   //---> Variables for fTreeEvent
105   fAmplitude_V0A   (0),   
106   fAmplitude_V0C   (0),   
107   fAmplitude_V0AEq (0),   
108   fAmplitude_V0CEq (0),  
109   fCentrality_V0A(0), 
110   fCentrality_V0C(0), 
111   fCentrality_V0M(0), 
112   fCentrality_V0AEq(0), 
113   fCentrality_V0CEq(0), 
114   fCentrality_V0MEq(0), 
115   fRefMultEta5(0),
116   fRefMultEta8(0),
117   fTrueMultEta5(0),
118   fTrueMultEta8(0),
119   fTrueMultVZEROA(0),
120   fTrueMultVZEROC(0),
121   fRunNumber(0),
122     fEvSel_HasAtLeastSPDVertex(0),
123     fEvSel_VtxZCut(0),
124     fEvSel_IsNotPileup(0),
125     fEvSel_IsNotPileupMV(0),
126     fEvSel_IsNotPileupInMultBins(0),
127     fEvSel_HasVtxContributor(0),
128     fEvSel_Triggered(0),
129     fEvSel_VtxZ(0), 
130     fEvSel_MCType(0), 
131   //---> Variables for fTreeV0
132         fTreeVariableChi2V0(0),
133         fTreeVariableDcaV0Daughters(0),
134         fTreeVariableDcaV0ToPrimVertex(0),
135         fTreeVariableDcaPosToPrimVertex(0),
136         fTreeVariableDcaNegToPrimVertex(0),
137         fTreeVariableV0CosineOfPointingAngle(0),
138         fTreeVariableV0Radius(0),
139         fTreeVariablePt(0),
140         fTreeVariablePtMC(0),
141         fTreeVariableRapK0Short(0),
142         fTreeVariableRapLambda(0),
143         fTreeVariableRapMC(0),
144         fTreeVariableInvMassK0s(0),
145         fTreeVariableInvMassLambda(0),
146         fTreeVariableInvMassAntiLambda(0),
147         fTreeVariableAlphaV0(0),
148         fTreeVariablePtArmV0(0),
149         fTreeVariableNegEta(0),
150         fTreeVariablePosEta(0),
151
152         fTreeVariableNSigmasPosProton(0),
153         fTreeVariableNSigmasPosPion(0),
154         fTreeVariableNSigmasNegProton(0),
155         fTreeVariableNSigmasNegPion(0),
156
157         fTreeVariableDistOverTotMom(0),
158         fTreeVariableLeastNbrCrossedRows(0),
159         fTreeVariableLeastRatioCrossedRowsOverFindable(0),
160         
161   fTreeVariableCentV0A(0),
162   fTreeVariableCentV0C(0),
163   fTreeVariableCentV0M(0),
164   fTreeVariableCentV0AEq(0),
165   fTreeVariableCentV0CEq(0),
166   fTreeVariableCentV0MEq(0),
167   fTreeVariableAmpV0A(0),
168   fTreeVariableAmpV0C(0),
169   fTreeVariableAmpV0AEq(0),
170   fTreeVariableAmpV0CEq(0),
171   fTreeVariableRefMultEta8(0),
172   fTreeVariableRefMultEta5(0),
173   fTreeVariableRunNumber(0),
174
175   fTreeVariablePtMother(0),
176   fTreeVariablePID(0),
177   fTreeVariablePIDPositive(0),
178   fTreeVariablePIDNegative(0),
179   fTreeVariablePIDMother(0),
180   fTreeVariablePrimaryStatus(0),
181   fTreeVariablePrimaryStatusMother(0),
182   //---> Variables for fTreeCascade
183   fTreeCascVarCharge(0), 
184         fTreeCascVarMassAsXi(0),
185         fTreeCascVarMassAsOmega(0),
186         fTreeCascVarPt(0),
187         fTreeCascVarPtMC(0),
188         fTreeCascVarRapXi(0),
189         fTreeCascVarRapOmega(0),
190         fTreeCascVarRapMC(0),
191         fTreeCascVarNegEta(0),
192         fTreeCascVarPosEta(0),
193         fTreeCascVarBachEta(0),
194         fTreeCascVarDCACascDaughters(0),
195         fTreeCascVarDCABachToPrimVtx(0),
196         fTreeCascVarDCAV0Daughters(0),
197         fTreeCascVarDCAV0ToPrimVtx(0),
198         fTreeCascVarDCAPosToPrimVtx(0),
199         fTreeCascVarDCANegToPrimVtx(0),
200         fTreeCascVarCascCosPointingAngle(0),
201         fTreeCascVarCascRadius(0),
202         fTreeCascVarV0Mass(0),
203         fTreeCascVarV0CosPointingAngle(0),
204         fTreeCascVarV0CosPointingAngleSpecial(0),
205         fTreeCascVarV0Radius(0),
206   fTreeCascVarLeastNbrClusters(0),
207         fTreeCascVarDistOverTotMom(0),
208         fTreeCascVarNegNSigmaPion(0),
209         fTreeCascVarNegNSigmaProton(0),
210         fTreeCascVarPosNSigmaPion(0),
211         fTreeCascVarPosNSigmaProton(0),
212         fTreeCascVarBachNSigmaPion(0),
213         fTreeCascVarBachNSigmaKaon(0),
214         fTreeCascVarCentV0A(0),
215         fTreeCascVarCentV0C(0),
216         fTreeCascVarCentV0M(0),
217         fTreeCascVarCentV0AEq(0),
218         fTreeCascVarCentV0CEq(0),
219         fTreeCascVarCentV0MEq(0),
220         fTreeCascVarAmpV0A(0),
221         fTreeCascVarAmpV0C(0),
222         fTreeCascVarAmpV0AEq(0),
223         fTreeCascVarAmpV0CEq(0),
224   fTreeCascVarRefMultEta8(0),
225   fTreeCascVarRefMultEta5(0),
226   fTreeCascVarTrueMultEta5(0),
227   fTreeCascVarTrueMultEta8(0),
228   fTreeCascVarTrueMultVZEROA(0),
229   fTreeCascVarTrueMultVZEROC(0),
230   fTreeCascVarIsPhysicalPrimary(0), 
231   fTreeCascVarPID(0), 
232   fTreeCascVarRunNumber(0), 
233   //---> Histograms
234   fHistEventCounter(0), 
235   //---> MC Generated Histo (analysis level) 
236         fHistPt_GenK0Short(0),
237         fHistPt_GenLambda(0),
238         fHistPt_GenAntiLambda(0),
239         fHistPt_GenXiMinus(0),
240         fHistPt_GenXiPlus(0),
241         fHistPt_GenOmegaMinus(0),
242         fHistPt_GenOmegaPlus(0),
243
244   //VsRefMult
245         fHistPtVsRefMultEta5_GenXiMinus(0),
246         fHistPtVsRefMultEta5_GenXiPlus(0),
247         fHistPtVsRefMultEta5_GenOmegaMinus(0),
248         fHistPtVsRefMultEta5_GenOmegaPlus(0),
249         fHistPtVsRefMultEta8_GenXiMinus(0),
250         fHistPtVsRefMultEta8_GenXiPlus(0),
251         fHistPtVsRefMultEta8_GenOmegaMinus(0),
252         fHistPtVsRefMultEta8_GenOmegaPlus(0),
253
254   //VsCentralities
255         fHistPtVsCentV0A_GenXiMinus(0),
256         fHistPtVsCentV0A_GenXiPlus(0),
257         fHistPtVsCentV0A_GenOmegaMinus(0),
258         fHistPtVsCentV0A_GenOmegaPlus(0),
259         fHistPtVsCentV0C_GenXiMinus(0),
260         fHistPtVsCentV0C_GenXiPlus(0),
261         fHistPtVsCentV0C_GenOmegaMinus(0),
262         fHistPtVsCentV0C_GenOmegaPlus(0),
263         fHistPtVsCentV0M_GenXiMinus(0),
264         fHistPtVsCentV0M_GenXiPlus(0),
265         fHistPtVsCentV0M_GenOmegaMinus(0),
266         fHistPtVsCentV0M_GenOmegaPlus(0),
267
268   //Equalized
269         fHistPtVsCentV0AEq_GenXiMinus(0),
270         fHistPtVsCentV0AEq_GenXiPlus(0),
271         fHistPtVsCentV0AEq_GenOmegaMinus(0),
272         fHistPtVsCentV0AEq_GenOmegaPlus(0),
273         fHistPtVsCentV0CEq_GenXiMinus(0),
274         fHistPtVsCentV0CEq_GenXiPlus(0),
275         fHistPtVsCentV0CEq_GenOmegaMinus(0),
276         fHistPtVsCentV0CEq_GenOmegaPlus(0),
277         fHistPtVsCentV0MEq_GenXiMinus(0),
278         fHistPtVsCentV0MEq_GenXiPlus(0),
279         fHistPtVsCentV0MEq_GenOmegaMinus(0),
280         fHistPtVsCentV0MEq_GenOmegaPlus(0),
281
282   //VsAmp
283         fHistPtVsAmpV0A_GenXiMinus(0),
284         fHistPtVsAmpV0A_GenXiPlus(0),
285         fHistPtVsAmpV0A_GenOmegaMinus(0),
286         fHistPtVsAmpV0A_GenOmegaPlus(0),
287         fHistPtVsAmpV0C_GenXiMinus(0),
288         fHistPtVsAmpV0C_GenXiPlus(0),
289         fHistPtVsAmpV0C_GenOmegaMinus(0),
290         fHistPtVsAmpV0C_GenOmegaPlus(0),
291         fHistPtVsAmpV0M_GenXiMinus(0),
292         fHistPtVsAmpV0M_GenXiPlus(0),
293         fHistPtVsAmpV0M_GenOmegaMinus(0),
294         fHistPtVsAmpV0M_GenOmegaPlus(0),
295   //Equalized Amps
296         fHistPtVsAmpV0AEq_GenXiMinus(0),
297         fHistPtVsAmpV0AEq_GenXiPlus(0),
298         fHistPtVsAmpV0AEq_GenOmegaMinus(0),
299         fHistPtVsAmpV0AEq_GenOmegaPlus(0),
300         fHistPtVsAmpV0CEq_GenXiMinus(0),
301         fHistPtVsAmpV0CEq_GenXiPlus(0),
302         fHistPtVsAmpV0CEq_GenOmegaMinus(0),
303         fHistPtVsAmpV0CEq_GenOmegaPlus(0),
304         fHistPtVsAmpV0MEq_GenXiMinus(0),
305         fHistPtVsAmpV0MEq_GenXiPlus(0),
306         fHistPtVsAmpV0MEq_GenOmegaMinus(0),
307         fHistPtVsAmpV0MEq_GenOmegaPlus(0)  
308
309 //------------------------------------------------
310 // Tree Variables 
311 {
312
313 }
314
315 AliAnalysisTaskStrangenessVsMultiplicityMC::AliAnalysisTaskStrangenessVsMultiplicityMC(const char *name) 
316   : AliAnalysisTaskSE(name), fListHist(0), fTreeEvent(0), fTreeV0(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0), 
317   fkSaveV0Tree      ( kFALSE ),
318   fkSaveCascadeTree ( kTRUE  ), 
319   fkRunVertexers    ( kTRUE  ),
320   fkSkipEventSelection( kFALSE ),
321   //---> Variables for fTreeEvent
322   fAmplitude_V0A (0),   
323   fAmplitude_V0C (0), 
324   fAmplitude_V0AEq (0),   
325   fAmplitude_V0CEq (0), 
326   fCentrality_V0A(0), 
327   fCentrality_V0C(0), 
328   fCentrality_V0M(0), 
329   fCentrality_V0AEq(0), 
330   fCentrality_V0CEq(0), 
331   fCentrality_V0MEq(0), 
332   fRefMultEta5(0),
333   fRefMultEta8(0),
334   fTrueMultEta5(0),
335   fTrueMultEta8(0),
336   fTrueMultVZEROA(0),
337   fTrueMultVZEROC(0),
338   fRunNumber(0),
339     fEvSel_HasAtLeastSPDVertex(0),
340     fEvSel_VtxZCut(0),
341     fEvSel_IsNotPileup(0),
342     fEvSel_IsNotPileupMV(0),
343     fEvSel_IsNotPileupInMultBins(0),
344     fEvSel_HasVtxContributor(0),
345     fEvSel_Triggered(0),
346     fEvSel_VtxZ(0), 
347     fEvSel_MCType(0), 
348   //---> Variables for fTreeV0
349         fTreeVariableChi2V0(0),
350         fTreeVariableDcaV0Daughters(0),
351         fTreeVariableDcaV0ToPrimVertex(0),
352         fTreeVariableDcaPosToPrimVertex(0),
353         fTreeVariableDcaNegToPrimVertex(0),
354         fTreeVariableV0CosineOfPointingAngle(0),
355         fTreeVariableV0Radius(0),
356         fTreeVariablePt(0),
357         fTreeVariablePtMC(0),
358         fTreeVariableRapK0Short(0),
359         fTreeVariableRapLambda(0),
360         fTreeVariableRapMC(0),
361         fTreeVariableInvMassK0s(0),
362         fTreeVariableInvMassLambda(0),
363         fTreeVariableInvMassAntiLambda(0),
364         fTreeVariableAlphaV0(0),
365         fTreeVariablePtArmV0(0),
366         fTreeVariableNegEta(0),
367         fTreeVariablePosEta(0),
368
369         fTreeVariableNSigmasPosProton(0),
370         fTreeVariableNSigmasPosPion(0),
371         fTreeVariableNSigmasNegProton(0),
372         fTreeVariableNSigmasNegPion(0),
373
374         fTreeVariableDistOverTotMom(0),
375         fTreeVariableLeastNbrCrossedRows(0),
376         fTreeVariableLeastRatioCrossedRowsOverFindable(0),
377         
378   fTreeVariableCentV0A(0),
379   fTreeVariableCentV0C(0),
380   fTreeVariableCentV0M(0),
381   fTreeVariableCentV0AEq(0),
382   fTreeVariableCentV0CEq(0),
383   fTreeVariableCentV0MEq(0),
384   fTreeVariableAmpV0A(0),
385   fTreeVariableAmpV0C(0),
386   fTreeVariableAmpV0AEq(0),
387   fTreeVariableAmpV0CEq(0),
388   fTreeVariableRefMultEta8(0),
389   fTreeVariableRefMultEta5(0),
390   fTreeVariableRunNumber(0),
391
392   fTreeVariablePtMother(0),
393   fTreeVariablePID(0),
394   fTreeVariablePIDPositive(0),
395   fTreeVariablePIDNegative(0),
396   fTreeVariablePIDMother(0),
397   fTreeVariablePrimaryStatus(0),
398   fTreeVariablePrimaryStatusMother(0),
399   //---> Variables for fTreeCascade
400   fTreeCascVarCharge(0), 
401         fTreeCascVarMassAsXi(0),
402         fTreeCascVarMassAsOmega(0),
403         fTreeCascVarPt(0),
404         fTreeCascVarPtMC(0),
405         fTreeCascVarRapXi(0),
406         fTreeCascVarRapOmega(0),
407         fTreeCascVarRapMC(0),
408         fTreeCascVarNegEta(0),
409         fTreeCascVarPosEta(0),
410         fTreeCascVarBachEta(0),
411         fTreeCascVarDCACascDaughters(0),
412         fTreeCascVarDCABachToPrimVtx(0),
413         fTreeCascVarDCAV0Daughters(0),
414         fTreeCascVarDCAV0ToPrimVtx(0),
415         fTreeCascVarDCAPosToPrimVtx(0),
416         fTreeCascVarDCANegToPrimVtx(0),
417         fTreeCascVarCascCosPointingAngle(0),
418         fTreeCascVarCascRadius(0),
419         fTreeCascVarV0Mass(0),
420         fTreeCascVarV0CosPointingAngle(0),
421         fTreeCascVarV0CosPointingAngleSpecial(0),
422         fTreeCascVarV0Radius(0),
423   fTreeCascVarLeastNbrClusters(0),
424         fTreeCascVarDistOverTotMom(0),
425         fTreeCascVarNegNSigmaPion(0),
426         fTreeCascVarNegNSigmaProton(0),
427         fTreeCascVarPosNSigmaPion(0),
428         fTreeCascVarPosNSigmaProton(0),
429         fTreeCascVarBachNSigmaPion(0),
430         fTreeCascVarBachNSigmaKaon(0),
431         fTreeCascVarCentV0A(0),
432         fTreeCascVarCentV0C(0),
433         fTreeCascVarCentV0M(0),
434         fTreeCascVarCentV0AEq(0),
435         fTreeCascVarCentV0CEq(0),
436         fTreeCascVarCentV0MEq(0),
437         fTreeCascVarAmpV0A(0),
438         fTreeCascVarAmpV0C(0),
439         fTreeCascVarAmpV0AEq(0),
440         fTreeCascVarAmpV0CEq(0),
441   fTreeCascVarRefMultEta8(0),
442   fTreeCascVarRefMultEta5(0),
443   fTreeCascVarTrueMultEta5(0),
444   fTreeCascVarTrueMultEta8(0),
445   fTreeCascVarTrueMultVZEROA(0),
446   fTreeCascVarTrueMultVZEROC(0),
447   fTreeCascVarIsPhysicalPrimary(0), 
448   fTreeCascVarPID(0), 
449   fTreeCascVarRunNumber(0), 
450   //---> Histograms
451   fHistEventCounter(0), 
452   //---> MC Generated Histo (analysis level) 
453         fHistPt_GenK0Short(0),
454         fHistPt_GenLambda(0),
455         fHistPt_GenAntiLambda(0),
456         fHistPt_GenXiMinus(0),
457         fHistPt_GenXiPlus(0),
458         fHistPt_GenOmegaMinus(0),
459         fHistPt_GenOmegaPlus(0),
460
461   //VsRefMult
462         fHistPtVsRefMultEta5_GenXiMinus(0),
463         fHistPtVsRefMultEta5_GenXiPlus(0),
464         fHistPtVsRefMultEta5_GenOmegaMinus(0),
465         fHistPtVsRefMultEta5_GenOmegaPlus(0),
466         fHistPtVsRefMultEta8_GenXiMinus(0),
467         fHistPtVsRefMultEta8_GenXiPlus(0),
468         fHistPtVsRefMultEta8_GenOmegaMinus(0),
469         fHistPtVsRefMultEta8_GenOmegaPlus(0),
470
471   //VsCentralities
472         fHistPtVsCentV0A_GenXiMinus(0),
473         fHistPtVsCentV0A_GenXiPlus(0),
474         fHistPtVsCentV0A_GenOmegaMinus(0),
475         fHistPtVsCentV0A_GenOmegaPlus(0),
476         fHistPtVsCentV0C_GenXiMinus(0),
477         fHistPtVsCentV0C_GenXiPlus(0),
478         fHistPtVsCentV0C_GenOmegaMinus(0),
479         fHistPtVsCentV0C_GenOmegaPlus(0),
480         fHistPtVsCentV0M_GenXiMinus(0),
481         fHistPtVsCentV0M_GenXiPlus(0),
482         fHistPtVsCentV0M_GenOmegaMinus(0),
483         fHistPtVsCentV0M_GenOmegaPlus(0),
484
485   //Equalized
486         fHistPtVsCentV0AEq_GenXiMinus(0),
487         fHistPtVsCentV0AEq_GenXiPlus(0),
488         fHistPtVsCentV0AEq_GenOmegaMinus(0),
489         fHistPtVsCentV0AEq_GenOmegaPlus(0),
490         fHistPtVsCentV0CEq_GenXiMinus(0),
491         fHistPtVsCentV0CEq_GenXiPlus(0),
492         fHistPtVsCentV0CEq_GenOmegaMinus(0),
493         fHistPtVsCentV0CEq_GenOmegaPlus(0),
494         fHistPtVsCentV0MEq_GenXiMinus(0),
495         fHistPtVsCentV0MEq_GenXiPlus(0),
496         fHistPtVsCentV0MEq_GenOmegaMinus(0),
497         fHistPtVsCentV0MEq_GenOmegaPlus(0),
498
499   //VsAmp
500         fHistPtVsAmpV0A_GenXiMinus(0),
501         fHistPtVsAmpV0A_GenXiPlus(0),
502         fHistPtVsAmpV0A_GenOmegaMinus(0),
503         fHistPtVsAmpV0A_GenOmegaPlus(0),
504         fHistPtVsAmpV0C_GenXiMinus(0),
505         fHistPtVsAmpV0C_GenXiPlus(0),
506         fHistPtVsAmpV0C_GenOmegaMinus(0),
507         fHistPtVsAmpV0C_GenOmegaPlus(0),
508         fHistPtVsAmpV0M_GenXiMinus(0),
509         fHistPtVsAmpV0M_GenXiPlus(0),
510         fHistPtVsAmpV0M_GenOmegaMinus(0),
511         fHistPtVsAmpV0M_GenOmegaPlus(0),
512   //Equalized Amps
513         fHistPtVsAmpV0AEq_GenXiMinus(0),
514         fHistPtVsAmpV0AEq_GenXiPlus(0),
515         fHistPtVsAmpV0AEq_GenOmegaMinus(0),
516         fHistPtVsAmpV0AEq_GenOmegaPlus(0),
517         fHistPtVsAmpV0CEq_GenXiMinus(0),
518         fHistPtVsAmpV0CEq_GenXiPlus(0),
519         fHistPtVsAmpV0CEq_GenOmegaMinus(0),
520         fHistPtVsAmpV0CEq_GenOmegaPlus(0),
521         fHistPtVsAmpV0MEq_GenXiMinus(0),
522         fHistPtVsAmpV0MEq_GenXiPlus(0),
523         fHistPtVsAmpV0MEq_GenOmegaMinus(0),
524         fHistPtVsAmpV0MEq_GenOmegaPlus(0)
525 {
526
527   //Re-vertex: Will only apply for cascade candidates
528
529   fV0VertexerSels[0] =  33.  ;  // max allowed chi2
530   fV0VertexerSels[1] =   0.02;  // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
531   fV0VertexerSels[2] =   0.02;  // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
532   fV0VertexerSels[4] =   0.95;  // min allowed cosine of V0's pointing angle         (LHC09a4 : 0.99)
533   fV0VertexerSels[5] =   1.0 ;  // min radius of the fiducial volume                 (LHC09a4 : 0.2)
534   fV0VertexerSels[6] = 200.  ;  // max radius of the fiducial volume                 (LHC09a4 : 100.0)
535         
536   fCascadeVertexerSels[0] =  33.   ;  // max allowed chi2 (same as PDC07)
537   fCascadeVertexerSels[1] =   0.05 ;  // min allowed V0 impact parameter                    (PDC07 : 0.05   / LHC09a4 : 0.025 )
538   fCascadeVertexerSels[2] =   0.010;  // "window" around the Lambda mass                    (PDC07 : 0.008  / LHC09a4 : 0.010 )
539   fCascadeVertexerSels[3] =   0.03 ;  // min allowed bachelor's impact parameter            (PDC07 : 0.035  / LHC09a4 : 0.025 )
540   fCascadeVertexerSels[4] =   2.0  ;  // max allowed DCA between the V0 and the bachelor    (PDC07 : 0.1    / LHC09a4 : 0.2   )
541   fCascadeVertexerSels[5] =   0.95 ;  // min allowed cosine of the cascade pointing angle   (PDC07 : 0.9985 / LHC09a4 : 0.998 )
542   fCascadeVertexerSels[6] =   0.4  ;  // min radius of the fiducial volume                  (PDC07 : 0.9    / LHC09a4 : 0.2   )
543   fCascadeVertexerSels[7] = 100.   ;  // max radius of the fiducial volume                  (PDC07 : 100    / LHC09a4 : 100   )
544         
545
546   DefineOutput(1, TList::Class()); // Event Counter Histo
547   DefineOutput(2, TTree::Class()); // Event Tree
548   DefineOutput(3, TTree::Class()); // V0 Tree
549   DefineOutput(4, TTree::Class()); // Cascade Tree
550 }
551
552
553 AliAnalysisTaskStrangenessVsMultiplicityMC::~AliAnalysisTaskStrangenessVsMultiplicityMC()
554 {
555 //------------------------------------------------
556 // DESTRUCTOR
557 //------------------------------------------------
558
559    if (fListHist){
560       delete fListHist;
561       fListHist = 0x0;
562    }
563    if (fTreeEvent){
564       delete fTreeEvent;
565       fTreeEvent = 0x0;
566    }
567    if (fTreeV0){
568       delete fTreeV0;
569       fTreeV0 = 0x0;
570    }
571    if (fTreeCascade){
572       delete fTreeCascade;
573       fTreeCascade = 0x0;
574    }
575 }
576
577 //________________________________________________________________________
578 void AliAnalysisTaskStrangenessVsMultiplicityMC::UserCreateOutputObjects()
579 {
580
581    OpenFile(2); 
582    // Called once
583
584 //------------------------------------------------
585
586    fTreeEvent = new TTree("fTreeEvent","Event");
587
588 //------------------------------------------------
589 // fTree Branch definitions - Event by Event info
590 //------------------------------------------------
591
592 //-----------BASIC-INFO---------------------------
593
594   //--- VZERO Data (Integrated)
595   fTreeEvent->Branch("fAmplitude_V0A",&fAmplitude_V0A,"fAmplitude_V0A/F");
596   fTreeEvent->Branch("fAmplitude_V0C",&fAmplitude_V0C,"fAmplitude_V0C/F");
597   fTreeEvent->Branch("fAmplitude_V0AEq",&fAmplitude_V0AEq,"fAmplitude_V0AEq/F");
598   fTreeEvent->Branch("fAmplitude_V0CEq",&fAmplitude_V0CEq,"fAmplitude_V0CEq/F");
599
600   //Info from AliCentrality (not necessarily 'centrality' per se) 
601   fTreeEvent->Branch("fCentrality_V0A",&fCentrality_V0A,"fCentrality_V0A/F");
602   fTreeEvent->Branch("fCentrality_V0C",&fCentrality_V0C,"fCentrality_V0C/F");
603   fTreeEvent->Branch("fCentrality_V0M",&fCentrality_V0M,"fCentrality_V0M/F");
604   fTreeEvent->Branch("fCentrality_V0AEq",&fCentrality_V0AEq,"fCentrality_V0AEq/F");
605   fTreeEvent->Branch("fCentrality_V0CEq",&fCentrality_V0CEq,"fCentrality_V0CEq/F");
606   fTreeEvent->Branch("fCentrality_V0MEq",&fCentrality_V0MEq,"fCentrality_V0MEq/F");
607   
608   //Official GetReferenceMultiplicity
609   fTreeEvent->Branch("fRefMultEta5",&fRefMultEta5,"fRefMultEta5/I");
610   fTreeEvent->Branch("fRefMultEta8",&fRefMultEta8,"fRefMultEta8/I");
611
612   fTreeEvent->Branch("fTrueMultEta5",&fTrueMultEta5,"fTrueMultEta5/I");
613   fTreeEvent->Branch("fTrueMultEta8",&fTrueMultEta8,"fTrueMultEta8/I");
614   fTreeEvent->Branch("fTrueMultVZEROA",&fTrueMultVZEROA,"fTrueMultVZEROA/I");
615   fTreeEvent->Branch("fTrueMultVZEROC",&fTrueMultVZEROC,"fTrueMultVZEROC/I");
616
617   //Run Number
618   fTreeEvent->Branch("fRunNumber", &fRunNumber, "fRunNumber/I");
619     
620     //Booleans for Event Selection
621     fTreeEvent->Branch("fEvSel_HasAtLeastSPDVertex", &fEvSel_HasAtLeastSPDVertex, "fEvSel_HasAtLeastSPDVertex/O");
622     fTreeEvent->Branch("fEvSel_VtxZCut", &fEvSel_VtxZCut, "fEvSel_VtxZCut/O");
623     fTreeEvent->Branch("fEvSel_IsNotPileup", &fEvSel_IsNotPileup, "fEvSel_IsNotPileup/O");
624     fTreeEvent->Branch("fEvSel_IsNotPileupMV", &fEvSel_IsNotPileupMV, "fEvSel_IsNotPileupMV/O");
625     fTreeEvent->Branch("fEvSel_IsNotPileupInMultBins", &fEvSel_IsNotPileupInMultBins, "fEvSel_IsNotPileupInMultBins/O");
626     fTreeEvent->Branch("fEvSel_HasVtxContributor", &fEvSel_HasVtxContributor, "fEvSel_HasVtxContributor/O");
627     fTreeEvent->Branch("fEvSel_Triggered", &fEvSel_Triggered, "fEvSel_Triggered/O");
628     fTreeEvent->Branch("fEvSel_VtxZ", &fEvSel_VtxZ, "fEvSel_VtxZ/F");
629     fTreeEvent->Branch("fEvSel_MCType", &fEvSel_MCType, "fEvSel_MCType/I");
630     
631
632   //Create Basic V0 Output Tree
633   fTreeV0 = new TTree( "fTreeV0", "V0 Candidates");
634
635 //------------------------------------------------
636 // fTreeV0 Branch definitions
637 //------------------------------------------------
638
639 //-----------BASIC-INFO---------------------------
640   fTreeV0->Branch("fTreeVariableChi2V0",&fTreeVariableChi2V0,"fTreeVariableChi2V0/F");
641   fTreeV0->Branch("fTreeVariableDcaV0Daughters",&fTreeVariableDcaV0Daughters,"fTreeVariableDcaV0Daughters/F");
642   fTreeV0->Branch("fTreeVariableDcaV0ToPrimVertex",&fTreeVariableDcaV0ToPrimVertex,"fTreeVariableDcaV0ToPrimVertex/F");
643   fTreeV0->Branch("fTreeVariableDcaPosToPrimVertex",&fTreeVariableDcaPosToPrimVertex,"fTreeVariableDcaPosToPrimVertex/F");
644   fTreeV0->Branch("fTreeVariableDcaNegToPrimVertex",&fTreeVariableDcaNegToPrimVertex,"fTreeVariableDcaNegToPrimVertex/F");
645   fTreeV0->Branch("fTreeVariableV0Radius",&fTreeVariableV0Radius,"fTreeVariableV0Radius/F");
646   fTreeV0->Branch("fTreeVariablePt",&fTreeVariablePt,"fTreeVariablePt/F");
647   fTreeV0->Branch("fTreeVariablePtMC",&fTreeVariablePtMC,"fTreeVariablePtMC/F");
648   fTreeV0->Branch("fTreeVariableRapK0Short",&fTreeVariableRapK0Short,"fTreeVariableRapK0Short/F");
649   fTreeV0->Branch("fTreeVariableRapLambda",&fTreeVariableRapLambda,"fTreeVariableRapLambda/F");
650   fTreeV0->Branch("fTreeVariableRapMC",&fTreeVariableRapMC,"fTreeVariableRapMC/F");
651   fTreeV0->Branch("fTreeVariableInvMassK0s",&fTreeVariableInvMassK0s,"fTreeVariableInvMassK0s/F");
652   fTreeV0->Branch("fTreeVariableInvMassLambda",&fTreeVariableInvMassLambda,"fTreeVariableInvMassLambda/F");
653   fTreeV0->Branch("fTreeVariableInvMassAntiLambda",&fTreeVariableInvMassAntiLambda,"fTreeVariableInvMassAntiLambda/F");
654   fTreeV0->Branch("fTreeVariableV0CosineOfPointingAngle",&fTreeVariableV0CosineOfPointingAngle,"fTreeVariableV0CosineOfPointingAngle/F");
655   fTreeV0->Branch("fTreeVariableAlphaV0",&fTreeVariableAlphaV0,"fTreeVariableAlphaV0/F");
656   fTreeV0->Branch("fTreeVariablePtArmV0",&fTreeVariablePtArmV0,"fTreeVariablePtArmV0/F");
657   fTreeV0->Branch("fTreeVariableLeastNbrCrossedRows",&fTreeVariableLeastNbrCrossedRows,"fTreeVariableLeastNbrCrossedRows/I");
658   fTreeV0->Branch("fTreeVariableLeastRatioCrossedRowsOverFindable",&fTreeVariableLeastRatioCrossedRowsOverFindable,"fTreeVariableLeastRatioCrossedRowsOverFindable/F");
659   fTreeV0->Branch("fTreeVariableDistOverTotMom",&fTreeVariableDistOverTotMom,"fTreeVariableDistOverTotMom/F");
660   fTreeV0->Branch("fTreeVariableNSigmasPosProton",&fTreeVariableNSigmasPosProton,"fTreeVariableNSigmasPosProton/F");
661   fTreeV0->Branch("fTreeVariableNSigmasPosPion",&fTreeVariableNSigmasPosPion,"fTreeVariableNSigmasPosPion/F");
662   fTreeV0->Branch("fTreeVariableNSigmasNegProton",&fTreeVariableNSigmasNegProton,"fTreeVariableNSigmasNegProton/F");
663   fTreeV0->Branch("fTreeVariableNSigmasNegPion",&fTreeVariableNSigmasNegPion,"fTreeVariableNSigmasNegPion/F");
664   fTreeV0->Branch("fTreeVariableNegEta",&fTreeVariableNegEta,"fTreeVariableNegEta/F");
665   fTreeV0->Branch("fTreeVariablePosEta",&fTreeVariablePosEta,"fTreeVariablePosEta/F");
666 //-----------MULTIPLICITY-INFO--------------------
667   fTreeV0->Branch("fTreeVariableCentV0A",&fTreeVariableCentV0A,"fTreeVariableCentV0A/F");
668   fTreeV0->Branch("fTreeVariableCentV0C",&fTreeVariableCentV0C,"fTreeVariableCentV0C/F");
669   fTreeV0->Branch("fTreeVariableCentV0M",&fTreeVariableCentV0M,"fTreeVariableCentV0M/F");
670   fTreeV0->Branch("fTreeVariableCentV0AEq",&fTreeVariableCentV0AEq,"fTreeVariableCentV0AEq/F");
671   fTreeV0->Branch("fTreeVariableCentV0CEq",&fTreeVariableCentV0CEq,"fTreeVariableCentV0CEq/F");
672   fTreeV0->Branch("fTreeVariableCentV0MEq",&fTreeVariableCentV0MEq,"fTreeVariableCentV0MEq/F");
673   fTreeV0->Branch("fTreeVariableAmpV0A",&fTreeVariableAmpV0A,"fTreeVariableAmpV0A/F");
674   fTreeV0->Branch("fTreeVariableAmpV0C",&fTreeVariableAmpV0C,"fTreeVariableAmpV0C/F");
675   fTreeV0->Branch("fTreeVariableAmpV0AEq",&fTreeVariableAmpV0AEq,"fTreeVariableAmpV0AEq/F");
676   fTreeV0->Branch("fTreeVariableAmpV0CEq",&fTreeVariableAmpV0CEq,"fTreeVariableAmpV0CEq/F");
677   fTreeV0->Branch("fTreeVariableRefMultEta8",&fTreeVariableRefMultEta8,"fTreeVariableRefMultEta8/I");
678   fTreeV0->Branch("fTreeVariableRefMultEta5",&fTreeVariableRefMultEta5,"fTreeVariableRefMultEta5/I");
679   fTreeV0->Branch("fTreeVariableRunNumber",&fTreeVariableRunNumber,"fTreeVariableRunNumber/I");
680 //-----------MC Exclusive info--------------------
681   fTreeV0->Branch("fTreeVariablePtMother",&fTreeVariablePtMother,"fTreeVariablePtMother/F");
682   fTreeV0->Branch("fTreeVariablePID",&fTreeVariablePID,"fTreeVariablePID/I");
683   fTreeV0->Branch("fTreeVariablePIDPositive",&fTreeVariablePIDPositive,"fTreeVariablePIDPositive/I");
684   fTreeV0->Branch("fTreeVariablePIDNegative",&fTreeVariablePIDNegative,"fTreeVariablePIDNegative/I");
685   fTreeV0->Branch("fTreeVariablePIDMother",&fTreeVariablePIDMother,"fTreeVariablePIDMother/I");
686   fTreeV0->Branch("fTreeVariablePrimaryStatus",&fTreeVariablePrimaryStatus,"fTreeVariablePrimaryStatus/I");
687   fTreeV0->Branch("fTreeVariablePrimaryStatusMother",&fTreeVariablePrimaryStatusMother,"fTreeVariablePrimaryStatusMother/I");
688 //------------------------------------------------
689
690   //Create Cascade output tree
691   fTreeCascade = new TTree("fTreeCascade","CascadeCandidates");
692
693 //------------------------------------------------
694 // fTreeCascade Branch definitions - Cascade Tree
695 //------------------------------------------------
696
697 //-----------BASIC-INFO---------------------------
698         fTreeCascade->Branch("fTreeCascVarCharge",&fTreeCascVarCharge,"fTreeCascVarCharge/I");  
699   fTreeCascade->Branch("fTreeCascVarMassAsXi",&fTreeCascVarMassAsXi,"fTreeCascVarMassAsXi/F");
700   fTreeCascade->Branch("fTreeCascVarMassAsOmega",&fTreeCascVarMassAsOmega,"fTreeCascVarMassAsOmega/F");
701   fTreeCascade->Branch("fTreeCascVarPt",&fTreeCascVarPt,"fTreeCascVarPt/F");
702   fTreeCascade->Branch("fTreeCascVarPtMC",&fTreeCascVarPtMC,"fTreeCascVarPtMC/F");
703   fTreeCascade->Branch("fTreeCascVarRapXi",&fTreeCascVarRapXi,"fTreeCascVarRapXi/F");
704   fTreeCascade->Branch("fTreeCascVarRapOmega",&fTreeCascVarRapOmega,"fTreeCascVarRapOmega/F");
705   fTreeCascade->Branch("fTreeCascVarRapMC",&fTreeCascVarRapMC,"fTreeCascVarRapMC/F");
706   fTreeCascade->Branch("fTreeCascVarNegEta",&fTreeCascVarNegEta,"fTreeCascVarNegEta/F");
707   fTreeCascade->Branch("fTreeCascVarPosEta",&fTreeCascVarPosEta,"fTreeCascVarPosEta/F");
708   fTreeCascade->Branch("fTreeCascVarBachEta",&fTreeCascVarBachEta,"fTreeCascVarBachEta/F");
709 //-----------INFO-FOR-CUTS------------------------
710   fTreeCascade->Branch("fTreeCascVarDCACascDaughters",&fTreeCascVarDCACascDaughters,"fTreeCascVarDCACascDaughters/F");
711   fTreeCascade->Branch("fTreeCascVarDCABachToPrimVtx",&fTreeCascVarDCABachToPrimVtx,"fTreeCascVarDCABachToPrimVtx/F");
712   fTreeCascade->Branch("fTreeCascVarDCAV0Daughters",&fTreeCascVarDCAV0Daughters,"fTreeCascVarDCAV0Daughters/F");
713   fTreeCascade->Branch("fTreeCascVarDCAV0ToPrimVtx",&fTreeCascVarDCAV0ToPrimVtx,"fTreeCascVarDCAV0ToPrimVtx/F");
714   fTreeCascade->Branch("fTreeCascVarDCAPosToPrimVtx",&fTreeCascVarDCAPosToPrimVtx,"fTreeCascVarDCAPosToPrimVtx/F");
715   fTreeCascade->Branch("fTreeCascVarDCANegToPrimVtx",&fTreeCascVarDCANegToPrimVtx,"fTreeCascVarDCANegToPrimVtx/F");
716   fTreeCascade->Branch("fTreeCascVarCascCosPointingAngle",&fTreeCascVarCascCosPointingAngle,"fTreeCascVarCascCosPointingAngle/F");
717   fTreeCascade->Branch("fTreeCascVarCascRadius",&fTreeCascVarCascRadius,"fTreeCascVarCascRadius/F");
718   fTreeCascade->Branch("fTreeCascVarV0Mass",&fTreeCascVarV0Mass,"fTreeCascVarV0Mass/F");
719   fTreeCascade->Branch("fTreeCascVarV0CosPointingAngle",&fTreeCascVarV0CosPointingAngle,"fTreeCascVarV0CosPointingAngle/F");
720   fTreeCascade->Branch("fTreeCascVarV0CosPointingAngleSpecial",&fTreeCascVarV0CosPointingAngleSpecial,"fTreeCascVarV0CosPointingAngleSpecial/F");
721   fTreeCascade->Branch("fTreeCascVarV0Radius",&fTreeCascVarV0Radius,"fTreeCascVarV0Radius/F");
722   fTreeCascade->Branch("fTreeCascVarLeastNbrClusters",&fTreeCascVarLeastNbrClusters,"fTreeCascVarLeastNbrClusters/I");
723 //-----------MULTIPLICITY-INFO--------------------
724   fTreeCascade->Branch("fTreeCascVarCentV0A",&fTreeCascVarCentV0A,"fTreeCascVarCentV0A/F");
725   fTreeCascade->Branch("fTreeCascVarCentV0C",&fTreeCascVarCentV0C,"fTreeCascVarCentV0C/F");
726   fTreeCascade->Branch("fTreeCascVarCentV0M",&fTreeCascVarCentV0M,"fTreeCascVarCentV0M/F");
727   fTreeCascade->Branch("fTreeCascVarCentV0AEq",&fTreeCascVarCentV0AEq,"fTreeCascVarCentV0AEq/F");
728   fTreeCascade->Branch("fTreeCascVarCentV0CEq",&fTreeCascVarCentV0CEq,"fTreeCascVarCentV0CEq/F");
729   fTreeCascade->Branch("fTreeCascVarCentV0MEq",&fTreeCascVarCentV0MEq,"fTreeCascVarCentV0MEq/F");
730   fTreeCascade->Branch("fTreeCascVarAmpV0A",&fTreeCascVarAmpV0A,"fTreeCascVarAmpV0A/F");
731   fTreeCascade->Branch("fTreeCascVarAmpV0C",&fTreeCascVarAmpV0C,"fTreeCascVarAmpV0C/F");
732   fTreeCascade->Branch("fTreeCascVarAmpV0AEq",&fTreeCascVarAmpV0AEq,"fTreeCascVarAmpV0AEq/F");
733   fTreeCascade->Branch("fTreeCascVarAmpV0CEq",&fTreeCascVarAmpV0CEq,"fTreeCascVarAmpV0CEq/F");
734   fTreeCascade->Branch("fTreeCascVarRefMultEta8",&fTreeCascVarRefMultEta8,"fTreeCascVarRefMultEta8/I");
735   fTreeCascade->Branch("fTreeCascVarRefMultEta5",&fTreeCascVarRefMultEta5,"fTreeCascVarRefMultEta5/I");
736   fTreeCascade->Branch("fTreeCascVarTrueMultEta5",&fTreeCascVarTrueMultEta5,"fTreeCascVarTrueMultEta5/I");
737   fTreeCascade->Branch("fTreeCascVarTrueMultEta8",&fTreeCascVarTrueMultEta8,"fTreeCascVarTrueMultEta8/I");
738   fTreeCascade->Branch("fTreeCascVarTrueMultVZEROA",&fTreeCascVarTrueMultVZEROA,"fTreeCascVarTrueMultVZEROA/I");
739   fTreeCascade->Branch("fTreeCascVarTrueMultVZEROC",&fTreeCascVarTrueMultVZEROC,"fTreeCascVarTrueMultVZEROC/I");
740   fTreeCascade->Branch("fTreeCascVarIsPhysicalPrimary",&fTreeCascVarIsPhysicalPrimary,"fTreeCascVarIsPhysicalPrimary/I");
741   fTreeCascade->Branch("fTreeCascVarPID",&fTreeCascVarPID,"fTreeCascVarPID/I");
742   fTreeCascade->Branch("fTreeCascVarRunNumber",&fTreeCascVarRunNumber,"fTreeCascVarRunNumber/I");
743 //-----------DECAY-LENGTH-INFO--------------------
744   fTreeCascade->Branch("fTreeCascVarDistOverTotMom",&fTreeCascVarDistOverTotMom,"fTreeCascVarDistOverTotMom/F");
745 //------------------------------------------------
746   fTreeCascade->Branch("fTreeCascVarNegNSigmaPion",&fTreeCascVarNegNSigmaPion,"fTreeCascVarNegNSigmaPion/F");
747   fTreeCascade->Branch("fTreeCascVarNegNSigmaProton",&fTreeCascVarNegNSigmaProton,"fTreeCascVarNegNSigmaProton/F");
748   fTreeCascade->Branch("fTreeCascVarPosNSigmaPion",&fTreeCascVarPosNSigmaPion,"fTreeCascVarPosNSigmaPion/F");
749   fTreeCascade->Branch("fTreeCascVarPosNSigmaProton",&fTreeCascVarPosNSigmaProton,"fTreeCascVarPosNSigmaProton/F");
750   fTreeCascade->Branch("fTreeCascVarBachNSigmaPion",&fTreeCascVarBachNSigmaPion,"fTreeCascVarBachNSigmaPion/F");
751   fTreeCascade->Branch("fTreeCascVarBachNSigmaKaon",&fTreeCascVarBachNSigmaKaon,"fTreeCascVarBachNSigmaKaon/F");
752
753 //------------------------------------------------
754 // Particle Identification Setup
755 //------------------------------------------------
756   
757    AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
758    AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
759    fPIDResponse = inputHandler->GetPIDResponse();
760
761   // Multiplicity
762   if(! fESDtrackCuts ){
763     fESDtrackCuts = new AliESDtrackCuts();
764   }
765
766 //------------------------------------------------
767 // V0 Multiplicity Histograms
768 //------------------------------------------------
769
770    // Create histograms
771    OpenFile(1);
772    fListHist = new TList();
773    fListHist->SetOwner();  // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
774
775    if(! fHistEventCounter ) {
776     //Histogram Output: Event-by-Event
777     fHistEventCounter = new TH1D( "fHistEventCounter", ";Evt. Sel. Step;Count",5,0,5); 
778     fHistEventCounter->GetXaxis()->SetBinLabel(1, "Processed");
779     fHistEventCounter->GetXaxis()->SetBinLabel(2, "Phys-Sel");  
780     fHistEventCounter->GetXaxis()->SetBinLabel(3, "Has Vtx");  
781     fHistEventCounter->GetXaxis()->SetBinLabel(4, "Vtx |z|<10cm");  
782     fHistEventCounter->GetXaxis()->SetBinLabel(5, "Isn't Pileup");
783     fListHist->Add(fHistEventCounter); 
784    }
785
786   //Histograms for Efficiency corrections... a bunch of them 
787   //1D Histograms - Fine if efficiency doesn't change vs mult (expected) 
788   //---> Always filled for |y|<0.5 
789   //V0s: basic Histos
790   if(! fHistPt_GenK0Short ) {
791     fHistPt_GenK0Short    = new TH1D( "fHistPt_GenK0Short",    "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenK0Short);    }
792   if(! fHistPt_GenLambda ) {
793     fHistPt_GenLambda     = new TH1D( "fHistPt_GenLambda",     "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenLambda);     }
794   if(! fHistPt_GenAntiLambda ) {
795     fHistPt_GenAntiLambda = new TH1D( "fHistPt_GenAntiLambda", "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenAntiLambda); }
796   //Cascades: basic Histos
797   if(! fHistPt_GenXiMinus ) {
798     fHistPt_GenXiMinus    = new TH1D( "fHistPt_GenXiMinus",    "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenXiMinus);    }
799   if(! fHistPt_GenXiPlus ) {
800      fHistPt_GenXiPlus     = new TH1D( "fHistPt_GenXiPlus",    "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenXiPlus);     }
801   if(! fHistPt_GenOmegaMinus ) {
802     fHistPt_GenOmegaMinus = new TH1D( "fHistPt_GenOmegaMinus", "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenOmegaMinus); }
803   if(! fHistPt_GenOmegaPlus ) {
804     fHistPt_GenOmegaPlus  = new TH1D( "fHistPt_GenOmegaPlus",  "Generated;p_{T} (GeV/c)",200,0,20);   fListHist->Add(fHistPt_GenOmegaPlus);  }
805   //2D Histos for vs Mult calculation 
806   if(! fHistPtVsRefMultEta5_GenXiMinus ) {
807     fHistPtVsRefMultEta5_GenXiMinus    = new TH2D( "fHistPtVsRefMultEta5_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta5_GenXiMinus);    }
808   if(! fHistPtVsRefMultEta5_GenXiPlus ) {
809     fHistPtVsRefMultEta5_GenXiPlus     = new TH2D( "fHistPtVsRefMultEta5_GenXiPlus",        "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta5_GenXiPlus);    }
810   if(! fHistPtVsRefMultEta5_GenOmegaMinus ) {
811     fHistPtVsRefMultEta5_GenOmegaMinus    = new TH2D( "fHistPtVsRefMultEta5_GenOmegaMinus", "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta5_GenOmegaMinus);    }
812   if(! fHistPtVsRefMultEta5_GenOmegaPlus ) {
813     fHistPtVsRefMultEta5_GenOmegaPlus     = new TH2D( "fHistPtVsRefMultEta5_GenOmegaPlus",  "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta5_GenOmegaPlus);    }
814   if(! fHistPtVsRefMultEta8_GenXiMinus ) {
815     fHistPtVsRefMultEta8_GenXiMinus    = new TH2D( "fHistPtVsRefMultEta8_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta8_GenXiMinus);    }
816   if(! fHistPtVsRefMultEta8_GenXiPlus ) {
817     fHistPtVsRefMultEta8_GenXiPlus     = new TH2D( "fHistPtVsRefMultEta8_GenXiPlus",        "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta8_GenXiPlus);    }
818   if(! fHistPtVsRefMultEta8_GenOmegaMinus ) {
819     fHistPtVsRefMultEta8_GenOmegaMinus    = new TH2D( "fHistPtVsRefMultEta8_GenOmegaMinus", "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta8_GenOmegaMinus);    }
820   if(! fHistPtVsRefMultEta8_GenOmegaPlus ) {
821     fHistPtVsRefMultEta8_GenOmegaPlus     = new TH2D( "fHistPtVsRefMultEta8_GenOmegaPlus",  "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   fListHist->Add(fHistPtVsRefMultEta8_GenOmegaPlus);    }
822
823   //Centralities: V0A, V0C, V0M, +Eq
824   if(! fHistPtVsCentV0A_GenXiMinus ) {
825     fHistPtVsCentV0A_GenXiMinus    = new TH2D( 
826     "fHistPtVsCentV0A_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
827     fListHist->Add(fHistPtVsCentV0A_GenXiMinus); }
828   if(! fHistPtVsCentV0A_GenXiPlus ) {
829     fHistPtVsCentV0A_GenXiPlus    = new TH2D( 
830     "fHistPtVsCentV0A_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
831     fListHist->Add(fHistPtVsCentV0A_GenXiPlus); }
832   if(! fHistPtVsCentV0A_GenOmegaMinus ) {
833     fHistPtVsCentV0A_GenOmegaMinus    = new TH2D( 
834     "fHistPtVsCentV0A_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
835     fListHist->Add(fHistPtVsCentV0A_GenOmegaMinus); }
836   if(! fHistPtVsCentV0A_GenOmegaPlus ) {
837     fHistPtVsCentV0A_GenOmegaPlus    = new TH2D( 
838     "fHistPtVsCentV0A_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
839     fListHist->Add(fHistPtVsCentV0A_GenOmegaPlus); }  
840
841   if(! fHistPtVsCentV0C_GenXiMinus ) {
842     fHistPtVsCentV0C_GenXiMinus    = new TH2D( 
843     "fHistPtVsCentV0C_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
844     fListHist->Add(fHistPtVsCentV0C_GenXiMinus); }
845   if(! fHistPtVsCentV0C_GenXiPlus ) {
846     fHistPtVsCentV0C_GenXiPlus    = new TH2D( 
847     "fHistPtVsCentV0C_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
848     fListHist->Add(fHistPtVsCentV0C_GenXiPlus); }
849   if(! fHistPtVsCentV0C_GenOmegaMinus ) {
850     fHistPtVsCentV0C_GenOmegaMinus    = new TH2D( 
851     "fHistPtVsCentV0C_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
852     fListHist->Add(fHistPtVsCentV0C_GenOmegaMinus); }
853   if(! fHistPtVsCentV0C_GenOmegaPlus ) {
854     fHistPtVsCentV0C_GenOmegaPlus    = new TH2D( 
855     "fHistPtVsCentV0C_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
856     fListHist->Add(fHistPtVsCentV0C_GenOmegaPlus); }  
857
858   if(! fHistPtVsCentV0M_GenXiMinus ) {
859     fHistPtVsCentV0M_GenXiMinus    = new TH2D( 
860     "fHistPtVsCentV0M_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
861     fListHist->Add(fHistPtVsCentV0M_GenXiMinus); }
862   if(! fHistPtVsCentV0M_GenXiPlus ) {
863     fHistPtVsCentV0M_GenXiPlus    = new TH2D( 
864     "fHistPtVsCentV0M_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
865     fListHist->Add(fHistPtVsCentV0M_GenXiPlus); }
866   if(! fHistPtVsCentV0M_GenOmegaMinus ) {
867     fHistPtVsCentV0M_GenOmegaMinus    = new TH2D( 
868     "fHistPtVsCentV0M_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
869     fListHist->Add(fHistPtVsCentV0M_GenOmegaMinus); }
870   if(! fHistPtVsCentV0M_GenOmegaPlus ) {
871     fHistPtVsCentV0M_GenOmegaPlus    = new TH2D( 
872     "fHistPtVsCentV0M_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
873     fListHist->Add(fHistPtVsCentV0M_GenOmegaPlus); }  
874
875   //Equalized
876   if(! fHistPtVsCentV0AEq_GenXiMinus ) {
877     fHistPtVsCentV0AEq_GenXiMinus    = new TH2D( 
878     "fHistPtVsCentV0AEq_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
879     fListHist->Add(fHistPtVsCentV0AEq_GenXiMinus); }
880   if(! fHistPtVsCentV0AEq_GenXiPlus ) {
881     fHistPtVsCentV0AEq_GenXiPlus    = new TH2D( 
882     "fHistPtVsCentV0AEq_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
883     fListHist->Add(fHistPtVsCentV0AEq_GenXiPlus); }
884   if(! fHistPtVsCentV0AEq_GenOmegaMinus ) {
885     fHistPtVsCentV0AEq_GenOmegaMinus    = new TH2D( 
886     "fHistPtVsCentV0AEq_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
887     fListHist->Add(fHistPtVsCentV0AEq_GenOmegaMinus); }
888   if(! fHistPtVsCentV0AEq_GenOmegaPlus ) {
889     fHistPtVsCentV0AEq_GenOmegaPlus    = new TH2D( 
890     "fHistPtVsCentV0AEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
891     fListHist->Add(fHistPtVsCentV0AEq_GenOmegaPlus); }  
892
893   if(! fHistPtVsCentV0CEq_GenXiMinus ) {
894     fHistPtVsCentV0CEq_GenXiMinus    = new TH2D( 
895     "fHistPtVsCentV0CEq_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
896     fListHist->Add(fHistPtVsCentV0CEq_GenXiMinus); }
897   if(! fHistPtVsCentV0CEq_GenXiPlus ) {
898     fHistPtVsCentV0CEq_GenXiPlus    = new TH2D( 
899     "fHistPtVsCentV0CEq_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
900     fListHist->Add(fHistPtVsCentV0CEq_GenXiPlus); }
901   if(! fHistPtVsCentV0CEq_GenOmegaMinus ) {
902     fHistPtVsCentV0CEq_GenOmegaMinus    = new TH2D( 
903     "fHistPtVsCentV0CEq_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
904     fListHist->Add(fHistPtVsCentV0CEq_GenOmegaMinus); }
905   if(! fHistPtVsCentV0CEq_GenOmegaPlus ) {
906     fHistPtVsCentV0CEq_GenOmegaPlus    = new TH2D( 
907     "fHistPtVsCentV0CEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
908     fListHist->Add(fHistPtVsCentV0CEq_GenOmegaPlus); }  
909
910   if(! fHistPtVsCentV0MEq_GenXiMinus ) {
911     fHistPtVsCentV0MEq_GenXiMinus    = new TH2D( 
912     "fHistPtVsCentV0MEq_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
913     fListHist->Add(fHistPtVsCentV0MEq_GenXiMinus); }
914   if(! fHistPtVsCentV0MEq_GenXiPlus ) {
915     fHistPtVsCentV0MEq_GenXiPlus    = new TH2D( 
916     "fHistPtVsCentV0MEq_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
917     fListHist->Add(fHistPtVsCentV0MEq_GenXiPlus); }
918   if(! fHistPtVsCentV0MEq_GenOmegaMinus ) {
919     fHistPtVsCentV0MEq_GenOmegaMinus    = new TH2D( 
920     "fHistPtVsCentV0MEq_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
921     fListHist->Add(fHistPtVsCentV0MEq_GenOmegaMinus); }
922   if(! fHistPtVsCentV0MEq_GenOmegaPlus ) {
923     fHistPtVsCentV0MEq_GenOmegaPlus    = new TH2D( 
924     "fHistPtVsCentV0MEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,100,0,100);   
925     fListHist->Add(fHistPtVsCentV0MEq_GenOmegaPlus); }  
926
927   //AMPLITUDES: V0A, V0C, V0M, +Eq
928   Double_t lMaxAmplitude = 2500; 
929   Long_t lAmplitudeBins = 10000;
930   if(! fHistPtVsAmpV0A_GenXiMinus ) {
931     fHistPtVsAmpV0A_GenXiMinus    = new TH2D( 
932     "fHistPtVsAmpV0A_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
933     fListHist->Add(fHistPtVsAmpV0A_GenXiMinus); }
934   if(! fHistPtVsAmpV0A_GenXiPlus ) {
935     fHistPtVsAmpV0A_GenXiPlus    = new TH2D( 
936     "fHistPtVsAmpV0A_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
937     fListHist->Add(fHistPtVsAmpV0A_GenXiPlus); }
938   if(! fHistPtVsAmpV0A_GenOmegaMinus ) {
939     fHistPtVsAmpV0A_GenOmegaMinus    = new TH2D( 
940     "fHistPtVsAmpV0A_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
941     fListHist->Add(fHistPtVsAmpV0A_GenOmegaMinus); }
942   if(! fHistPtVsAmpV0A_GenOmegaPlus ) {
943     fHistPtVsAmpV0A_GenOmegaPlus    = new TH2D( 
944     "fHistPtVsAmpV0A_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
945     fListHist->Add(fHistPtVsAmpV0A_GenOmegaPlus); }  
946
947   if(! fHistPtVsAmpV0C_GenXiMinus ) {
948     fHistPtVsAmpV0C_GenXiMinus    = new TH2D( 
949     "fHistPtVsAmpV0C_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
950     fListHist->Add(fHistPtVsAmpV0C_GenXiMinus); }
951   if(! fHistPtVsAmpV0C_GenXiPlus ) {
952     fHistPtVsAmpV0C_GenXiPlus    = new TH2D( 
953     "fHistPtVsAmpV0C_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
954     fListHist->Add(fHistPtVsAmpV0C_GenXiPlus); }
955   if(! fHistPtVsAmpV0C_GenOmegaMinus ) {
956     fHistPtVsAmpV0C_GenOmegaMinus    = new TH2D( 
957     "fHistPtVsAmpV0C_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
958     fListHist->Add(fHistPtVsAmpV0C_GenOmegaMinus); }
959   if(! fHistPtVsAmpV0C_GenOmegaPlus ) {
960     fHistPtVsAmpV0C_GenOmegaPlus    = new TH2D( 
961     "fHistPtVsAmpV0C_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
962     fListHist->Add(fHistPtVsAmpV0C_GenOmegaPlus); }  
963
964   if(! fHistPtVsAmpV0M_GenXiMinus ) {
965     fHistPtVsAmpV0M_GenXiMinus    = new TH2D( 
966     "fHistPtVsAmpV0M_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
967     fListHist->Add(fHistPtVsAmpV0M_GenXiMinus); }
968   if(! fHistPtVsAmpV0M_GenXiPlus ) {
969     fHistPtVsAmpV0M_GenXiPlus    = new TH2D( 
970     "fHistPtVsAmpV0M_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
971     fListHist->Add(fHistPtVsAmpV0M_GenXiPlus); }
972   if(! fHistPtVsAmpV0M_GenOmegaMinus ) {
973     fHistPtVsAmpV0M_GenOmegaMinus    = new TH2D( 
974     "fHistPtVsAmpV0M_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
975     fListHist->Add(fHistPtVsAmpV0M_GenOmegaMinus); }
976   if(! fHistPtVsAmpV0M_GenOmegaPlus ) {
977     fHistPtVsAmpV0M_GenOmegaPlus    = new TH2D( 
978     "fHistPtVsAmpV0M_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
979     fListHist->Add(fHistPtVsAmpV0M_GenOmegaPlus); }  
980
981   //Equalized
982   if(! fHistPtVsAmpV0AEq_GenXiMinus ) {
983     fHistPtVsAmpV0AEq_GenXiMinus    = new TH2D( 
984     "fHistPtVsAmpV0AEq_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
985     fListHist->Add(fHistPtVsAmpV0AEq_GenXiMinus); }
986   if(! fHistPtVsAmpV0AEq_GenXiPlus ) {
987     fHistPtVsAmpV0AEq_GenXiPlus    = new TH2D( 
988     "fHistPtVsAmpV0AEq_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
989     fListHist->Add(fHistPtVsAmpV0AEq_GenXiPlus); }
990   if(! fHistPtVsAmpV0AEq_GenOmegaMinus ) {
991     fHistPtVsAmpV0AEq_GenOmegaMinus    = new TH2D( 
992     "fHistPtVsAmpV0AEq_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
993     fListHist->Add(fHistPtVsAmpV0AEq_GenOmegaMinus); }
994   if(! fHistPtVsAmpV0AEq_GenOmegaPlus ) {
995     fHistPtVsAmpV0AEq_GenOmegaPlus    = new TH2D( 
996     "fHistPtVsAmpV0AEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
997     fListHist->Add(fHistPtVsAmpV0AEq_GenOmegaPlus); }  
998
999   if(! fHistPtVsAmpV0CEq_GenXiMinus ) {
1000     fHistPtVsAmpV0CEq_GenXiMinus    = new TH2D( 
1001     "fHistPtVsAmpV0CEq_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1002     fListHist->Add(fHistPtVsAmpV0CEq_GenXiMinus); }
1003   if(! fHistPtVsAmpV0CEq_GenXiPlus ) {
1004     fHistPtVsAmpV0CEq_GenXiPlus    = new TH2D( 
1005     "fHistPtVsAmpV0CEq_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1006     fListHist->Add(fHistPtVsAmpV0CEq_GenXiPlus); }
1007   if(! fHistPtVsAmpV0CEq_GenOmegaMinus ) {
1008     fHistPtVsAmpV0CEq_GenOmegaMinus    = new TH2D( 
1009     "fHistPtVsAmpV0CEq_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1010     fListHist->Add(fHistPtVsAmpV0CEq_GenOmegaMinus); }
1011   if(! fHistPtVsAmpV0CEq_GenOmegaPlus ) {
1012     fHistPtVsAmpV0CEq_GenOmegaPlus    = new TH2D( 
1013     "fHistPtVsAmpV0CEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1014     fListHist->Add(fHistPtVsAmpV0CEq_GenOmegaPlus); }  
1015
1016   if(! fHistPtVsAmpV0MEq_GenXiMinus ) {
1017     fHistPtVsAmpV0MEq_GenXiMinus    = new TH2D( 
1018     "fHistPtVsAmpV0MEq_GenXiMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1019     fListHist->Add(fHistPtVsAmpV0MEq_GenXiMinus); }
1020   if(! fHistPtVsAmpV0MEq_GenXiPlus ) {
1021     fHistPtVsAmpV0MEq_GenXiPlus    = new TH2D( 
1022     "fHistPtVsAmpV0MEq_GenXiPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1023     fListHist->Add(fHistPtVsAmpV0MEq_GenXiPlus); }
1024   if(! fHistPtVsAmpV0MEq_GenOmegaMinus ) {
1025     fHistPtVsAmpV0MEq_GenOmegaMinus    = new TH2D( 
1026     "fHistPtVsAmpV0MEq_GenOmegaMinus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1027     fListHist->Add(fHistPtVsAmpV0MEq_GenOmegaMinus); }
1028   if(! fHistPtVsAmpV0MEq_GenOmegaPlus ) {
1029     fHistPtVsAmpV0MEq_GenOmegaPlus    = new TH2D( 
1030     "fHistPtVsAmpV0MEq_GenOmegaPlus",       "Generated;p_{T} (GeV/c); Mult",200,0,20,lAmplitudeBins,0,lMaxAmplitude);   
1031     fListHist->Add(fHistPtVsAmpV0MEq_GenOmegaPlus); }  
1032
1033    //List of Histograms: Normal
1034    PostData(1, fListHist);
1035
1036    //TTree Object: Saved to base directory. Should cache to disk while saving. 
1037    //(Important to avoid excessive memory usage, particularly when merging)
1038    PostData(2, fTreeEvent);
1039    PostData(3, fTreeV0);
1040    PostData(4, fTreeCascade);
1041
1042 }// end UserCreateOutputObjects
1043
1044
1045 //________________________________________________________________________
1046 void AliAnalysisTaskStrangenessVsMultiplicityMC::UserExec(Option_t *) 
1047 {
1048   // Main loop
1049   // Called for each event
1050
1051    AliESDEvent *lESDevent = 0x0;
1052    AliMCEvent  *lMCevent  = 0x0; 
1053    AliStack    *lMCstack  = 0x0; 
1054
1055     //Zero all booleans, etc
1056     fEvSel_HasAtLeastSPDVertex    = kFALSE;
1057     fEvSel_VtxZCut                = kFALSE;
1058     fEvSel_IsNotPileup            = kFALSE;
1059     fEvSel_IsNotPileupInMultBins  = kFALSE;
1060     fEvSel_HasVtxContributor      = kFALSE;
1061     fEvSel_Triggered              = kFALSE;
1062     fEvSel_VtxZ = -100; 
1063     fEvSel_MCType = -100; 
1064   // Connect to the InputEvent   
1065   // After these lines, we should have an ESD/AOD event + the number of V0s in it.
1066
1067    // Appropriate for ESD analysis! 
1068       
1069    lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
1070    if (!lESDevent) {
1071       AliWarning("ERROR: lESDevent not available \n");
1072       return;
1073    }
1074
1075   //Get VZERO Information for multiplicity later
1076   AliVVZERO* esdV0 = lESDevent->GetVZEROData();
1077   if (!esdV0) {
1078     AliError("AliVVZERO not available");
1079     return;
1080   }
1081         
1082   lMCevent = MCEvent();
1083   if (!lMCevent) {
1084     Printf("ERROR: Could not retrieve MC event \n");
1085     cout << "Name of the file with pb :" <<  fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;   
1086     return;
1087   }
1088
1089   lMCstack = lMCevent->Stack();
1090   if (!lMCstack) {
1091     Printf("ERROR: Could not retrieve MC stack \n");
1092     cout << "Name of the file with pb :" <<  fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
1093     return;
1094   }
1095
1096    fRunNumber = lESDevent->GetRunNumber();
1097
1098   Double_t lMagneticField = -10; 
1099   lMagneticField = lESDevent->GetMagneticField( );
1100
1101 //------------------------------------------------
1102 // MC type (ND, SD, DD) 
1103 //------------------------------------------------
1104
1105     AliGenEventHeader * header = lMCevent->GenEventHeader();
1106     Int_t processtype = AliPWG0Helper::GetPythiaEventProcessType(header);
1107     // non diffractive
1108     if (processtype !=92 && processtype !=93 && processtype != 94) fEvSel_MCType = 1;
1109     // single diffractive
1110     if ((processtype == 92 || processtype == 93)) fEvSel_MCType = 2;
1111     // double diffractive
1112     if (processtype == 94) fEvSel_MCType = 3;
1113
1114 //------------------------------------------------
1115 // Physics Selection
1116 //------------------------------------------------
1117   
1118   fHistEventCounter->Fill(0.5); 
1119
1120   UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1121   Bool_t isSelected = 0;
1122   isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
1123   fEvSel_Triggered = isSelected;
1124   
1125   //Standard Min-Bias Selection
1126   if ( (! isSelected) && (! fkSkipEventSelection ) ) {
1127     PostData(1, fListHist);
1128     PostData(2, fTreeEvent);
1129     PostData(3, fTreeV0);
1130     PostData(4, fTreeCascade);
1131     return;
1132   }
1133
1134   fHistEventCounter->Fill(1.5);
1135  
1136   //------------------------------------------------
1137   // Primary Vertex Requirements Section:
1138   //  ---> pp: has vertex, |z|<10cm
1139   //------------------------------------------------
1140   
1141   //classical Proton-proton like selection 
1142   const AliESDVertex *lPrimaryBestESDVtx     = lESDevent->GetPrimaryVertex();   
1143   const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
1144   const AliESDVertex *lPrimarySPDVtx         = lESDevent->GetPrimaryVertexSPD();
1145
1146   Double_t lBestPrimaryVtxPos[3]          = {-100.0, -100.0, -100.0};
1147   lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
1148   fEvSel_VtxZ = lBestPrimaryVtxPos[2];
1149
1150   //Only accept if Tracking or SPD vertex is fine 
1151   if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() && !fkSkipEventSelection ){
1152     AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1153     PostData(1, fListHist); 
1154     PostData(2, fTreeEvent);
1155     PostData(3, fTreeV0);
1156     PostData(4, fTreeCascade);
1157     return;
1158   }
1159     
1160     if(! (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus()) ){
1161         //Passed selection!
1162         fEvSel_HasAtLeastSPDVertex = kTRUE;
1163     }
1164     
1165   //Has SPD or Tracking Vertex
1166   fHistEventCounter -> Fill(2.5); 
1167
1168   //Always do Primary Vertex Selection 
1169   if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0 && !fkSkipEventSelection ) {
1170     AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1171     PostData(1, fListHist); 
1172     PostData(2, fTreeEvent);
1173     PostData(3, fTreeV0);
1174     PostData(4, fTreeCascade);
1175     return;
1176   }
1177     
1178     if(TMath::Abs(lBestPrimaryVtxPos[2]) <= 10.0 ){
1179         //Passed selection!
1180         fEvSel_VtxZCut = kTRUE;
1181     }
1182
1183   //Fill Event selected counter
1184   fHistEventCounter -> Fill(3.5);
1185
1186   //------------------------------------------------
1187   // Check if this isn't pileup
1188   //------------------------------------------------
1189
1190   if(lESDevent->IsPileupFromSPDInMultBins() && !fkSkipEventSelection ){
1191     // minContributors=3, minZdist=0.8, nSigmaZdist=3., nSigmaDiamXY=2., nSigmaDiamZ=5.  
1192     //-> see http://alisoft.cern.ch/viewvc/trunk/STEER/AliESDEvent.h?root=AliRoot&r1=41914&r2=42199&pathrev=42199
1193     AliWarning("Pb / Event tagged as pile-up by SPD... return !"); 
1194     PostData(1, fListHist); 
1195     PostData(2, fTreeEvent);
1196     PostData(3, fTreeV0);
1197     PostData(4, fTreeCascade);
1198     return; 
1199   }
1200     
1201     if( !lESDevent->IsPileupFromSPD()           ) fEvSel_IsNotPileup           = kTRUE;
1202     if( !lESDevent->IsPileupFromSPDInMultBins() ) fEvSel_IsNotPileupInMultBins = kTRUE;
1203     
1204     //First implementation of pileup from multi-vertexer (simple use of analysis utils)
1205     //if ( !fUtils->IsPileUpMV( lESDevent ) ) fEvSel_IsNotPileupMV = kTRUE;
1206     fEvSel_IsNotPileupMV = kFALSE ; //dummy
1207     
1208   //Fill Event isn't pileup counter
1209   fHistEventCounter -> Fill(4.5);
1210
1211 //------------------------------------------------
1212 // Multiplicity Information Acquistion
1213 //------------------------------------------------
1214
1215   //Monte Carlo Level information ! 
1216   //--------- GENERATED NUMBER OF CHARGED PARTICLES
1217   // ---> Variable Definition
1218
1219   Long_t lNchEta5   = 0; 
1220   Long_t lNchEta8   = 0; 
1221   Long_t lNchVZEROA = 0; 
1222   Long_t lNchVZEROC = 0; 
1223
1224   //----- Loop on Stack ----------------------------------------------------------------
1225   for (Int_t iCurrentLabelStack = 0;  iCurrentLabelStack < (lMCstack->GetNtrack()); iCurrentLabelStack++) 
1226   {// This is the begining of the loop on tracks
1227       TParticle* particleOne = lMCstack->Particle(iCurrentLabelStack);
1228       if(!particleOne) continue;
1229       if(!particleOne->GetPDG()) continue;
1230       Double_t lThisCharge = particleOne->GetPDG()->Charge()/3.;
1231       if(TMath::Abs(lThisCharge)<0.001) continue;
1232       if(! (lMCstack->IsPhysicalPrimary(iCurrentLabelStack)) ) continue;
1233      
1234       //Double_t gpt = particleOne -> Pt();
1235       Double_t geta = particleOne -> Eta(); 
1236
1237       if( TMath::Abs(geta) < 0.5 ) lNchEta5++; 
1238       if( TMath::Abs(geta) < 0.8 ) lNchEta8++; 
1239       if( 2.8 < geta && geta < 5.1 ) lNchVZEROA++; 
1240       if(-3.7 < geta && geta <-1.7 ) lNchVZEROC++; 
1241   }//End of loop on tracks
1242
1243   //Attribution 
1244   fTrueMultEta5 = lNchEta5; 
1245   fTrueMultEta8 = lNchEta8; 
1246   fTrueMultVZEROA = lNchVZEROA; 
1247   fTrueMultVZEROC = lNchVZEROC; 
1248   //----- End Loop on Stack ------------------------------------------------------------
1249
1250   //Standard GetReferenceMultiplicity Estimator (0.5 and 0.8)
1251   fRefMultEta5 = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,0.5);
1252   fRefMultEta8 = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,0.8);
1253
1254   // VZERO PART
1255   Float_t  multV0A  = 0;            //  multiplicity from V0 reco side A
1256   Float_t  multV0C  = 0;            //  multiplicity from V0 reco side C
1257   Float_t  multV0AEq  = 0;          //  multiplicity from V0 reco side A
1258   Float_t  multV0CEq  = 0;          //  multiplicity from V0 reco side C
1259   Float_t  multV0ACorr  = 0;            //  multiplicity from V0 reco side A
1260   Float_t  multV0CCorr  = 0;            //  multiplicity from V0 reco side C
1261
1262   //Non-Equalized Signal: copy of multV0ACorr and multV0CCorr from AliCentralitySelectionTask
1263   //Getters for uncorrected multiplicity  
1264   multV0A=esdV0->GetMTotV0A();
1265   multV0C=esdV0->GetMTotV0C();
1266
1267   //Get Z vertex position of SPD vertex (why not Tracking if available?) 
1268   Float_t zvtx = lPrimarySPDVtx->GetZ(); 
1269
1270   //Acquire Corrected multV0A 
1271   multV0ACorr = AliESDUtils::GetCorrV0A(multV0A,zvtx);    
1272   multV0CCorr = AliESDUtils::GetCorrV0C(multV0C,zvtx);   
1273     
1274   //Copy to Event Tree for extra information 
1275   fAmplitude_V0A = multV0ACorr; 
1276   fAmplitude_V0C = multV0CCorr; 
1277
1278   // Equalized signals // From AliCentralitySelectionTask
1279   for(Int_t iCh = 4; iCh < 7; ++iCh) {
1280     Double_t mult = lESDevent->GetVZEROEqMultiplicity(iCh);
1281     multV0AEq += mult;
1282   }
1283   for(Int_t iCh = 0; iCh < 3; ++iCh) {
1284     Double_t mult = lESDevent->GetVZEROEqMultiplicity(iCh);
1285     multV0CEq += mult;
1286   }
1287   fAmplitude_V0AEq = multV0AEq; 
1288   fAmplitude_V0CEq = multV0CEq; 
1289
1290   fCentrality_V0A   = -100; 
1291   fCentrality_V0C   = -100; 
1292   fCentrality_V0M   = -100; 
1293   fCentrality_V0AEq = -100; 
1294   fCentrality_V0CEq = -100; 
1295   fCentrality_V0MEq = -100; 
1296
1297   //AliCentrality... Check if working? 
1298   AliCentrality* centrality;
1299   centrality = lESDevent->GetCentrality();
1300   if ( !(centrality->GetQuality()>1) ){ 
1301     fCentrality_V0A   = centrality->GetCentralityPercentile( "V0A"   ); 
1302     fCentrality_V0C   = centrality->GetCentralityPercentile( "V0C"   ); 
1303     fCentrality_V0M   = centrality->GetCentralityPercentile( "V0M"   ); 
1304     fCentrality_V0AEq = centrality->GetCentralityPercentile( "V0AEq" ); 
1305     fCentrality_V0CEq = centrality->GetCentralityPercentile( "V0CEq" ); 
1306     fCentrality_V0MEq = centrality->GetCentralityPercentile( "V0MEq" ); 
1307   }
1308   
1309   //Event-level fill 
1310   fTreeEvent->Fill() ;
1311   
1312 //------------------------------------------------
1313
1314 //------------------------------------------------
1315 // Fill Efficiency Denominators, please 
1316 //------------------------------------------------
1317
1318    Int_t    lThisPDG  = 0;
1319    Double_t lThisRap  = 0;
1320    Double_t lThisPt   = 0;
1321
1322 //----- Loop on Generated CASCADES ---------------
1323    for (Int_t ilab = 0;  ilab < (lMCstack->GetNtrack()); ilab++) 
1324    {// This is the begining of the loop on tracks
1325       
1326       TParticle* lPart = 0x0; 
1327       lPart = lMCstack->Particle( ilab );
1328       if(!lPart){
1329          Printf("Generated loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", ilab );
1330          continue;
1331       }
1332
1333       lThisPDG = lPart->GetPdgCode();         
1334
1335       if ( (TMath::Abs(lThisPDG) == 3312) || (TMath::Abs(lThisPDG) == 3334) || (TMath::Abs(lThisPDG) == 3122) || lThisPDG == 310 ) 
1336       {
1337         lThisRap   = MyRapidity(lPart->Energy(),lPart->Pz());
1338         lThisPt    = lPart->Pt();
1339
1340         //Use Physical Primaries only for filling These Histos
1341         if ( lMCstack->IsPhysicalPrimary(ilab)!=kTRUE ) continue;
1342
1343         if( lThisPDG ==   310 && TMath::Abs(lThisRap) < 0.5 ) fHistPt_GenK0Short       -> Fill ( lThisPt ); 
1344         if( lThisPDG ==  3122 && TMath::Abs(lThisRap) < 0.5 ) fHistPt_GenLambda     -> Fill ( lThisPt ); 
1345         if( lThisPDG == -3122 && TMath::Abs(lThisRap) < 0.5 ) fHistPt_GenAntiLambda -> Fill ( lThisPt ); 
1346
1347         if( lThisPDG ==  3312 && TMath::Abs(lThisRap) < 0.5 ){
1348           fHistPt_GenXiMinus                -> Fill (lThisPt);          
1349           fHistPtVsRefMultEta5_GenXiMinus   -> Fill (lThisPt, fRefMultEta5); 
1350           fHistPtVsRefMultEta8_GenXiMinus   -> Fill (lThisPt, fRefMultEta8);
1351           //Centralities 
1352           fHistPtVsCentV0A_GenXiMinus       -> Fill (lThisPt, fCentrality_V0A);  
1353           fHistPtVsCentV0C_GenXiMinus       -> Fill (lThisPt, fCentrality_V0C);  
1354           fHistPtVsCentV0M_GenXiMinus       -> Fill (lThisPt, fCentrality_V0M);  
1355           fHistPtVsCentV0AEq_GenXiMinus       -> Fill (lThisPt, fCentrality_V0AEq);  
1356           fHistPtVsCentV0CEq_GenXiMinus       -> Fill (lThisPt, fCentrality_V0CEq);  
1357           fHistPtVsCentV0MEq_GenXiMinus       -> Fill (lThisPt, fCentrality_V0MEq);  
1358           //Amplitudes 
1359           fHistPtVsAmpV0A_GenXiMinus       -> Fill (lThisPt, fAmplitude_V0A);  
1360           fHistPtVsAmpV0C_GenXiMinus       -> Fill (lThisPt, fAmplitude_V0C);  
1361           fHistPtVsAmpV0M_GenXiMinus       -> Fill (lThisPt, fAmplitude_V0A + fAmplitude_V0C);  
1362           fHistPtVsAmpV0AEq_GenXiMinus       -> Fill (lThisPt, fAmplitude_V0AEq);  
1363           fHistPtVsAmpV0CEq_GenXiMinus       -> Fill (lThisPt, fAmplitude_V0CEq);  
1364           fHistPtVsAmpV0MEq_GenXiMinus       -> Fill (lThisPt, fAmplitude_V0AEq + fAmplitude_V0CEq);  
1365         }
1366         if( lThisPDG == -3312 && TMath::Abs(lThisRap) < 0.5 ){
1367           fHistPt_GenXiPlus                -> Fill (lThisPt);          
1368           fHistPtVsRefMultEta5_GenXiPlus   -> Fill (lThisPt, fRefMultEta5); 
1369           fHistPtVsRefMultEta8_GenXiPlus   -> Fill (lThisPt, fRefMultEta8);
1370           //Centralities 
1371           fHistPtVsCentV0A_GenXiPlus       -> Fill (lThisPt, fCentrality_V0A);  
1372           fHistPtVsCentV0C_GenXiPlus       -> Fill (lThisPt, fCentrality_V0C);  
1373           fHistPtVsCentV0M_GenXiPlus       -> Fill (lThisPt, fCentrality_V0M);  
1374           fHistPtVsCentV0AEq_GenXiPlus       -> Fill (lThisPt, fCentrality_V0AEq);  
1375           fHistPtVsCentV0CEq_GenXiPlus       -> Fill (lThisPt, fCentrality_V0CEq);  
1376           fHistPtVsCentV0MEq_GenXiPlus       -> Fill (lThisPt, fCentrality_V0MEq);  
1377           //Amplitudes 
1378           fHistPtVsAmpV0A_GenXiPlus       -> Fill (lThisPt, fAmplitude_V0A);  
1379           fHistPtVsAmpV0C_GenXiPlus       -> Fill (lThisPt, fAmplitude_V0C);  
1380           fHistPtVsAmpV0M_GenXiPlus       -> Fill (lThisPt, fAmplitude_V0A + fAmplitude_V0C);  
1381           fHistPtVsAmpV0AEq_GenXiPlus       -> Fill (lThisPt, fAmplitude_V0AEq);  
1382           fHistPtVsAmpV0CEq_GenXiPlus       -> Fill (lThisPt, fAmplitude_V0CEq);  
1383           fHistPtVsAmpV0MEq_GenXiPlus       -> Fill (lThisPt, fAmplitude_V0AEq + fAmplitude_V0CEq);  
1384         }
1385         if( lThisPDG ==  3334 && TMath::Abs(lThisRap) < 0.5 ){
1386           fHistPt_GenOmegaMinus                -> Fill (lThisPt);          
1387           fHistPtVsRefMultEta5_GenOmegaMinus   -> Fill (lThisPt, fRefMultEta5); 
1388           fHistPtVsRefMultEta8_GenOmegaMinus   -> Fill (lThisPt, fRefMultEta8);
1389           //Centralities 
1390           fHistPtVsCentV0A_GenOmegaMinus       -> Fill (lThisPt, fCentrality_V0A);  
1391           fHistPtVsCentV0C_GenOmegaMinus       -> Fill (lThisPt, fCentrality_V0C);  
1392           fHistPtVsCentV0M_GenOmegaMinus       -> Fill (lThisPt, fCentrality_V0M);  
1393           fHistPtVsCentV0AEq_GenOmegaMinus       -> Fill (lThisPt, fCentrality_V0AEq);  
1394           fHistPtVsCentV0CEq_GenOmegaMinus       -> Fill (lThisPt, fCentrality_V0CEq);  
1395           fHistPtVsCentV0MEq_GenOmegaMinus       -> Fill (lThisPt, fCentrality_V0MEq);  
1396           //Amplitudes 
1397           fHistPtVsAmpV0A_GenOmegaMinus       -> Fill (lThisPt, fAmplitude_V0A);  
1398           fHistPtVsAmpV0C_GenOmegaMinus       -> Fill (lThisPt, fAmplitude_V0C);  
1399           fHistPtVsAmpV0M_GenOmegaMinus       -> Fill (lThisPt, fAmplitude_V0A + fAmplitude_V0C);  
1400           fHistPtVsAmpV0AEq_GenOmegaMinus       -> Fill (lThisPt, fAmplitude_V0AEq);  
1401           fHistPtVsAmpV0CEq_GenOmegaMinus       -> Fill (lThisPt, fAmplitude_V0CEq);  
1402           fHistPtVsAmpV0MEq_GenOmegaMinus       -> Fill (lThisPt, fAmplitude_V0AEq + fAmplitude_V0CEq);  
1403         }
1404         if( lThisPDG == -3334 && TMath::Abs(lThisRap) < 0.5 ){
1405           fHistPt_GenOmegaPlus                -> Fill (lThisPt);          
1406           fHistPtVsRefMultEta5_GenOmegaPlus   -> Fill (lThisPt, fRefMultEta5); 
1407           fHistPtVsRefMultEta8_GenOmegaPlus   -> Fill (lThisPt, fRefMultEta8);
1408           //Centralities 
1409           fHistPtVsCentV0A_GenOmegaPlus       -> Fill (lThisPt, fCentrality_V0A);  
1410           fHistPtVsCentV0C_GenOmegaPlus       -> Fill (lThisPt, fCentrality_V0C);  
1411           fHistPtVsCentV0M_GenOmegaPlus       -> Fill (lThisPt, fCentrality_V0M);  
1412           fHistPtVsCentV0AEq_GenOmegaPlus       -> Fill (lThisPt, fCentrality_V0AEq);  
1413           fHistPtVsCentV0CEq_GenOmegaPlus       -> Fill (lThisPt, fCentrality_V0CEq);  
1414           fHistPtVsCentV0MEq_GenOmegaPlus       -> Fill (lThisPt, fCentrality_V0MEq);  
1415           //Amplitudes 
1416           fHistPtVsAmpV0A_GenOmegaPlus       -> Fill (lThisPt, fAmplitude_V0A);  
1417           fHistPtVsAmpV0C_GenOmegaPlus       -> Fill (lThisPt, fAmplitude_V0C);  
1418           fHistPtVsAmpV0M_GenOmegaPlus       -> Fill (lThisPt, fAmplitude_V0A + fAmplitude_V0C);  
1419           fHistPtVsAmpV0AEq_GenOmegaPlus       -> Fill (lThisPt, fAmplitude_V0AEq);  
1420           fHistPtVsAmpV0CEq_GenOmegaPlus       -> Fill (lThisPt, fAmplitude_V0CEq);  
1421           fHistPtVsAmpV0MEq_GenOmegaPlus       -> Fill (lThisPt, fAmplitude_V0AEq + fAmplitude_V0CEq);  
1422         }
1423       }
1424    }//End of loop on tracks
1425 //----- End Loop on Cascades ------------------------------------------------------------
1426
1427 //------------------------------------------------
1428 // Fill V0 Tree as needed
1429 //------------------------------------------------
1430
1431 //Variable definition
1432    Int_t    lOnFlyStatus = 0;// nv0sOn = 0, nv0sOff = 0;
1433    Double_t lChi2V0 = 0;
1434    Double_t lDcaV0Daughters = 0, lDcaV0ToPrimVertex = 0;
1435    Double_t lDcaPosToPrimVertex = 0, lDcaNegToPrimVertex = 0;
1436    Double_t lV0CosineOfPointingAngle = 0;
1437    Double_t lV0Radius = 0, lPt = 0;
1438    Double_t lRapK0Short = 0, lRapLambda = 0;
1439    Double_t lInvMassK0s = 0, lInvMassLambda = 0, lInvMassAntiLambda = 0;
1440    Double_t lAlphaV0 = 0, lPtArmV0 = 0;
1441
1442    Double_t fMinV0Pt = 0; 
1443    Double_t fMaxV0Pt = 100; 
1444
1445    Int_t nv0s = 0;
1446    nv0s = lESDevent->GetNumberOfV0s();
1447
1448    for (Int_t iV0 = 0; iV0 < nv0s; iV0++) //extra-crazy test
1449    {// This is the begining of the V0 loop
1450       AliESDv0 *v0 = ((AliESDEvent*)lESDevent)->GetV0(iV0);
1451       if (!v0) continue;
1452
1453       Double_t tDecayVertexV0[3]; v0->GetXYZ(tDecayVertexV0[0],tDecayVertexV0[1],tDecayVertexV0[2]); 
1454
1455       Double_t tV0mom[3];
1456       v0->GetPxPyPz( tV0mom[0],tV0mom[1],tV0mom[2] ); 
1457       Double_t lV0TotalMomentum = TMath::Sqrt(
1458       tV0mom[0]*tV0mom[0]+tV0mom[1]*tV0mom[1]+tV0mom[2]*tV0mom[2] );
1459
1460       lV0Radius = TMath::Sqrt(tDecayVertexV0[0]*tDecayVertexV0[0]+tDecayVertexV0[1]*tDecayVertexV0[1]);
1461
1462       lPt = v0->Pt();
1463       lRapK0Short = v0->RapK0Short();
1464       lRapLambda  = v0->RapLambda();
1465       if ((lPt<fMinV0Pt)||(fMaxV0Pt<lPt)) continue;
1466
1467       UInt_t lKeyPos = (UInt_t)TMath::Abs(v0->GetPindex());
1468       UInt_t lKeyNeg = (UInt_t)TMath::Abs(v0->GetNindex());
1469
1470       Double_t lMomPos[3]; v0->GetPPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]);
1471       Double_t lMomNeg[3]; v0->GetNPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
1472
1473       AliESDtrack *pTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyPos);
1474       AliESDtrack *nTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyNeg);
1475       if (!pTrack || !nTrack) {
1476          Printf("ERROR: Could not retreive one of the daughter track");
1477          continue;
1478       }
1479
1480       //Daughter Eta for Eta selection, afterwards
1481       fTreeVariableNegEta = nTrack->Eta();
1482       fTreeVariablePosEta = pTrack->Eta();
1483
1484       // Filter like-sign V0 (next: add counter and distribution)
1485       if ( pTrack->GetSign() == nTrack->GetSign()){
1486          continue;
1487       } 
1488
1489       //________________________________________________________________________
1490       // Track quality cuts 
1491       Float_t lPosTrackCrossedRows = pTrack->GetTPCClusterInfo(2,1);
1492       Float_t lNegTrackCrossedRows = nTrack->GetTPCClusterInfo(2,1);
1493       fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
1494       if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
1495          fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
1496
1497       // TPC refit condition (done during reconstruction for Offline but not for On-the-fly)
1498       if( !(pTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue;
1499       if( !(nTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue;
1500      
1501   
1502       if ( ( ( pTrack->GetTPCClusterInfo(2,1) ) < 70 ) || ( ( nTrack->GetTPCClusterInfo(2,1) ) < 70 ) ) continue;
1503         
1504       //GetKinkIndex condition
1505       if( pTrack->GetKinkIndex(0)>0 || nTrack->GetKinkIndex(0)>0 ) continue;
1506
1507       //Findable clusters > 0 condition
1508       if( pTrack->GetTPCNclsF()<=0 || nTrack->GetTPCNclsF()<=0 ) continue;
1509
1510       //Compute ratio Crossed Rows / Findable clusters
1511       //Note: above test avoids division by zero! 
1512       Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF())); 
1513       Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF())); 
1514
1515       fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
1516       if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
1517          fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
1518
1519       //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
1520       if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) continue;
1521
1522       //End track Quality Cuts
1523       //________________________________________________________________________
1524
1525       lDcaPosToPrimVertex = TMath::Abs(pTrack->GetD(lBestPrimaryVtxPos[0],
1526                                                         lBestPrimaryVtxPos[1],
1527                                                         lMagneticField) );
1528
1529       lDcaNegToPrimVertex = TMath::Abs(nTrack->GetD(lBestPrimaryVtxPos[0],
1530                                                         lBestPrimaryVtxPos[1],
1531                                                         lMagneticField) );
1532
1533       lOnFlyStatus = v0->GetOnFlyStatus();
1534       lChi2V0 = v0->GetChi2V0();
1535       lDcaV0Daughters = v0->GetDcaV0Daughters();
1536       lDcaV0ToPrimVertex = v0->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lBestPrimaryVtxPos[2]);
1537       lV0CosineOfPointingAngle = v0->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lBestPrimaryVtxPos[2]);
1538       fTreeVariableV0CosineOfPointingAngle=lV0CosineOfPointingAngle;
1539
1540       // Getting invariant mass infos directly from ESD
1541       v0->ChangeMassHypothesis(310);
1542       lInvMassK0s = v0->GetEffMass();
1543       v0->ChangeMassHypothesis(3122);
1544       lInvMassLambda = v0->GetEffMass();
1545       v0->ChangeMassHypothesis(-3122);
1546       lInvMassAntiLambda = v0->GetEffMass();
1547       lAlphaV0 = v0->AlphaV0();
1548       lPtArmV0 = v0->PtArmV0();
1549
1550
1551 //===============================================
1552 // Monte Carlo Association starts here
1553 //===============================================
1554
1555       //---> Set Everything to "I don't know" before starting
1556
1557       fTreeVariablePIDPositive = 0;
1558       fTreeVariablePIDNegative = 0;
1559
1560       fTreeVariablePtMother = -1;
1561       fTreeVariablePtMC = -1;
1562       fTreeVariableRapMC = -100;
1563
1564       fTreeVariablePID = -1; 
1565       fTreeVariablePIDMother = -1;
1566
1567       fTreeVariablePrimaryStatus = 0; 
1568       fTreeVariablePrimaryStatusMother = 0; 
1569     
1570       Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrack->GetLabel() );
1571       Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrack->GetLabel() );
1572                 
1573       TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );
1574       TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );
1575             
1576       Int_t lPIDPositive = mcPosV0Dghter -> GetPdgCode();
1577       Int_t lPIDNegative = mcNegV0Dghter -> GetPdgCode();
1578
1579       fTreeVariablePIDPositive = lPIDPositive;
1580       fTreeVariablePIDNegative = lPIDNegative;
1581
1582       Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ; 
1583       Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();
1584     
1585       if( lblMotherPosV0Dghter == lblMotherNegV0Dghter && lblMotherPosV0Dghter > -1 ){
1586          //either label is fine, they're equal at this stage
1587          TParticle* pThisV0 = lMCstack->Particle( lblMotherPosV0Dghter ); 
1588          //Set tree variables
1589          fTreeVariablePID   = pThisV0->GetPdgCode(); //PDG Code
1590          fTreeVariablePtMC  = pThisV0->Pt(); //Perfect Pt
1591
1592          //Only Interested if it's a Lambda, AntiLambda or K0s 
1593          //Avoid the Junction Bug! PYTHIA has particles with Px=Py=Pz=E=0 occasionally, 
1594          //having particle code 88 (unrecognized by PDG), for documentation purposes.
1595          //Even ROOT's TParticle::Y() is not prepared to deal with that exception!
1596          //Note that TParticle::Pt() is immune (that would just return 0)...
1597          //Though granted that that should be extremely rare in this precise condition...
1598          if( TMath::Abs(fTreeVariablePID) == 3122 || fTreeVariablePID==310 ){
1599             fTreeVariableRapMC = pThisV0->Y(); //Perfect Y
1600          }
1601          if( lMCstack->IsPhysicalPrimary       (lblMotherPosV0Dghter) ) fTreeVariablePrimaryStatus = 1; //Is Primary!
1602          if( lMCstack->IsSecondaryFromWeakDecay(lblMotherPosV0Dghter) ) fTreeVariablePrimaryStatus = 2; //Weak Decay!
1603          if( lMCstack->IsSecondaryFromMaterial (lblMotherPosV0Dghter) ) fTreeVariablePrimaryStatus = 3; //Material Int!
1604          
1605          //Now we try to acquire the V0 parent particle, if possible
1606          Int_t lblThisV0Parent = pThisV0->GetFirstMother();
1607          if ( lblThisV0Parent > -1 ){ //if it has a parent, get it and store specs
1608             TParticle* pThisV0Parent = lMCstack->Particle( lblThisV0Parent );
1609             fTreeVariablePIDMother   = pThisV0Parent->GetPdgCode(); //V0 Mother PDG
1610             fTreeVariablePtMother    = pThisV0Parent->Pt();         //V0 Mother Pt
1611             //Primary Status for the V0 Mother particle 
1612             if( lMCstack->IsPhysicalPrimary       (lblThisV0Parent) ) fTreeVariablePrimaryStatusMother = 1; //Is Primary!
1613             if( lMCstack->IsSecondaryFromWeakDecay(lblThisV0Parent) ) fTreeVariablePrimaryStatusMother = 2; //Weak Decay!
1614             if( lMCstack->IsSecondaryFromMaterial (lblThisV0Parent) ) fTreeVariablePrimaryStatusMother = 3; //Material Int!
1615          }
1616       }
1617
1618       fTreeVariablePt = v0->Pt();
1619       fTreeVariableChi2V0 = lChi2V0; 
1620       fTreeVariableDcaV0ToPrimVertex = lDcaV0ToPrimVertex;
1621       fTreeVariableDcaV0Daughters = lDcaV0Daughters;
1622       fTreeVariableV0CosineOfPointingAngle = lV0CosineOfPointingAngle; 
1623       fTreeVariableV0Radius = lV0Radius;
1624       fTreeVariableDcaPosToPrimVertex = lDcaPosToPrimVertex;
1625       fTreeVariableDcaNegToPrimVertex = lDcaNegToPrimVertex;
1626       fTreeVariableInvMassK0s = lInvMassK0s;
1627       fTreeVariableInvMassLambda = lInvMassLambda;
1628       fTreeVariableInvMassAntiLambda = lInvMassAntiLambda;
1629       fTreeVariableRapK0Short = lRapK0Short;
1630       fTreeVariableRapLambda = lRapLambda;
1631       fTreeVariableAlphaV0 = lAlphaV0;
1632       fTreeVariablePtArmV0 = lPtArmV0;
1633
1634       //Official means of acquiring N-sigmas 
1635       fTreeVariableNSigmasPosProton = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kProton );
1636       fTreeVariableNSigmasPosPion   = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kPion );
1637       fTreeVariableNSigmasNegProton = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kProton );
1638       fTreeVariableNSigmasNegPion   = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kPion );
1639
1640 //This requires an Invariant Mass Hypothesis afterwards
1641       fTreeVariableDistOverTotMom = TMath::Sqrt(
1642                                                 TMath::Power( tDecayVertexV0[0] - lBestPrimaryVtxPos[0] , 2) +
1643                                                 TMath::Power( tDecayVertexV0[1] - lBestPrimaryVtxPos[1] , 2) +
1644                                                 TMath::Power( tDecayVertexV0[2] - lBestPrimaryVtxPos[2] , 2)
1645                                         );
1646       fTreeVariableDistOverTotMom /= (lV0TotalMomentum+1e-10); //avoid division by zero, to be sure
1647
1648       //Copy Multiplicity information 
1649       fTreeVariableCentV0A = fCentrality_V0A; 
1650       fTreeVariableCentV0C = fCentrality_V0C; 
1651       fTreeVariableCentV0M = fCentrality_V0M; 
1652       fTreeVariableCentV0AEq = fCentrality_V0AEq; 
1653       fTreeVariableCentV0CEq = fCentrality_V0CEq; 
1654       fTreeVariableCentV0MEq = fCentrality_V0MEq; 
1655       fTreeVariableAmpV0A = fAmplitude_V0A; 
1656       fTreeVariableAmpV0C = fAmplitude_V0C; 
1657       fTreeVariableAmpV0AEq = fAmplitude_V0AEq; 
1658       fTreeVariableAmpV0CEq = fAmplitude_V0CEq; 
1659       fTreeVariableRefMultEta8 = fRefMultEta8;
1660       fTreeVariableRefMultEta5 = fRefMultEta5;
1661       fTreeVariableRunNumber = fRunNumber; 
1662
1663 //------------------------------------------------
1664 // Fill Tree! 
1665 //------------------------------------------------
1666      
1667      // The conditionals are meant to decrease excessive
1668      // memory usage!
1669      
1670      //First Selection: Reject OnFly
1671      if( lOnFlyStatus == 0 ){
1672        //Second Selection: rough 20-sigma band, parametric.
1673        //K0Short: Enough to parametrize peak broadening with linear function.
1674        Double_t lUpperLimitK0Short = (5.63707e-01) + (1.14979e-02)*fTreeVariablePt;
1675        Double_t lLowerLimitK0Short = (4.30006e-01) - (1.10029e-02)*fTreeVariablePt;
1676        //Lambda: Linear (for higher pt) plus exponential (for low-pt broadening)
1677        //[0]+[1]*x+[2]*TMath::Exp(-[3]*x)
1678        Double_t lUpperLimitLambda = (1.13688e+00) + (5.27838e-03)*fTreeVariablePt + (8.42220e-02)*TMath::Exp(-(3.80595e+00)*fTreeVariablePt);
1679        Double_t lLowerLimitLambda = (1.09501e+00) - (5.23272e-03)*fTreeVariablePt - (7.52690e-02)*TMath::Exp(-(3.46339e+00)*fTreeVariablePt);
1680        //Do Selection
1681        if( (fTreeVariableInvMassLambda    < lUpperLimitLambda  && fTreeVariableInvMassLambda     > lLowerLimitLambda     ) ||
1682           (fTreeVariableInvMassAntiLambda < lUpperLimitLambda  && fTreeVariableInvMassAntiLambda > lLowerLimitLambda     ) ||
1683           (fTreeVariableInvMassK0s        < lUpperLimitK0Short && fTreeVariableInvMassK0s        > lLowerLimitK0Short    ) ){
1684          //Pre-selection in case this is AA...
1685          if ( TMath::Abs(fTreeVariableNegEta)<0.8 && TMath::Abs(fTreeVariablePosEta)<0.8 && fkSaveV0Tree ) fTreeV0->Fill();
1686        }
1687      }
1688    }// This is the end of the V0 loop
1689
1690 //------------------------------------------------
1691 // Fill V0 tree over.
1692 //------------------------------------------------
1693
1694 //------------------------------------------------
1695 // Rerun cascade vertexer! 
1696 //------------------------------------------------
1697     
1698   if( fkRunVertexers ){ 
1699     lESDevent->ResetCascades();
1700     lESDevent->ResetV0s();
1701
1702     AliV0vertexer lV0vtxer;
1703     AliCascadeVertexer lCascVtxer;
1704                   
1705     lV0vtxer.SetDefaultCuts(fV0VertexerSels);
1706     lCascVtxer.SetDefaultCuts(fCascadeVertexerSels);
1707
1708     lV0vtxer.Tracks2V0vertices(lESDevent);
1709     lCascVtxer.V0sTracks2CascadeVertices(lESDevent);
1710   }
1711
1712 //------------------------------------------------
1713 // MAIN CASCADE LOOP STARTS HERE
1714 //------------------------------------------------
1715 // Code Credit: Antonin Maire (thanks^100)
1716 // ---> This is an adaptation
1717
1718   Long_t ncascades = 0;
1719         ncascades = lESDevent->GetNumberOfCascades();
1720   
1721   for (Int_t iXi = 0; iXi < ncascades; iXi++){
1722     //------------------------------------------------
1723     // Initializations
1724     //------------------------------------------------  
1725           //Double_t lTrkgPrimaryVtxRadius3D = -500.0;
1726           //Double_t lBestPrimaryVtxRadius3D = -500.0;
1727
1728           // - 1st part of initialisation : variables needed to store AliESDCascade data members
1729           Double_t lEffMassXi      = 0. ;
1730           //Double_t lChi2Xi         = -1. ;
1731           Double_t lDcaXiDaughters = -1. ;
1732           Double_t lXiCosineOfPointingAngle = -1. ;
1733           Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
1734           Double_t lXiRadius = -1000. ;
1735           
1736           // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
1737           Int_t    lPosTPCClusters    = -1; // For ESD only ...//FIXME : wait for availability in AOD
1738           Int_t    lNegTPCClusters    = -1; // For ESD only ...
1739           Int_t    lBachTPCClusters   = -1; // For ESD only ...
1740                         
1741           // - 3rd part of initialisation : about V0 part in cascades
1742           Double_t lInvMassLambdaAsCascDghter = 0.;
1743           //Double_t lV0Chi2Xi         = -1. ;
1744           Double_t lDcaV0DaughtersXi = -1.;
1745                 
1746           Double_t lDcaBachToPrimVertexXi = -1., lDcaV0ToPrimVertexXi = -1.;
1747           Double_t lDcaPosToPrimVertexXi  = -1.;
1748           Double_t lDcaNegToPrimVertexXi  = -1.;
1749           Double_t lV0CosineOfPointingAngleXi = -1. ;
1750           Double_t lV0CosineOfPointingAngleXiSpecial = -1. ;
1751           Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
1752           Double_t lV0RadiusXi = -1000.0;
1753           Double_t lV0quality  = 0.;
1754         
1755           // - 4th part of initialisation : Effective masses
1756           Double_t lInvMassXiMinus    = 0.;
1757           Double_t lInvMassXiPlus     = 0.;
1758           Double_t lInvMassOmegaMinus = 0.;
1759           Double_t lInvMassOmegaPlus  = 0.;
1760     
1761           // - 6th part of initialisation : extra info for QA
1762           Double_t lXiMomX       = 0. , lXiMomY = 0., lXiMomZ = 0.;
1763           Double_t lXiTransvMom  = 0. ;
1764           //Double_t lXiTransvMomMC= 0. ;
1765           Double_t lXiTotMom     = 0. ;
1766                 
1767           Double_t lBachMomX       = 0., lBachMomY  = 0., lBachMomZ   = 0.;
1768           //Double_t lBachTransvMom  = 0.;
1769           //Double_t lBachTotMom     = 0.;
1770
1771     fTreeCascVarNegNSigmaPion   = -100;
1772     fTreeCascVarNegNSigmaProton = -100;
1773     fTreeCascVarPosNSigmaPion   = -100;
1774     fTreeCascVarPosNSigmaProton = -100;
1775     fTreeCascVarBachNSigmaPion  = -100;
1776     fTreeCascVarBachNSigmaKaon  = -100;
1777         
1778           Short_t  lChargeXi = -2;
1779           //Double_t lV0toXiCosineOfPointingAngle = 0. ;
1780         
1781           Double_t lRapXi   = -20.0, lRapOmega = -20.0, lRapMC = -20;//  lEta = -20.0, lTheta = 360., lPhi = 720. ;
1782           //Double_t lAlphaXi = -200., lPtArmXi  = -200.0;
1783             
1784     // -------------------------------------
1785     // II.ESD - Calculation Part dedicated to Xi vertices (ESD)
1786     
1787           AliESDcascade *xi = lESDevent->GetCascade(iXi);
1788           if (!xi) continue;
1789         
1790                 // - II.Step 2 : Assigning the necessary variables for specific AliESDcascade data members (ESD)        
1791                 //-------------
1792           lV0quality = 0.;
1793           xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis : cascade = Xi- decay
1794
1795           lEffMassXi                    = xi->GetEffMassXi();
1796           //lChi2Xi                         = xi->GetChi2Xi();
1797           lDcaXiDaughters       = xi->GetDcaXiDaughters();
1798           lXiCosineOfPointingAngle                  = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0],
1799                                                                                  lBestPrimaryVtxPos[1],
1800                                                                                  lBestPrimaryVtxPos[2] );
1801                   // Take care : the best available vertex should be used (like in AliCascadeVertexer)
1802         
1803           xi->GetXYZcascade( lPosXi[0],  lPosXi[1], lPosXi[2] ); 
1804           lXiRadius                     = TMath::Sqrt( lPosXi[0]*lPosXi[0]  +  lPosXi[1]*lPosXi[1] );           
1805
1806                 // - II.Step 3 : around the tracks : Bach + V0 (ESD)
1807                 // ~ Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1808                 //-------------
1809                 
1810         UInt_t lIdxPosXi        = (UInt_t) TMath::Abs( xi->GetPindex() );
1811         UInt_t lIdxNegXi        = (UInt_t) TMath::Abs( xi->GetNindex() );
1812         UInt_t lBachIdx         = (UInt_t) TMath::Abs( xi->GetBindex() );
1813                 // Care track label can be negative in MC production (linked with the track quality)
1814                 // However = normally, not the case for track index ...
1815           
1816           // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1817           if(lBachIdx == lIdxNegXi) {
1818                   AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
1819           }
1820     if(lBachIdx == lIdxPosXi) {
1821         AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
1822           }
1823           
1824           AliESDtrack *pTrackXi         = lESDevent->GetTrack( lIdxPosXi );
1825           AliESDtrack *nTrackXi         = lESDevent->GetTrack( lIdxNegXi );
1826           AliESDtrack *bachTrackXi      = lESDevent->GetTrack( lBachIdx );
1827
1828           if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1829                   AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
1830                   continue;
1831           }
1832
1833       fTreeCascVarPosEta = pTrackXi->Eta();
1834       fTreeCascVarNegEta = nTrackXi->Eta();
1835       fTreeCascVarBachEta = bachTrackXi->Eta();
1836       
1837       Double_t lBMom[3], lNMom[3], lPMom[3];
1838       xi->GetBPxPyPz( lBMom[0], lBMom[1], lBMom[2] );
1839       xi->GetPPxPyPz( lPMom[0], lPMom[1], lPMom[2] );
1840       xi->GetNPxPyPz( lNMom[0], lNMom[1], lNMom[2] );
1841       
1842       //fTreeCascVarBachTransMom = TMath::Sqrt( lBMom[0]*lBMom[0] + lBMom[1]*lBMom[1] );
1843       //fTreeCascVarPosTransMom  = TMath::Sqrt( lPMom[0]*lPMom[0] + lPMom[1]*lPMom[1] );
1844       //fTreeCascVarNegTransMom  = TMath::Sqrt( lNMom[0]*lNMom[0] + lNMom[1]*lNMom[1] );
1845   
1846     //------------------------------------------------
1847     // TPC dEdx information 
1848     //------------------------------------------------
1849     fTreeCascVarNegNSigmaPion   = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kPion   );
1850     fTreeCascVarNegNSigmaProton = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kProton );
1851     fTreeCascVarPosNSigmaPion   = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kPion );
1852     fTreeCascVarPosNSigmaProton = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kProton );
1853     fTreeCascVarBachNSigmaPion  = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kPion );
1854     fTreeCascVarBachNSigmaKaon  = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kKaon );
1855
1856     //------------------------------------------------
1857     // TPC Number of clusters info
1858     // --- modified to save the smallest number 
1859     // --- of TPC clusters for the 3 tracks
1860     //------------------------------------------------
1861               
1862           lPosTPCClusters   = pTrackXi->GetTPCNcls();
1863           lNegTPCClusters   = nTrackXi->GetTPCNcls();
1864           lBachTPCClusters  = bachTrackXi->GetTPCNcls(); 
1865
1866     // 1 - Poor quality related to TPCrefit
1867           ULong_t pStatus    = pTrackXi->GetStatus();
1868           ULong_t nStatus    = nTrackXi->GetStatus();
1869           ULong_t bachStatus = bachTrackXi->GetStatus();
1870
1871     //fTreeCascVarkITSRefitBachelor = kTRUE; 
1872     //fTreeCascVarkITSRefitNegative = kTRUE; 
1873     //fTreeCascVarkITSRefitPositive = kTRUE; 
1874
1875     if ((pStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1876     if ((nStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1877     if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1878
1879     //Extra Debug Information: booleans for ITS refit
1880     //if ((pStatus&AliESDtrack::kITSrefit)    == 0) { fTreeCascVarkITSRefitPositive = kFALSE; }
1881     //if ((nStatus&AliESDtrack::kITSrefit)    == 0) { fTreeCascVarkITSRefitNegative = kFALSE; }
1882     //if ((bachStatus&AliESDtrack::kITSrefit) == 0) { fTreeCascVarkITSRefitBachelor = kFALSE; }
1883
1884           // 2 - Poor quality related to TPC clusters: lowest cut of 70 clusters
1885     if(lPosTPCClusters  < 70) { AliWarning("Pb / V0 Pos. track has less than 70 TPC clusters ... continue!"); continue; }
1886           if(lNegTPCClusters  < 70) { AliWarning("Pb / V0 Neg. track has less than 70 TPC clusters ... continue!"); continue; }
1887           if(lBachTPCClusters < 70) { AliWarning("Pb / Bach.   track has less than 70 TPC clusters ... continue!"); continue; }
1888           Int_t leastnumberofclusters = 1000; 
1889           if( lPosTPCClusters < leastnumberofclusters ) leastnumberofclusters = lPosTPCClusters;
1890           if( lNegTPCClusters < leastnumberofclusters ) leastnumberofclusters = lNegTPCClusters;
1891           if( lBachTPCClusters < leastnumberofclusters ) leastnumberofclusters = lBachTPCClusters;
1892
1893           lInvMassLambdaAsCascDghter    = xi->GetEffMass();
1894           // This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
1895           lDcaV0DaughtersXi             = xi->GetDcaV0Daughters(); 
1896           //lV0Chi2Xi                   = xi->GetChi2V0();
1897         
1898           lV0CosineOfPointingAngleXi    = xi->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0],
1899                                                                             lBestPrimaryVtxPos[1],
1900                                                                             lBestPrimaryVtxPos[2] );
1901     //Modification: V0 CosPA wrt to Cascade decay vertex
1902           lV0CosineOfPointingAngleXiSpecial     = xi->GetV0CosineOfPointingAngle( lPosXi[0],
1903                                                                             lPosXi[1],
1904                                                                             lPosXi[2] );
1905
1906           lDcaV0ToPrimVertexXi          = xi->GetD( lBestPrimaryVtxPos[0], 
1907                                                       lBestPrimaryVtxPos[1], 
1908                                                       lBestPrimaryVtxPos[2] );
1909                 
1910           lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD(       lBestPrimaryVtxPos[0], 
1911                                                                 lBestPrimaryVtxPos[1], 
1912                                                                 lMagneticField  ) ); 
1913                                           // Note : AliExternalTrackParam::GetD returns an algebraic value ...
1914                 
1915           xi->GetXYZ( lPosV0Xi[0],  lPosV0Xi[1], lPosV0Xi[2] ); 
1916           lV0RadiusXi           = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0]  +  lPosV0Xi[1]*lPosV0Xi[1] );
1917         
1918           lDcaPosToPrimVertexXi         = TMath::Abs( pTrackXi  ->GetD( lBestPrimaryVtxPos[0], 
1919                                                                 lBestPrimaryVtxPos[1], 
1920                                                                 lMagneticField  )     ); 
1921         
1922           lDcaNegToPrimVertexXi         = TMath::Abs( nTrackXi  ->GetD( lBestPrimaryVtxPos[0], 
1923                                                                 lBestPrimaryVtxPos[1], 
1924                                                                 lMagneticField  )     ); 
1925                 
1926           // - II.Step 4 : around effective masses (ESD)
1927           // ~ change mass hypotheses to cover all the possibilities :  Xi-/+, Omega -/+
1928                 
1929           if( bachTrackXi->Charge() < 0 )       {
1930                   lV0quality = 0.;
1931                   xi->ChangeMassHypothesis(lV0quality , 3312);  
1932                           // Calculate the effective mass of the Xi- candidate. 
1933                           // pdg code 3312 = Xi-
1934                   lInvMassXiMinus = xi->GetEffMassXi();
1935                 
1936                   lV0quality = 0.;
1937                   xi->ChangeMassHypothesis(lV0quality , 3334);  
1938                           // Calculate the effective mass of the Xi- candidate. 
1939                           // pdg code 3334 = Omega-
1940                   lInvMassOmegaMinus = xi->GetEffMassXi();
1941                                         
1942                   lV0quality = 0.;
1943                   xi->ChangeMassHypothesis(lV0quality , 3312);  // Back to default hyp.
1944           }// end if negative bachelor
1945         
1946         
1947           if( bachTrackXi->Charge() >  0 ){
1948                   lV0quality = 0.;
1949                   xi->ChangeMassHypothesis(lV0quality , -3312);         
1950                           // Calculate the effective mass of the Xi+ candidate. 
1951                           // pdg code -3312 = Xi+
1952                   lInvMassXiPlus = xi->GetEffMassXi();
1953                 
1954                   lV0quality = 0.;
1955                   xi->ChangeMassHypothesis(lV0quality , -3334);         
1956                           // Calculate the effective mass of the Xi+ candidate. 
1957                           // pdg code -3334  = Omega+
1958                   lInvMassOmegaPlus = xi->GetEffMassXi();
1959                 
1960                   lV0quality = 0.;
1961                   xi->ChangeMassHypothesis(lV0quality , -3312);         // Back to "default" hyp.
1962           }// end if positive bachelor
1963                   // - II.Step 6 : extra info for QA (ESD)
1964                   // miscellaneous pieces of info that may help regarding data quality assessment.
1965                   //-------------
1966
1967           xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
1968                   lXiTransvMom          = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY );
1969                   lXiTotMom     = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY   + lXiMomZ*lXiMomZ );
1970                 
1971           xi->GetBPxPyPz(  lBachMomX,  lBachMomY,  lBachMomZ );
1972                   //lBachTransvMom  = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY );
1973                   //lBachTotMom         = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY  +  lBachMomZ*lBachMomZ  );
1974
1975           lChargeXi = xi->Charge();
1976
1977           //lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
1978         
1979           lRapXi    = xi->RapXi();
1980           lRapOmega = xi->RapOmega();
1981           //lEta      = xi->Eta();
1982           //lTheta    = xi->Theta() *180.0/TMath::Pi();
1983           //lPhi      = xi->Phi()   *180.0/TMath::Pi();
1984           //lAlphaXi  = xi->AlphaXi();
1985           //lPtArmXi  = xi->PtArmXi();
1986
1987 //------------------------------------------------
1988 // Associate Cascade Candidates to Monte Carlo!
1989 //------------------------------------------------      
1990
1991 //Warning: Not using Continues... Need to fill tree later!
1992
1993   Double_t lXiTransvMomMC= 0. ; 
1994         Int_t lPDGCodeCascade = 0;      
1995         Int_t lPID_BachMother = 0;
1996         Int_t lPID_NegMother = 0;
1997         Int_t lPID_PosMother = 0;
1998   fTreeCascVarIsPhysicalPrimary = 0; // 0: not defined, any candidate may have this
1999
2000         if(fDebug > 5)
2001                 cout    << "MC EventNumber : " << lMCevent->Header()->GetEvent() 
2002                         << " / MC event Number in Run : " << lMCevent->Header()->GetEventNrInRun() << endl;
2003         
2004 //----------------------------------------
2005 // Regular MC ASSOCIATION STARTS HERE
2006 //----------------------------------------
2007
2008           Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );  
2009                   // Abs value = needed ! question of quality track association ...
2010           Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );
2011           Int_t lblBach        = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
2012
2013           TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );
2014           TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );
2015           TParticle* mcBach        = lMCstack->Particle( lblBach );
2016       
2017     //fTreeCascVarPosTransMomMC = mcPosV0Dghter->Pt();
2018     //fTreeCascVarNegTransMomMC = mcNegV0Dghter->Pt();
2019
2020           //fTreeCascVarPIDPositive = mcPosV0Dghter -> GetPdgCode();
2021           //fTreeCascVarPIDNegative = mcNegV0Dghter -> GetPdgCode();
2022           //fTreeCascVarPIDBachelor = mcBach->GetPdgCode();
2023
2024           // - Step 4.2 : level of the Xi daughters
2025                 
2026           Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ; 
2027           Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();
2028         
2029           //Rather uncivilized: Open brackets for each 'continue'
2030           if(! (lblMotherPosV0Dghter != lblMotherNegV0Dghter) ) { // same mother
2031           if(! (lblMotherPosV0Dghter < 0) ) { // mother != primary (!= -1)
2032           if(! (lblMotherNegV0Dghter < 0) ) {
2033                                         
2034                 // mothers = Lambda candidate ... a priori
2035         
2036           TParticle* mcMotherPosV0Dghter = lMCstack->Particle( lblMotherPosV0Dghter );
2037           TParticle* mcMotherNegV0Dghter = lMCstack->Particle( lblMotherNegV0Dghter );
2038                         
2039           // - Step 4.3 : level of Xi candidate
2040         
2041           Int_t lblGdMotherPosV0Dghter =   mcMotherPosV0Dghter->GetFirstMother() ;
2042           Int_t lblGdMotherNegV0Dghter =   mcMotherNegV0Dghter->GetFirstMother() ;
2043                                 
2044                 if(! (lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter) ) {
2045                 if(! (lblGdMotherPosV0Dghter < 0) ) { // primary lambda ...
2046                 if(! (lblGdMotherNegV0Dghter < 0) ) { // primary lambda ...
2047
2048                   // Gd mothers = Xi candidate ... a priori
2049         
2050           TParticle* mcGdMotherPosV0Dghter = lMCstack->Particle( lblGdMotherPosV0Dghter );
2051           TParticle* mcGdMotherNegV0Dghter = lMCstack->Particle( lblGdMotherNegV0Dghter );
2052                                         
2053           Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetFirstMother()  );
2054         
2055   //            if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters
2056                   if(!(lblMotherBach != lblGdMotherPosV0Dghter)) { //same mother for bach and V0 daughters
2057         
2058           TParticle* mcMotherBach = lMCstack->Particle( lblMotherBach );
2059         
2060     lPID_BachMother = mcMotherBach->GetPdgCode();
2061           lPID_NegMother = mcGdMotherPosV0Dghter->GetPdgCode();
2062           lPID_PosMother = mcGdMotherNegV0Dghter->GetPdgCode();
2063    
2064           if(lPID_BachMother==lPID_NegMother && lPID_BachMother==lPID_PosMother){ 
2065                   lPDGCodeCascade = lPID_BachMother; 
2066       lXiTransvMomMC = mcMotherBach->Pt();
2067       if( lMCstack->IsPhysicalPrimary       (lblMotherBach) ) fTreeCascVarIsPhysicalPrimary = 1; //Is Primary!
2068       if( lMCstack->IsSecondaryFromWeakDecay(lblMotherBach) ) fTreeCascVarIsPhysicalPrimary = 2; //Weak Decay!
2069       if( lMCstack->IsSecondaryFromMaterial (lblMotherBach) ) fTreeCascVarIsPhysicalPrimary = 3; //From Material!
2070       if ( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) !=0 ){
2071         lRapMC = 0.5*TMath::Log( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) );
2072       }
2073           }
2074
2075   }}}}}}} //Ends all conditionals above...
2076
2077 //----------------------------------------
2078 // Regular MC ASSOCIATION ENDS HERE
2079 //----------------------------------------
2080
2081
2082   //------------------------------------------------
2083   // Set Variables for adding to tree
2084   //------------------------------------------------            
2085         
2086           fTreeCascVarCharge    = lChargeXi;
2087           fTreeCascVarPID = lPDGCodeCascade; 
2088           if(lInvMassXiMinus!=0)    fTreeCascVarMassAsXi = lInvMassXiMinus;
2089           if(lInvMassXiPlus!=0)     fTreeCascVarMassAsXi = lInvMassXiPlus;
2090           if(lInvMassOmegaMinus!=0) fTreeCascVarMassAsOmega = lInvMassOmegaMinus;
2091           if(lInvMassOmegaPlus!=0)  fTreeCascVarMassAsOmega = lInvMassOmegaPlus;
2092           fTreeCascVarPt = lXiTransvMom;
2093           fTreeCascVarPtMC = lXiTransvMomMC;
2094           fTreeCascVarRapXi = lRapXi ;
2095           fTreeCascVarRapMC = lRapMC ;
2096           fTreeCascVarRapOmega = lRapOmega ;
2097           fTreeCascVarDCACascDaughters = lDcaXiDaughters;
2098           fTreeCascVarDCABachToPrimVtx = lDcaBachToPrimVertexXi;
2099           fTreeCascVarDCAV0Daughters = lDcaV0DaughtersXi;
2100           fTreeCascVarDCAV0ToPrimVtx = lDcaV0ToPrimVertexXi;
2101           fTreeCascVarDCAPosToPrimVtx = lDcaPosToPrimVertexXi;
2102           fTreeCascVarDCANegToPrimVtx = lDcaNegToPrimVertexXi;
2103           fTreeCascVarCascCosPointingAngle = lXiCosineOfPointingAngle;
2104           fTreeCascVarCascRadius = lXiRadius;
2105           fTreeCascVarV0Mass = lInvMassLambdaAsCascDghter;
2106           fTreeCascVarV0CosPointingAngle = lV0CosineOfPointingAngleXi;
2107           fTreeCascVarV0CosPointingAngleSpecial = lV0CosineOfPointingAngleXiSpecial;
2108           fTreeCascVarV0Radius = lV0RadiusXi;
2109           fTreeCascVarLeastNbrClusters = leastnumberofclusters;
2110
2111           //Copy Multiplicity information 
2112           fTreeCascVarCentV0A = fCentrality_V0A; 
2113           fTreeCascVarCentV0C = fCentrality_V0C; 
2114           fTreeCascVarCentV0M = fCentrality_V0M; 
2115           fTreeCascVarCentV0AEq = fCentrality_V0AEq; 
2116           fTreeCascVarCentV0CEq = fCentrality_V0CEq; 
2117           fTreeCascVarCentV0MEq = fCentrality_V0MEq; 
2118           fTreeCascVarAmpV0A = fAmplitude_V0A; 
2119           fTreeCascVarAmpV0C = fAmplitude_V0C; 
2120           fTreeCascVarAmpV0AEq = fAmplitude_V0AEq; 
2121           fTreeCascVarAmpV0CEq = fAmplitude_V0CEq; 
2122           fTreeCascVarRefMultEta8 = fRefMultEta8;
2123           fTreeCascVarRefMultEta5 = fRefMultEta5;
2124           fTreeCascVarRunNumber = fRunNumber; 
2125
2126           fTreeCascVarDistOverTotMom = TMath::Sqrt(
2127                                                 TMath::Power( lPosXi[0] - lBestPrimaryVtxPos[0] , 2) +
2128                                                 TMath::Power( lPosXi[1] - lBestPrimaryVtxPos[1] , 2) +
2129                                                 TMath::Power( lPosXi[2] - lBestPrimaryVtxPos[2] , 2)
2130                                         );
2131           fTreeCascVarDistOverTotMom /= (lXiTotMom+1e-13);
2132
2133 //All vars not specified here: specified elsewhere!
2134
2135 //------------------------------------------------
2136 // Fill Tree! 
2137 //------------------------------------------------
2138
2139 // The conditional is meant to decrease excessive
2140 // memory usage! Be careful when loosening the 
2141 // cut!
2142
2143   //Xi    Mass window: 150MeV wide
2144   //Omega mass window: 150MeV wide
2145
2146   if( fkSaveCascadeTree && ( (fTreeCascVarMassAsXi<1.32+0.075&&fTreeCascVarMassAsXi>1.32-0.075) ||
2147       (fTreeCascVarMassAsOmega<1.68+0.075&&fTreeCascVarMassAsOmega>1.68-0.075) ) ){
2148       fTreeCascade->Fill();
2149   }
2150
2151 //------------------------------------------------
2152 // Fill tree over.
2153 //------------------------------------------------
2154
2155         }// end of the Cascade loop (ESD or AOD)
2156
2157   // Post output data.
2158   PostData(1, fListHist); 
2159   PostData(2, fTreeEvent);
2160   PostData(3, fTreeV0);
2161   PostData(4, fTreeCascade);
2162 }
2163
2164 //________________________________________________________________________
2165 void AliAnalysisTaskStrangenessVsMultiplicityMC::Terminate(Option_t *)
2166 {
2167    // Draw result to the screen
2168    // Called once at the end of the query
2169
2170    TList *cRetrievedList = 0x0;
2171    cRetrievedList = (TList*)GetOutputData(1);
2172    if(!cRetrievedList){
2173       Printf("ERROR - AliAnalysisTaskStrangenessVsMultiplicityMC : ouput data container list not available\n");
2174       return;
2175    }    
2176         
2177    fHistEventCounter = dynamic_cast<TH1D*> (  cRetrievedList->FindObject("fHistEventCounter")  );
2178    if (!fHistEventCounter) {
2179       Printf("ERROR - AliAnalysisTaskStrangenessVsMultiplicityMC : fHistEventCounter not available");
2180       return;
2181    }
2182   
2183    TCanvas *canCheck = new TCanvas("AliAnalysisTaskStrangenessVsMultiplicityMC","V0 Multiplicity",10,10,510,510);
2184    canCheck->cd(1)->SetLogy();
2185
2186    fHistEventCounter->SetMarkerStyle(22);
2187    fHistEventCounter->DrawCopy("E");
2188 }
2189
2190 //----------------------------------------------------------------------------
2191
2192 Double_t AliAnalysisTaskStrangenessVsMultiplicityMC::MyRapidity(Double_t rE, Double_t rPz) const
2193 {
2194    // Local calculation for rapidity
2195    Double_t ReturnValue = -100;
2196    if( (rE-rPz+1.e-13) != 0 && (rE+rPz) != 0 ){ 
2197       ReturnValue =  0.5*TMath::Log((rE+rPz)/(rE-rPz+1.e-13));
2198    }
2199    return ReturnValue;
2200