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