Added IsPhsyicalPrimary Flag to Cascade task
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Cascades / AliAnalysisTaskExtractPerformanceCascade.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 // Modified version of AliAnalysisTaskCheckCascade.cxx.
19 // This is a 'hybrid' output version, in that it uses a classic TTree
20 // ROOT object to store the candidates, plus a couple of histograms filled on
21 // a per-event basis for storing variables too numerous to put in a tree. 
22 //
23 // --- Adapted to look for lambdas as well, using code from 
24 //        AliAnalysisTaskCheckPerformanceStrange.cxx
25 //
26 //  --- Algorithm Description 
27 //   1. Loop over primaries in stack to acquire generated charged Xi
28 //   2. Loop over stack to find Cascades, fill TH3Fs "PrimRawPt"s for Efficiency
29 //   3. Perform Physics Selection
30 //   4. Perform Primary Vertex |z|<10cm selection
31 //   5. Perform Primary Vertex NoTPCOnly vertexing selection (>0 contrib.)
32 //   6. Perform Pileup Rejection
33 //   7. Analysis Loops: 
34 //    7a. Fill TH3Fs "PrimAnalysisPt" for control purposes only
35 //
36 //  Please Report Any Bugs! 
37 //
38 //   --- David Dobrigkeit Chinellato
39 //        (david.chinellato@gmail.com)
40 //
41 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42
43 class TTree;
44 class TParticle;
45 class TVector3;
46
47 //class AliMCEventHandler;
48 //class AliMCEvent;
49 //class AliStack;
50
51 class AliESDVertex;
52 class AliAODVertex;
53 class AliESDv0;
54 class AliAODv0;
55
56 #include <Riostream.h>
57 #include "TList.h"
58 #include "TH1.h"
59 #include "TH2.h"
60 #include "TH3.h"
61 #include "TFile.h"
62 #include "THnSparse.h"
63 #include "TVector3.h"
64 #include "TCanvas.h"
65 #include "TMath.h"
66 #include "TLegend.h"
67 #include "AliLog.h"
68
69 #include "AliESDEvent.h"
70 #include "AliAODEvent.h"
71 #include "AliV0vertexer.h"
72 #include "AliCascadeVertexer.h"
73 #include "AliESDpid.h"
74 #include "AliESDtrack.h"
75 #include "AliESDtrackCuts.h"
76 #include "AliInputEventHandler.h"
77 #include "AliAnalysisManager.h"
78 #include "AliMCEventHandler.h"
79 #include "AliMCEvent.h"
80 #include "AliStack.h"
81
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 "AliAnalysisUtils.h"
89 #include "AliGenEventHeader.h"
90
91 #include "AliAnalysisTaskExtractPerformanceCascade.h"
92
93 using std::cout;
94 using std::endl;
95
96 ClassImp(AliAnalysisTaskExtractPerformanceCascade)
97
98 AliAnalysisTaskExtractPerformanceCascade::AliAnalysisTaskExtractPerformanceCascade() 
99   : AliAnalysisTaskSE(), fListHist(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0), fUtils(0),
100    fkIsNuclear   ( kFALSE ), 
101    fkSwitchINT7  ( kFALSE ),
102    fpArapidityShift ( 0.465 ),
103    fCentralityEstimator("V0M"),
104    fkpAVertexSelection( kFALSE ),
105    fEtaRefMult ( 0.5 ),
106 //------------------------------------------------
107 // Tree Variables
108 //------------------------------------------------
109
110    fTreeCascVarCharge(0),
111    fTreeCascVarMassAsXi(0),
112    fTreeCascVarMassAsOmega(0),
113    fTreeCascVarPt(0),
114    fTreeCascVarPtMC(0),
115    fTreeCascVarRapMC(0),
116    fTreeCascVarRapXi(0),
117    fTreeCascVarRapOmega(0),
118    fTreeCascVarNegEta(0),
119    fTreeCascVarPosEta(0),
120    fTreeCascVarBachEta(0),
121    fTreeCascVarDCACascDaughters(0),
122    fTreeCascVarDCABachToPrimVtx(0),
123    fTreeCascVarDCAV0Daughters(0),
124    fTreeCascVarDCAV0ToPrimVtx(0),
125    fTreeCascVarDCAPosToPrimVtx(0),
126    fTreeCascVarDCANegToPrimVtx(0),
127    fTreeCascVarCascCosPointingAngle(0),
128    fTreeCascVarCascRadius(0),
129    fTreeCascVarV0Mass(0),
130    fTreeCascVarV0CosPointingAngle(0),
131    fTreeCascVarV0CosPointingAngleSpecial(0),
132    fTreeCascVarV0Radius(0),
133    fTreeCascVarLeastNbrClusters(0),
134    fTreeCascVarMultiplicity(0),
135    fTreeCascVarMultiplicityV0A(0),
136    fTreeCascVarMultiplicityZNA(0),
137    fTreeCascVarMultiplicityTRK(0),
138    fTreeCascVarMultiplicitySPD(0),
139    fTreeCascVarMultiplicityMC(0),
140    fTreeCascVarDistOverTotMom(0),
141    fTreeCascVarIsPhysicalPrimary(0),
142    fTreeCascVarPID(0),
143    fTreeCascVarPIDBachelor(0),
144    fTreeCascVarPIDNegative(0),
145    fTreeCascVarPIDPositive(0),
146    fTreeCascVarPosTransMom(0),
147    fTreeCascVarNegTransMom(0),
148    fTreeCascVarPosTransMomMC(0),
149    fTreeCascVarNegTransMomMC(0),
150    fTreeCascVarNegNSigmaPion(0),
151    fTreeCascVarNegNSigmaProton(0),
152    fTreeCascVarPosNSigmaPion(0),
153    fTreeCascVarPosNSigmaProton(0),
154    fTreeCascVarBachNSigmaPion(0),
155    fTreeCascVarBachNSigmaKaon(0),
156
157 //------------------------------------------------
158 // HISTOGRAMS
159 // --- Filled on an Event-by-event basis
160 //------------------------------------------------
161    fHistV0MultiplicityBeforeTrigSel(0),
162    fHistV0MultiplicityForTrigEvt(0), 
163    fHistV0MultiplicityForSelEvt(0),
164    fHistV0MultiplicityForSelEvtNoTPCOnly(0),
165    fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0),
166    fHistMultiplicityBeforeTrigSel(0),
167    fHistMultiplicityForTrigEvt(0),
168    fHistMultiplicity(0),
169    fHistMultiplicityNoTPCOnly(0),
170    fHistMultiplicityNoTPCOnlyNoPileup(0),
171
172 //V0A Centrality
173 fHistMultiplicityV0ABeforeTrigSel(0),
174 fHistMultiplicityV0AForTrigEvt(0),
175 fHistMultiplicityV0A(0),
176 fHistMultiplicityV0ANoTPCOnly(0),
177 fHistMultiplicityV0ANoTPCOnlyNoPileup(0),
178
179 //ZNA Centrality
180 fHistMultiplicityZNABeforeTrigSel(0),
181 fHistMultiplicityZNAForTrigEvt(0),
182 fHistMultiplicityZNA(0),
183 fHistMultiplicityZNANoTPCOnly(0),
184 fHistMultiplicityZNANoTPCOnlyNoPileup(0),
185
186 //TRK Centrality
187 fHistMultiplicityTRKBeforeTrigSel(0),
188 fHistMultiplicityTRKForTrigEvt(0),
189 fHistMultiplicityTRK(0),
190 fHistMultiplicityTRKNoTPCOnly(0),
191 fHistMultiplicityTRKNoTPCOnlyNoPileup(0),
192
193 //SPD Centrality
194 fHistMultiplicitySPDBeforeTrigSel(0),
195 fHistMultiplicitySPDForTrigEvt(0),
196 fHistMultiplicitySPD(0),
197 fHistMultiplicitySPDNoTPCOnly(0),
198 fHistMultiplicitySPDNoTPCOnlyNoPileup(0),
199
200
201 //------------------------------------------------
202 // PARTICLE HISTOGRAMS
203 // --- Filled on a Particle-by-Particle basis
204 //------------------------------------------------
205    f3dHistGenPtVsYVsMultXiMinus(0),
206    f3dHistGenPtVsYVsMultXiPlus(0),
207    f3dHistGenPtVsYVsMultOmegaMinus(0),
208    f3dHistGenPtVsYVsMultOmegaPlus(0),
209    f3dHistGenSelectedPtVsYVsMultXiMinus(0),
210    f3dHistGenSelectedPtVsYVsMultXiPlus(0),
211    f3dHistGenSelectedPtVsYVsMultOmegaMinus(0),
212    f3dHistGenSelectedPtVsYVsMultOmegaPlus(0),
213    f3dHistGenPtVsYCMSVsMultXiMinus(0),
214    f3dHistGenPtVsYCMSVsMultXiPlus(0),
215    f3dHistGenPtVsYCMSVsMultOmegaMinus(0),
216    f3dHistGenPtVsYCMSVsMultOmegaPlus(0),
217    f3dHistGenSelectedPtVsYCMSVsMultXiMinus(0),
218    f3dHistGenSelectedPtVsYCMSVsMultXiPlus(0),
219    f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus(0),
220    f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus(0),
221
222 //MC Mult
223
224 f3dHistGenPtVsYVsMultMCXiMinus(0),
225 f3dHistGenPtVsYVsMultMCXiPlus(0),
226 f3dHistGenPtVsYVsMultMCOmegaMinus(0),
227 f3dHistGenPtVsYVsMultMCOmegaPlus(0),
228 f3dHistGenSelectedPtVsYVsMultMCXiMinus(0),
229 f3dHistGenSelectedPtVsYVsMultMCXiPlus(0),
230 f3dHistGenSelectedPtVsYVsMultMCOmegaMinus(0),
231 f3dHistGenSelectedPtVsYVsMultMCOmegaPlus(0),
232 f3dHistGenPtVsYCMSVsMultMCXiMinus(0),
233 f3dHistGenPtVsYCMSVsMultMCXiPlus(0),
234 f3dHistGenPtVsYCMSVsMultMCOmegaMinus(0),
235 f3dHistGenPtVsYCMSVsMultMCOmegaPlus(0),
236 f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus(0),
237 f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus(0),
238 f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus(0),
239 f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus(0),
240
241 //V0A
242
243 f3dHistGenPtVsYVsMultV0AXiMinus(0),
244 f3dHistGenPtVsYVsMultV0AXiPlus(0),
245 f3dHistGenPtVsYVsMultV0AOmegaMinus(0),
246 f3dHistGenPtVsYVsMultV0AOmegaPlus(0),
247 f3dHistGenSelectedPtVsYVsMultV0AXiMinus(0),
248 f3dHistGenSelectedPtVsYVsMultV0AXiPlus(0),
249 f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus(0),
250 f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus(0),
251 f3dHistGenPtVsYCMSVsMultV0AXiMinus(0),
252 f3dHistGenPtVsYCMSVsMultV0AXiPlus(0),
253 f3dHistGenPtVsYCMSVsMultV0AOmegaMinus(0),
254 f3dHistGenPtVsYCMSVsMultV0AOmegaPlus(0),
255 f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus(0),
256 f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus(0),
257 f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus(0),
258 f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus(0),
259
260 //ZNA
261
262 f3dHistGenPtVsYVsMultZNAXiMinus(0),
263 f3dHistGenPtVsYVsMultZNAXiPlus(0),
264 f3dHistGenPtVsYVsMultZNAOmegaMinus(0),
265 f3dHistGenPtVsYVsMultZNAOmegaPlus(0),
266 f3dHistGenSelectedPtVsYVsMultZNAXiMinus(0),
267 f3dHistGenSelectedPtVsYVsMultZNAXiPlus(0),
268 f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus(0),
269 f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus(0),
270 f3dHistGenPtVsYCMSVsMultZNAXiMinus(0),
271 f3dHistGenPtVsYCMSVsMultZNAXiPlus(0),
272 f3dHistGenPtVsYCMSVsMultZNAOmegaMinus(0),
273 f3dHistGenPtVsYCMSVsMultZNAOmegaPlus(0),
274 f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus(0),
275 f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus(0),
276 f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus(0),
277 f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus(0),
278
279 //TRK
280
281 f3dHistGenPtVsYVsMultTRKXiMinus(0),
282 f3dHistGenPtVsYVsMultTRKXiPlus(0),
283 f3dHistGenPtVsYVsMultTRKOmegaMinus(0),
284 f3dHistGenPtVsYVsMultTRKOmegaPlus(0),
285 f3dHistGenSelectedPtVsYVsMultTRKXiMinus(0),
286 f3dHistGenSelectedPtVsYVsMultTRKXiPlus(0),
287 f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus(0),
288 f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus(0),
289 f3dHistGenPtVsYCMSVsMultTRKXiMinus(0),
290 f3dHistGenPtVsYCMSVsMultTRKXiPlus(0),
291 f3dHistGenPtVsYCMSVsMultTRKOmegaMinus(0),
292 f3dHistGenPtVsYCMSVsMultTRKOmegaPlus(0),
293 f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus(0),
294 f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus(0),
295 f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus(0),
296 f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus(0),
297
298 //SPD
299
300 f3dHistGenPtVsYVsMultSPDXiMinus(0),
301 f3dHistGenPtVsYVsMultSPDXiPlus(0),
302 f3dHistGenPtVsYVsMultSPDOmegaMinus(0),
303 f3dHistGenPtVsYVsMultSPDOmegaPlus(0),
304 f3dHistGenSelectedPtVsYVsMultSPDXiMinus(0),
305 f3dHistGenSelectedPtVsYVsMultSPDXiPlus(0),
306 f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus(0),
307 f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus(0),
308 f3dHistGenPtVsYCMSVsMultSPDXiMinus(0),
309 f3dHistGenPtVsYCMSVsMultSPDXiPlus(0),
310 f3dHistGenPtVsYCMSVsMultSPDOmegaMinus(0),
311 f3dHistGenPtVsYCMSVsMultSPDOmegaPlus(0),
312 f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus(0),
313 f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus(0),
314 f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus(0),
315 f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus(0),
316
317
318    fHistPVx(0),
319    fHistPVy(0),
320    fHistPVz(0),
321    fHistPVxAnalysis(0),
322    fHistPVyAnalysis(0),
323    fHistPVzAnalysis(0)
324 {
325   // Dummy Constructor
326 }
327
328 AliAnalysisTaskExtractPerformanceCascade::AliAnalysisTaskExtractPerformanceCascade(const char *name) 
329   : AliAnalysisTaskSE(name), fListHist(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0), fUtils(0),
330    fkIsNuclear   ( kFALSE ), 
331    fkSwitchINT7  ( kFALSE ),
332    fpArapidityShift ( 0.465 ),
333    fCentralityEstimator("V0M"),
334    fkpAVertexSelection( kFALSE ),
335    fEtaRefMult ( 0.5 ),
336 //------------------------------------------------
337 // Tree Variables
338 //------------------------------------------------
339
340    fTreeCascVarCharge(0),
341    fTreeCascVarMassAsXi(0),
342    fTreeCascVarMassAsOmega(0),
343    fTreeCascVarPt(0),
344    fTreeCascVarPtMC(0),
345    fTreeCascVarRapMC(0),
346    fTreeCascVarRapXi(0),
347    fTreeCascVarRapOmega(0),
348    fTreeCascVarNegEta(0),
349    fTreeCascVarPosEta(0),
350    fTreeCascVarBachEta(0),
351    fTreeCascVarDCACascDaughters(0),
352    fTreeCascVarDCABachToPrimVtx(0),
353    fTreeCascVarDCAV0Daughters(0),
354    fTreeCascVarDCAV0ToPrimVtx(0),
355    fTreeCascVarDCAPosToPrimVtx(0),
356    fTreeCascVarDCANegToPrimVtx(0),
357    fTreeCascVarCascCosPointingAngle(0),
358    fTreeCascVarCascRadius(0),
359    fTreeCascVarV0Mass(0),
360    fTreeCascVarV0CosPointingAngle(0),
361    fTreeCascVarV0CosPointingAngleSpecial(0),
362    fTreeCascVarV0Radius(0),
363    fTreeCascVarLeastNbrClusters(0),
364    fTreeCascVarMultiplicity(0),
365    fTreeCascVarMultiplicityV0A(0),
366    fTreeCascVarMultiplicityZNA(0),
367    fTreeCascVarMultiplicityTRK(0),
368    fTreeCascVarMultiplicitySPD(0),
369    fTreeCascVarMultiplicityMC(0),
370    fTreeCascVarDistOverTotMom(0),
371    fTreeCascVarIsPhysicalPrimary(0),
372    fTreeCascVarPID(0),
373    fTreeCascVarPIDBachelor(0),
374    fTreeCascVarPIDNegative(0),
375    fTreeCascVarPIDPositive(0),
376    fTreeCascVarPosTransMom(0),
377    fTreeCascVarNegTransMom(0),
378    fTreeCascVarPosTransMomMC(0),
379    fTreeCascVarNegTransMomMC(0),
380    fTreeCascVarNegNSigmaPion(0),
381    fTreeCascVarNegNSigmaProton(0),
382    fTreeCascVarPosNSigmaPion(0),
383    fTreeCascVarPosNSigmaProton(0),
384    fTreeCascVarBachNSigmaPion(0),
385    fTreeCascVarBachNSigmaKaon(0),
386
387 //------------------------------------------------
388 // HISTOGRAMS
389 // --- Filled on an Event-by-event basis
390 //------------------------------------------------
391    fHistV0MultiplicityBeforeTrigSel(0),
392    fHistV0MultiplicityForTrigEvt(0), 
393    fHistV0MultiplicityForSelEvt(0),
394    fHistV0MultiplicityForSelEvtNoTPCOnly(0),
395    fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0),
396    fHistMultiplicityBeforeTrigSel(0),
397    fHistMultiplicityForTrigEvt(0),
398    fHistMultiplicity(0),
399    fHistMultiplicityNoTPCOnly(0),
400    fHistMultiplicityNoTPCOnlyNoPileup(0),
401
402 //V0A Centrality
403 fHistMultiplicityV0ABeforeTrigSel(0),
404 fHistMultiplicityV0AForTrigEvt(0),
405 fHistMultiplicityV0A(0),
406 fHistMultiplicityV0ANoTPCOnly(0),
407 fHistMultiplicityV0ANoTPCOnlyNoPileup(0),
408
409 //ZNA Centrality
410 fHistMultiplicityZNABeforeTrigSel(0),
411 fHistMultiplicityZNAForTrigEvt(0),
412 fHistMultiplicityZNA(0),
413 fHistMultiplicityZNANoTPCOnly(0),
414 fHistMultiplicityZNANoTPCOnlyNoPileup(0),
415
416 //TRK Centrality
417 fHistMultiplicityTRKBeforeTrigSel(0),
418 fHistMultiplicityTRKForTrigEvt(0),
419 fHistMultiplicityTRK(0),
420 fHistMultiplicityTRKNoTPCOnly(0),
421 fHistMultiplicityTRKNoTPCOnlyNoPileup(0),
422
423 //SPD Centrality
424 fHistMultiplicitySPDBeforeTrigSel(0),
425 fHistMultiplicitySPDForTrigEvt(0),
426 fHistMultiplicitySPD(0),
427 fHistMultiplicitySPDNoTPCOnly(0),
428 fHistMultiplicitySPDNoTPCOnlyNoPileup(0),
429
430 //------------------------------------------------
431 // PARTICLE HISTOGRAMS
432 // --- Filled on a Particle-by-Particle basis
433 //------------------------------------------------
434    f3dHistGenPtVsYVsMultXiMinus(0),
435    f3dHistGenPtVsYVsMultXiPlus(0),
436    f3dHistGenPtVsYVsMultOmegaMinus(0),
437    f3dHistGenPtVsYVsMultOmegaPlus(0),
438    f3dHistGenSelectedPtVsYVsMultXiMinus(0),
439    f3dHistGenSelectedPtVsYVsMultXiPlus(0),
440    f3dHistGenSelectedPtVsYVsMultOmegaMinus(0),
441    f3dHistGenSelectedPtVsYVsMultOmegaPlus(0),
442    f3dHistGenPtVsYCMSVsMultXiMinus(0),
443    f3dHistGenPtVsYCMSVsMultXiPlus(0),
444    f3dHistGenPtVsYCMSVsMultOmegaMinus(0),
445    f3dHistGenPtVsYCMSVsMultOmegaPlus(0),
446    f3dHistGenSelectedPtVsYCMSVsMultXiMinus(0),
447    f3dHistGenSelectedPtVsYCMSVsMultXiPlus(0),
448    f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus(0),
449    f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus(0),
450
451 //MC Mult
452
453 f3dHistGenPtVsYVsMultMCXiMinus(0),
454 f3dHistGenPtVsYVsMultMCXiPlus(0),
455 f3dHistGenPtVsYVsMultMCOmegaMinus(0),
456 f3dHistGenPtVsYVsMultMCOmegaPlus(0),
457 f3dHistGenSelectedPtVsYVsMultMCXiMinus(0),
458 f3dHistGenSelectedPtVsYVsMultMCXiPlus(0),
459 f3dHistGenSelectedPtVsYVsMultMCOmegaMinus(0),
460 f3dHistGenSelectedPtVsYVsMultMCOmegaPlus(0),
461 f3dHistGenPtVsYCMSVsMultMCXiMinus(0),
462 f3dHistGenPtVsYCMSVsMultMCXiPlus(0),
463 f3dHistGenPtVsYCMSVsMultMCOmegaMinus(0),
464 f3dHistGenPtVsYCMSVsMultMCOmegaPlus(0),
465 f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus(0),
466 f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus(0),
467 f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus(0),
468 f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus(0),
469
470 //V0A
471
472 f3dHistGenPtVsYVsMultV0AXiMinus(0),
473 f3dHistGenPtVsYVsMultV0AXiPlus(0),
474 f3dHistGenPtVsYVsMultV0AOmegaMinus(0),
475 f3dHistGenPtVsYVsMultV0AOmegaPlus(0),
476 f3dHistGenSelectedPtVsYVsMultV0AXiMinus(0),
477 f3dHistGenSelectedPtVsYVsMultV0AXiPlus(0),
478 f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus(0),
479 f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus(0),
480 f3dHistGenPtVsYCMSVsMultV0AXiMinus(0),
481 f3dHistGenPtVsYCMSVsMultV0AXiPlus(0),
482 f3dHistGenPtVsYCMSVsMultV0AOmegaMinus(0),
483 f3dHistGenPtVsYCMSVsMultV0AOmegaPlus(0),
484 f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus(0),
485 f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus(0),
486 f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus(0),
487 f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus(0),
488
489 //ZNA
490
491 f3dHistGenPtVsYVsMultZNAXiMinus(0),
492 f3dHistGenPtVsYVsMultZNAXiPlus(0),
493 f3dHistGenPtVsYVsMultZNAOmegaMinus(0),
494 f3dHistGenPtVsYVsMultZNAOmegaPlus(0),
495 f3dHistGenSelectedPtVsYVsMultZNAXiMinus(0),
496 f3dHistGenSelectedPtVsYVsMultZNAXiPlus(0),
497 f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus(0),
498 f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus(0),
499 f3dHistGenPtVsYCMSVsMultZNAXiMinus(0),
500 f3dHistGenPtVsYCMSVsMultZNAXiPlus(0),
501 f3dHistGenPtVsYCMSVsMultZNAOmegaMinus(0),
502 f3dHistGenPtVsYCMSVsMultZNAOmegaPlus(0),
503 f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus(0),
504 f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus(0),
505 f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus(0),
506 f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus(0),
507
508 //TRK
509
510 f3dHistGenPtVsYVsMultTRKXiMinus(0),
511 f3dHistGenPtVsYVsMultTRKXiPlus(0),
512 f3dHistGenPtVsYVsMultTRKOmegaMinus(0),
513 f3dHistGenPtVsYVsMultTRKOmegaPlus(0),
514 f3dHistGenSelectedPtVsYVsMultTRKXiMinus(0),
515 f3dHistGenSelectedPtVsYVsMultTRKXiPlus(0),
516 f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus(0),
517 f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus(0),
518 f3dHistGenPtVsYCMSVsMultTRKXiMinus(0),
519 f3dHistGenPtVsYCMSVsMultTRKXiPlus(0),
520 f3dHistGenPtVsYCMSVsMultTRKOmegaMinus(0),
521 f3dHistGenPtVsYCMSVsMultTRKOmegaPlus(0),
522 f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus(0),
523 f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus(0),
524 f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus(0),
525 f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus(0),
526
527 //SPD
528
529 f3dHistGenPtVsYVsMultSPDXiMinus(0),
530 f3dHistGenPtVsYVsMultSPDXiPlus(0),
531 f3dHistGenPtVsYVsMultSPDOmegaMinus(0),
532 f3dHistGenPtVsYVsMultSPDOmegaPlus(0),
533 f3dHistGenSelectedPtVsYVsMultSPDXiMinus(0),
534 f3dHistGenSelectedPtVsYVsMultSPDXiPlus(0),
535 f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus(0),
536 f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus(0),
537 f3dHistGenPtVsYCMSVsMultSPDXiMinus(0),
538 f3dHistGenPtVsYCMSVsMultSPDXiPlus(0),
539 f3dHistGenPtVsYCMSVsMultSPDOmegaMinus(0),
540 f3dHistGenPtVsYCMSVsMultSPDOmegaPlus(0),
541 f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus(0),
542 f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus(0),
543 f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus(0),
544 f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus(0),
545
546
547    fHistPVx(0),
548    fHistPVy(0),
549    fHistPVz(0),
550    fHistPVxAnalysis(0),
551    fHistPVyAnalysis(0),
552    fHistPVzAnalysis(0)
553 {
554    // Constructor
555
556    //Set Variables for re-running the cascade vertexers (as done for MS paper)
557         
558         // New Loose : 1st step for the 7 TeV pp analysis
559         /*
560         fV0Sels[0] =  33.  ;  // max allowed chi2
561         fV0Sels[1] =   0.02;  // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
562         fV0Sels[2] =   0.02;  // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
563         fV0Sels[3] =   2.0 ;  // max allowed DCA between the daughter tracks       (LHC09a4 : 0.5)
564         fV0Sels[4] =   0.95;  // min allowed cosine of V0's pointing angle         (LHC09a4 : 0.99)
565         fV0Sels[5] =   1.0 ;  // min radius of the fiducial volume                 (LHC09a4 : 0.2)
566         fV0Sels[6] = 100.  ;  // max radius of the fiducial volume                 (LHC09a4 : 100.0)
567         
568         fCascSels[0] =  33.   ;  // max allowed chi2 (same as PDC07)
569         fCascSels[1] =   0.05 ;  // min allowed V0 impact parameter                    (PDC07 : 0.05   / LHC09a4 : 0.025 )
570         fCascSels[2] =   0.010;  // "window" around the Lambda mass                    (PDC07 : 0.008  / LHC09a4 : 0.010 )
571         fCascSels[3] =   0.03 ;  // min allowed bachelor's impact parameter            (PDC07 : 0.035  / LHC09a4 : 0.025 )
572         fCascSels[4] =   2.0  ;  // max allowed DCA between the V0 and the bachelor    (PDC07 : 0.1    / LHC09a4 : 0.2   )
573         fCascSels[5] =   0.95 ;  // min allowed cosine of the cascade pointing angle   (PDC07 : 0.9985 / LHC09a4 : 0.998 )
574         fCascSels[6] =   0.4  ;  // min radius of the fiducial volume                  (PDC07 : 0.9    / LHC09a4 : 0.2   )
575         fCascSels[7] = 100.   ;  // max radius of the fiducial volume                  (PDC07 : 100    / LHC09a4 : 100   )
576         */
577    // Output slot #0 writes into a TList container (Cascade)
578    DefineOutput(1, TList::Class());
579    DefineOutput(2, TTree::Class());
580 }
581
582
583 AliAnalysisTaskExtractPerformanceCascade::~AliAnalysisTaskExtractPerformanceCascade()
584 {
585 //------------------------------------------------
586 // DESTRUCTOR
587 //------------------------------------------------
588
589    if (fListHist){
590       delete fListHist;
591       fListHist = 0x0;
592    }
593    if (fTreeCascade){
594       delete fTreeCascade;
595       fTreeCascade = 0x0;
596    }
597     //cleanup esd track cuts object too...
598    if (fESDtrackCuts){
599     delete fESDtrackCuts;
600     fESDtrackCuts = 0x0; 
601   }
602   if (fUtils){
603     delete fUtils;
604     fUtils = 0x0;
605   }
606
607 }
608
609 //________________________________________________________________________
610 void AliAnalysisTaskExtractPerformanceCascade::UserCreateOutputObjects()
611 {
612    OpenFile(2); 
613    // Called once
614
615 //------------------------------------------------
616
617    fTreeCascade = new TTree("fTreeCascade","CascadeCandidates");
618
619 //------------------------------------------------
620 // fTreeCascade Branch definitions - Cascade Tree
621 //------------------------------------------------
622
623 //------------------------------------------------
624 // fTreeCascade Branch definitions
625 //------------------------------------------------
626
627 //-----------BASIC-INFO---------------------------
628 /* 1*/          fTreeCascade->Branch("fTreeCascVarCharge",&fTreeCascVarCharge,"fTreeCascVarCharge/I");  
629 /* 2*/          fTreeCascade->Branch("fTreeCascVarMassAsXi",&fTreeCascVarMassAsXi,"fTreeCascVarMassAsXi/F");
630 /* 3*/          fTreeCascade->Branch("fTreeCascVarMassAsOmega",&fTreeCascVarMassAsOmega,"fTreeCascVarMassAsOmega/F");
631 /* 4*/          fTreeCascade->Branch("fTreeCascVarPt",&fTreeCascVarPt,"fTreeCascVarPt/F");
632 /* 5*/          fTreeCascade->Branch("fTreeCascVarPtMC",&fTreeCascVarPtMC,"fTreeCascVarPtMC/F");
633 /* 6*/          fTreeCascade->Branch("fTreeCascVarRapXi",&fTreeCascVarRapXi,"fTreeCascVarRapXi/F");
634 /* 7*/          fTreeCascade->Branch("fTreeCascVarRapMC",&fTreeCascVarRapMC,"fTreeCascVarRapMC/F");
635 /* 8*/          fTreeCascade->Branch("fTreeCascVarRapOmega",&fTreeCascVarRapOmega,"fTreeCascVarRapOmega/F");
636 /* 9*/          fTreeCascade->Branch("fTreeCascVarNegEta",&fTreeCascVarNegEta,"fTreeCascVarNegEta/F");
637 /*10*/          fTreeCascade->Branch("fTreeCascVarPosEta",&fTreeCascVarPosEta,"fTreeCascVarPosEta/F");
638 /*11*/          fTreeCascade->Branch("fTreeCascVarBachEta",&fTreeCascVarBachEta,"fTreeCascVarBachEta/F");
639 //-----------INFO-FOR-CUTS------------------------
640 /*12*/          fTreeCascade->Branch("fTreeCascVarDCACascDaughters",&fTreeCascVarDCACascDaughters,"fTreeCascVarDCACascDaughters/F");
641 /*13*/          fTreeCascade->Branch("fTreeCascVarDCABachToPrimVtx",&fTreeCascVarDCABachToPrimVtx,"fTreeCascVarDCABachToPrimVtx/F");
642 /*14*/          fTreeCascade->Branch("fTreeCascVarDCAV0Daughters",&fTreeCascVarDCAV0Daughters,"fTreeCascVarDCAV0Daughters/F");
643 /*15*/          fTreeCascade->Branch("fTreeCascVarDCAV0ToPrimVtx",&fTreeCascVarDCAV0ToPrimVtx,"fTreeCascVarDCAV0ToPrimVtx/F");
644 /*16*/          fTreeCascade->Branch("fTreeCascVarDCAPosToPrimVtx",&fTreeCascVarDCAPosToPrimVtx,"fTreeCascVarDCAPosToPrimVtx/F");
645 /*17*/          fTreeCascade->Branch("fTreeCascVarDCANegToPrimVtx",&fTreeCascVarDCANegToPrimVtx,"fTreeCascVarDCANegToPrimVtx/F");
646 /*18*/          fTreeCascade->Branch("fTreeCascVarCascCosPointingAngle",&fTreeCascVarCascCosPointingAngle,"fTreeCascVarCascCosPointingAngle/F");
647 /*19*/          fTreeCascade->Branch("fTreeCascVarCascRadius",&fTreeCascVarCascRadius,"fTreeCascVarCascRadius/F");
648 /*20*/          fTreeCascade->Branch("fTreeCascVarV0Mass",&fTreeCascVarV0Mass,"fTreeCascVarV0Mass/F");
649 /*21*/          fTreeCascade->Branch("fTreeCascVarV0CosPointingAngle",&fTreeCascVarV0CosPointingAngle,"fTreeCascVarV0CosPointingAngle/F");
650 /*21*/          fTreeCascade->Branch("fTreeCascVarV0CosPointingAngleSpecial",&fTreeCascVarV0CosPointingAngleSpecial,"fTreeCascVarV0CosPointingAngleSpecial/F");
651 /*22*/          fTreeCascade->Branch("fTreeCascVarV0Radius",&fTreeCascVarV0Radius,"fTreeCascVarV0Radius/F");
652 /*23*/          fTreeCascade->Branch("fTreeCascVarLeastNbrClusters",&fTreeCascVarLeastNbrClusters,"fTreeCascVarLeastNbrClusters/I");
653 //-----------MULTIPLICITY-INFO--------------------
654 /*24*/          fTreeCascade->Branch("fTreeCascVarMultiplicity",&fTreeCascVarMultiplicity,"fTreeCascVarMultiplicity/I");
655 /*24*/          fTreeCascade->Branch("fTreeCascVarMultiplicityV0A",&fTreeCascVarMultiplicityV0A,"fTreeCascVarMultiplicityV0A/I");
656 /*24*/          fTreeCascade->Branch("fTreeCascVarMultiplicityZNA",&fTreeCascVarMultiplicityZNA,"fTreeCascVarMultiplicityZNA/I");
657 /*24*/          fTreeCascade->Branch("fTreeCascVarMultiplicityTRK",&fTreeCascVarMultiplicityTRK,"fTreeCascVarMultiplicityTRK/I");
658 /*24*/          fTreeCascade->Branch("fTreeCascVarMultiplicitySPD",&fTreeCascVarMultiplicitySPD,"fTreeCascVarMultiplicitySPD/I");
659 /*24*/          fTreeCascade->Branch("fTreeCascVarMultiplicityMC",&fTreeCascVarMultiplicityMC,"fTreeCascVarMultiplicityMC/I");
660 //-----------DECAY-LENGTH-INFO--------------------
661 /*25*/          fTreeCascade->Branch("fTreeCascVarDistOverTotMom",&fTreeCascVarDistOverTotMom,"fTreeCascVarDistOverTotMom/F");
662 //-----------MC-PID-------------------------------
663 /*25bis*/ fTreeCascade->Branch("fTreeCascVarIsPhysicalPrimary",&fTreeCascVarIsPhysicalPrimary,"fTreeCascVarIsPhysicalPrimary/I");
664 /*26*/          fTreeCascade->Branch("fTreeCascVarPID",&fTreeCascVarPID,"fTreeCascVarPID/I");
665 /*27*/          fTreeCascade->Branch("fTreeCascVarPIDBachelor",&fTreeCascVarPIDBachelor,"fTreeCascVarPIDBachelor/I");
666 /*28*/    fTreeCascade->Branch("fTreeCascVarPIDNegative",&fTreeCascVarPIDNegative,"fTreeCascVarPIDNegative/I");
667 /*29*/    fTreeCascade->Branch("fTreeCascVarPIDPositive",&fTreeCascVarPIDPositive,"fTreeCascVarPIDPositive/I");
668 /*30*/          fTreeCascade->Branch("fTreeCascVarPosTransMom",&fTreeCascVarPosTransMom,"fTreeCascVarPosTransMom/F");
669 /*31*/          fTreeCascade->Branch("fTreeCascVarNegTransMom",&fTreeCascVarNegTransMom,"fTreeCascVarNegTransMom/F");
670 /*32*/          fTreeCascade->Branch("fTreeCascVarPosTransMomMC",&fTreeCascVarPosTransMomMC,"fTreeCascVarPosTransMomMC/F");
671 /*33*/          fTreeCascade->Branch("fTreeCascVarNegTransMomMC",&fTreeCascVarNegTransMomMC,"fTreeCascVarNegTransMomMC/F");
672 //------------------------------------------------
673 /*34*/          fTreeCascade->Branch("fTreeCascVarNegNSigmaPion",&fTreeCascVarNegNSigmaPion,"fTreeCascVarNegNSigmaPion/F");
674 /*35*/          fTreeCascade->Branch("fTreeCascVarNegNSigmaProton",&fTreeCascVarNegNSigmaProton,"fTreeCascVarNegNSigmaProton/F");
675 /*36*/          fTreeCascade->Branch("fTreeCascVarPosNSigmaPion",&fTreeCascVarPosNSigmaPion,"fTreeCascVarPosNSigmaPion/F");
676 /*37*/          fTreeCascade->Branch("fTreeCascVarPosNSigmaProton",&fTreeCascVarPosNSigmaProton,"fTreeCascVarPosNSigmaProton/F");
677 /*38*/          fTreeCascade->Branch("fTreeCascVarBachNSigmaPion",&fTreeCascVarBachNSigmaPion,"fTreeCascVarBachNSigmaPion/F");
678 /*39*/          fTreeCascade->Branch("fTreeCascVarBachNSigmaKaon",&fTreeCascVarBachNSigmaKaon,"fTreeCascVarBachNSigmaKaon/F");
679
680 //------------------------------------------------
681 // Particle Identification Setup
682 //------------------------------------------------
683
684    AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
685    AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
686    fPIDResponse = inputHandler->GetPIDResponse();
687
688 // Multiplicity 
689
690   if(! fESDtrackCuts ){
691     fESDtrackCuts = new AliESDtrackCuts();
692   }
693   if(! fUtils ){
694     fUtils = new AliAnalysisUtils();
695   }
696
697 //------------------------------------------------
698 // V0 Multiplicity Histograms
699 //------------------------------------------------
700
701    // Create histograms
702    OpenFile(1);
703    fListHist = new TList();
704    fListHist->SetOwner();  // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
705
706
707    if(! fHistV0MultiplicityBeforeTrigSel) {
708       fHistV0MultiplicityBeforeTrigSel = new TH1F("fHistV0MultiplicityBeforeTrigSel", 
709          "V0s per event (before Trig. Sel.);Nbr of V0s/Evt;Events", 
710          25, 0, 25);
711       fListHist->Add(fHistV0MultiplicityBeforeTrigSel);
712    }
713            
714    if(! fHistV0MultiplicityForTrigEvt) {
715       fHistV0MultiplicityForTrigEvt = new TH1F("fHistV0MultiplicityForTrigEvt", 
716          "V0s per event (for triggered evt);Nbr of V0s/Evt;Events", 
717          25, 0, 25);
718       fListHist->Add(fHistV0MultiplicityForTrigEvt);
719    }
720
721    if(! fHistV0MultiplicityForSelEvt) {
722       fHistV0MultiplicityForSelEvt = new TH1F("fHistV0MultiplicityForSelEvt", 
723          "V0s per event;Nbr of V0s/Evt;Events", 
724          25, 0, 25);
725       fListHist->Add(fHistV0MultiplicityForSelEvt);
726    }
727
728    if(! fHistV0MultiplicityForSelEvtNoTPCOnly) {
729       fHistV0MultiplicityForSelEvtNoTPCOnly = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnly", 
730          "V0s per event;Nbr of V0s/Evt;Events", 
731          25, 0, 25);
732       fListHist->Add(fHistV0MultiplicityForSelEvtNoTPCOnly);
733    }
734    if(! fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup) {
735       fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup", 
736          "V0s per event;Nbr of V0s/Evt;Events", 
737          25, 0, 25);
738       fListHist->Add(fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup);
739    }
740
741 //------------------------------------------------
742 // Track Multiplicity Histograms
743 //------------------------------------------------
744
745    if(! fHistMultiplicityBeforeTrigSel) {
746       fHistMultiplicityBeforeTrigSel = new TH1F("fHistMultiplicityBeforeTrigSel", 
747          "Tracks per event;Nbr of Tracks;Events", 
748          200, 0, 200);          
749       fListHist->Add(fHistMultiplicityBeforeTrigSel);
750    }
751    if(! fHistMultiplicityForTrigEvt) {
752       fHistMultiplicityForTrigEvt = new TH1F("fHistMultiplicityForTrigEvt", 
753          "Tracks per event;Nbr of Tracks;Events", 
754          200, 0, 200);          
755       fListHist->Add(fHistMultiplicityForTrigEvt);
756    }
757    if(! fHistMultiplicity) {
758       fHistMultiplicity = new TH1F("fHistMultiplicity", 
759          "Tracks per event;Nbr of Tracks;Events", 
760          200, 0, 200);          
761       fListHist->Add(fHistMultiplicity);
762    }
763    if(! fHistMultiplicityNoTPCOnly) {
764       fHistMultiplicityNoTPCOnly = new TH1F("fHistMultiplicityNoTPCOnly", 
765          "Tracks per event;Nbr of Tracks;Events", 
766          200, 0, 200);          
767       fListHist->Add(fHistMultiplicityNoTPCOnly);
768    }
769    if(! fHistMultiplicityNoTPCOnlyNoPileup) {
770       fHistMultiplicityNoTPCOnlyNoPileup = new TH1F("fHistMultiplicityNoTPCOnlyNoPileup", 
771          "Tracks per event;Nbr of Tracks;Events", 
772          200, 0, 200);          
773       fListHist->Add(fHistMultiplicityNoTPCOnlyNoPileup);
774    }
775   
776   
777   //V0A Centrality (if PbPb / pPb)
778   if(! fHistMultiplicityV0ABeforeTrigSel) {
779     fHistMultiplicityV0ABeforeTrigSel = new TH1F("fHistMultiplicityV0ABeforeTrigSel",
780                                                  "Centrality Distribution: V0A;V0A Centrality;Events",
781                                                  200, 0, 200);
782     fListHist->Add(fHistMultiplicityV0ABeforeTrigSel);
783   }
784   if(! fHistMultiplicityV0AForTrigEvt) {
785     fHistMultiplicityV0AForTrigEvt = new TH1F("fHistMultiplicityV0AForTrigEvt",
786                                               "Centrality Distribution: V0A;V0A Centrality;Events",
787                                               200, 0, 200);
788     fListHist->Add(fHistMultiplicityV0AForTrigEvt);
789   }
790   if(! fHistMultiplicityV0A) {
791     fHistMultiplicityV0A = new TH1F("fHistMultiplicityV0A",
792                                     "Centrality Distribution: V0A;V0A Centrality;Events",
793                                     200, 0, 200);
794     fListHist->Add(fHistMultiplicityV0A);
795   }
796   if(! fHistMultiplicityV0ANoTPCOnly) {
797     fHistMultiplicityV0ANoTPCOnly = new TH1F("fHistMultiplicityV0ANoTPCOnly",
798                                              "Centrality Distribution: V0A;V0A Centrality;Events",
799                                              200, 0, 200);
800     fListHist->Add(fHistMultiplicityV0ANoTPCOnly);
801   }
802   if(! fHistMultiplicityV0ANoTPCOnlyNoPileup) {
803     fHistMultiplicityV0ANoTPCOnlyNoPileup = new TH1F("fHistMultiplicityV0ANoTPCOnlyNoPileup",
804                                                      "Centrality Distribution: V0A;V0A Centrality;Events",
805                                                      200, 0, 200);
806     fListHist->Add(fHistMultiplicityV0ANoTPCOnlyNoPileup);
807   }
808   
809   //ZNA Centrality (if PbPb / pPb)
810   if(! fHistMultiplicityZNABeforeTrigSel) {
811     fHistMultiplicityZNABeforeTrigSel = new TH1F("fHistMultiplicityZNABeforeTrigSel",
812                                                  "Centrality Distribution: ZNA;ZNA Centrality;Events",
813                                                  200, 0, 200);
814     fListHist->Add(fHistMultiplicityZNABeforeTrigSel);
815   }
816   if(! fHistMultiplicityZNAForTrigEvt) {
817     fHistMultiplicityZNAForTrigEvt = new TH1F("fHistMultiplicityZNAForTrigEvt",
818                                               "Centrality Distribution: ZNA;ZNA Centrality;Events",
819                                               200, 0, 200);
820     fListHist->Add(fHistMultiplicityZNAForTrigEvt);
821   }
822   if(! fHistMultiplicityZNA) {
823     fHistMultiplicityZNA = new TH1F("fHistMultiplicityZNA",
824                                     "Centrality Distribution: ZNA;ZNA Centrality;Events",
825                                     200, 0, 200);
826     fListHist->Add(fHistMultiplicityZNA);
827   }
828   if(! fHistMultiplicityZNANoTPCOnly) {
829     fHistMultiplicityZNANoTPCOnly = new TH1F("fHistMultiplicityZNANoTPCOnly",
830                                              "Centrality Distribution: ZNA;ZNA Centrality;Events",
831                                              200, 0, 200);
832     fListHist->Add(fHistMultiplicityZNANoTPCOnly);
833   }
834   if(! fHistMultiplicityZNANoTPCOnlyNoPileup) {
835     fHistMultiplicityZNANoTPCOnlyNoPileup = new TH1F("fHistMultiplicityZNANoTPCOnlyNoPileup",
836                                                      "Centrality Distribution: ZNA;ZNA Centrality;Events",
837                                                      200, 0, 200);
838     fListHist->Add(fHistMultiplicityZNANoTPCOnlyNoPileup);
839   }
840   
841   //TRK Centrality (if PbPb / pPb)
842   if(! fHistMultiplicityTRKBeforeTrigSel) {
843     fHistMultiplicityTRKBeforeTrigSel = new TH1F("fHistMultiplicityTRKBeforeTrigSel",
844                                                  "Centrality Distribution: TRK;TRK Centrality;Events",
845                                                  200, 0, 200);
846     fListHist->Add(fHistMultiplicityTRKBeforeTrigSel);
847   }
848   if(! fHistMultiplicityTRKForTrigEvt) {
849     fHistMultiplicityTRKForTrigEvt = new TH1F("fHistMultiplicityTRKForTrigEvt",
850                                               "Centrality Distribution: TRK;TRK Centrality;Events",
851                                               200, 0, 200);
852     fListHist->Add(fHistMultiplicityTRKForTrigEvt);
853   }
854   if(! fHistMultiplicityTRK) {
855     fHistMultiplicityTRK = new TH1F("fHistMultiplicityTRK",
856                                     "Centrality Distribution: TRK;TRK Centrality;Events",
857                                     200, 0, 200);
858     fListHist->Add(fHistMultiplicityTRK);
859   }
860   if(! fHistMultiplicityTRKNoTPCOnly) {
861     fHistMultiplicityTRKNoTPCOnly = new TH1F("fHistMultiplicityTRKNoTPCOnly",
862                                              "Centrality Distribution: TRK;TRK Centrality;Events",
863                                              200, 0, 200);
864     fListHist->Add(fHistMultiplicityTRKNoTPCOnly);
865   }
866   if(! fHistMultiplicityTRKNoTPCOnlyNoPileup) {
867     fHistMultiplicityTRKNoTPCOnlyNoPileup = new TH1F("fHistMultiplicityTRKNoTPCOnlyNoPileup",
868                                                      "Centrality Distribution: TRK;TRK Centrality;Events",
869                                                      200, 0, 200);
870     fListHist->Add(fHistMultiplicityTRKNoTPCOnlyNoPileup);
871   }
872   
873   //SPD Centrality (if PbPb / pPb)
874   if(! fHistMultiplicitySPDBeforeTrigSel) {
875     fHistMultiplicitySPDBeforeTrigSel = new TH1F("fHistMultiplicitySPDBeforeTrigSel",
876                                                  "Centrality Distribution: SPD;SPD Centrality;Events",
877                                                  200, 0, 200);
878     fListHist->Add(fHistMultiplicitySPDBeforeTrigSel);
879   }
880   if(! fHistMultiplicitySPDForTrigEvt) {
881     fHistMultiplicitySPDForTrigEvt = new TH1F("fHistMultiplicitySPDForTrigEvt",
882                                               "Centrality Distribution: SPD;SPD Centrality;Events",
883                                               200, 0, 200);
884     fListHist->Add(fHistMultiplicitySPDForTrigEvt);
885   }
886   if(! fHistMultiplicitySPD) {
887     fHistMultiplicitySPD = new TH1F("fHistMultiplicitySPD",
888                                     "Centrality Distribution: SPD;SPD Centrality;Events",
889                                     200, 0, 200);
890     fListHist->Add(fHistMultiplicitySPD);
891   }
892   if(! fHistMultiplicitySPDNoTPCOnly) {
893     fHistMultiplicitySPDNoTPCOnly = new TH1F("fHistMultiplicitySPDNoTPCOnly",
894                                              "Centrality Distribution: SPD;SPD Centrality;Events",
895                                              200, 0, 200);
896     fListHist->Add(fHistMultiplicitySPDNoTPCOnly);
897   }
898   if(! fHistMultiplicitySPDNoTPCOnlyNoPileup) {
899     fHistMultiplicitySPDNoTPCOnlyNoPileup = new TH1F("fHistMultiplicitySPDNoTPCOnlyNoPileup",
900                                                      "Centrality Distribution: SPD;SPD Centrality;Events",
901                                                      200, 0, 200);
902     fListHist->Add(fHistMultiplicitySPDNoTPCOnlyNoPileup);
903   }
904   
905
906   
907
908 //------------------------------------------------
909 // Generated Particle Histograms
910 //------------------------------------------------
911
912    Int_t lCustomNBins = 200; 
913    Double_t lCustomPtUpperLimit = 20; 
914    Int_t lCustomNBinsMultiplicity = 100;
915
916 //----------------------------------
917 // Raw Generated (Pre-physics-selection)
918 //----------------------------------
919
920 //--------------------------------------------------------------------------------------
921 //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
922
923    if(! f3dHistGenPtVsYVsMultXiMinus) {
924       f3dHistGenPtVsYVsMultXiMinus = new TH3F( "f3dHistGenPtVsYVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
925       fListHist->Add(f3dHistGenPtVsYVsMultXiMinus);
926    }
927    if(! f3dHistGenPtVsYVsMultXiPlus) {
928       f3dHistGenPtVsYVsMultXiPlus = new TH3F( "f3dHistGenPtVsYVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
929       fListHist->Add(f3dHistGenPtVsYVsMultXiPlus);
930    }
931 //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
932
933    if(! f3dHistGenPtVsYVsMultOmegaMinus) {
934       f3dHistGenPtVsYVsMultOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
935       fListHist->Add(f3dHistGenPtVsYVsMultOmegaMinus);
936    }
937    if(! f3dHistGenPtVsYVsMultOmegaPlus) {
938       f3dHistGenPtVsYVsMultOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
939       fListHist->Add(f3dHistGenPtVsYVsMultOmegaPlus);
940    }
941
942 //All generated cascades, YCMS
943
944    if(! f3dHistGenPtVsYCMSVsMultXiMinus) {
945       f3dHistGenPtVsYCMSVsMultXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
946       fListHist->Add(f3dHistGenPtVsYCMSVsMultXiMinus);
947    }
948    if(! f3dHistGenPtVsYCMSVsMultXiPlus) {
949       f3dHistGenPtVsYCMSVsMultXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
950       fListHist->Add(f3dHistGenPtVsYCMSVsMultXiPlus);
951    }
952 //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
953
954    if(! f3dHistGenPtVsYCMSVsMultOmegaMinus) {
955       f3dHistGenPtVsYCMSVsMultOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
956       fListHist->Add(f3dHistGenPtVsYCMSVsMultOmegaMinus);
957    }
958    if(! f3dHistGenPtVsYCMSVsMultOmegaPlus) {
959       f3dHistGenPtVsYCMSVsMultOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
960       fListHist->Add(f3dHistGenPtVsYCMSVsMultOmegaPlus);
961    }
962
963
964 //--------------------------------------------------------------------------------------
965 //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
966
967    if(! f3dHistGenSelectedPtVsYVsMultXiMinus) {
968       f3dHistGenSelectedPtVsYVsMultXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
969       fListHist->Add(f3dHistGenSelectedPtVsYVsMultXiMinus);
970    }
971    if(! f3dHistGenSelectedPtVsYVsMultXiPlus) {
972       f3dHistGenSelectedPtVsYVsMultXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
973       fListHist->Add(f3dHistGenSelectedPtVsYVsMultXiPlus);
974    }
975 //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
976
977    if(! f3dHistGenSelectedPtVsYVsMultOmegaMinus) {
978       f3dHistGenSelectedPtVsYVsMultOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
979       fListHist->Add(f3dHistGenSelectedPtVsYVsMultOmegaMinus);
980    }
981    if(! f3dHistGenSelectedPtVsYVsMultOmegaPlus) {
982       f3dHistGenSelectedPtVsYVsMultOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
983       fListHist->Add(f3dHistGenSelectedPtVsYVsMultOmegaPlus);
984    }
985
986 //ANALYSIS level Cascades, YCMS
987
988
989    if(! f3dHistGenSelectedPtVsYCMSVsMultXiMinus) {
990       f3dHistGenSelectedPtVsYCMSVsMultXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
991       fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultXiMinus);
992    }
993    if(! f3dHistGenSelectedPtVsYCMSVsMultXiPlus) {
994       f3dHistGenSelectedPtVsYCMSVsMultXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
995       fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultXiPlus);
996    }
997 //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
998
999    if(! f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus) {
1000       f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1001       fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus);
1002    }
1003    if(! f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus) {
1004       f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1005       fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus);
1006    }
1007   
1008   //======================================================================================
1009   //--------------------------------------------------------------------------------------
1010   // True Generated (For Multiplicity Unfolding)
1011   //--------------------------------------------------------------------------------------
1012   //======================================================================================
1013   
1014   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
1015   
1016   if(! f3dHistGenPtVsYVsMultMCXiMinus) {
1017     f3dHistGenPtVsYVsMultMCXiMinus = new TH3F( "f3dHistGenPtVsYVsMultMCXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1018     fListHist->Add(f3dHistGenPtVsYVsMultMCXiMinus);
1019   }
1020   if(! f3dHistGenPtVsYVsMultMCXiPlus) {
1021     f3dHistGenPtVsYVsMultMCXiPlus = new TH3F( "f3dHistGenPtVsYVsMultMCXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1022     fListHist->Add(f3dHistGenPtVsYVsMultMCXiPlus);
1023   }
1024   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1025   
1026   if(! f3dHistGenPtVsYVsMultMCOmegaMinus) {
1027     f3dHistGenPtVsYVsMultMCOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultMCOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1028     fListHist->Add(f3dHistGenPtVsYVsMultMCOmegaMinus);
1029   }
1030   if(! f3dHistGenPtVsYVsMultMCOmegaPlus) {
1031     f3dHistGenPtVsYVsMultMCOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultMCOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1032     fListHist->Add(f3dHistGenPtVsYVsMultMCOmegaPlus);
1033   }
1034   
1035   //All generated cascades, YCMS
1036   
1037   if(! f3dHistGenPtVsYCMSVsMultMCXiMinus) {
1038     f3dHistGenPtVsYCMSVsMultMCXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultMCXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1039     fListHist->Add(f3dHistGenPtVsYCMSVsMultMCXiMinus);
1040   }
1041   if(! f3dHistGenPtVsYCMSVsMultMCXiPlus) {
1042     f3dHistGenPtVsYCMSVsMultMCXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultMCXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1043     fListHist->Add(f3dHistGenPtVsYCMSVsMultMCXiPlus);
1044   }
1045   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1046   
1047   if(! f3dHistGenPtVsYCMSVsMultMCOmegaMinus) {
1048     f3dHistGenPtVsYCMSVsMultMCOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultMCOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1049     fListHist->Add(f3dHistGenPtVsYCMSVsMultMCOmegaMinus);
1050   }
1051   if(! f3dHistGenPtVsYCMSVsMultMCOmegaPlus) {
1052     f3dHistGenPtVsYCMSVsMultMCOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultMCOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1053     fListHist->Add(f3dHistGenPtVsYCMSVsMultMCOmegaPlus);
1054   }
1055   
1056
1057   //--------------------------------------------------------------------------------------
1058   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
1059   
1060   if(! f3dHistGenSelectedPtVsYVsMultMCXiMinus) {
1061     f3dHistGenSelectedPtVsYVsMultMCXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultMCXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1062     fListHist->Add(f3dHistGenSelectedPtVsYVsMultMCXiMinus);
1063   }
1064   if(! f3dHistGenSelectedPtVsYVsMultMCXiPlus) {
1065     f3dHistGenSelectedPtVsYVsMultMCXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultMCXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1066     fListHist->Add(f3dHistGenSelectedPtVsYVsMultMCXiPlus);
1067   }
1068   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1069   
1070   if(! f3dHistGenSelectedPtVsYVsMultMCOmegaMinus) {
1071     f3dHistGenSelectedPtVsYVsMultMCOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultMCOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1072     fListHist->Add(f3dHistGenSelectedPtVsYVsMultMCOmegaMinus);
1073   }
1074   if(! f3dHistGenSelectedPtVsYVsMultMCOmegaPlus) {
1075     f3dHistGenSelectedPtVsYVsMultMCOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultMCOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1076     fListHist->Add(f3dHistGenSelectedPtVsYVsMultMCOmegaPlus);
1077   }
1078   
1079   //ANALYSIS level Cascades, YCMS
1080   
1081   
1082   if(! f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus) {
1083     f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1084     fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus);
1085   }
1086   if(! f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus) {
1087     f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1088     fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus);
1089   }
1090   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1091   
1092   if(! f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus) {
1093     f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1094     fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus);
1095   }
1096   if(! f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus) {
1097     f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1098     fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus);
1099   }
1100
1101   //======================================================================================
1102   //--------------------------------------------------------------------------------------
1103   // V0A
1104   //--------------------------------------------------------------------------------------
1105   //======================================================================================
1106   
1107   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
1108   
1109   if(! f3dHistGenPtVsYVsMultV0AXiMinus) {
1110     f3dHistGenPtVsYVsMultV0AXiMinus = new TH3F( "f3dHistGenPtVsYVsMultV0AXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1111     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultV0AXiMinus);
1112   }
1113   if(! f3dHistGenPtVsYVsMultV0AXiPlus) {
1114     f3dHistGenPtVsYVsMultV0AXiPlus = new TH3F( "f3dHistGenPtVsYVsMultV0AXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1115     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultV0AXiPlus);
1116   }
1117   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1118   
1119   if(! f3dHistGenPtVsYVsMultV0AOmegaMinus) {
1120     f3dHistGenPtVsYVsMultV0AOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultV0AOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1121     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultV0AOmegaMinus);
1122   }
1123   if(! f3dHistGenPtVsYVsMultV0AOmegaPlus) {
1124     f3dHistGenPtVsYVsMultV0AOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultV0AOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1125     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultV0AOmegaPlus);
1126   }
1127   
1128   //All generated cascades, YCMS
1129   
1130   if(! f3dHistGenPtVsYCMSVsMultV0AXiMinus) {
1131     f3dHistGenPtVsYCMSVsMultV0AXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultV0AXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1132     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultV0AXiMinus);
1133   }
1134   if(! f3dHistGenPtVsYCMSVsMultV0AXiPlus) {
1135     f3dHistGenPtVsYCMSVsMultV0AXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultV0AXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1136     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultV0AXiPlus);
1137   }
1138   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1139   
1140   if(! f3dHistGenPtVsYCMSVsMultV0AOmegaMinus) {
1141     f3dHistGenPtVsYCMSVsMultV0AOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultV0AOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1142     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultV0AOmegaMinus);
1143   }
1144   if(! f3dHistGenPtVsYCMSVsMultV0AOmegaPlus) {
1145     f3dHistGenPtVsYCMSVsMultV0AOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultV0AOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1146     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultV0AOmegaPlus);
1147   }
1148   
1149   
1150   //--------------------------------------------------------------------------------------
1151   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
1152   
1153   if(! f3dHistGenSelectedPtVsYVsMultV0AXiMinus) {
1154     f3dHistGenSelectedPtVsYVsMultV0AXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultV0AXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1155     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultV0AXiMinus);
1156   }
1157   if(! f3dHistGenSelectedPtVsYVsMultV0AXiPlus) {
1158     f3dHistGenSelectedPtVsYVsMultV0AXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultV0AXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1159     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultV0AXiPlus);
1160   }
1161   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1162   
1163   if(! f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus) {
1164     f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1165     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus);
1166   }
1167   if(! f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus) {
1168     f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1169     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus);
1170   }
1171   
1172   //ANALYSIS level Cascades, YCMS
1173   
1174   
1175   if(! f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus) {
1176     f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1177     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus);
1178   }
1179   if(! f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus) {
1180     f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1181     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus);
1182   }
1183   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1184   
1185   if(! f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus) {
1186     f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1187     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus);
1188   }
1189   if(! f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus) {
1190     f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1191     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus);
1192   }
1193   
1194   
1195   //======================================================================================
1196   //--------------------------------------------------------------------------------------
1197   // ZNA
1198   //--------------------------------------------------------------------------------------
1199   //======================================================================================
1200   
1201   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
1202   
1203   if(! f3dHistGenPtVsYVsMultZNAXiMinus) {
1204     f3dHistGenPtVsYVsMultZNAXiMinus = new TH3F( "f3dHistGenPtVsYVsMultZNAXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1205     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultZNAXiMinus);
1206   }
1207   if(! f3dHistGenPtVsYVsMultZNAXiPlus) {
1208     f3dHistGenPtVsYVsMultZNAXiPlus = new TH3F( "f3dHistGenPtVsYVsMultZNAXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1209     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultZNAXiPlus);
1210   }
1211   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1212   
1213   if(! f3dHistGenPtVsYVsMultZNAOmegaMinus) {
1214     f3dHistGenPtVsYVsMultZNAOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultZNAOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1215     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultZNAOmegaMinus);
1216   }
1217   if(! f3dHistGenPtVsYVsMultZNAOmegaPlus) {
1218     f3dHistGenPtVsYVsMultZNAOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultZNAOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1219     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultZNAOmegaPlus);
1220   }
1221   
1222   //All generated cascades, YCMS
1223   
1224   if(! f3dHistGenPtVsYCMSVsMultZNAXiMinus) {
1225     f3dHistGenPtVsYCMSVsMultZNAXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultZNAXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1226     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultZNAXiMinus);
1227   }
1228   if(! f3dHistGenPtVsYCMSVsMultZNAXiPlus) {
1229     f3dHistGenPtVsYCMSVsMultZNAXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultZNAXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1230     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultZNAXiPlus);
1231   }
1232   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1233   
1234   if(! f3dHistGenPtVsYCMSVsMultZNAOmegaMinus) {
1235     f3dHistGenPtVsYCMSVsMultZNAOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultZNAOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1236     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultZNAOmegaMinus);
1237   }
1238   if(! f3dHistGenPtVsYCMSVsMultZNAOmegaPlus) {
1239     f3dHistGenPtVsYCMSVsMultZNAOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultZNAOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1240     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultZNAOmegaPlus);
1241   }
1242   
1243   
1244   //--------------------------------------------------------------------------------------
1245   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
1246   
1247   if(! f3dHistGenSelectedPtVsYVsMultZNAXiMinus) {
1248     f3dHistGenSelectedPtVsYVsMultZNAXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultZNAXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1249     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultZNAXiMinus);
1250   }
1251   if(! f3dHistGenSelectedPtVsYVsMultZNAXiPlus) {
1252     f3dHistGenSelectedPtVsYVsMultZNAXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultZNAXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1253     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultZNAXiPlus);
1254   }
1255   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1256   
1257   if(! f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus) {
1258     f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1259     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus);
1260   }
1261   if(! f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus) {
1262     f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1263     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus);
1264   }
1265   
1266   //ANALYSIS level Cascades, YCMS
1267   
1268   
1269   if(! f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus) {
1270     f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1271     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus);
1272   }
1273   if(! f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus) {
1274     f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1275     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus);
1276   }
1277   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1278   
1279   if(! f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus) {
1280     f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1281     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus);
1282   }
1283   if(! f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus) {
1284     f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1285     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus);
1286   }
1287
1288   
1289   //======================================================================================
1290   //--------------------------------------------------------------------------------------
1291   // TRK
1292   //--------------------------------------------------------------------------------------
1293   //======================================================================================
1294   
1295   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
1296   
1297   if(! f3dHistGenPtVsYVsMultTRKXiMinus) {
1298     f3dHistGenPtVsYVsMultTRKXiMinus = new TH3F( "f3dHistGenPtVsYVsMultTRKXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1299     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultTRKXiMinus);
1300   }
1301   if(! f3dHistGenPtVsYVsMultTRKXiPlus) {
1302     f3dHistGenPtVsYVsMultTRKXiPlus = new TH3F( "f3dHistGenPtVsYVsMultTRKXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1303     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultTRKXiPlus);
1304   }
1305   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1306   
1307   if(! f3dHistGenPtVsYVsMultTRKOmegaMinus) {
1308     f3dHistGenPtVsYVsMultTRKOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultTRKOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1309     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultTRKOmegaMinus);
1310   }
1311   if(! f3dHistGenPtVsYVsMultTRKOmegaPlus) {
1312     f3dHistGenPtVsYVsMultTRKOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultTRKOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1313     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultTRKOmegaPlus);
1314   }
1315   
1316   //All generated cascades, YCMS
1317   
1318   if(! f3dHistGenPtVsYCMSVsMultTRKXiMinus) {
1319     f3dHistGenPtVsYCMSVsMultTRKXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultTRKXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1320     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultTRKXiMinus);
1321   }
1322   if(! f3dHistGenPtVsYCMSVsMultTRKXiPlus) {
1323     f3dHistGenPtVsYCMSVsMultTRKXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultTRKXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1324     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultTRKXiPlus);
1325   }
1326   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1327   
1328   if(! f3dHistGenPtVsYCMSVsMultTRKOmegaMinus) {
1329     f3dHistGenPtVsYCMSVsMultTRKOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultTRKOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1330     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultTRKOmegaMinus);
1331   }
1332   if(! f3dHistGenPtVsYCMSVsMultTRKOmegaPlus) {
1333     f3dHistGenPtVsYCMSVsMultTRKOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultTRKOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1334     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultTRKOmegaPlus);
1335   }
1336   
1337   
1338   //--------------------------------------------------------------------------------------
1339   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
1340   
1341   if(! f3dHistGenSelectedPtVsYVsMultTRKXiMinus) {
1342     f3dHistGenSelectedPtVsYVsMultTRKXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultTRKXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1343     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultTRKXiMinus);
1344   }
1345   if(! f3dHistGenSelectedPtVsYVsMultTRKXiPlus) {
1346     f3dHistGenSelectedPtVsYVsMultTRKXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultTRKXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1347     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultTRKXiPlus);
1348   }
1349   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1350   
1351   if(! f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus) {
1352     f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1353     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus);
1354   }
1355   if(! f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus) {
1356     f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1357     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus);
1358   }
1359   
1360   //ANALYSIS level Cascades, YCMS
1361   
1362   
1363   if(! f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus) {
1364     f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1365     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus);
1366   }
1367   if(! f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus) {
1368     f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1369     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus);
1370   }
1371   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1372   
1373   if(! f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus) {
1374     f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1375     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus);
1376   }
1377   if(! f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus) {
1378     f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1379     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus);
1380   }
1381   
1382   //======================================================================================
1383   //--------------------------------------------------------------------------------------
1384   // SPD
1385   //--------------------------------------------------------------------------------------
1386   //======================================================================================
1387   
1388   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
1389   
1390   if(! f3dHistGenPtVsYVsMultSPDXiMinus) {
1391     f3dHistGenPtVsYVsMultSPDXiMinus = new TH3F( "f3dHistGenPtVsYVsMultSPDXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1392     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultSPDXiMinus);
1393   }
1394   if(! f3dHistGenPtVsYVsMultSPDXiPlus) {
1395     f3dHistGenPtVsYVsMultSPDXiPlus = new TH3F( "f3dHistGenPtVsYVsMultSPDXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1396     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultSPDXiPlus);
1397   }
1398   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1399   
1400   if(! f3dHistGenPtVsYVsMultSPDOmegaMinus) {
1401     f3dHistGenPtVsYVsMultSPDOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultSPDOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1402     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultSPDOmegaMinus);
1403   }
1404   if(! f3dHistGenPtVsYVsMultSPDOmegaPlus) {
1405     f3dHistGenPtVsYVsMultSPDOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultSPDOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1406     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYVsMultSPDOmegaPlus);
1407   }
1408   
1409   //All generated cascades, YCMS
1410   
1411   if(! f3dHistGenPtVsYCMSVsMultSPDXiMinus) {
1412     f3dHistGenPtVsYCMSVsMultSPDXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultSPDXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1413     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultSPDXiMinus);
1414   }
1415   if(! f3dHistGenPtVsYCMSVsMultSPDXiPlus) {
1416     f3dHistGenPtVsYCMSVsMultSPDXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultSPDXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1417     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultSPDXiPlus);
1418   }
1419   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1420   
1421   if(! f3dHistGenPtVsYCMSVsMultSPDOmegaMinus) {
1422     f3dHistGenPtVsYCMSVsMultSPDOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultSPDOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1423     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultSPDOmegaMinus);
1424   }
1425   if(! f3dHistGenPtVsYCMSVsMultSPDOmegaPlus) {
1426     f3dHistGenPtVsYCMSVsMultSPDOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultSPDOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1427     if(fkIsNuclear) fListHist->Add(f3dHistGenPtVsYCMSVsMultSPDOmegaPlus);
1428   }
1429   
1430   
1431   //--------------------------------------------------------------------------------------
1432   //--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
1433   
1434   if(! f3dHistGenSelectedPtVsYVsMultSPDXiMinus) {
1435     f3dHistGenSelectedPtVsYVsMultSPDXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultSPDXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1436     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultSPDXiMinus);
1437   }
1438   if(! f3dHistGenSelectedPtVsYVsMultSPDXiPlus) {
1439     f3dHistGenSelectedPtVsYVsMultSPDXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultSPDXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1440     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultSPDXiPlus);
1441   }
1442   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1443   
1444   if(! f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus) {
1445     f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1446     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus);
1447   }
1448   if(! f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus) {
1449     f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1450     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus);
1451   }
1452   
1453   //ANALYSIS level Cascades, YCMS
1454   
1455   
1456   if(! f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus) {
1457     f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1458     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus);
1459   }
1460   if(! f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus) {
1461     f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1462     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus);
1463   }
1464   //--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
1465   
1466   if(! f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus) {
1467     f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1468     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus);
1469   }
1470   if(! f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus) {
1471     f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
1472     if(fkIsNuclear) fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus);
1473   }
1474   
1475 //----------------------------------
1476 // Primary Vertex Position Histos
1477 //----------------------------------
1478
1479    if(! fHistPVx) {
1480          fHistPVx = new TH1F("fHistPVx", 
1481             "PV x position;Nbr of Evts;x", 
1482             2000, -0.5, 0.5);       
1483       fListHist->Add(fHistPVx);
1484    }
1485    if(! fHistPVy) {
1486          fHistPVy = new TH1F("fHistPVy", 
1487             "PV y position;Nbr of Evts;y", 
1488             2000, -0.5, 0.5);       
1489       fListHist->Add(fHistPVy);
1490    }
1491    if(! fHistPVz) {
1492          fHistPVz = new TH1F("fHistPVz", 
1493             "PV z position;Nbr of Evts;z", 
1494             400, -20, 20);       
1495       fListHist->Add(fHistPVz);
1496    }
1497
1498    if(! fHistPVxAnalysis) {
1499          fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", 
1500             "PV x position;Nbr of Evts;x", 
1501             2000, -0.5, 0.5);       
1502       fListHist->Add(fHistPVxAnalysis);
1503    }
1504    if(! fHistPVyAnalysis) {
1505          fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", 
1506             "PV y position;Nbr of Evts;y", 
1507             2000, -0.5, 0.5);       
1508       fListHist->Add(fHistPVyAnalysis);
1509    }
1510    if(! fHistPVzAnalysis) {
1511          fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", 
1512             "PV z position;Nbr of Evts;z", 
1513             400, -20, 20);       
1514       fListHist->Add(fHistPVzAnalysis);
1515    }
1516
1517    //List of Histograms: Normal
1518    PostData(1, fListHist);
1519
1520    //TTree Object: Saved to base directory. Should cache to disk while saving. 
1521    //(Important to avoid excessive memory usage, particularly when merging)
1522    PostData(2, fTreeCascade);
1523
1524 }// end UserCreateOutputObjects
1525
1526
1527 //________________________________________________________________________
1528 void AliAnalysisTaskExtractPerformanceCascade::UserExec(Option_t *) 
1529 {
1530   // Main loop
1531   // Called for each event
1532
1533    AliESDEvent *lESDevent = 0x0;
1534    AliMCEvent  *lMCevent  = 0x0; 
1535    AliStack    *lMCstack  = 0x0; 
1536
1537    Int_t    lNumberOfV0s                      = -1;
1538    Double_t lTrkgPrimaryVtxPos[3]          = {-100.0, -100.0, -100.0};
1539    Double_t lBestPrimaryVtxPos[3]          = {-100.0, -100.0, -100.0};
1540    Double_t lMagneticField                 = -10.;
1541    
1542   // Connect to the InputEvent   
1543   // After these lines, we should have an ESD/AOD event + the number of V0s in it.
1544
1545    // Appropriate for ESD analysis! 
1546       
1547    lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
1548    if (!lESDevent) {
1549       AliWarning("ERROR: lESDevent not available \n");
1550       return;
1551    }
1552
1553 /* --- Acquisition of exact event ID
1554    fTreeVariableRunNumber = lESDevent->GetRunNumber();
1555    fTreeVariableEventNumber =  
1556     ( ( ((ULong64_t)lESDevent->GetPeriodNumber() ) << 36 ) |
1557       ( ((ULong64_t)lESDevent->GetOrbitNumber () ) << 12 ) |
1558         ((ULong64_t)lESDevent->GetBunchCrossNumber() )  );
1559 */
1560    lMCevent = MCEvent();
1561    if (!lMCevent) {
1562       Printf("ERROR: Could not retrieve MC event \n");
1563       cout << "Name of the file with pb :" <<  fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;   
1564       return;
1565    }
1566
1567    lMCstack = lMCevent->Stack();
1568    if (!lMCstack) {
1569       Printf("ERROR: Could not retrieve MC stack \n");
1570       cout << "Name of the file with pb :" <<  fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
1571       return;
1572    }
1573    TArrayF mcPrimaryVtx;
1574    AliGenEventHeader* mcHeader=lMCevent->GenEventHeader();
1575    if(!mcHeader) return;
1576    mcHeader->PrimaryVertex(mcPrimaryVtx);
1577         
1578 //------------------------------------------------
1579 // Multiplicity Information Acquistion
1580 //------------------------------------------------
1581   
1582    //REVISED multiplicity estimator after 'multiplicity day' (2011)
1583    Int_t lMultiplicity = -100;
1584    Int_t lMultiplicityV0A = -100;
1585    Int_t lMultiplicityZNA = -100;
1586    Int_t lMultiplicityTRK = -100;
1587    Int_t lMultiplicitySPD = -100;
1588
1589    //testing purposes
1590    if(fkIsNuclear == kFALSE) lMultiplicity =  fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,  fEtaRefMult );
1591
1592   //--------- GENERATED NUMBER OF CHARGED PARTICLES
1593   // ---> Set Variables to Zero again
1594   // ---> Variable Definition
1595   
1596   Long_t lNumberOfCharged = 0;
1597   
1598   //----- Loop on Stack ----------------------------------------------------------------
1599   for (Int_t iCurrentLabelStack = 0;  iCurrentLabelStack < (lMCstack->GetNtrack()); iCurrentLabelStack++)
1600   {// This is the begining of the loop on tracks
1601     TParticle* particleOne = lMCstack->Particle(iCurrentLabelStack);
1602     if(!particleOne) continue;
1603     if(!particleOne->GetPDG()) continue;
1604     Double_t lThisCharge = particleOne->GetPDG()->Charge()/3.;
1605     if(TMath::Abs(lThisCharge)<0.001) continue;
1606     if(! (lMCstack->IsPhysicalPrimary(iCurrentLabelStack)) ) continue;
1607     
1608     //Double_t gpt = particleOne -> Pt();
1609     Double_t geta = particleOne -> Eta();
1610     
1611     if( TMath::Abs(geta) < 0.5) lNumberOfCharged++;
1612   }//End of loop on tracks
1613   //----- End Loop on Stack ------------------------------------------------------------
1614
1615   
1616    //---> If this is a nuclear collision, then go nuclear on "multiplicity" variable...
1617    //---> Warning: Experimental
1618    if(fkIsNuclear == kTRUE){ 
1619       AliCentrality* centrality;
1620       centrality = lESDevent->GetCentrality();
1621       lMultiplicity = ( ( Int_t ) ( centrality->GetCentralityPercentile( fCentralityEstimator.Data() ) ) );
1622       lMultiplicityV0A = ( ( Int_t ) ( centrality->GetCentralityPercentile(   "V0A" ) ) );
1623       lMultiplicityZNA = ( ( Int_t ) ( centrality->GetCentralityPercentile(   "ZNA" ) ) );
1624       lMultiplicityTRK = ( ( Int_t ) ( centrality->GetCentralityPercentile(   "TRK" ) ) );
1625       lMultiplicitySPD = ( ( Int_t ) ( centrality->GetCentralityPercentile(   "CL1" ) ) );
1626       if (centrality->GetQuality()>1) {
1627         PostData(1, fListHist);
1628         PostData(2, fTreeCascade);
1629         return;
1630       }
1631    }
1632   
1633    //Set variable for filling tree afterwards!
1634    //---> pp case......: GetReferenceMultiplicity
1635    //---> Pb-Pb case...: Centrality by V0M
1636
1637    fTreeCascVarMultiplicity = lMultiplicity;
1638    fTreeCascVarMultiplicityMC = lNumberOfCharged;
1639    fTreeCascVarMultiplicityV0A = lMultiplicityV0A;
1640    fTreeCascVarMultiplicityZNA = lMultiplicityZNA;
1641    fTreeCascVarMultiplicityTRK = lMultiplicityTRK;
1642    fTreeCascVarMultiplicitySPD = lMultiplicitySPD;
1643
1644    fHistV0MultiplicityBeforeTrigSel->Fill ( lESDevent->GetNumberOfV0s() );
1645    fHistMultiplicityBeforeTrigSel->Fill ( lMultiplicity );
1646    fHistMultiplicityV0ABeforeTrigSel->Fill ( lMultiplicityV0A );
1647    fHistMultiplicityZNABeforeTrigSel->Fill ( lMultiplicityZNA );
1648    fHistMultiplicityTRKBeforeTrigSel->Fill ( lMultiplicityTRK );
1649    fHistMultiplicitySPDBeforeTrigSel->Fill ( lMultiplicitySPD );
1650   
1651 //------------------------------------------------
1652 // MC Information Acquistion
1653 //------------------------------------------------
1654
1655    Int_t iNumberOfPrimaries = -1;
1656    iNumberOfPrimaries = lMCstack->GetNprimary();
1657    if(iNumberOfPrimaries < 1) return; 
1658
1659 //------------------------------------------------
1660 // Variable Definition
1661 //------------------------------------------------
1662
1663    Int_t lNbMCPrimary        = 0;
1664
1665    Double_t lPtCurrentPart   = 0;
1666   
1667    //Int_t lComeFromSigma      = 0;
1668
1669    // current mc particle 's mother
1670    //Int_t iCurrentMother  = 0;
1671    lNbMCPrimary = lMCstack->GetNprimary();
1672
1673 //------------------------------------------------
1674 // Pre-Physics Selection
1675 //------------------------------------------------
1676
1677 //----- Loop on primary Xi, Omega --------------------------------------------------------------
1678    for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) 
1679    {// This is the begining of the loop on primaries
1680       
1681       TParticle* lCurrentParticlePrimary = 0x0; 
1682       lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack );
1683       if(!lCurrentParticlePrimary){
1684          Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
1685          continue;
1686       }
1687       if ( TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3312 || TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3334 ) { 
1688          Double_t lRapXiMCPrimary = -100;
1689          if( (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) != 0 ) { 
1690            if ( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) !=0 ){
1691              lRapXiMCPrimary = 0.5*TMath::Log( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) );
1692            }
1693          }
1694
1695          //=================================================================================
1696          // Xi Histograms
1697          if( lCurrentParticlePrimary->GetPdgCode() == 3312 ){ 
1698            lPtCurrentPart    = lCurrentParticlePrimary->Pt();
1699            f3dHistGenPtVsYVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
1700            f3dHistGenPtVsYCMSVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
1701            //MultMC
1702            f3dHistGenPtVsYVsMultMCXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
1703            f3dHistGenPtVsYCMSVsMultMCXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
1704            //V0A
1705            f3dHistGenPtVsYVsMultV0AXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
1706            f3dHistGenPtVsYCMSVsMultV0AXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
1707            //ZNA
1708            f3dHistGenPtVsYVsMultZNAXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
1709            f3dHistGenPtVsYCMSVsMultZNAXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
1710            //TRK
1711            f3dHistGenPtVsYVsMultTRKXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
1712            f3dHistGenPtVsYCMSVsMultTRKXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
1713            //SPD
1714            f3dHistGenPtVsYVsMultSPDXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
1715            f3dHistGenPtVsYCMSVsMultSPDXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
1716          }
1717          if( lCurrentParticlePrimary->GetPdgCode() == -3312 ){ 
1718            lPtCurrentPart    = lCurrentParticlePrimary->Pt();
1719            f3dHistGenPtVsYVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
1720            f3dHistGenPtVsYCMSVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
1721            //MultMC
1722            f3dHistGenPtVsYVsMultMCXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
1723            f3dHistGenPtVsYCMSVsMultMCXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
1724            //V0A
1725            f3dHistGenPtVsYVsMultV0AXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
1726            f3dHistGenPtVsYCMSVsMultV0AXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
1727            //ZNA
1728            f3dHistGenPtVsYVsMultZNAXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
1729            f3dHistGenPtVsYCMSVsMultZNAXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
1730            //TRK
1731            f3dHistGenPtVsYVsMultTRKXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
1732            f3dHistGenPtVsYCMSVsMultTRKXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
1733            //SPD
1734            f3dHistGenPtVsYVsMultSPDXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
1735            f3dHistGenPtVsYCMSVsMultSPDXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
1736          }
1737          // Omega Histograms
1738          if( lCurrentParticlePrimary->GetPdgCode() == 3334 ){ 
1739            lPtCurrentPart    = lCurrentParticlePrimary->Pt();
1740            f3dHistGenPtVsYVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
1741            f3dHistGenPtVsYCMSVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
1742             //MultMC
1743            f3dHistGenPtVsYVsMultMCOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
1744            f3dHistGenPtVsYCMSVsMultMCOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
1745            //V0A
1746            f3dHistGenPtVsYVsMultV0AOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
1747            f3dHistGenPtVsYCMSVsMultV0AOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
1748            //ZNA
1749            f3dHistGenPtVsYVsMultZNAOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
1750            f3dHistGenPtVsYCMSVsMultZNAOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
1751            //TRK
1752            f3dHistGenPtVsYVsMultTRKOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
1753            f3dHistGenPtVsYCMSVsMultTRKOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
1754            //SPD
1755            f3dHistGenPtVsYVsMultSPDOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
1756            f3dHistGenPtVsYCMSVsMultSPDOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
1757          }
1758          if( lCurrentParticlePrimary->GetPdgCode() == -3334 ){
1759             lPtCurrentPart    = lCurrentParticlePrimary->Pt();
1760             f3dHistGenPtVsYVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
1761             f3dHistGenPtVsYCMSVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
1762             //MultMC
1763             f3dHistGenPtVsYVsMultMCOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
1764             f3dHistGenPtVsYCMSVsMultMCOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
1765            //V0A
1766            f3dHistGenPtVsYVsMultV0AOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
1767            f3dHistGenPtVsYCMSVsMultV0AOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
1768            //ZNA
1769            f3dHistGenPtVsYVsMultZNAOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
1770            f3dHistGenPtVsYCMSVsMultZNAOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
1771            //TRK
1772            f3dHistGenPtVsYVsMultTRKOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
1773            f3dHistGenPtVsYCMSVsMultTRKOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
1774            //SPD
1775            f3dHistGenPtVsYVsMultSPDOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
1776            f3dHistGenPtVsYCMSVsMultSPDOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
1777          }
1778       }
1779    }
1780 //----- End Loop on primary Xi, Omega ----------------------------------------------------------
1781
1782 // ---> Set Variables to Zero again
1783 // ---> Variable Definition
1784
1785    lPtCurrentPart   = 0;
1786
1787 //------------------------------------------------
1788 // Physics Selection
1789 //------------------------------------------------
1790
1791    UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1792    Bool_t isSelected = 0;
1793    isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
1794
1795    //pA triggering: CINT7
1796    if( fkSwitchINT7 ) isSelected = (maskIsSelected & AliVEvent::kINT7) == AliVEvent::kINT7;
1797
1798    //Standard Min-Bias Selection
1799    if ( ! isSelected ) { 
1800         PostData(1, fListHist);
1801         PostData(2, fTreeCascade);
1802       return;
1803    }
1804
1805 //------------------------------------------------
1806 // Rerun cascade vertexer! 
1807 //------------------------------------------------
1808 /*
1809   lESDevent->ResetCascades();
1810   lESDevent->ResetV0s();
1811
1812   AliV0vertexer lV0vtxer;
1813   AliCascadeVertexer lCascVtxer;
1814                 
1815   lV0vtxer.SetDefaultCuts(fV0Sels);
1816   lCascVtxer.SetDefaultCuts(fCascSels);
1817
1818   lV0vtxer.Tracks2V0vertices(lESDevent);
1819   lCascVtxer.V0sTracks2CascadeVertices(lESDevent);
1820 */
1821 //------------------------------------------------
1822 // After Trigger Selection
1823 //------------------------------------------------
1824
1825    lNumberOfV0s          = lESDevent->GetNumberOfV0s();
1826   
1827    //Set variable for filling tree afterwards!
1828    fHistV0MultiplicityForTrigEvt->Fill(lNumberOfV0s);
1829    fHistMultiplicityForTrigEvt->Fill ( lMultiplicity );
1830   fHistMultiplicityV0AForTrigEvt       ->Fill( lMultiplicityV0A  );
1831   fHistMultiplicityZNAForTrigEvt       ->Fill( lMultiplicityZNA  );
1832   fHistMultiplicityTRKForTrigEvt       ->Fill( lMultiplicityTRK  );
1833   fHistMultiplicitySPDForTrigEvt       ->Fill( lMultiplicitySPD  );
1834
1835 //------------------------------------------------
1836 // Getting: Primary Vertex + MagField Info
1837 //------------------------------------------------
1838
1839    const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
1840    // get the vtx stored in ESD found with tracks
1841    lPrimaryTrackingESDVtx->GetXYZ( lTrkgPrimaryVtxPos );
1842         
1843    const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex();      
1844    // get the best primary vertex available for the event
1845    // As done in AliCascadeVertexer, we keep the one which is the best one available.
1846    // between : Tracking vertex > SPD vertex > TPC vertex > default SPD vertex
1847    // This one will be used for next calculations (DCA essentially)
1848    lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
1849
1850    Double_t lPrimaryVtxPosition[3];
1851    const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
1852    lPrimaryVtxPosition[0] = primaryVtx->GetX();
1853    lPrimaryVtxPosition[1] = primaryVtx->GetY();
1854    lPrimaryVtxPosition[2] = primaryVtx->GetZ();
1855    fHistPVx->Fill( lPrimaryVtxPosition[0] );
1856    fHistPVy->Fill( lPrimaryVtxPosition[1] );
1857    fHistPVz->Fill( lPrimaryVtxPosition[2] );
1858
1859   //------------------------------------------------
1860   // Primary Vertex Requirements Section:
1861   //  ---> pp and PbPb: Only requires |z|<10cm
1862   //  ---> pPb: all requirements checked at this stage
1863   //------------------------------------------------
1864   
1865   //Roberto's PV selection criteria, implemented 17th April 2013
1866   
1867   /* vertex selection */
1868   Bool_t fHasVertex = kFALSE;
1869   
1870   const AliESDVertex *vertex = lESDevent->GetPrimaryVertexTracks();
1871   if (vertex->GetNContributors() < 1) {
1872     vertex = lESDevent->GetPrimaryVertexSPD();
1873     if (vertex->GetNContributors() < 1) fHasVertex = kFALSE;
1874     else fHasVertex = kTRUE;
1875     TString vtxTyp = vertex->GetTitle();
1876     Double_t cov[6]={0};
1877     vertex->GetCovarianceMatrix(cov);
1878     Double_t zRes = TMath::Sqrt(cov[5]);
1879     if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) fHasVertex = kFALSE;
1880   }
1881   else fHasVertex = kTRUE;
1882   
1883   //Is First event in chunk rejection: Still present!
1884   if(fkpAVertexSelection==kTRUE && fHasVertex == kFALSE) {
1885     AliWarning("Pb / | PV does not satisfy selection criteria!");
1886     PostData(1, fListHist);
1887     PostData(2, fTreeCascade);
1888     return;
1889   }
1890   
1891   //Is First event in chunk rejection: Still present!
1892   if(fkpAVertexSelection==kTRUE && fUtils->IsFirstEventInChunk(lESDevent)) {
1893     AliWarning("Pb / | This is the first event in the chunk!");
1894     PostData(1, fListHist);
1895     PostData(2, fTreeCascade);
1896     return;
1897   }
1898   
1899   //17 April Fix: Always do primary vertex Z selection, after pA vertex selection from Roberto
1900   if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0) {
1901     AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1902     PostData(1, fListHist);
1903     PostData(2, fTreeCascade);
1904     return;
1905   }
1906   
1907   lMagneticField = lESDevent->GetMagneticField( );
1908   fHistV0MultiplicityForSelEvt ->Fill( lNumberOfV0s );
1909   fHistMultiplicity->Fill(lMultiplicity);
1910   fHistMultiplicityV0A->Fill(lMultiplicityV0A);
1911   fHistMultiplicityZNA->Fill(lMultiplicityZNA);
1912   fHistMultiplicityTRK->Fill(lMultiplicityTRK);
1913   fHistMultiplicitySPD->Fill(lMultiplicitySPD);
1914
1915 //------------------------------------------------
1916 // SKIP: Events with well-established PVtx
1917 //------------------------------------------------
1918         
1919    const AliESDVertex *lPrimaryTrackingESDVtxCheck = lESDevent->GetPrimaryVertexTracks();
1920    const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
1921    if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtxCheck->GetStatus() && fkpAVertexSelection==kFALSE ){
1922       AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1923         PostData(1, fListHist);
1924         PostData(2, fTreeCascade);
1925       return;
1926    }
1927    fHistV0MultiplicityForSelEvtNoTPCOnly ->Fill( lNumberOfV0s );
1928    fHistMultiplicityNoTPCOnly->Fill(lMultiplicity);
1929   fHistMultiplicityV0ANoTPCOnly->Fill(lMultiplicityV0A);
1930   fHistMultiplicityZNANoTPCOnly->Fill(lMultiplicityZNA);
1931   fHistMultiplicityTRKNoTPCOnly->Fill(lMultiplicityTRK);
1932   fHistMultiplicitySPDNoTPCOnly->Fill(lMultiplicitySPD);
1933
1934 //------------------------------------------------
1935 // Pileup Rejection Studies
1936 //------------------------------------------------
1937
1938    // FIXME : quality selection regarding pile-up rejection 
1939    if(lESDevent->IsPileupFromSPD() && !fkIsNuclear ){// minContributors=3, minZdist=0.8, nSigmaZdist=3., nSigmaDiamXY=2., nSigmaDiamZ=5.  -> see http://alisoft.cern.ch/viewvc/trunk/STEER/AliESDEvent.h?root=AliRoot&r1=41914&r2=42199&pathrev=42199
1940       AliWarning("Pb / This is tagged as Pileup from SPD... return !");
1941         PostData(1, fListHist);
1942         PostData(2, fTreeCascade);
1943       return;
1944    }
1945    fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup ->Fill( lNumberOfV0s );
1946    fHistMultiplicityNoTPCOnlyNoPileup->Fill(lMultiplicity);
1947   fHistMultiplicityV0ANoTPCOnlyNoPileup->Fill(lMultiplicityV0A);
1948   fHistMultiplicityZNANoTPCOnlyNoPileup->Fill(lMultiplicityZNA);
1949   fHistMultiplicityTRKNoTPCOnlyNoPileup->Fill(lMultiplicityTRK);
1950   fHistMultiplicitySPDNoTPCOnlyNoPileup->Fill(lMultiplicitySPD);
1951
1952    //Do control histograms without the IsFromVertexerZ events, but consider them in analysis...
1953    if( ! (lESDevent->GetPrimaryVertex()->IsFromVertexerZ() )     ){ 
1954       fHistPVxAnalysis->Fill( lPrimaryVtxPosition[0] );
1955       fHistPVyAnalysis->Fill( lPrimaryVtxPosition[1] );
1956       fHistPVzAnalysis->Fill( lPrimaryVtxPosition[2] );
1957    }
1958
1959 //------------------------------------------------
1960 // stack loop starts here
1961 //------------------------------------------------
1962
1963 //----- Loop on primary Xi, Omega --------------------------------------------------------------
1964    for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) 
1965    {// This is the begining of the loop on primaries
1966       
1967       TParticle* lCurrentParticlePrimary = 0x0; 
1968       lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack );
1969       if(!lCurrentParticlePrimary){
1970          Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
1971          continue;
1972       }
1973       if ( TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3312 || TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3334 ) { 
1974          Double_t lRapXiMCPrimary = -100;
1975          if( (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) != 0 ) { 
1976            if ( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) !=0 ){
1977              lRapXiMCPrimary = 0.5*TMath::Log( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) );
1978            }
1979          }
1980
1981          //=================================================================================
1982          // Xi Histograms
1983          if( lCurrentParticlePrimary->GetPdgCode() == 3312 ){ 
1984             lPtCurrentPart    = lCurrentParticlePrimary->Pt();
1985             f3dHistGenSelectedPtVsYVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
1986             f3dHistGenSelectedPtVsYCMSVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
1987             //MultMC
1988             f3dHistGenSelectedPtVsYVsMultMCXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
1989             f3dHistGenSelectedPtVsYCMSVsMultMCXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
1990            //V0A
1991            f3dHistGenSelectedPtVsYVsMultV0AXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
1992            f3dHistGenSelectedPtVsYCMSVsMultV0AXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
1993            //ZNA
1994            f3dHistGenSelectedPtVsYVsMultZNAXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
1995            f3dHistGenSelectedPtVsYCMSVsMultZNAXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
1996            //TRK
1997            f3dHistGenSelectedPtVsYVsMultTRKXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
1998            f3dHistGenSelectedPtVsYCMSVsMultTRKXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
1999            //SPD
2000            f3dHistGenSelectedPtVsYVsMultSPDXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
2001            f3dHistGenSelectedPtVsYCMSVsMultSPDXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
2002          }
2003          if( lCurrentParticlePrimary->GetPdgCode() == -3312 ){
2004             lPtCurrentPart    = lCurrentParticlePrimary->Pt();
2005             f3dHistGenSelectedPtVsYVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
2006             f3dHistGenSelectedPtVsYCMSVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
2007             //MultMC
2008             f3dHistGenSelectedPtVsYVsMultMCXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
2009             f3dHistGenSelectedPtVsYCMSVsMultMCXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
2010            //V0A
2011            f3dHistGenSelectedPtVsYVsMultV0AXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
2012            f3dHistGenSelectedPtVsYCMSVsMultV0AXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
2013            //ZNA
2014            f3dHistGenSelectedPtVsYVsMultZNAXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
2015            f3dHistGenSelectedPtVsYCMSVsMultZNAXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
2016            //TRK
2017            f3dHistGenSelectedPtVsYVsMultTRKXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
2018            f3dHistGenSelectedPtVsYCMSVsMultTRKXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
2019            //SPD
2020            f3dHistGenSelectedPtVsYVsMultSPDXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
2021            f3dHistGenSelectedPtVsYCMSVsMultSPDXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
2022          }
2023          // Omega Histograms
2024          if( lCurrentParticlePrimary->GetPdgCode() == 3334 ){ 
2025             lPtCurrentPart    = lCurrentParticlePrimary->Pt();
2026             f3dHistGenSelectedPtVsYVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
2027             f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
2028             //MultMC
2029             f3dHistGenSelectedPtVsYVsMultMCOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
2030             f3dHistGenSelectedPtVsYCMSVsMultMCOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
2031            //V0A
2032            f3dHistGenSelectedPtVsYVsMultV0AOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
2033            f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
2034            //ZNA
2035            f3dHistGenSelectedPtVsYVsMultZNAOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
2036            f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
2037            //TRK
2038            f3dHistGenSelectedPtVsYVsMultTRKOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
2039            f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
2040            //SPD
2041            f3dHistGenSelectedPtVsYVsMultSPDOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
2042            f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
2043          }
2044          if( lCurrentParticlePrimary->GetPdgCode() == -3334 ){
2045             lPtCurrentPart    = lCurrentParticlePrimary->Pt();
2046             f3dHistGenSelectedPtVsYVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
2047             f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
2048             //MultMC
2049             f3dHistGenSelectedPtVsYVsMultMCOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lNumberOfCharged);
2050             f3dHistGenSelectedPtVsYCMSVsMultMCOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lNumberOfCharged);
2051            //V0A
2052            f3dHistGenSelectedPtVsYVsMultV0AOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityV0A);
2053            f3dHistGenSelectedPtVsYCMSVsMultV0AOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityV0A);
2054            //ZNA
2055            f3dHistGenSelectedPtVsYVsMultZNAOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityZNA);
2056            f3dHistGenSelectedPtVsYCMSVsMultZNAOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityZNA);
2057            //TRK
2058            f3dHistGenSelectedPtVsYVsMultTRKOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicityTRK);
2059            f3dHistGenSelectedPtVsYCMSVsMultTRKOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicityTRK);
2060            //SPD
2061            f3dHistGenSelectedPtVsYVsMultSPDOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicitySPD);
2062            f3dHistGenSelectedPtVsYCMSVsMultSPDOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicitySPD);
2063          }
2064       }
2065    }
2066 //----- End Loop on primary Xi, Omega ----------------------------------------------------------
2067
2068 //------------------------------------------------
2069 // MAIN CASCADE LOOP STARTS HERE
2070 //------------------------------------------------
2071 // Code Credit: Antonin Maire (thanks^100)
2072 // ---> This is an adaptation
2073
2074   Long_t ncascades = 0;
2075         ncascades = lESDevent->GetNumberOfCascades();
2076
2077
2078   for (Int_t iXi = 0; iXi < ncascades; iXi++){
2079     //------------------------------------------------
2080     // Initializations
2081     //------------------------------------------------  
2082           //Double_t lTrkgPrimaryVtxRadius3D = -500.0;
2083           //Double_t lBestPrimaryVtxRadius3D = -500.0;
2084
2085           // - 1st part of initialisation : variables needed to store AliESDCascade data members
2086           Double_t lEffMassXi      = 0. ;
2087           //Double_t lChi2Xi         = -1. ;
2088           Double_t lDcaXiDaughters = -1. ;
2089           Double_t lXiCosineOfPointingAngle = -1. ;
2090           Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
2091           Double_t lXiRadius = -1000. ;
2092           
2093           // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
2094           Int_t    lPosTPCClusters    = -1; // For ESD only ...//FIXME : wait for availability in AOD
2095           Int_t    lNegTPCClusters    = -1; // For ESD only ...
2096           Int_t    lBachTPCClusters   = -1; // For ESD only ...
2097                         
2098           // - 3rd part of initialisation : about V0 part in cascades
2099           Double_t lInvMassLambdaAsCascDghter = 0.;
2100           //Double_t lV0Chi2Xi         = -1. ;
2101           Double_t lDcaV0DaughtersXi = -1.;
2102                 
2103           Double_t lDcaBachToPrimVertexXi = -1., lDcaV0ToPrimVertexXi = -1.;
2104           Double_t lDcaPosToPrimVertexXi  = -1.;
2105           Double_t lDcaNegToPrimVertexXi  = -1.;
2106           Double_t lV0CosineOfPointingAngleXi = -1. ;
2107           Double_t lV0CosineOfPointingAngleXiSpecial = -1. ;
2108           Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
2109           Double_t lV0RadiusXi = -1000.0;
2110           Double_t lV0quality  = 0.;
2111         
2112           // - 4th part of initialisation : Effective masses
2113           Double_t lInvMassXiMinus    = 0.;
2114           Double_t lInvMassXiPlus     = 0.;
2115           Double_t lInvMassOmegaMinus = 0.;
2116           Double_t lInvMassOmegaPlus  = 0.;
2117     
2118           // - 6th part of initialisation : extra info for QA
2119           Double_t lXiMomX       = 0. , lXiMomY = 0., lXiMomZ = 0.;
2120           Double_t lXiTransvMom  = 0. ;
2121           Double_t lXiTransvMomMC= 0. ;
2122           Double_t lXiTotMom     = 0. ;
2123                 
2124           Double_t lBachMomX       = 0., lBachMomY  = 0., lBachMomZ   = 0.;
2125           //Double_t lBachTransvMom  = 0.;
2126           //Double_t lBachTotMom     = 0.;
2127
2128     fTreeCascVarNegNSigmaPion   = -100;
2129     fTreeCascVarNegNSigmaProton = -100;
2130     fTreeCascVarPosNSigmaPion   = -100;
2131     fTreeCascVarPosNSigmaProton = -100;
2132     fTreeCascVarBachNSigmaPion  = -100;
2133     fTreeCascVarBachNSigmaKaon  = -100;
2134         
2135           Short_t  lChargeXi = -2;
2136           //Double_t lV0toXiCosineOfPointingAngle = 0. ;
2137         
2138           Double_t lRapXi   = -20.0, lRapOmega = -20.0, lRapMC = -20.0; //  lEta = -20.0, lTheta = 360., lPhi = 720. ;
2139           //Double_t lAlphaXi = -200., lPtArmXi  = -200.0;
2140             
2141     // -------------------------------------
2142     // II.ESD - Calculation Part dedicated to Xi vertices (ESD)
2143     
2144           AliESDcascade *xi = lESDevent->GetCascade(iXi);
2145           if (!xi) continue;
2146         
2147           
2148                   // - II.Step 1 : around primary vertex
2149                   //-------------
2150           //lTrkgPrimaryVtxRadius3D = TMath::Sqrt(  lTrkgPrimaryVtxPos[0] * lTrkgPrimaryVtxPos[0] +
2151           //                                        lTrkgPrimaryVtxPos[1] * lTrkgPrimaryVtxPos[1] +
2152           //                                        lTrkgPrimaryVtxPos[2] * lTrkgPrimaryVtxPos[2] );
2153
2154           //lBestPrimaryVtxRadius3D = TMath::Sqrt(  lBestPrimaryVtxPos[0] * lBestPrimaryVtxPos[0] +
2155           //                                        lBestPrimaryVtxPos[1] * lBestPrimaryVtxPos[1] +
2156           //                                        lBestPrimaryVtxPos[2] * lBestPrimaryVtxPos[2] );
2157
2158                 // - II.Step 2 : Assigning the necessary variables for specific AliESDcascade data members (ESD)        
2159                 //-------------
2160           lV0quality = 0.;
2161           xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis : cascade = Xi- decay
2162
2163           lEffMassXi                    = xi->GetEffMassXi();
2164           //lChi2Xi                         = xi->GetChi2Xi();
2165           lDcaXiDaughters       = xi->GetDcaXiDaughters();
2166           lXiCosineOfPointingAngle                  = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0],
2167                                                                                  lBestPrimaryVtxPos[1],
2168                                                                                  lBestPrimaryVtxPos[2] );
2169                   // Take care : the best available vertex should be used (like in AliCascadeVertexer)
2170         
2171           xi->GetXYZcascade( lPosXi[0],  lPosXi[1], lPosXi[2] ); 
2172           lXiRadius                     = TMath::Sqrt( lPosXi[0]*lPosXi[0]  +  lPosXi[1]*lPosXi[1] );           
2173
2174                 // - II.Step 3 : around the tracks : Bach + V0 (ESD)
2175                 // ~ Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
2176                 //-------------
2177                 
2178         UInt_t lIdxPosXi        = (UInt_t) TMath::Abs( xi->GetPindex() );
2179         UInt_t lIdxNegXi        = (UInt_t) TMath::Abs( xi->GetNindex() );
2180         UInt_t lBachIdx         = (UInt_t) TMath::Abs( xi->GetBindex() );
2181                 // Care track label can be negative in MC production (linked with the track quality)
2182                 // However = normally, not the case for track index ...
2183           
2184           // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
2185           if(lBachIdx == lIdxNegXi) {
2186                   AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
2187           }
2188     if(lBachIdx == lIdxPosXi) {
2189         AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
2190           }
2191           
2192           AliESDtrack *pTrackXi         = lESDevent->GetTrack( lIdxPosXi );
2193           AliESDtrack *nTrackXi         = lESDevent->GetTrack( lIdxNegXi );
2194           AliESDtrack *bachTrackXi      = lESDevent->GetTrack( lBachIdx );
2195
2196           if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
2197                   AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
2198                   continue;
2199           }
2200
2201    fTreeCascVarPosEta = pTrackXi->Eta();
2202    fTreeCascVarNegEta = nTrackXi->Eta();
2203    fTreeCascVarBachEta = bachTrackXi->Eta();
2204   
2205     //------------------------------------------------
2206     // TPC dEdx information 
2207     //------------------------------------------------
2208     fTreeCascVarNegNSigmaPion   = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kPion   );
2209     fTreeCascVarNegNSigmaProton = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kProton );
2210     fTreeCascVarPosNSigmaPion   = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kPion );
2211     fTreeCascVarPosNSigmaProton = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kProton );
2212     fTreeCascVarBachNSigmaPion  = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kPion );
2213     fTreeCascVarBachNSigmaKaon  = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kKaon );
2214
2215     //------------------------------------------------
2216     // TPC Number of clusters info
2217     // --- modified to save the smallest number 
2218     // --- of TPC clusters for the 3 tracks
2219     //------------------------------------------------
2220               
2221           lPosTPCClusters   = pTrackXi->GetTPCNcls();
2222           lNegTPCClusters   = nTrackXi->GetTPCNcls();
2223           lBachTPCClusters  = bachTrackXi->GetTPCNcls(); 
2224
2225     // 1 - Poor quality related to TPCrefit
2226           ULong_t pStatus    = pTrackXi->GetStatus();
2227           ULong_t nStatus    = nTrackXi->GetStatus();
2228           ULong_t bachStatus = bachTrackXi->GetStatus();
2229     if ((pStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
2230     if ((nStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
2231     if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
2232           // 2 - Poor quality related to TPC clusters: lowest cut of 70 clusters
2233     if(lPosTPCClusters  < 70) { AliWarning("Pb / V0 Pos. track has less than 70 TPC clusters ... continue!"); continue; }
2234           if(lNegTPCClusters  < 70) { AliWarning("Pb / V0 Neg. track has less than 70 TPC clusters ... continue!"); continue; }
2235           if(lBachTPCClusters < 70) { AliWarning("Pb / Bach.   track has less than 70 TPC clusters ... continue!"); continue; }
2236           Int_t leastnumberofclusters = 1000; 
2237           if( lPosTPCClusters < leastnumberofclusters ) leastnumberofclusters = lPosTPCClusters;
2238           if( lNegTPCClusters < leastnumberofclusters ) leastnumberofclusters = lNegTPCClusters;
2239           if( lBachTPCClusters < leastnumberofclusters ) leastnumberofclusters = lBachTPCClusters;
2240
2241           lInvMassLambdaAsCascDghter    = xi->GetEffMass();
2242           // This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
2243           lDcaV0DaughtersXi             = xi->GetDcaV0Daughters(); 
2244           //lV0Chi2Xi                   = xi->GetChi2V0();
2245         
2246           lV0CosineOfPointingAngleXi    = xi->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0],
2247                                                                             lBestPrimaryVtxPos[1],
2248                                                                             lBestPrimaryVtxPos[2] );
2249     //Modification to check cosPA of v0 wrt to cascade vertex
2250           lV0CosineOfPointingAngleXiSpecial     = xi->GetV0CosineOfPointingAngle( lPosXi[0],
2251                                                                             lPosXi[1],
2252                                                                             lPosXi[2] );
2253
2254           lDcaV0ToPrimVertexXi          = xi->GetD( lBestPrimaryVtxPos[0], 
2255                                                       lBestPrimaryVtxPos[1], 
2256                                                       lBestPrimaryVtxPos[2] );
2257                 
2258           lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD(       lBestPrimaryVtxPos[0], 
2259                                                                 lBestPrimaryVtxPos[1], 
2260                                                                 lMagneticField  ) ); 
2261                                           // Note : AliExternalTrackParam::GetD returns an algebraic value ...
2262                 
2263           xi->GetXYZ( lPosV0Xi[0],  lPosV0Xi[1], lPosV0Xi[2] ); 
2264           lV0RadiusXi           = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0]  +  lPosV0Xi[1]*lPosV0Xi[1] );
2265         
2266           lDcaPosToPrimVertexXi         = TMath::Abs( pTrackXi  ->GetD( lBestPrimaryVtxPos[0], 
2267                                                                 lBestPrimaryVtxPos[1], 
2268                                                                 lMagneticField  )     ); 
2269         
2270           lDcaNegToPrimVertexXi         = TMath::Abs( nTrackXi  ->GetD( lBestPrimaryVtxPos[0], 
2271                                                                 lBestPrimaryVtxPos[1], 
2272                                                                 lMagneticField  )     ); 
2273                 
2274           // - II.Step 4 : around effective masses (ESD)
2275           // ~ change mass hypotheses to cover all the possibilities :  Xi-/+, Omega -/+
2276                 
2277           if( bachTrackXi->Charge() < 0 )       {
2278                   lV0quality = 0.;
2279                   xi->ChangeMassHypothesis(lV0quality , 3312);  
2280                           // Calculate the effective mass of the Xi- candidate. 
2281                           // pdg code 3312 = Xi-
2282                   lInvMassXiMinus = xi->GetEffMassXi();
2283                 
2284                   lV0quality = 0.;
2285                   xi->ChangeMassHypothesis(lV0quality , 3334);  
2286                           // Calculate the effective mass of the Xi- candidate. 
2287                           // pdg code 3334 = Omega-
2288                   lInvMassOmegaMinus = xi->GetEffMassXi();
2289                                         
2290                   lV0quality = 0.;
2291                   xi->ChangeMassHypothesis(lV0quality , 3312);  // Back to default hyp.
2292           }// end if negative bachelor
2293         
2294         
2295           if( bachTrackXi->Charge() >  0 ){
2296                   lV0quality = 0.;
2297                   xi->ChangeMassHypothesis(lV0quality , -3312);         
2298                           // Calculate the effective mass of the Xi+ candidate. 
2299                           // pdg code -3312 = Xi+
2300                   lInvMassXiPlus = xi->GetEffMassXi();
2301                 
2302                   lV0quality = 0.;
2303                   xi->ChangeMassHypothesis(lV0quality , -3334);         
2304                           // Calculate the effective mass of the Xi+ candidate. 
2305                           // pdg code -3334  = Omega+
2306                   lInvMassOmegaPlus = xi->GetEffMassXi();
2307                 
2308                   lV0quality = 0.;
2309                   xi->ChangeMassHypothesis(lV0quality , -3312);         // Back to "default" hyp.
2310           }// end if positive bachelor
2311                   // - II.Step 6 : extra info for QA (ESD)
2312                   // miscellaneous pieces of info that may help regarding data quality assessment.
2313                   //-------------
2314
2315           xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
2316                   lXiTransvMom          = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY );
2317                   lXiTotMom     = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY   + lXiMomZ*lXiMomZ );
2318                 
2319           xi->GetBPxPyPz(  lBachMomX,  lBachMomY,  lBachMomZ );
2320                   //lBachTransvMom  = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY );
2321                   //lBachTotMom         = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY  +  lBachMomZ*lBachMomZ  );
2322
2323           lChargeXi = xi->Charge();
2324
2325           //lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
2326         
2327           lRapXi    = xi->RapXi();
2328           lRapOmega = xi->RapOmega();
2329           //lEta      = xi->Eta();
2330           //lTheta    = xi->Theta() *180.0/TMath::Pi();
2331           //lPhi      = xi->Phi()   *180.0/TMath::Pi();
2332           //lAlphaXi  = xi->AlphaXi();
2333           //lPtArmXi  = xi->PtArmXi();
2334         
2335 //------------------------------------------------
2336 // Associate Cascade Candidates to Monte Carlo!
2337 //------------------------------------------------      
2338
2339 //Warning: Not using Continues... Need to fill tree later!
2340         
2341         Int_t lPDGCodeCascade = 0;      
2342
2343         Int_t lPID_BachMother = 0;
2344         Int_t lPID_NegMother = 0;
2345         Int_t lPID_PosMother = 0;
2346   fTreeCascVarIsPhysicalPrimary = 0; // 0: not defined, any candidate may have this
2347
2348           fTreeCascVarPIDPositive = 0;
2349           fTreeCascVarPIDNegative = 0;
2350           fTreeCascVarPIDBachelor = 0;
2351
2352
2353         if(fDebug > 5)
2354                 cout    << "MC EventNumber : " << lMCevent->Header()->GetEvent() 
2355                         << " / MC event Number in Run : " << lMCevent->Header()->GetEventNrInRun() << endl;
2356         
2357         // - Step 4.1 : level of the V0 daughters
2358                 
2359 //----------------------------------------
2360 // Regular MC ASSOCIATION STARTS HERE
2361 //----------------------------------------
2362
2363           Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );  
2364                   // Abs value = needed ! question of quality track association ...
2365           Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );
2366           Int_t lblBach        = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
2367
2368           TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );
2369           TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );
2370           TParticle* mcBach        = lMCstack->Particle( lblBach );     
2371         
2372     fTreeCascVarPosTransMomMC = mcPosV0Dghter->Pt();
2373     fTreeCascVarNegTransMomMC = mcNegV0Dghter->Pt();
2374
2375           fTreeCascVarPIDPositive = mcPosV0Dghter -> GetPdgCode();
2376           fTreeCascVarPIDNegative = mcNegV0Dghter -> GetPdgCode();
2377           fTreeCascVarPIDBachelor = mcBach->GetPdgCode();
2378
2379           // - Step 4.2 : level of the Xi daughters
2380                 
2381           Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ; 
2382           Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();
2383         
2384           //Rather uncivilized: Open brackets for each 'continue'
2385           if(! (lblMotherPosV0Dghter != lblMotherNegV0Dghter) ) { // same mother
2386           if(! (lblMotherPosV0Dghter < 0) ) { // mother != primary (!= -1)
2387           if(! (lblMotherNegV0Dghter < 0) ) {
2388                                         
2389                 // mothers = Lambda candidate ... a priori
2390         
2391           TParticle* mcMotherPosV0Dghter = lMCstack->Particle( lblMotherPosV0Dghter );
2392           TParticle* mcMotherNegV0Dghter = lMCstack->Particle( lblMotherNegV0Dghter );
2393                         
2394           // - Step 4.3 : level of Xi candidate
2395         
2396           Int_t lblGdMotherPosV0Dghter =   mcMotherPosV0Dghter->GetFirstMother() ;
2397           Int_t lblGdMotherNegV0Dghter =   mcMotherNegV0Dghter->GetFirstMother() ;
2398                                 
2399                 if(! (lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter) ) {
2400                 if(! (lblGdMotherPosV0Dghter < 0) ) { // primary lambda ...
2401                 if(! (lblGdMotherNegV0Dghter < 0) ) { // primary lambda ...
2402
2403                   // Gd mothers = Xi candidate ... a priori
2404         
2405           TParticle* mcGdMotherPosV0Dghter = lMCstack->Particle( lblGdMotherPosV0Dghter );
2406           TParticle* mcGdMotherNegV0Dghter = lMCstack->Particle( lblGdMotherNegV0Dghter );
2407                                         
2408           Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetFirstMother()  );
2409         
2410   //            if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters
2411                   if(!(lblMotherBach != lblGdMotherPosV0Dghter)) { //same mother for bach and V0 daughters
2412         
2413           TParticle* mcMotherBach = lMCstack->Particle( lblMotherBach );
2414         
2415     lPID_BachMother = mcMotherBach->GetPdgCode();
2416           lPID_NegMother = mcGdMotherPosV0Dghter->GetPdgCode();
2417           lPID_PosMother = mcGdMotherNegV0Dghter->GetPdgCode();
2418    
2419           if(lPID_BachMother==lPID_NegMother && lPID_BachMother==lPID_PosMother){ 
2420                   lPDGCodeCascade = lPID_BachMother; 
2421       lXiTransvMomMC = mcMotherBach->Pt();
2422       if( lMCstack->IsPhysicalPrimary       (lblMotherBach) ) fTreeCascVarIsPhysicalPrimary = 1; //Is Primary!
2423       if( lMCstack->IsSecondaryFromWeakDecay(lblMotherBach) ) fTreeCascVarIsPhysicalPrimary = 2; //Weak Decay!
2424       if( lMCstack->IsSecondaryFromMaterial (lblMotherBach) ) fTreeCascVarIsPhysicalPrimary = 3; //From Material!
2425       if ( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) !=0 ){
2426         lRapMC = 0.5*TMath::Log( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) );
2427       }
2428           }
2429
2430   }}}}}}} //Ends all conditionals above...
2431
2432   //----------------------------------------
2433   // Regular MC ASSOCIATION ENDS HERE
2434   //----------------------------------------
2435
2436   //------------------------------------------------
2437   // Set Variables for adding to tree
2438   //------------------------------------------------            
2439         
2440 /* 1*/          fTreeCascVarCharge      = lChargeXi;
2441 /* 2*/          if(lInvMassXiMinus!=0)    fTreeCascVarMassAsXi = lInvMassXiMinus;
2442 /* 2*/          if(lInvMassXiPlus!=0)     fTreeCascVarMassAsXi = lInvMassXiPlus;
2443 /* 3*/          if(lInvMassOmegaMinus!=0) fTreeCascVarMassAsOmega = lInvMassOmegaMinus;
2444 /* 3*/          if(lInvMassOmegaPlus!=0)  fTreeCascVarMassAsOmega = lInvMassOmegaPlus;
2445 /* 4*/          fTreeCascVarPt = lXiTransvMom;
2446 /* 4*/          fTreeCascVarPtMC = lXiTransvMomMC;
2447 /* 5*/          fTreeCascVarRapXi = lRapXi ;
2448 /* 5*/          fTreeCascVarRapMC = lRapMC ;
2449 /* 6*/          fTreeCascVarRapOmega = lRapOmega ;
2450 /* 7*/          fTreeCascVarDCACascDaughters = lDcaXiDaughters;
2451 /* 8*/          fTreeCascVarDCABachToPrimVtx = lDcaBachToPrimVertexXi;
2452 /* 9*/          fTreeCascVarDCAV0Daughters = lDcaV0DaughtersXi;
2453 /*10*/          fTreeCascVarDCAV0ToPrimVtx = lDcaV0ToPrimVertexXi;
2454 /*11*/          fTreeCascVarDCAPosToPrimVtx = lDcaPosToPrimVertexXi;
2455 /*12*/          fTreeCascVarDCANegToPrimVtx = lDcaNegToPrimVertexXi;
2456 /*13*/          fTreeCascVarCascCosPointingAngle = lXiCosineOfPointingAngle;
2457 /*14*/          fTreeCascVarCascRadius = lXiRadius;
2458 /*15*/          fTreeCascVarV0Mass = lInvMassLambdaAsCascDghter;
2459 /*16*/          fTreeCascVarV0CosPointingAngle = lV0CosineOfPointingAngleXi;
2460 /*16*/          fTreeCascVarV0CosPointingAngleSpecial = lV0CosineOfPointingAngleXiSpecial;
2461 /*17*/          fTreeCascVarV0Radius = lV0RadiusXi;
2462 /*20*/          fTreeCascVarLeastNbrClusters = leastnumberofclusters;
2463 /*21*/          fTreeCascVarMultiplicity = lMultiplicity; //multiplicity, whatever that may be
2464
2465 /*23*/          fTreeCascVarDistOverTotMom = TMath::Sqrt(
2466                                                 TMath::Power( lPosXi[0] - lBestPrimaryVtxPos[0] , 2) +
2467                                                 TMath::Power( lPosXi[1] - lBestPrimaryVtxPos[1] , 2) +
2468                                                 TMath::Power( lPosXi[2] - lBestPrimaryVtxPos[2] , 2)
2469                                         );
2470 /*23*/          fTreeCascVarDistOverTotMom /= (lXiTotMom+1e-13);
2471 /*24*/    //Not specified here, it has been set already (TRunNumber)
2472 /*25*/          fTreeCascVarPID = lPDGCodeCascade;
2473
2474 //------------------------------------------------
2475 // Fill Tree! 
2476 //------------------------------------------------
2477
2478 // The conditional is meant to decrease excessive
2479 // memory usage! Be careful when loosening the 
2480 // cut!
2481
2482   //Xi    Mass window: 150MeV wide
2483   //Omega mass window: 150MeV wide
2484
2485   if( (fTreeCascVarMassAsXi<1.32+0.075&&fTreeCascVarMassAsXi>1.32-0.075) ||
2486       (fTreeCascVarMassAsOmega<1.68+0.075&&fTreeCascVarMassAsOmega>1.68-0.075) ){
2487       fTreeCascade->Fill();
2488   }
2489
2490 //------------------------------------------------
2491 // Fill tree over.
2492 //------------------------------------------------
2493
2494         }// end of the Cascade loop (ESD or AOD)
2495
2496    // Post output data.
2497    PostData(1, fListHist);
2498    PostData(2, fTreeCascade);
2499 }
2500
2501 //________________________________________________________________________
2502 void AliAnalysisTaskExtractPerformanceCascade::Terminate(Option_t *)
2503 {
2504    // Draw result to the screen
2505    // Called once at the end of the query
2506
2507    TList *cRetrievedList = 0x0;
2508    cRetrievedList = (TList*)GetOutputData(1);
2509    if(!cRetrievedList){
2510       Printf("ERROR - AliAnalysisTaskExtractCascade : ouput data container list not available\n");
2511       return;
2512    }    
2513         
2514    fHistV0MultiplicityForTrigEvt = dynamic_cast<TH1F*> (  cRetrievedList->FindObject("fHistV0MultiplicityForTrigEvt")  );
2515    if (!fHistV0MultiplicityForTrigEvt) {
2516       Printf("ERROR - AliAnalysisTaskExtractCascade : fHistV0MultiplicityForTrigEvt not available");
2517       return;
2518    }
2519   
2520    TCanvas *canCheck = new TCanvas("AliAnalysisTaskExtractCascade","V0 Multiplicity",10,10,510,510);
2521    canCheck->cd(1)->SetLogy();
2522
2523    fHistV0MultiplicityForTrigEvt->SetMarkerStyle(22);
2524    fHistV0MultiplicityForTrigEvt->DrawCopy("E");
2525 }
2526
2527 //----------------------------------------------------------------------------
2528
2529 Double_t AliAnalysisTaskExtractPerformanceCascade::MyRapidity(Double_t rE, Double_t rPz) const
2530 {
2531    // Local calculation for rapidity
2532    Double_t ReturnValue = -100;
2533    if( (rE-rPz+1.e-13) != 0 && (rE+rPz) != 0 ){ 
2534       ReturnValue =  0.5*TMath::Log((rE+rPz)/(rE-rPz+1.e-13));
2535    }
2536    return ReturnValue;
2537