]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/Cascades/AliAnalysisTaskCheckCascadepp276.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Cascades / AliAnalysisTaskCheckCascadepp276.cxx
1 /**************************************************************************
2  *  Authors : Antonin Maire, Boris Hippolyte                              *
3  * Contributors are mentioned in the code where appropriate.              *
4  *                                                                        *
5  * Permission to use, copy, modify and distribute this software and its   *
6  * documentation strictly for non-commercial purposes is hereby granted   *
7  * without fee, provided that the above copyright notice appears in all   *
8  * copies and that both the copyright notice and this permission notice   *
9  * appear in the supporting documentation. The authors make no claims     *
10  * about the suitability of this software for any purpose. It is          *
11  * provided "as is" without express or implied warranty.                  *
12  **************************************************************************/
13
14 //-----------------------------------------------------------------
15 //            AliAnalysisTaskCheckCascadepp276 class
16 //
17 //            Origin AliAnalysisTaskCheckCascade which has four roles :
18 //              1. QAing the Cascades from ESD and AOD
19 //                 Origin:  AliAnalysisTaskESDCheckV0 by Boris Hippolyte Nov2007, hippolyt@in2p3.fr
20 //              2. Prepare the plots which stand as raw material for yield extraction (wi/wo PID)
21 //              3. Supply an AliCFContainer meant to define the optimised topological selections
22 //              4. Rough azimuthal correlation study (Eta, Phi)
23 //              Adapted to Cascade : A.Maire Mar2008, antonin.maire@ires.in2p3.fr
24 //              Modified :           A.Maire Mar2010 
25 //
26 //              Adapted to PbPb analysis: M. Nicassio, maria.nicassio@ba.infn.it
27 //               Feb-August2011
28 //                - Physics selection moved to the run.C macro
29 //                - Centrality selection added (+ setters) and histos
30 //                - flag and setters added (CF container usage, vertex range)
31 //                - histo added and histo/container binning changed 
32 //                - protection in the destructor for CAF usage          
33 //                - AliWarning disabled
34 //                - number of tracklets from AOD also          
35 //                - automatic settings for PID
36 //               September2011
37 //                - proper time histos/container added (V0 and Cascades)
38 //                - cosine PA V0 wrt Xi vertex in the container  
39 //               November2011
40 //                - re-run V0's and cascade's vertexers (SetCuts instead SetDefaultCuts!!)
41 //                - problems of libraries on Grid --> code copied in the task (from AliRoot v5-10-AN
42 //                  where new pt dependent V0's cosPA cut implemented by Iouri) 
43 //                - AOD analysis part completed 
44 //
45 //
46 //              Adapted to pp 2.76 TeV analysis: D. Colella, domenico.colella@ba.infn.it
47 //               Gen-now 2012
48 //                - Physics selection re-moved here (mainly for normalization in the efficiency calcuation)
49 //                - Centrality selection deleted
50 //
51 //
52 //             Adapted to pPb 5.02 TeV analysis: D. Colella, domenico.colella@ba.infn.it
53 //               Aug-Sep 2014
54 //               - Added the parameter fCollidingSystem, to distingish between pp and pPb procedures
55 //
56 //
57 //
58 //-----------------------------------------------------------------
59
60 class TTree;
61 class TParticle;
62 class TVector3;
63
64 class AliESDVertex;
65 class AliAODVertex;
66 class AliESDv0;
67 class AliAODv0;
68
69 #include <Riostream.h>
70 #include "TList.h"
71 #include "TH1.h"
72 #include "TH2.h"
73 #include "TH3.h"
74 #include "THnSparse.h"
75 #include "TVector3.h"
76 #include "TCanvas.h"
77 #include "TMath.h"
78 #include "TLegend.h"
79
80 #include "AliLog.h"
81 #include "AliESDEvent.h"
82 #include "AliAODEvent.h"
83 #include "AliV0vertexer.h"
84 #include "AliCascadeVertexer.h"
85 #include "AliESDtrackCuts.h"
86 #include "AliPIDResponse.h"
87
88 #include "AliESDVZERO.h"
89
90 #include "AliInputEventHandler.h"
91 #include "AliAnalysisManager.h"
92 #include "AliMCEventHandler.h"
93 #include "AliESDInputHandler.h" 
94 #include "AliAODInputHandler.h"
95 #include "AliCFContainer.h"
96 #include "AliMultiplicity.h"
97
98 #include "AliESDcascade.h"
99 #include "AliAODcascade.h"
100 #include "AliAODTrack.h"
101 #include "AliAnalysisUtils.h"
102
103 #include "AliAnalysisTaskCheckCascadepp276.h"
104
105
106 using std::cout;
107 using std::endl;
108
109 ClassImp(AliAnalysisTaskCheckCascadepp276)
110
111
112
113 //________________________________________________________________________
114 AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276() 
115   : AliAnalysisTaskSE(), 
116     fAnalysisType               ("ESD"),
117     fESDtrackCuts               (0),
118     fUtils                      (0),
119     fCollidingSystem            ("pp"),
120     fPIDResponse                (0),
121     fkRerunV0CascVertexers      (0),
122     fkSDDSelectionOn            (kTRUE),
123     fkQualityCutZprimVtxPos     (kTRUE),
124     fkQualityCutNoTPConlyPrimVtx(kTRUE),
125     fkQualityCutTPCrefit        (kTRUE),
126     fkQualityCutnTPCcls         (kTRUE),
127     fkQualityCutPileup          (kTRUE),
128     fwithSDD                    (kTRUE),
129     fMinnTPCcls                 (0),
130     fkExtraSelections           (0),
131     fVtxRange                   (0),
132     fVtxRangeMin                (0),
133     fMinPtCutOnDaughterTracks   (0),
134     fEtaCutOnDaughterTracks     (0),
135
136     // - Plots initialisation
137     fListHistCascade(0),
138       // Cascades multiplicity plots
139       fHistCascadeMultiplicityBeforeAnySel(0),
140       fHistCascadeMultiplicityAfterSDDSel(0),
141       fHistCascadeMultiplicityAfterPhysicsSel(0),
142       fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
143       fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
144       fHistCascadeMultiplicityAfterVertexCutSel(0),
145       // Tracks multiplicity plots
146       fHistTrackMultiplicityBeforeAnySel(0),
147       fHistTrackMultiplicityAfterSDDSel(0),
148       fHistTrackMultiplicityAfterPhysicsSel(0),
149       fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
150       fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
151       fHistTrackMultiplicityAfterVertexCutSel(0),
152       // Vertex position plots (BestVertex)
153       fHistPVx(0), fHistPVy(0), fHistPVz(0),
154       fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),    
155       // TPC cluster distributions for daughters
156       fHistPosV0TPCClusters(0), 
157       fHistNegV0TPCClusters(0), 
158       fHistBachTPCClusters(0),
159       // Cut's variables distributions
160       fHistEffMassXi(0), 
161       fHistDcaXiDaughters(0), 
162       fHistDcaBachToPrimVertex(0), 
163       fHistXiCosineOfPointingAngle(0), 
164       fHistXiRadius(0),
165       fHistMassLambdaAsCascDghter(0),
166       fHistDcaV0DaughtersXi(0),
167       fHistDcaV0ToPrimVertexXi(0), 
168       fHistV0CosineOfPointingAngleXi(0),
169       fHistV0RadiusXi(0),
170       fHistDcaPosToPrimVertexXi(0), 
171       fHistDcaNegToPrimVertexXi(0), 
172       // Invariant mass distributions
173       fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),
174       // Transverse and total momentum distributions
175       fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),
176       // Others QA plots
177       fHistChargeXi(0),
178       fHistV0toXiCosineOfPointingAngle(0),
179       fHistRapXi(0), fHistRapOmega(0), 
180       fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),
181       fHistThetaXi(0), 
182       fHistPhiXi(0),
183       f2dHistArmenteros(0),                     
184       f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),
185       f2dHistEffMassLambdaVsEffMassXiPlus(0),  f2dHistEffMassXiVsEffMassOmegaPlus(0),
186       f2dHistXiRadiusVsEffMassXiMinus(0),      f2dHistXiRadiusVsEffMassXiPlus(0),
187       f2dHistXiRadiusVsEffMassOmegaMinus(0),   f2dHistXiRadiusVsEffMassOmegaPlus(0),
188       f2dHistTPCdEdxOfCascDghters(0),
189       f2dHistDcaXiDaughtersvsInvMass(0), 
190       f2dHistDcaBachToPrimVertexvsInvMass(0), 
191       f2dHistXiCosineOfPointingAnglevsInvMass(0),
192       f2dHistMassLambdaAsCascDghtervsInvMass(0),
193       f2dHistDcaV0DaughtersXivsInvMass(0),
194       f2dHistDcaV0ToPrimVertexXivsInvMass(0),
195       // Containers for cuts study 
196       fCFContCascadePIDXiMinus(0),
197       fCFContCascadePIDXiPlus(0),
198       fCFContCascadePIDOmegaMinus(0),
199       fCFContCascadePIDOmegaPlus(0),
200       fCFContCascadeCuts(0)
201     
202     {
203      // Dummy Constructor
204         for(Int_t iV0selIdx   = 0; iV0selIdx   < 7; iV0selIdx++   ) { fV0Sels          [iV0selIdx   ] = -1.; }
205         for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels        [iCascSelIdx ] = -1.; }
206     }
207
208
209 //________________________________________________________________________
210 AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276(const char *name) 
211   : AliAnalysisTaskSE(name), 
212     fAnalysisType               ("ESD"), 
213     fESDtrackCuts               (0), 
214     fUtils                      (0),
215     fCollidingSystem            ("pp"),
216     fPIDResponse                (0),
217     fkRerunV0CascVertexers      (0),
218     fkSDDSelectionOn            (kTRUE),
219     fkQualityCutZprimVtxPos     (kTRUE),
220     fkQualityCutNoTPConlyPrimVtx(kTRUE),
221     fkQualityCutTPCrefit        (kTRUE),
222     fkQualityCutnTPCcls         (kTRUE),
223     fkQualityCutPileup          (kTRUE),
224     fwithSDD                    (kTRUE),
225     fMinnTPCcls                 (0),
226     fkExtraSelections           (0),
227     fVtxRange                   (0),
228     fVtxRangeMin                (0),
229     fMinPtCutOnDaughterTracks   (0),
230     fEtaCutOnDaughterTracks     (0),
231      
232     // - Plots initialisation
233     fListHistCascade(0),
234
235       // Cascades multiplicity plots
236       fHistCascadeMultiplicityBeforeAnySel(0),
237       fHistCascadeMultiplicityAfterSDDSel(0),
238       fHistCascadeMultiplicityAfterPhysicsSel(0),
239       fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
240       fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
241       fHistCascadeMultiplicityAfterVertexCutSel(0),
242       // Tracks multiplicity plots
243       fHistTrackMultiplicityBeforeAnySel(0),
244       fHistTrackMultiplicityAfterSDDSel(0),
245       fHistTrackMultiplicityAfterPhysicsSel(0),
246       fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
247       fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
248       fHistTrackMultiplicityAfterVertexCutSel(0),
249       // Vertex position plots (BestVertex)
250       fHistPVx(0), fHistPVy(0), fHistPVz(0),
251       fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),
252       // TPC cluster distributions for daughters
253       fHistPosV0TPCClusters(0), fHistNegV0TPCClusters(0), fHistBachTPCClusters(0),
254       // Cut's variables distributions
255       fHistEffMassXi(0),
256       fHistDcaXiDaughters(0),
257       fHistDcaBachToPrimVertex(0),
258       fHistXiCosineOfPointingAngle(0),
259       fHistXiRadius(0),
260       fHistMassLambdaAsCascDghter(0),
261       fHistDcaV0DaughtersXi(0),
262       fHistDcaV0ToPrimVertexXi(0),
263       fHistV0CosineOfPointingAngleXi(0),
264       fHistV0RadiusXi(0),
265       fHistDcaPosToPrimVertexXi(0),
266       fHistDcaNegToPrimVertexXi(0),
267       // Invariant mass distributions
268       fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),
269       // Transverse and total momentum distributions
270       fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),
271       // Others QA plots
272       fHistChargeXi(0),
273       fHistV0toXiCosineOfPointingAngle(0),
274       fHistRapXi(0), fHistRapOmega(0),
275       fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),
276       fHistThetaXi(0),
277       fHistPhiXi(0),
278       f2dHistArmenteros(0),
279       f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),
280       f2dHistEffMassLambdaVsEffMassXiPlus(0),  f2dHistEffMassXiVsEffMassOmegaPlus(0),
281       f2dHistXiRadiusVsEffMassXiMinus(0),      f2dHistXiRadiusVsEffMassXiPlus(0),
282       f2dHistXiRadiusVsEffMassOmegaMinus(0),   f2dHistXiRadiusVsEffMassOmegaPlus(0),
283       f2dHistTPCdEdxOfCascDghters(0),
284       f2dHistDcaXiDaughtersvsInvMass(0),
285       f2dHistDcaBachToPrimVertexvsInvMass(0),
286       f2dHistXiCosineOfPointingAnglevsInvMass(0),
287       f2dHistMassLambdaAsCascDghtervsInvMass(0),
288       f2dHistDcaV0DaughtersXivsInvMass(0),
289       f2dHistDcaV0ToPrimVertexXivsInvMass(0),
290       // Containers for cuts study 
291       fCFContCascadePIDXiMinus(0),
292       fCFContCascadePIDXiPlus(0),
293       fCFContCascadePIDOmegaMinus(0),
294       fCFContCascadePIDOmegaPlus(0),
295       fCFContCascadeCuts(0)
296     
297     //_____Costructor____
298     {
299      // Define input and output slots here
300      // Input slot #0 works with a TChain
301      // DefineInput(0, TChain::Class());
302      // Output slot #1 writes into a TList container (cascade)
303      if (fCollidingSystem == "pp") {
304          fV0Sels[0] =  33.  ;     // max allowed chi2
305          fV0Sels[1] =   0.01;     // min allowed impact parameter for the 1st daughter 
306          fV0Sels[2] =   0.01;     // min allowed impact parameter for the 2nd daughter 
307          fV0Sels[3] =   1.5;      // max allowed DCA between the daughter tracks       
308          fV0Sels[4] =   0.9;      // min allowed cosine of V0's pointing angle - This is pT dependent        
309          fV0Sels[5] =   0.2;      // min radius of the fiducial volume                 
310          fV0Sels[6] = 200.;       // max radius of the fiducial volume                 
311          fCascSels[0] =  33.;     // max allowed chi2 (same as PDC07)
312          fCascSels[1] =   0.01;   // min allowed V0 impact parameter                    
313          fCascSels[2] =   0.008;  // "window" around the Lambda mass                    
314          fCascSels[3] =   0.01;   // min allowed bachelor's impact parameter          
315          fCascSels[4] =   2.0;    // max allowed DCA between the V0 and the bachelor    
316          fCascSels[5] =   0.95;   // min allowed cosine of the cascade pointing angle   
317          fCascSels[6] =   0.2;    // min radius of the fiducial volume                  
318          fCascSels[7] = 100.;     // max radius of the fiducial volume 
319      } else if (fCollidingSystem == "pPb") {
320          fV0Sels[0] =  33.  ;     // max allowed chi2
321          fV0Sels[1] =   0.02;     // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
322          fV0Sels[2] =   0.02;     // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
323          fV0Sels[3] =   2.0 ;     // max allowed DCA between the daughter tracks       (LHC09a4 : 0.5)
324          fV0Sels[4] =   0.95;     // min allowed cosine of V0's pointing angle         (LHC09a4 : 0.99)
325          fV0Sels[5] =   1.0 ;     // min radius of the fiducial volume                 (LHC09a4 : 0.2)
326          fV0Sels[6] = 200.  ;     // max radius of the fiducial volume                 (LHC09a4 : 100.0)
327          fCascSels[0] =  33.   ;  // max allowed chi2 (same as PDC07)
328          fCascSels[1] =   0.05 ;  // min allowed V0 impact parameter                    (PDC07 : 0.05   / LHC09a4 : 0.025 )
329          fCascSels[2] =   0.010;  // "window" around the Lambda mass                    (PDC07 : 0.008  / LHC09a4 : 0.010 )
330          fCascSels[3] =   0.03 ;  // min allowed bachelor's impact parameter            (PDC07 : 0.035  / LHC09a4 : 0.025 )
331          fCascSels[4] =   2.0  ;  // max allowed DCA between the V0 and the bachelor    (PDC07 : 0.1    / LHC09a4 : 0.2   )
332          fCascSels[5] =   0.95 ;  // min allowed cosine of the cascade pointing angle   (PDC07 : 0.9985 / LHC09a4 : 0.998 )
333          fCascSels[6] =   0.4  ;  // min radius of the fiducial volume                  (PDC07 : 0.9    / LHC09a4 : 0.2   )
334          fCascSels[7] = 100.   ;  // max radius of the fiducial volume                  (PDC07 : 100    / LHC09a4 : 100   )
335      }
336      // Output slot #0 writes into a TList container (Cascade)
337      DefineOutput(1, TList::Class());
338      DefineOutput(2, AliCFContainer::Class());
339      DefineOutput(3, AliCFContainer::Class());
340      DefineOutput(4, AliCFContainer::Class());
341      DefineOutput(5, AliCFContainer::Class());
342      DefineOutput(6, AliCFContainer::Class());
343      AliLog::SetClassDebugLevel("AliAnalysisTaskCheckCascadepp276",1);
344     } 
345
346
347     //_____Destructor_____
348     AliAnalysisTaskCheckCascadepp276::~AliAnalysisTaskCheckCascadepp276() {
349       // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.
350       // They will be deleted when fListCascade is deleted by the TSelector dtor
351       // Because of TList::SetOwner() ...   
352        if (fListHistCascade && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())           { delete fListHistCascade; fListHistCascade = 0x0; }
353        if (fCFContCascadePIDXiMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())   { delete fCFContCascadePIDXiMinus; fCFContCascadePIDXiMinus = 0x0; }
354        if (fCFContCascadePIDXiPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())    { delete fCFContCascadePIDXiPlus; fCFContCascadePIDXiPlus = 0x0; }
355        if (fCFContCascadePIDOmegaMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){ delete fCFContCascadePIDOmegaMinus; fCFContCascadePIDOmegaMinus = 0x0; }
356        if (fCFContCascadePIDOmegaPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDOmegaPlus; fCFContCascadePIDOmegaPlus = 0x0; }  
357        if (fCFContCascadeCuts && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())         { delete fCFContCascadeCuts; fCFContCascadeCuts = 0x0; }
358        if (fESDtrackCuts)                                                                          { delete fESDtrackCuts; fESDtrackCuts = 0x0; }
359     }
360
361
362 //________________________________________________________________________
363 void AliAnalysisTaskCheckCascadepp276::UserCreateOutputObjects() {
364   // Create histograms
365   // Called once
366
367
368  fListHistCascade = new TList();
369  fListHistCascade->SetOwner();  // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
370
371  //-----------------------------------------------
372  // Particle Identification Setup (new PID object)
373  //-----------------------------------------------
374  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
375  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
376  fPIDResponse = inputHandler->GetPIDResponse();
377  // Only used to get the number of primary reconstructed tracks
378  if (fAnalysisType == "ESD" && (! fESDtrackCuts )){
379    fESDtrackCuts = new AliESDtrackCuts();
380  }
381
382  //---------------------------------------------------
383  // Initialize cuts to re-run V0 and cascade vertexers
384  //---------------------------------------------------
385  // Not validated; to be checked
386  if (fCollidingSystem == "pp") {
387       fV0Sels[0] =  33.  ;     // max allowed chi2
388       fV0Sels[1] =   0.01;     // min allowed impact parameter for the 1st daughter 
389       fV0Sels[2] =   0.01;     // min allowed impact parameter for the 2nd daughter 
390       fV0Sels[3] =   1.5;      // max allowed DCA between the daughter tracks       
391       fV0Sels[4] =   0.9;      // min allowed cosine of V0's pointing angle         
392       fV0Sels[5] =   0.2;      // min radius of the fiducial volume                 
393       fV0Sels[6] = 200.;       // max radius of the fiducial volume                 
394       fCascSels[0] =  33.;     // max allowed chi2 (same as PDC07)
395       fCascSels[1] =   0.01;   // min allowed V0 impact parameter                    
396       fCascSels[2] =   0.008;  // "window" around the Lambda mass                    
397       fCascSels[3] =   0.01;   // min allowed bachelor's impact parameter          
398       fCascSels[4] =   2.0;    // max allowed DCA between the V0 and the bachelor    
399       fCascSels[5] =   0.95;   // min allowed cosine of the cascade pointing angle   
400       fCascSels[6] =   0.2;    // min radius of the fiducial volume                  
401       fCascSels[7] = 100.;     // max radius of the fiducial volume 
402  } else if (fCollidingSystem == "pPb") {
403       fV0Sels[0] =  33.  ;     // max allowed chi2
404       fV0Sels[1] =   0.02;     // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
405       fV0Sels[2] =   0.02;     // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
406       fV0Sels[3] =   2.0 ;     // max allowed DCA between the daughter tracks       (LHC09a4 : 0.5)
407       fV0Sels[4] =   0.95;     // min allowed cosine of V0's pointing angle         (LHC09a4 : 0.99)
408       fV0Sels[5] =   1.0 ;     // min radius of the fiducial volume                 (LHC09a4 : 0.2)
409       fV0Sels[6] = 200.  ;     // max radius of the fiducial volume                 (LHC09a4 : 100.0)
410       fCascSels[0] =  33.   ;  // max allowed chi2 (same as PDC07)
411       fCascSels[1] =   0.05 ;  // min allowed V0 impact parameter                    (PDC07 : 0.05   / LHC09a4 : 0.025 )
412       fCascSels[2] =   0.010;  // "window" around the Lambda mass                    (PDC07 : 0.008  / LHC09a4 : 0.010 )
413       fCascSels[3] =   0.03 ;  // min allowed bachelor's impact parameter            (PDC07 : 0.035  / LHC09a4 : 0.025 )
414       fCascSels[4] =   2.0  ;  // max allowed DCA between the V0 and the bachelor    (PDC07 : 0.1    / LHC09a4 : 0.2   )
415       fCascSels[5] =   0.95 ;  // min allowed cosine of the cascade pointing angle   (PDC07 : 0.9985 / LHC09a4 : 0.998 )
416       fCascSels[6] =   0.4  ;  // min radius of the fiducial volume                  (PDC07 : 0.9    / LHC09a4 : 0.2   )
417       fCascSels[7] = 100.   ;  // max radius of the fiducial volume                  (PDC07 : 100    / LHC09a4 : 100   )
418  }
419
420  //----------------------
421  // Initialize the histos
422  //----------------------
423  
424  // - Cascades multiplicity plots 
425  if(! fHistCascadeMultiplicityBeforeAnySel) {
426         fHistCascadeMultiplicityBeforeAnySel = new TH1F("fHistCascadeMultiplicityBeforeAnySel",
427                         "Cascades per event (before any selections);Nbr of Cascades/Evt;Events",                
428                         20, 0, 20);
429         fListHistCascade->Add(fHistCascadeMultiplicityBeforeAnySel);
430  }
431  if(! fHistCascadeMultiplicityAfterSDDSel) {
432         fHistCascadeMultiplicityAfterSDDSel = new TH1F("fHistCascadeMultiplicityAfterSDDSel", 
433                         "Cascades per event (after the SDD selection);Nbr of Cascades/Evt;Events", 
434                         20, 0, 20);             
435         fListHistCascade->Add(fHistCascadeMultiplicityAfterSDDSel);
436  }
437  if(! fHistCascadeMultiplicityAfterPhysicsSel) {
438         fHistCascadeMultiplicityAfterPhysicsSel = new TH1F("fHistCascadeMultiplicityAfterPhysicsSel",
439                         "Cascades per event (after physics selection);Nbr of Cascades/Evt;Events",
440                         20, 0, 20);
441         fListHistCascade->Add(fHistCascadeMultiplicityAfterPhysicsSel);
442  }
443  if(! fHistCascadeMultiplicityForSelEvtNoTPCOnly) {
444         fHistCascadeMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnly",
445                         "Cascades per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",
446                         20, 0, 20);
447         fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnly);
448  }
449  if(! fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup) {
450         fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup",
451                         "Cascades per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",
452                         20, 0, 20);
453         fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup);
454  }
455  if(! fHistCascadeMultiplicityAfterVertexCutSel) {
456         fHistCascadeMultiplicityAfterVertexCutSel = new TH1F("fHistCascadeMultiplicityAfterVertexCutSel",
457                                                              "Cascades per event (after vertex cut selection);Nbr of Cascades/Evt;Events",
458                                                              20, 0, 20);
459         fListHistCascade->Add(fHistCascadeMultiplicityAfterVertexCutSel);
460  }
461  // - Tracks multiplicity plots 
462  if(! fHistTrackMultiplicityBeforeAnySel) {
463         fHistTrackMultiplicityBeforeAnySel = new TH1F("fHistTrackMultiplicityBeforeAnySel", 
464                         "Tracks per event (before any selections);Nbr of Cascades/Evt;Events", 
465                         100, 0, 100);           
466         fListHistCascade->Add(fHistTrackMultiplicityBeforeAnySel);
467  } 
468  if(! fHistTrackMultiplicityAfterSDDSel) {
469         fHistTrackMultiplicityAfterSDDSel = new TH1F("fHistTrackMultiplicityAfterSDDSel",                  
470                         "Tracks per event (after the SDD selection);Nbr of Cascades/Evt;Events",
471                         100, 0, 100);
472         fListHistCascade->Add(fHistTrackMultiplicityAfterSDDSel);
473  }
474  if(! fHistTrackMultiplicityAfterPhysicsSel) {
475         fHistTrackMultiplicityAfterPhysicsSel = new TH1F("fHistTrackMultiplicityAfterPhysicsSel",
476                         "Tracks per event (after physics selection);Nbr of Cascades/Evt;Events",
477                         100, 0, 100);
478         fListHistCascade->Add(fHistTrackMultiplicityAfterPhysicsSel);
479  }
480  if(! fHistTrackMultiplicityForSelEvtNoTPCOnly) {
481         fHistTrackMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnly",
482                         "Tracks per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",
483                         100, 0, 100);
484         fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnly);
485  }
486  if(! fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup) {
487         fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup",
488                         "Tracks per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",
489                         100, 0, 100);
490         fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
491  }
492  if(! fHistTrackMultiplicityAfterVertexCutSel) {
493         fHistTrackMultiplicityAfterVertexCutSel = new TH1F("fHistTrackMultiplicityAfterVertexCutSel",
494                                                            "Tracks per event (after vertex cut selection);Nbr of Cascades/Evt;Events",
495                                                            100, 0, 100);
496         fListHistCascade->Add(fHistTrackMultiplicityAfterVertexCutSel);
497  }
498  // - Vertex position plots
499  if(! fHistPVx ){
500         fHistPVx = new TH1F("fHistPVx", "Best PV position in x; x (cm); Events", 2000, -0.5, 0.5);
501         fListHistCascade->Add(fHistPVx);
502  }
503  if(! fHistPVy ){
504         fHistPVy = new TH1F("fHistPVy", "Best PV position in y; y (cm); Events", 2000, -0.5, 0.5);
505         fListHistCascade->Add(fHistPVy);
506  }
507  if(! fHistPVz ){
508         fHistPVz = new TH1F("fHistPVz", "Best PV position in z; z (cm); Events", 400, -20, 20);
509         fListHistCascade->Add(fHistPVz);
510  } 
511  if(! fHistPVxAnalysis ){
512         fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", "Best PV position in x (after events selections); x (cm); Events", 2000, -0.5, 0.5);
513         fListHistCascade->Add(fHistPVxAnalysis);
514  }
515  if(! fHistPVyAnalysis ){
516         fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", "Best PV position in y (after events selections); y (cm); Events", 2000, -0.5, 0.5);
517         fListHistCascade->Add(fHistPVyAnalysis);
518  }
519  if(! fHistPVzAnalysis ){
520         fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", "Best PV position in z (after events selections); z (cm); Events", 400, -20, 20);
521         fListHistCascade->Add(fHistPVzAnalysis);
522  }
523  // - TPC clusetr sdistributions for daughters (histos for events containing at least ONE CASCADE)
524  if(! fHistPosV0TPCClusters ){
525         fHistPosV0TPCClusters = new TH1F("fHistPosV0TPCClusters", "TPC clusters for Pos. V0 daughter track, in Casc; Nbr of TPC clusters (V0 Pos.); Track counts", 165, 0.0, 165.0);
526         fListHistCascade->Add(fHistPosV0TPCClusters);
527  }
528  if(! fHistNegV0TPCClusters ){
529         fHistNegV0TPCClusters = new TH1F("fHistNegV0TPCClusters", "TPC clusters for Neg. V0 daughter track, in Casc; Nbr of TPC clusters (V0 Neg.); Track counts", 165, 0.0, 165.0);
530         fListHistCascade->Add(fHistNegV0TPCClusters);
531  }
532  if(! fHistBachTPCClusters ){
533         fHistBachTPCClusters = new TH1F("fHistBachTPCClusters", "TPC clusters for Bachelor track; Nbr of TPC clusters (Bach); Track counts", 165, 0.0, 165.0);
534         fListHistCascade->Add(fHistBachTPCClusters);
535  }
536  // - Cut's variables distributions (typical histos for cascades): as example only for the Xi (both particle and anti-particle)
537  if(! fHistEffMassXi) {
538      fHistEffMassXi = new TH1F("fHistEffMassXi", "Xi candidates; Invariant Mass (GeV/c^{2}); Counts", 400, 1.2, 2.0);
539      fListHistCascade->Add(fHistEffMassXi);
540  }  
541  if(! fHistDcaXiDaughters ){
542      fHistDcaXiDaughters = new TH1F("fHistDcaXiDaughters", "DCA between Xi daughters; DCA (cm); Counts", 210, 0., 2.1);
543      fListHistCascade->Add(fHistDcaXiDaughters);
544  }
545  if(! fHistDcaBachToPrimVertex) {
546      fHistDcaBachToPrimVertex = new TH1F("fHistDcaBachToPrimVertex", "Impact parameter of Bach. to Prim. Vertex; DCA (cm); Counts", 250, 0., 0.25);
547      fListHistCascade->Add(fHistDcaBachToPrimVertex);
548  }
549  if(! fHistXiCosineOfPointingAngle) {
550      fHistXiCosineOfPointingAngle = new TH1F("fHistXiCosineOfPointingAngle", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Counts", 601, 0.94, 1.0001);
551      fListHistCascade->Add(fHistXiCosineOfPointingAngle);
552  }
553  if(! fHistXiRadius ){
554      fHistXiRadius = new TH1F("fHistXiRadius", "Cascade decay transv. radius; r (cm); Counts" , 2050, 0., 205.0);
555      fListHistCascade->Add(fHistXiRadius);
556  }
557  if(! fHistMassLambdaAsCascDghter) {
558      fHistMassLambdaAsCascDghter = new TH1F("fHistMassLambdaAsCascDghter", "#Lambda associated to cascade candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.0, 1.3);
559      fListHistCascade->Add(fHistMassLambdaAsCascDghter);
560  }
561  if(! fHistDcaV0DaughtersXi) {
562      fHistDcaV0DaughtersXi = new TH1F("fHistDcaV0DaughtersXi", "DCA between V0 daughters, in cascade; DCA (cm); Counts", 320, 0., 1.6);
563      fListHistCascade->Add(fHistDcaV0DaughtersXi);
564  }
565  if(! fHistDcaV0ToPrimVertexXi) {
566      fHistDcaV0ToPrimVertexXi = new TH1F("fHistDcaV0ToPrimVertexXi", "Impact parameter of V0  to Prim. Vertex, in cascade; DCA (cm); Counts", 200, 0., 1.);
567      fListHistCascade->Add(fHistDcaV0ToPrimVertexXi);
568  }
569  if(! fHistV0CosineOfPointingAngleXi) {
570      fHistV0CosineOfPointingAngleXi = new TH1F("fHistV0CosineOfPointingAngleXi", "Cosine of V0 Pointing Angle, in cascade; Cos(V0 Point. Angl); Counts", 201, 0.8, 1.001);
571      fListHistCascade->Add(fHistV0CosineOfPointingAngleXi);
572  }
573  if(! fHistV0RadiusXi) {
574      fHistV0RadiusXi = new TH1F("fHistV0RadiusXi", "V0 decay radius, in cascade; radius (cm); Counts", 2050, 0., 205.0);
575      fListHistCascade->Add(fHistV0RadiusXi);
576  }
577  if(! fHistDcaPosToPrimVertexXi) {
578      fHistDcaPosToPrimVertexXi = new TH1F("fHistDcaPosToPrimVertexXi", "Impact parameter of V0 pos daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);
579      fListHistCascade->Add(fHistDcaPosToPrimVertexXi);
580  }
581  if(! fHistDcaNegToPrimVertexXi) {
582      fHistDcaNegToPrimVertexXi = new TH1F("fHistDcaNegToPrimVertexXi", "Impact parameter of V0 neg daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);
583      fListHistCascade->Add(fHistDcaNegToPrimVertexXi);
584  }
585  // - Effective mass histos for cascades.
586     //By cascade hyp  
587  if(! fHistMassXiMinus) {
588      fHistMassXiMinus = new TH1F("fHistMassXiMinus", "#Xi^{-} candidates; M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);
589      fListHistCascade->Add(fHistMassXiMinus);
590  } 
591  if(! fHistMassXiPlus) {
592      fHistMassXiPlus = new TH1F("fHistMassXiPlus", "#Xi^{+} candidates; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);
593      fListHistCascade->Add(fHistMassXiPlus);
594  }
595  if(! fHistMassOmegaMinus) {
596      fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus", "#Omega^{-} candidates; M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500, 1.5, 2.5);
597      fListHistCascade->Add(fHistMassOmegaMinus);
598  }
599  if(! fHistMassOmegaPlus) {
600      fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus", "#Omega^{+} candidates;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
601      fListHistCascade->Add(fHistMassOmegaPlus);
602  }
603  // - Transverse and total momentum distributions
604  if(! fHistXiTransvMom ){
605      fHistXiTransvMom = new TH1F("fHistXiTransvMom", "#Xi transverse momentum (cand. around the mass peak); p_{t}(#Xi) (GeV/c); Counts", 100, 0.0, 10.0);
606      fListHistCascade->Add(fHistXiTransvMom);
607  }
608  if(! fHistXiTotMom ){
609      fHistXiTotMom = new TH1F("fHistXiTotMom", "#Xi momentum norm (cand. around the mass peak); p_{tot}(#Xi) (GeV/c); Counts", 150, 0.0, 15.0);
610      fListHistCascade->Add(fHistXiTotMom);
611  }
612  if(! fHistBachTransvMomXi ){
613      fHistBachTransvMomXi = new TH1F("fHistBachTransvMomXi", "#Xi Bach. transverse momentum (cand. around the mass peak); p_{t}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);
614      fListHistCascade->Add(fHistBachTransvMomXi);
615  }
616  if(! fHistBachTotMomXi ){
617      fHistBachTotMomXi = new TH1F("fHistBachTotMomXi", "#Xi Bach. momentum norm (cand. around the mass peak); p_{tot}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);
618      fListHistCascade->Add(fHistBachTotMomXi);
619  }
620  // - Others QA plots
621     //TH1
622  if(! fHistChargeXi ){
623      fHistChargeXi = new TH1F("fHistChargeXi", "Charge of Xi candidates; Sign; Counts", 5, -2.0, 3.0);
624      fListHistCascade->Add(fHistChargeXi);
625  }
626  if(! fHistV0toXiCosineOfPointingAngle) {
627      fHistV0toXiCosineOfPointingAngle = new TH1F("fHistV0toXiCosineOfPointingAngle", "Cos. of V0 Ptng Angl / Xi vtx ; Cos(V0 Point. Angl / Xi vtx); Counts", 1101, 0.89, 1.0001);
628      fListHistCascade->Add(fHistV0toXiCosineOfPointingAngle);
629  }
630  if(! fHistRapXi ){
631      fHistRapXi = new TH1F("fHistRapXi", "Rapidity of #Xi candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);
632      fListHistCascade->Add(fHistRapXi);
633  }
634  if(! fHistRapOmega ){
635      fHistRapOmega = new TH1F("fHistRapOmega", "Rapidity of #Omega candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);
636      fListHistCascade->Add(fHistRapOmega);
637  }
638  if(! fHistEtaXi ){
639      fHistEtaXi = new TH1F("fHistEtaXi", "Pseudo-rap. of #Xi candidates (around the mass peak); #eta; Counts", 20, -1.0, 1.0);
640      fListHistCascade->Add(fHistEtaXi);
641  }
642  if(! fHistEtaBachXi){
643      fHistEtaBachXi = new TH1F("fHistEtaBachXi", "Pseudo-rap. of #Xi bachelor; #eta; Counts", 40, -2.0, 2.0);
644      fListHistCascade->Add(fHistEtaBachXi);
645  }
646  if(! fHistEtaPosXi){
647      fHistEtaPosXi = new TH1F("fHistEtaPosXi", "Pseudo-rap. of #Xi positive meson daughter; #eta; Counts", 40, -2.0, 2.0);
648      fListHistCascade->Add(fHistEtaPosXi);
649  }
650  if(! fHistEtaNegXi){
651      fHistEtaNegXi = new TH1F("fHistEtaNegXi", "Pseudo-rap. of #Xi negative meson daughter; #eta; Counts", 40, -2.0, 2.0);
652      fListHistCascade->Add(fHistEtaNegXi);
653  }
654  if(! fHistThetaXi ){
655      fHistThetaXi = new TH1F("fHistThetaXi", "#theta of #Xi candidates (around the mass peak); #theta (deg); Counts", 180, 0., 180.0);
656      fListHistCascade->Add(fHistThetaXi);
657  }
658  if(! fHistPhiXi ){
659      fHistPhiXi = new TH1F("fHistPhiXi", "#phi of #Xi candidates (around the mass peak); #phi (deg); Counts", 360, 0., 360.);
660      fListHistCascade->Add(fHistPhiXi);
661  }
662  if(! f2dHistArmenteros) {
663      f2dHistArmenteros = new TH2F("f2dHistArmenteros", "#alpha_{Arm}(casc. cand.) Vs Pt_{Arm}(casc. cand.); #alpha_{Arm}; Pt_{Arm} (GeV/c)", 140, -1.2, 1.2, 300, 0., 0.3);
664      fListHistCascade->Add(f2dHistArmenteros);
665  }
666     //TH2
667  if(! f2dHistEffMassLambdaVsEffMassXiMinus) {
668      f2dHistEffMassLambdaVsEffMassXiMinus = new TH2F("f2dHistEffMassLambdaVsEffMassXiMinus", "M_{#Lambda} Vs M_{#Xi^{-} candidates}; Inv. M_{#Lambda^{0}} (GeV/c^{2}); M( #Lambda , #pi^{-} ) (GeV/c^{2})", 300, 1.1, 1.13, 400, 1.2, 2.0);
669      fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiMinus);
670  }
671  if(! f2dHistEffMassXiVsEffMassOmegaMinus) {
672      f2dHistEffMassXiVsEffMassOmegaMinus = new TH2F("f2dHistEffMassXiVsEffMassOmegaMinus", "M_{#Xi^{-} candidates} Vs M_{#Omega^{-} candidates}; M( #Lambda , #pi^{-} ) (GeV/c^{2}); M( #Lambda , K^{-} ) (GeV/c^{2})", 400, 1.2, 2.0, 500, 1.5, 2.5);
673      fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaMinus);
674  }
675  if(! f2dHistEffMassLambdaVsEffMassXiPlus) {
676      f2dHistEffMassLambdaVsEffMassXiPlus = new TH2F("f2dHistEffMassLambdaVsEffMassXiPlus", "M_{#Lambda} Vs M_{#Xi^{+} candidates}; Inv. M_{#Lambda^{0}} (GeV/c^{2}); M( #Lambda , #pi^{+} ) (GeV/c^{2})", 300, 1.1, 1.13, 400, 1.2, 2.0);
677      fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiPlus);
678  }
679  if(! f2dHistEffMassXiVsEffMassOmegaPlus) {
680      f2dHistEffMassXiVsEffMassOmegaPlus = new TH2F("f2dHistEffMassXiVsEffMassOmegaPlus", "M_{#Xi^{+} candidates} Vs M_{#Omega^{+} candidates}; M( #Lambda , #pi^{+} ) (GeV/c^{2}); M( #Lambda , K^{+} ) (GeV/c^{2})", 400, 1.2, 2.0, 500, 1.5, 2.5);
681      fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaPlus);
682  }
683  if(! f2dHistXiRadiusVsEffMassXiMinus) {
684      f2dHistXiRadiusVsEffMassXiMinus = new TH2F("f2dHistXiRadiusVsEffMassXiMinus", "Transv. R_{Xi Decay} Vs M_{#Xi^{-} candidates}; r_{cascade} (cm); M( #Lambda , #pi^{-} ) (GeV/c^{2})", 450, 0., 45.0, 400, 1.2, 2.0);
685      fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiMinus);
686  }
687  if(! f2dHistXiRadiusVsEffMassXiPlus) {
688      f2dHistXiRadiusVsEffMassXiPlus = new TH2F("f2dHistXiRadiusVsEffMassXiPlus", "Transv. R_{Xi Decay} Vs M_{#Xi^{+} candidates}; r_{cascade} (cm); M( #Lambda , #pi^{+} ) (GeV/c^{2})", 450, 0., 45.0, 400, 1.2, 2.0);
689      fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiPlus);
690  }
691  if(! f2dHistXiRadiusVsEffMassOmegaMinus) {
692      f2dHistXiRadiusVsEffMassOmegaMinus = new TH2F("f2dHistXiRadiusVsEffMassOmegaMinus", "Transv. R_{Xi Decay} Vs M_{#Omega^{-} candidates}; r_{cascade} (cm); M( #Lambda , K^{-} ) (GeV/c^{2}) ", 450, 0., 45.0, 500, 1.5, 2.5);
693      fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaMinus);
694  }
695  if(! f2dHistXiRadiusVsEffMassOmegaPlus) {
696      f2dHistXiRadiusVsEffMassOmegaPlus = new TH2F("f2dHistXiRadiusVsEffMassOmegaPlus", "Transv. R_{Xi Decay} Vs M_{#Omega^{+} candidates}; r_{cascade} (cm); M( #Lambda , K^{+} ) (GeV/c^{2}) ", 450, 0., 45.0, 500, 1.5, 2.5);
697      fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaPlus);
698  }
699  if(! f2dHistTPCdEdxOfCascDghters){
700      f2dHistTPCdEdxOfCascDghters = new TH2F("f2dHistTPCdEdxOfCascDghters", "TPC dE/dx of the cascade daughters; charge x || #vec{p}_{TPC inner wall}(Casc. daughter) || (GeV/c); TPC signal (ADC)", 2000, -10.0, 10.0, 450, 0., 900.);
701      fListHistCascade->Add(f2dHistTPCdEdxOfCascDghters);
702  }
703  if(! f2dHistDcaXiDaughtersvsInvMass){
704      f2dHistDcaXiDaughtersvsInvMass = new TH2F("f2dHistDcaXiDaughtersvsInvMass", "DCA between Xi Daughters; DCA (cm); Number of Cascades", 100, 0., 0.5, 400, 1.2, 2.0);
705      fListHistCascade->Add(f2dHistDcaXiDaughtersvsInvMass);
706  }
707  if(! f2dHistDcaBachToPrimVertexvsInvMass) {
708      f2dHistDcaBachToPrimVertexvsInvMass = new TH2F("f2dHistDcaBachToPrimVertexvsInvMass", "DCA of Bach. to Prim. Vertex; DCA (cm); Number of Cascades", 250, 0., 0.25, 400, 1.2, 2.0);
709      fListHistCascade->Add(f2dHistDcaBachToPrimVertexvsInvMass);
710  }
711  if(! f2dHistXiCosineOfPointingAnglevsInvMass){
712      f2dHistXiCosineOfPointingAnglevsInvMass = new TH2F("f2dHistXiCosineOfPointingAnglevsInvMass", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Number of Xis", 200, 0.99, 1.0, 400, 1.2, 2.0);
713      fListHistCascade->Add(f2dHistXiCosineOfPointingAnglevsInvMass);
714  }
715  if(! f2dHistMassLambdaAsCascDghtervsInvMass){ 
716      f2dHistMassLambdaAsCascDghtervsInvMass = new TH2F("f2dHistMassLambdaAsCascDghtervsInvMass","#Lambda associated to Casc. candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.00, 1.3, 400, 1.2, 2.0);
717      fListHistCascade->Add(f2dHistMassLambdaAsCascDghtervsInvMass);
718  }
719  if(! f2dHistDcaV0DaughtersXivsInvMass){
720      f2dHistDcaV0DaughtersXivsInvMass = new TH2F("f2dHistDcaV0DaughtersXivsInvMass", "DCA between V0 daughters, in cascade; DCA (cm); Number of V0s", 120, 0., 0.6, 400, 1.2, 2.0);
721      fListHistCascade->Add(f2dHistDcaV0DaughtersXivsInvMass);
722  }
723  if(! f2dHistDcaV0ToPrimVertexXivsInvMass){
724      f2dHistDcaV0ToPrimVertexXivsInvMass = new TH2F("f2dHistDcaV0ToPrimVertexXivsInvMass", "DCA of V0 to Prim. Vertex, in cascade; DCA (cm); Number of Cascades", 200, 0., 1., 400, 1.2, 2.0);
725      fListHistCascade->Add(f2dHistDcaV0ToPrimVertexXivsInvMass);
726  }
727  // - CFContainer PID study Xi minus
728  if(!fCFContCascadePIDXiMinus)  {
729    const Int_t  lNbSteps      =  7 ;
730    const Int_t  lNbVariables  =  3 ;
731      //Array for the number of bins in each dimension :
732    Int_t lNbBinsPerVar[3] = {0};
733    lNbBinsPerVar[0] = 100;
734    lNbBinsPerVar[1] = 800;
735    lNbBinsPerVar[2] = 22;
736    if (fCollidingSystem == "pp" && fkSDDSelectionOn) {
737         if (fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",
738                                                                     fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
739                                                                     "Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
740         else if (!fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",
741                                                                     fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
742                                                                     "Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar ); 
743    } else if (fCollidingSystem == "pp" && !fkSDDSelectionOn) {
744         fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",
745                                                       fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
746                                                       "Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
747    } else if (fCollidingSystem == "pPb") {
748         fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",
749                                                       fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
750                                                       "Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
751    }
752      //Setting the bin limits 
753    fCFContCascadePIDXiMinus->SetBinLimits(0,   0.0  ,  10.0 );  // Pt(Cascade)
754    fCFContCascadePIDXiMinus->SetBinLimits(1,   1.2  ,   2.0 );  // Xi Effective mass
755    fCFContCascadePIDXiMinus->SetBinLimits(2,  -1.1  ,   1.1 );  // Rapidity
756      //Setting the step title : one per PID case
757    fCFContCascadePIDXiMinus->SetStepTitle(0, "No PID");
758    fCFContCascadePIDXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
759    fCFContCascadePIDXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
760    fCFContCascadePIDXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
761    fCFContCascadePIDXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");
762    fCFContCascadePIDXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
763    fCFContCascadePIDXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");  
764      //Setting the variable title, per axis
765    fCFContCascadePIDXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
766    fCFContCascadePIDXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");
767    fCFContCascadePIDXiMinus->SetVarTitle(2, "Y_{#Xi}");
768    fListHistCascade->Add(fCFContCascadePIDXiMinus);
769  }
770  // - CFContainer PID study Xi plus
771  if (!fCFContCascadePIDXiPlus) {
772    const Int_t  lNbSteps      =  7 ;
773    const Int_t  lNbVariables  =  3 ;
774      //Array for the number of bins in each dimension :
775    Int_t lNbBinsPerVar[3] = {0};
776    lNbBinsPerVar[0] = 100;
777    lNbBinsPerVar[1] = 800;
778    lNbBinsPerVar[2] = 22;
779    if (fCollidingSystem == "pp" && fkSDDSelectionOn) {
780         if (fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",
781                                                                    fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
782                                                                    "Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar);
783         else if (!fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",
784                                                                          fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
785                                                                          "Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar);
786    } else if (fCollidingSystem == "pp" && !fkSDDSelectionOn) { 
787         fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",
788                                                      fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
789                                                      "Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar);
790    } else if (fCollidingSystem == "pPb") {
791         fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",
792                                                      fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
793                                                      "Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar);
794    }
795      //Setting the bin limits 
796    fCFContCascadePIDXiPlus->SetBinLimits(0,   0.0  ,  10.0 );   // Pt(Cascade)
797    fCFContCascadePIDXiPlus->SetBinLimits(1,   1.2  ,   2.0 );   // Xi Effective mass
798    fCFContCascadePIDXiPlus->SetBinLimits(2,  -1.1  ,   1.1 );   // Rapidity
799      //Setting the step title : one per PID case
800    fCFContCascadePIDXiPlus->SetStepTitle(0, "No PID");
801    fCFContCascadePIDXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
802    fCFContCascadePIDXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
803    fCFContCascadePIDXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
804    fCFContCascadePIDXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");
805    fCFContCascadePIDXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
806    fCFContCascadePIDXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
807      //Setting the variable title, per axis
808    fCFContCascadePIDXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
809    fCFContCascadePIDXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");
810    fCFContCascadePIDXiPlus->SetVarTitle(2, "Y_{#Xi}");
811    fListHistCascade->Add(fCFContCascadePIDXiPlus);
812  }
813  // - CFContainer PID study Omega minus
814  if(!fCFContCascadePIDOmegaMinus)  {
815    const Int_t  lNbSteps      =  7 ;
816    const Int_t  lNbVariables  =  3 ;
817      //Array for the number of bins in each dimension :
818    Int_t lNbBinsPerVar[3] = {0};
819    lNbBinsPerVar[0] = 100;
820    lNbBinsPerVar[1] = 1000;
821    lNbBinsPerVar[2] = 22;
822    if (fCollidingSystem == "pp" && fkSDDSelectionOn) {
823         if (fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",
824                                                                        fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
825                                                                        "Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
826         else if (!fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",
827                                                                              fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
828                                                                              "Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
829    } else if (!fkSDDSelectionOn) {
830         fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",
831                                                          fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
832                                                          "Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
833    } else if (fCollidingSystem == "pPb") {
834         fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",
835                                                          fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
836                                                          "Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
837    }
838      //Setting the bin limits 
839    fCFContCascadePIDOmegaMinus->SetBinLimits(0,   0.0  ,  10.0 );       // Pt(Cascade)
840    fCFContCascadePIDOmegaMinus->SetBinLimits(1,   1.5  ,   2.5 );       // Omega Effective mass
841    fCFContCascadePIDOmegaMinus->SetBinLimits(2,  -1.1  ,   1.1 );       // Rapidity
842      //Setting the step title : one per PID case
843    fCFContCascadePIDOmegaMinus->SetStepTitle(0, "No PID");
844    fCFContCascadePIDOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
845    fCFContCascadePIDOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
846    fCFContCascadePIDOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
847    fCFContCascadePIDOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");
848    fCFContCascadePIDOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
849    fCFContCascadePIDOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
850      //Setting the variable title, per axis
851    fCFContCascadePIDOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
852    fCFContCascadePIDOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");
853    fCFContCascadePIDOmegaMinus->SetVarTitle(2, "Y_{#Omega}");
854    fListHistCascade->Add(fCFContCascadePIDOmegaMinus);
855  }
856  // - CFContainer PID study Omega plus
857  if(!fCFContCascadePIDOmegaPlus)  {
858    const Int_t  lNbSteps      =  7 ;
859    const Int_t  lNbVariables  =  3 ;
860      //Array for the number of bins in each dimension :
861    Int_t lNbBinsPerVar[3] = {0};
862    lNbBinsPerVar[0] = 100;
863    lNbBinsPerVar[1] = 1000;
864    lNbBinsPerVar[2] = 22; 
865    if (fCollidingSystem == "pp" && fkSDDSelectionOn) {
866         if (fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",
867                                                                       fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
868                                                                       "Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
869         else if (!fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",
870                                                                             fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
871                                                                             "Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
872    } else if (fCollidingSystem == "pp" && !fkSDDSelectionOn) {
873         fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",
874                                                         fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
875                                                         "Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
876    } else if (fCollidingSystem == "pPb") {
877         fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",
878                                                         fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
879                                                         "Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
880    }
881      //Setting the bin limits 
882    fCFContCascadePIDOmegaPlus->SetBinLimits(0,   0.0  ,  10.0 );        // Pt(Cascade)
883    fCFContCascadePIDOmegaPlus->SetBinLimits(1,   1.5  ,   2.5 );        // Omega Effective mass
884    fCFContCascadePIDOmegaPlus->SetBinLimits(2,  -1.1  ,   1.1 );        // Rapidity 
885      //Setting the step title : one per PID case
886    fCFContCascadePIDOmegaPlus->SetStepTitle(0, "No PID");
887    fCFContCascadePIDOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
888    fCFContCascadePIDOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
889    fCFContCascadePIDOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
890    fCFContCascadePIDOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");
891    fCFContCascadePIDOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
892    fCFContCascadePIDOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
893      //Setting the variable title, per axis
894    fCFContCascadePIDOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
895    fCFContCascadePIDOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");
896    fCFContCascadePIDOmegaPlus->SetVarTitle(2, "Y_{#Omega}");  
897    fListHistCascade->Add(fCFContCascadePIDOmegaPlus);
898  }
899  // - CFContainer: towards the optimisation of topological selections
900  if(! fCFContCascadeCuts) {
901         // Container meant to store all the relevant distributions corresponding to the cut variables.
902         // NB: overflow/underflow of variables on which we want to cut later should be 0!!! 
903    const Int_t  lNbSteps      =  4 ;
904    const Int_t  lNbVariables  =  19 ;
905      //Array for the number of bins in each dimension :
906    Int_t lNbBinsPerVar[lNbVariables] = {0};
907    lNbBinsPerVar[0]  = 25;     //DcaCascDaughters             :  [0.0,2.5]           -> Rec.Cut = 2.0;
908    lNbBinsPerVar[1]  = 25;     //DcaBachToPrimVertex          :  [0.0,0.24,100.0]    -> Rec.Cut = 0.01; 
909    lNbBinsPerVar[2]  = 61;     //CascCosineOfPointingAngle    :  [0.94,1.001]        -> Rec.Cut = 0.95;
910    lNbBinsPerVar[3]  = 40;     //CascRadius                   :  [0.0,3.9,1000.0]    -> Rec.Cut = 0.2;
911    lNbBinsPerVar[4]  = 30;     //InvMassLambdaAsCascDghter    :  [1.1,1.3]           -> Rec.Cut = 0.008;
912    lNbBinsPerVar[5]  = 21;     //DcaV0Daughters               :  [0.0,2.0]           -> Rec.Cut = 1.5;
913    lNbBinsPerVar[6]  = 201;    //V0CosineOfPointingAngleToXi  :  [0.89,1.0]          -> No Rec.Cut;
914    lNbBinsPerVar[7]  = 40;     //V0Radius                     :  [0.0,3.9,1000.0]    -> Rec.Cut = 0.2;
915    lNbBinsPerVar[8]  = 40;     //DcaV0ToPrimVertex            :  [0.0,0.39,110.0]    -> Rec.Cut = 0.01;  
916    lNbBinsPerVar[9]  = 25;     //DcaPosToPrimVertex           :  [0.0,0.24,100.0]    -> Rec.Cut = 0.01;
917    lNbBinsPerVar[10] = 25;     //DcaNegToPrimVertex           :  [0.0,0.24,100.0]    -> Rec.Cut = 0.01;
918    lNbBinsPerVar[11] = 150;    //InvMassXi                    :   2-MeV/c2 bins
919    lNbBinsPerVar[12] = 120;    //InvMassOmega                 :   2-MeV/c2 bins
920    lNbBinsPerVar[13] = 100;    //XiTransvMom                  :  [0.0,10.0]
921    lNbBinsPerVar[14] = 110;    //Y(Xi)                        :   0.02 in rapidity units
922    lNbBinsPerVar[15] = 110;    //Y(Omega)                     :   0.02 in rapidity units
923    lNbBinsPerVar[16] = 112;    //Proper lenght of cascade       
924    lNbBinsPerVar[17] = 112;    //Proper lenght of V0
925    lNbBinsPerVar[18] = 112;    //Distance V0-Xi in transverse plane
926    if (fCollidingSystem == "pp" && fkSDDSelectionOn) {
927         if (fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",
928                                                               fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
929                                                               "Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
930         else if (!fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",
931                                                                     fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
932                                                                     "Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
933    } else if (fCollidingSystem == "pp" && !fkSDDSelectionOn) {
934         fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",
935                                                 fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
936                                                 "Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
937    } else if (fCollidingSystem == "pPb") {
938         fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f",
939                                                 fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),
940                                                 "Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
941    }
942      //Setting the bin limits 
943      //0 -  DcaXiDaughters
944    //Double_t *lBinLim0  = new Double_t[ lNbBinsPerVar[0] + 1 ];
945    //     for(Int_t i=0; i< lNbBinsPerVar[0]; i++) lBinLim0[i] = (Double_t)0.0 + (2.4 - 0.0)/(lNbBinsPerVar[0] - 1) * (Double_t)i;
946    //     lBinLim0[ lNbBinsPerVar[0] ] = 3.0;
947    //fCFContCascadeCuts -> SetBinLimits(0, lBinLim0);  
948    //delete [] lBinLim0;
949    fCFContCascadeCuts->SetBinLimits(0,0.0,2.5);
950      //1 - DcaToPrimVertexXi
951    Double_t *lBinLim1  = new Double_t[ lNbBinsPerVar[1] + 1 ];
952         for(Int_t i=0; i<lNbBinsPerVar[1]; i++) lBinLim1[i] = (Double_t)0.0 + (0.24  - 0.0)/(lNbBinsPerVar[1] - 1) * (Double_t)i;
953         lBinLim1[ lNbBinsPerVar[1] ] = 100.0;
954    fCFContCascadeCuts -> SetBinLimits(1, lBinLim1);  
955    delete [] lBinLim1;    
956      //2 - CascCosineOfPointingAngle 
957    fCFContCascadeCuts->SetBinLimits(2, 0.94, 1.001);
958      //3 - CascRadius
959    Double_t *lBinLim3  = new Double_t[ lNbBinsPerVar[3]+1 ];
960         for(Int_t i=0; i< lNbBinsPerVar[3]; i++)   lBinLim3[i]  = (Double_t)0.0   + (3.9  - 0.0 )/(lNbBinsPerVar[3] - 1)  * (Double_t)i ;
961         lBinLim3[ lNbBinsPerVar[3] ] = 1000.0;
962    fCFContCascadeCuts -> SetBinLimits(3,  lBinLim3 );        
963    delete [] lBinLim3;
964      //4 - InvMassLambdaAsCascDghter
965    fCFContCascadeCuts->SetBinLimits(4, 1.1, 1.13);
966      //5 - DcaV0Daughters
967    fCFContCascadeCuts -> SetBinLimits(5, 0., 2.1);
968      //6 - V0CosineOfPointingAngle
969    fCFContCascadeCuts -> SetBinLimits(6, 0.8, 1.001);
970      //7 - V0Radius
971    Double_t *lBinLim7 = new Double_t[ lNbBinsPerVar[7] + 1];
972         for(Int_t i=0; i< lNbBinsPerVar[7];i++) lBinLim7[i] = (Double_t)0.0 + (3.9 - 0.0)/(lNbBinsPerVar[7] - 1) * (Double_t)i;
973         lBinLim7[ lNbBinsPerVar[7] ] = 1000.0;
974    fCFContCascadeCuts -> SetBinLimits(7, lBinLim7); 
975    delete [] lBinLim7;
976      //8 - DcaV0ToPrimVertex
977    Double_t *lBinLim8  = new Double_t[ lNbBinsPerVar[8]+1 ];
978         for(Int_t i=0; i< lNbBinsPerVar[8];i++)   lBinLim8[i]  = (Double_t)0.0   + (0.39  - 0.0 )/(lNbBinsPerVar[8]-1)  * (Double_t)i ;
979         lBinLim8[ lNbBinsPerVar[8]  ] = 100.0;
980    fCFContCascadeCuts -> SetBinLimits(8,  lBinLim8 );    
981    delete [] lBinLim8;
982      //9 - DcaPosToPrimVertex
983    Double_t *lBinLim9  = new Double_t[ lNbBinsPerVar[9]+1 ];
984         for(Int_t i=0; i< lNbBinsPerVar[9];i++)   lBinLim9[i]  = (Double_t)0.0   + (0.24  - 0.0 )/(lNbBinsPerVar[9]-1)  * (Double_t)i ;
985         lBinLim9[ lNbBinsPerVar[9]  ] = 100.0;
986    fCFContCascadeCuts -> SetBinLimits(9,  lBinLim9 );        
987    delete [] lBinLim9;
988      //10 - DcaNegToPrimVertex
989    Double_t *lBinLim10  = new Double_t[ lNbBinsPerVar[10]+1 ];
990         for(Int_t i=0; i< lNbBinsPerVar[10];i++)   lBinLim10[i]  = (Double_t)0.0   + (0.24  - 0.0 )/(lNbBinsPerVar[10]-1)  * (Double_t)i ;
991         lBinLim10[ lNbBinsPerVar[10]  ] = 100.0;
992    fCFContCascadeCuts -> SetBinLimits(10,  lBinLim10 );            // DcaPosToPrimVertexXi : 0.0 to 0.25 
993    delete [] lBinLim10;
994      //11 - InvMassXi
995    fCFContCascadeCuts->SetBinLimits(11, 1.25, 1.40);
996      //12 - InvMassOmega
997    fCFContCascadeCuts->SetBinLimits(12, 1.62, 1.74);
998      //13 - XiTransvMom
999    fCFContCascadeCuts->SetBinLimits(13, 0.0, 10.0); 
1000      //14 - Y(Xi)
1001    fCFContCascadeCuts->SetBinLimits(14, -1.1, 1.1);
1002      //15 - Y(Omega)
1003    fCFContCascadeCuts->SetBinLimits(15, -1.1, 1.1);
1004      //16 - Proper time of cascade
1005    Double_t *lBinLim16  = new Double_t[ lNbBinsPerVar[16]+1 ];
1006    for(Int_t i=0; i< lNbBinsPerVar[16];i++) lBinLim16[i] = (Double_t) -1. + (110. + 1.0 ) / (lNbBinsPerVar[16] - 1) * (Double_t) i;
1007    lBinLim16[ lNbBinsPerVar[16] ] = 2000.0;
1008    fCFContCascadeCuts->SetBinLimits(16, lBinLim16);
1009      //17 - Proper time of V0
1010    fCFContCascadeCuts->SetBinLimits(17, lBinLim16);
1011      //18 - Distance V0-Xi in transverse plane
1012    fCFContCascadeCuts->SetBinLimits(18, lBinLim16);
1013      // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)
1014    fCFContCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates");
1015    fCFContCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates");
1016    fCFContCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates");
1017    fCFContCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates");
1018      // Setting the variable title, per axis
1019    fCFContCascadeCuts->SetVarTitle(0,  "Dca(cascade daughters) (cm)");
1020    fCFContCascadeCuts->SetVarTitle(1,  "ImpactParamToPV(bachelor) (cm)");
1021    fCFContCascadeCuts->SetVarTitle(2,  "cos(cascade PA)");
1022    fCFContCascadeCuts->SetVarTitle(3,  "R_{2d}(cascade decay) (cm)");
1023    fCFContCascadeCuts->SetVarTitle(4,  "M_{#Lambda}(as casc dghter) (GeV/c^{2})");
1024    fCFContCascadeCuts->SetVarTitle(5,  "Dca(V0 daughters) in Xi (cm)");
1025    if (fCollidingSystem == "pp")       fCFContCascadeCuts->SetVarTitle(6,  "cos(V0 PA) to cascade vtx");
1026    else if (fCollidingSystem == "pPb") fCFContCascadeCuts->SetVarTitle(6,  "cos(V0 PA) to primary vtx");
1027    fCFContCascadeCuts->SetVarTitle(7,  "R_{2d}(V0 decay) (cm)");
1028    fCFContCascadeCuts->SetVarTitle(8,  "ImpactParamToPV(V0) (cm)");
1029    fCFContCascadeCuts->SetVarTitle(9,  "ImpactParamToPV(Pos) (cm)");
1030    fCFContCascadeCuts->SetVarTitle(10, "ImpactParamToPV(Neg) (cm)");
1031    fCFContCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");
1032    fCFContCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");
1033    fCFContCascadeCuts->SetVarTitle(13, "pt(cascade) (GeV/c)");
1034    fCFContCascadeCuts->SetVarTitle(14, "Y(Xi)");
1035    fCFContCascadeCuts->SetVarTitle(15, "Y(Omega)");
1036    fCFContCascadeCuts->SetVarTitle(16, "mL/p (cascade) (cm)");
1037    fCFContCascadeCuts->SetVarTitle(17, "mL/p (V0) (cm)");
1038    fCFContCascadeCuts->SetVarTitle(18, "Distance V0-Cascade in transverse plane (cm)");
1039    fListHistCascade->Add(fCFContCascadeCuts);
1040  }
1041
1042  PostData(1, fListHistCascade);
1043  PostData(2, fCFContCascadePIDXiMinus);
1044  PostData(3, fCFContCascadePIDXiPlus);
1045  PostData(4, fCFContCascadePIDOmegaMinus);
1046  PostData(5, fCFContCascadePIDOmegaPlus);
1047  PostData(6, fCFContCascadeCuts);
1048 } // end UserCreateOutputObjects
1049
1050
1051 //________________________________________________________________________
1052 void AliAnalysisTaskCheckCascadepp276::UserExec(Option_t *) {
1053
1054   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1055   // Main loop (called for each event)
1056   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1057   
1058   //----------------
1059   //Define variables 
1060   AliESDEvent *lESDevent = 0x0;
1061   AliAODEvent *lAODevent = 0x0;
1062
1063   //----------------------
1064   // Check the PIDresponse
1065   //---------------------
1066   if(!fPIDResponse) {
1067        AliError("Cannot get pid response");
1068        return;
1069   }
1070   if(! fESDtrackCuts ){
1071        fESDtrackCuts = new AliESDtrackCuts();
1072   }
1073   if(! fUtils ){
1074        fUtils = new AliAnalysisUtils();
1075   }
1076
1077
1078   ///////////////////
1079   // EVENT SELECTIONS
1080   ///////////////////
1081   // In order:
1082   // 1) SDD selection
1083   // 2) Physics selection
1084   // 3) Select only looking at events with well-established PV
1085   // 4) Pileup selection
1086   // 5) |Z| < 10 cm
1087
1088   //----------------------
1089   // Before any selections
1090   //----------------------
1091   //- Define the variables
1092   Int_t ncascadesBeforeAnySel = 0;
1093   Int_t nTrackMultiplicityBeforeAnySel = 0;
1094   if (fAnalysisType == "ESD") {
1095       // - Load the InputEvent and check
1096       lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
1097       if (!lESDevent) {
1098          AliWarning("ERROR: lESDevent not available \n");
1099          return;
1100       }
1101       // - Take the number of cascades and tracks before any events selection
1102       ncascadesBeforeAnySel = lESDevent->GetNumberOfCascades();
1103       nTrackMultiplicityBeforeAnySel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1104   } else if (fAnalysisType == "AOD") {
1105       // - Load the InputEvent and check
1106       lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() );
1107       if (!lAODevent) {
1108           AliWarning("ERROR: lAODevent not available \n");
1109           return;
1110       }
1111       // - Take the number of cascades and tracks before any events selection
1112       ncascadesBeforeAnySel  = lAODevent->GetNumberOfCascades();
1113       nTrackMultiplicityBeforeAnySel = -100;  //FIXME: I can't find the equivalent method for the AOD  
1114   } else {
1115       Printf("Analysis type (ESD or AOD) not specified \n");
1116       return;
1117   }
1118   // - Fill the plots
1119   fHistCascadeMultiplicityBeforeAnySel->Fill(ncascadesBeforeAnySel);
1120   fHistTrackMultiplicityBeforeAnySel->Fill(nTrackMultiplicityBeforeAnySel);
1121
1122   //--------------
1123   // SDD selection
1124   //--------------
1125   // - Define the variables
1126   Int_t ncascadesAfterSDDSel = 0;
1127   Int_t nTrackMultiplicityAfterSDDSel = 0;
1128   // - Selection for ESD and AOD
1129   if (fAnalysisType == "ESD") {
1130      if (fkSDDSelectionOn && fCollidingSystem == "pp") {
1131         TString trcl = lESDevent->GetFiredTriggerClasses();
1132         //cout<<"Fired Trigger Classes: "<<trcl<<endl;
1133         if (fwithSDD){
1134           if(!(trcl.Contains("ALLNOTRD"))) {
1135                cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. =>  RETURN!! (Exclude it)..."<<endl;
1136                PostData(1, fListHistCascade);
1137                PostData(2, fCFContCascadePIDXiMinus);
1138                PostData(3, fCFContCascadePIDXiPlus);
1139                PostData(4, fCFContCascadePIDOmegaMinus);
1140                PostData(5, fCFContCascadePIDOmegaPlus);
1141                PostData(6, fCFContCascadeCuts);
1142                return;
1143           }
1144         } else if (!fwithSDD){
1145           if((trcl.Contains("ALLNOTRD"))) {
1146                cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. =>  RETURN!! (Exclude it)..."<<endl;
1147                PostData(1, fListHistCascade);
1148                PostData(2, fCFContCascadePIDXiMinus);
1149                PostData(3, fCFContCascadePIDXiPlus);
1150                PostData(4, fCFContCascadePIDOmegaMinus);
1151                PostData(5, fCFContCascadePIDOmegaPlus);
1152                PostData(6, fCFContCascadeCuts);
1153                return;
1154           }
1155         }
1156      }
1157      // - Take the number of cascades and tracks after the SDD selection
1158      ncascadesAfterSDDSel = lESDevent->GetNumberOfCascades();
1159      nTrackMultiplicityAfterSDDSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1160   } else if (fAnalysisType == "AOD") {
1161      if (fkSDDSelectionOn && fCollidingSystem == "pp") {
1162         TString trcl = lAODevent->GetFiredTriggerClasses();
1163         if (fwithSDD){
1164            if(!(trcl.Contains("ALLNOTRD"))) {
1165                 PostData(1, fListHistCascade);
1166                 PostData(2, fCFContCascadePIDXiMinus);
1167                 PostData(3, fCFContCascadePIDXiPlus);
1168                 PostData(4, fCFContCascadePIDOmegaMinus);
1169                 PostData(5, fCFContCascadePIDOmegaPlus);
1170                 PostData(6, fCFContCascadeCuts);
1171                 cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. =>  RETURN!! (Exclude it)..."<<endl;
1172                 return;
1173            }
1174         } else if (!fwithSDD) {
1175            if((trcl.Contains("ALLNOTRD"))) {
1176                 PostData(1, fListHistCascade);
1177                 PostData(2, fCFContCascadePIDXiMinus);
1178                 PostData(3, fCFContCascadePIDXiPlus);
1179                 PostData(4, fCFContCascadePIDOmegaMinus);
1180                 PostData(5, fCFContCascadePIDOmegaPlus);
1181                 PostData(6, fCFContCascadeCuts);
1182                 cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. =>  RETURN!! (Exclude it)..."<<endl;
1183                 return;
1184            }
1185         }
1186      }
1187      // - Take the number of cascades and tracks after the SDD selection
1188      ncascadesAfterSDDSel = lAODevent->GetNumberOfCascades();
1189      nTrackMultiplicityAfterSDDSel = -100; //FIXME: I can't find the equivalent method for the AOD
1190   }
1191   // - Fill the plots
1192   fHistCascadeMultiplicityAfterSDDSel->Fill(ncascadesAfterSDDSel);
1193   fHistTrackMultiplicityAfterSDDSel->Fill(nTrackMultiplicityAfterSDDSel);
1194
1195   //-------------------------------------------
1196   // Multiplicity estimators for pPb collisions  //FIXME
1197   //-------------------------------------------
1198   //AliCentrality* centrality = 0;
1199   //if      (fAnalysisType == "ESD" && (fCollidingSystem == "pPb")) centrality = lESDevent->GetCentrality();
1200   //else if (fAnalysisType == "AOD" && (fCollidingSystem == "pPb")) centrality = lAODevent->GetCentrality();
1201   //Float_t lcentrality = 0.;
1202   //if (fCollidingSystem == "pPb") {
1203   //     if (fkUseCleaning) lcentrality = centrality->GetCentralityPercentile(fCentrEstimator.Data());
1204   //     else {
1205   //         lcentrality = centrality->GetCentralityPercentileUnchecked(fCentrEstimator.Data());
1206   //         if (centrality->GetQuality()>1) {
1207   //             PostData(1, fCFContCascadeCuts);
1208   //            return;
1209   //         }
1210   //     }
1211   //     //if (lcentrality<fCentrLowLim||lcentrality>=fCentrUpLim) { 
1212   //     //    PostData(1, fCFContCascadeCuts);
1213   //     //    return;
1214   //     //}
1215   //} else if (fCollidingSystem == "pp") lcentrality = 0.;  
1216
1217   //------------------
1218   // Physics selection 
1219   //-----------------
1220   // - Define the variables
1221   Int_t ncascadesAfterPhysicsSel = 0;
1222   Int_t nTrackMultiplicityAfterPhysicsSel = 0;
1223   // - Selection for ESD and AOD
1224   UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1225   Bool_t isSelected = 0;
1226   if      (fCollidingSystem == "pp" ) isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
1227   else if (fCollidingSystem == "pPb") isSelected = (maskIsSelected & AliVEvent::kINT7) == AliVEvent::kINT7;
1228   if(! isSelected){
1229       PostData(1, fListHistCascade);
1230       PostData(2, fCFContCascadePIDXiMinus);
1231       PostData(3, fCFContCascadePIDXiPlus);
1232       PostData(4, fCFContCascadePIDOmegaMinus);
1233       PostData(5, fCFContCascadePIDOmegaPlus);
1234       PostData(6, fCFContCascadeCuts);
1235       cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. =>  RETURN!! (Exclude it)..."<<endl;
1236       return;
1237   }
1238   if (fAnalysisType == "ESD") {
1239       // - Take the number of cascades and tracks after physics selection
1240       ncascadesAfterPhysicsSel = lESDevent->GetNumberOfCascades();    
1241       nTrackMultiplicityAfterPhysicsSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);  
1242   } else if (fAnalysisType == "AOD") {
1243       // - Take the number of cascades and tracks after the physics selection
1244       ncascadesAfterPhysicsSel = lAODevent->GetNumberOfCascades();
1245       nTrackMultiplicityAfterPhysicsSel = -100;  //FIXME: I can't find the equivalent method for the AOD    
1246   } 
1247   // - Fill the plots
1248   fHistCascadeMultiplicityAfterPhysicsSel->Fill(ncascadesAfterPhysicsSel);
1249   fHistTrackMultiplicityAfterPhysicsSel->Fill(nTrackMultiplicityAfterPhysicsSel);
1250
1251   //---------------------------------------
1252   // Re-run cascade vertexer (only for ESD)
1253   //---------------------------------------
1254   if (fAnalysisType == "ESD" && fkRerunV0CascVertexers) {
1255        lESDevent->ResetCascades();
1256        lESDevent->ResetV0s();
1257        AliV0vertexer *lV0vtxer = new AliV0vertexer();
1258        AliCascadeVertexer *lCascVtxer = new AliCascadeVertexer();
1259        //lV0vtxer->GetCuts(fV0Sels);
1260        //lCascVtxer->GetCuts(fCascSels);
1261        lV0vtxer->SetCuts(fV0Sels);      // NB don't use SetDefaultCuts!! because it acts on static variables 
1262        lCascVtxer->SetCuts(fCascSels);
1263        lV0vtxer->Tracks2V0vertices(lESDevent);
1264        lCascVtxer->V0sTracks2CascadeVertices(lESDevent);
1265        //delete lV0vtxer;
1266        //delete lCascVtxer;
1267   }
1268
1269   //------------------------------
1270   // Well-established PV selection
1271   //------------------------------
1272   // - Define variables
1273   Int_t ncascadesForSelEvtNoTPCOnly = 0;
1274   Int_t nTrackMultiplicityForSelEvtNoTPCOnly = 0;
1275   // - Selection for the two colliding systems
1276   if (fCollidingSystem == "pp") {
1277       // - Selection for ESD and AOD
1278       if (fAnalysisType == "ESD") {
1279           // - Vertex coordinates: get the PVs stored in the ESD found with tracks and SPD
1280           const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
1281           const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
1282           // - Select only looking at events with well-established PV
1283           if (fkQualityCutNoTPConlyPrimVtx) {
1284               if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() ){
1285                   AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1286                   PostData(1, fListHistCascade);
1287                   PostData(2, fCFContCascadePIDXiMinus);
1288                   PostData(3, fCFContCascadePIDXiPlus);
1289                   PostData(4, fCFContCascadePIDOmegaMinus);
1290                   PostData(5, fCFContCascadePIDOmegaPlus);
1291                   PostData(6, fCFContCascadeCuts);
1292                   return;
1293               }
1294           }
1295           // - Take the number of cascades and tracks after TPConly selection
1296           ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();
1297           nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1298       } else if (fAnalysisType == "AOD") {
1299           // - Vertex coordinates: get the PVs stored in the AOD found with tracks and SPD
1300           const AliAODVertex *lPrimarySPDVtx = lAODevent->GetPrimaryVertexSPD();
1301           const AliAODVertex *lPrimaryTrackingAODVtx = lAODevent->GetPrimaryVertex();
1302           // - Select only looking at events with well-established PV
1303           if (fkQualityCutNoTPConlyPrimVtx) {
1304               if (!lPrimarySPDVtx && !lPrimaryTrackingAODVtx) {
1305                   AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1306                   PostData(1, fListHistCascade);
1307                   PostData(2, fCFContCascadePIDXiMinus);
1308                   PostData(3, fCFContCascadePIDXiPlus);
1309                   PostData(4, fCFContCascadePIDOmegaMinus);
1310                   PostData(5, fCFContCascadePIDOmegaPlus);
1311                   PostData(6, fCFContCascadeCuts);
1312                   return;
1313               }
1314           }
1315           // - Take the number of cascades and tracks after TPConly selection
1316           ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();
1317           nTrackMultiplicityForSelEvtNoTPCOnly = -100;  //FIXME: I can't find the equivalent method for the AOD
1318       }
1319   } else if (fCollidingSystem == "pPb") {
1320       if (fAnalysisType == "ESD") {
1321           Bool_t fHasVertex = kFALSE;
1322           const AliESDVertex *vertex = lESDevent->GetPrimaryVertexTracks();
1323           if (vertex->GetNContributors() < 1) {
1324               vertex = lESDevent->GetPrimaryVertexSPD();
1325               if (vertex->GetNContributors() < 1) fHasVertex = kFALSE;
1326               else                                fHasVertex = kTRUE;
1327               TString vtxTyp = vertex->GetTitle();
1328               Double_t cov[6]={0};
1329               vertex->GetCovarianceMatrix(cov);
1330               Double_t zRes = TMath::Sqrt(cov[5]);
1331               if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) fHasVertex = kFALSE;
1332           } else fHasVertex = kTRUE;
1333           if (fHasVertex == kFALSE) {
1334               AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1335               PostData(1, fListHistCascade);
1336               PostData(2, fCFContCascadePIDXiMinus);
1337               PostData(3, fCFContCascadePIDXiPlus);
1338               PostData(4, fCFContCascadePIDOmegaMinus);
1339               PostData(5, fCFContCascadePIDOmegaPlus);
1340               PostData(6, fCFContCascadeCuts);
1341               return;
1342           }
1343           if (fUtils->IsFirstEventInChunk(lESDevent)) { //Is First event in chunk rejection: Still present!
1344               AliWarning("Pb / This is the first event in the chunk! ... return !");
1345               PostData(1, fListHistCascade);
1346               PostData(2, fCFContCascadePIDXiMinus);
1347               PostData(3, fCFContCascadePIDXiPlus);
1348               PostData(4, fCFContCascadePIDOmegaMinus);
1349               PostData(5, fCFContCascadePIDOmegaPlus);
1350               PostData(6, fCFContCascadeCuts);
1351               return;
1352           }
1353           // - Take the number of cascades and tracks after TPConly selection
1354           ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();
1355           nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1356       } else if (fAnalysisType == "AOD") {
1357           Bool_t fHasVertex = kFALSE;
1358           const AliAODVertex *vertex = lAODevent->GetPrimaryVertex();
1359           if (vertex->GetNContributors() < 1) {
1360               vertex = lAODevent->GetPrimaryVertexSPD();
1361               if (vertex->GetNContributors() < 1) fHasVertex = kFALSE;
1362               else                                fHasVertex = kTRUE;
1363               TString vtxTyp = vertex->GetTitle();
1364               Double_t cov[6]={0};
1365               vertex->GetCovarianceMatrix(cov);
1366               Double_t zRes = TMath::Sqrt(cov[5]);
1367               if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) fHasVertex = kFALSE;
1368           } else fHasVertex = kTRUE;
1369           if (fHasVertex == kFALSE) {
1370               AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1371               PostData(1, fListHistCascade);
1372               PostData(2, fCFContCascadePIDXiMinus);
1373               PostData(3, fCFContCascadePIDXiPlus);
1374               PostData(4, fCFContCascadePIDOmegaMinus);
1375               PostData(5, fCFContCascadePIDOmegaPlus);
1376               PostData(6, fCFContCascadeCuts);
1377               return;
1378           }
1379           if (fHasVertex == kFALSE) { //Is First event in chunk rejection: Still present!  //FIXME
1380               AliWarning("Pb / This is the first event in the chunk! ... return !");
1381               PostData(1, fListHistCascade);
1382               PostData(2, fCFContCascadePIDXiMinus);
1383               PostData(3, fCFContCascadePIDXiPlus);
1384               PostData(4, fCFContCascadePIDOmegaMinus);
1385               PostData(5, fCFContCascadePIDOmegaPlus);
1386               PostData(6, fCFContCascadeCuts);
1387               return;
1388           }  
1389           // - Take the number of cascades and tracks after TPConly selection
1390           ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();
1391           nTrackMultiplicityForSelEvtNoTPCOnly = -100;  //FIXME: I can't find the equivalent method for the AOD
1392       }
1393   }
1394   // - Fill the plots
1395   fHistCascadeMultiplicityForSelEvtNoTPCOnly->Fill(ncascadesForSelEvtNoTPCOnly);
1396   fHistTrackMultiplicityForSelEvtNoTPCOnly->Fill(nTrackMultiplicityForSelEvtNoTPCOnly);
1397    
1398  
1399   //----------------
1400   // Pilup selection
1401   //----------------
1402   // - Define variables
1403   Int_t ncascadesForSelEvtNoTPCOnlyNoPileup = 0;
1404   Int_t nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = 0;
1405   // - Selection for ESD and AOD
1406   if (fAnalysisType == "ESD" && fCollidingSystem == "pp") {
1407       if (fkQualityCutPileup) {
1408           if(lESDevent->IsPileupFromSPD()){
1409               AliWarning("Pb / Pile-up event ... return!");
1410               PostData(1, fListHistCascade);
1411               PostData(2, fCFContCascadePIDXiMinus);
1412               PostData(3, fCFContCascadePIDXiPlus);
1413               PostData(4, fCFContCascadePIDOmegaMinus);
1414               PostData(5, fCFContCascadePIDOmegaPlus);
1415               PostData(6, fCFContCascadeCuts);
1416               return;
1417           }
1418       }
1419       // - Take the number of cascades and tracks after Pileup selection
1420       ncascadesForSelEvtNoTPCOnlyNoPileup = lESDevent->GetNumberOfCascades();
1421       nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1422   } else if (fAnalysisType == "AOD" && fCollidingSystem == "pp") {
1423       if (fkQualityCutPileup) {
1424           if(lAODevent->IsPileupFromSPD()){
1425               AliWarning("Pb / Pile-up event ... return!");
1426               PostData(1, fListHistCascade);
1427               PostData(2, fCFContCascadePIDXiMinus);
1428               PostData(3, fCFContCascadePIDXiPlus);
1429               PostData(4, fCFContCascadePIDOmegaMinus);
1430               PostData(5, fCFContCascadePIDOmegaPlus);
1431               PostData(6, fCFContCascadeCuts);
1432               return;
1433           }
1434       }
1435       // - Take the number of cascades and tracks after Pileup selection
1436       ncascadesForSelEvtNoTPCOnlyNoPileup = lAODevent->GetNumberOfCascades();
1437       nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -100;   //FIXME: I can't find the equivalent method for the AOD
1438   }
1439   fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(ncascadesForSelEvtNoTPCOnlyNoPileup);
1440   fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
1441     
1442   //----------------------------------------------------
1443   // Vertex Z position selection (+ magnetic field info)
1444   //----------------------------------------------------
1445   // - Define variables
1446   Double_t lBestPrimaryVtxPos[3]  = {-100.0, -100.0, -100.0};
1447   Double_t lMagneticField         = -10.;
1448   Double_t tPrimaryVtxPosition[3] = {-100.0, -100.0, -100.0};
1449   Int_t ncascadesAfterVertexSel          = 0;
1450   Int_t nTrackMultiplicityAfterVertexSel = 0; 
1451   // - Selection for ESD and AOD
1452   if (fAnalysisType == "ESD") {
1453       // - Vertex coordinates: get the best primary vertex available for the event 
1454       const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex(); 
1455       if (!lPrimaryBestESDVtx){
1456           AliWarning("No prim. vertex in ESD... return!");
1457           PostData(1, fListHistCascade);
1458           PostData(2, fCFContCascadePIDXiMinus);
1459           PostData(3, fCFContCascadePIDXiPlus);
1460           PostData(4, fCFContCascadePIDOmegaMinus);
1461           PostData(5, fCFContCascadePIDOmegaPlus);
1462           PostData(6, fCFContCascadeCuts);
1463           return;
1464       }
1465       lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
1466       // - Fill the vertex plots before any event selection on vertex position
1467       const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
1468       tPrimaryVtxPosition[0] = primaryVtx->GetX();
1469       tPrimaryVtxPosition[1] = primaryVtx->GetY();
1470       tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1471           fHistPVx->Fill( tPrimaryVtxPosition[0] );
1472           fHistPVy->Fill( tPrimaryVtxPosition[1] );
1473           fHistPVz->Fill( tPrimaryVtxPosition[2] );       
1474       // - Get magnetic filed info
1475       lMagneticField = lESDevent->GetMagneticField();
1476       //if(TMath::Abs(lMagneticField ) < 10e-6) continue;
1477       // - Selection on the primary vertex Z position 
1478       if (fkQualityCutZprimVtxPos) {
1479           if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
1480                AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1481                PostData(1, fListHistCascade);
1482                PostData(2, fCFContCascadePIDXiMinus);
1483                PostData(3, fCFContCascadePIDXiPlus);
1484                PostData(4, fCFContCascadePIDOmegaMinus);
1485                PostData(5, fCFContCascadePIDOmegaPlus);
1486                PostData(6, fCFContCascadeCuts);
1487                return;
1488           }
1489       }
1490       // - Take the number of cascades and tracks after vertex Z position selection
1491       ncascadesAfterVertexSel = lESDevent->GetNumberOfCascades();
1492       nTrackMultiplicityAfterVertexSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5); 
1493   } else if (fAnalysisType == "AOD") {
1494       // - Vertex coordinates: get the best primary vertex available for the event
1495       const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex();
1496       if (!lPrimaryBestAODVtx){
1497           AliWarning("No prim. vertex in AOD... return!");
1498           PostData(1, fListHistCascade);
1499           PostData(2, fCFContCascadePIDXiMinus);
1500           PostData(3, fCFContCascadePIDXiPlus);
1501           PostData(4, fCFContCascadePIDOmegaMinus);
1502           PostData(5, fCFContCascadePIDOmegaPlus);
1503           PostData(6, fCFContCascadeCuts);
1504           return;
1505       }
1506       lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );
1507       // - Fill the vertex plots before any event selection on vertex position
1508       const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
1509       tPrimaryVtxPosition[0] = primaryVtx->GetX();
1510       tPrimaryVtxPosition[1] = primaryVtx->GetY();
1511       tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1512           fHistPVx->Fill( tPrimaryVtxPosition[0] );
1513           fHistPVy->Fill( tPrimaryVtxPosition[1] );
1514           fHistPVz->Fill( tPrimaryVtxPosition[2] );
1515       // - Get magnetic filed info
1516       lMagneticField = lAODevent->GetMagneticField();
1517       //if(TMath::Abs(lMagneticField ) < 10e-6) continue;
1518       // - Selection on the primary vertex Z position 
1519       if (fkQualityCutZprimVtxPos) {
1520           if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
1521               AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1522               PostData(1, fListHistCascade);
1523               PostData(2, fCFContCascadePIDXiMinus);
1524               PostData(3, fCFContCascadePIDXiPlus);
1525               PostData(4, fCFContCascadePIDOmegaMinus);
1526               PostData(5, fCFContCascadePIDOmegaPlus);
1527               PostData(6, fCFContCascadeCuts);
1528               return;
1529           }
1530       }
1531       // - Take the number of cascades and tracks after vertex Z position selection
1532       ncascadesAfterVertexSel = lAODevent->GetNumberOfCascades();
1533       nTrackMultiplicityAfterVertexSel = -100; //FIXME: I can't find the equivalent method for the AOD
1534   } 
1535   // - Fill the plots
1536   fHistCascadeMultiplicityAfterVertexCutSel->Fill(ncascadesAfterVertexSel);
1537   fHistTrackMultiplicityAfterVertexCutSel->Fill(nTrackMultiplicityAfterVertexSel);
1538
1539   // - Vertex position plots: after any event selections
1540   tPrimaryVtxPosition[0] = -100.0;
1541   tPrimaryVtxPosition[1] = -100.0;
1542   tPrimaryVtxPosition[2] = -100.0;
1543   if (fAnalysisType == "ESD") {
1544        const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
1545        tPrimaryVtxPosition[0] = primaryVtx->GetX();
1546        tPrimaryVtxPosition[1] = primaryVtx->GetY();
1547        tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1548   } else if (fAnalysisType == "AOD") {
1549        const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
1550        tPrimaryVtxPosition[0] = primaryVtx->GetX();
1551        tPrimaryVtxPosition[1] = primaryVtx->GetY();
1552        tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1553   }
1554   fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] );
1555   fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] );
1556   fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] );
1557   
1558
1559
1560   //////////////////////////////
1561   // CASCADE RECONSTRUCTION PART
1562   //////////////////////////////
1563   
1564   //%%%%%%%%%%%%%
1565   // Cascade loop
1566   Int_t ncascades = 0;
1567   if      (fAnalysisType == "ESD") ncascades = lESDevent->GetNumberOfCascades();
1568   else if (fAnalysisType == "AOD") ncascades = lAODevent->GetNumberOfCascades();
1569
1570   for (Int_t iXi = 0; iXi < ncascades; iXi++) {// This is the begining of the Cascade loop (ESD or AOD)
1571            
1572       // -----------------------------------------------------------------------
1573       // - Initialisation of the local variables that will be needed for ESD/AOD
1574
1575       // - 0th part of initialisation : around primary vertex ...
1576       //Double_t lBestPrimaryVtxRadius3D     = -500.0;
1577       // - 1st part of initialisation : variables needed to store AliESDCascade data members
1578       Double_t lEffMassXi                  = 0.;
1579       Double_t lDcaXiDaughters             = -1.;
1580       Double_t lXiCosineOfPointingAngle    = -1.;
1581       Double_t lPosXi[3]                   = { -1000.0, -1000.0, -1000.0 };
1582       Double_t lXiRadius                   = -1000. ;
1583       // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
1584       UShort_t lPosTPCClusters             = -1; // For ESD only ...
1585       UShort_t lNegTPCClusters             = -1; // For ESD only ...
1586       UShort_t lBachTPCClusters            = -1; // For ESD only ...
1587       Double_t lInnerWallMomCascDghters[3] = {-100., -100., -100.};
1588       Double_t lTPCSignalCascDghters   [3] = {-100., -100., -100.};
1589       // - 3rd part of initialisation : about V0 part in cascades
1590       Double_t lInvMassLambdaAsCascDghter  = 0.;
1591       Double_t lDcaV0DaughtersXi           = -1.;
1592       Double_t lDcaBachToPrimVertexXi      = -1.;
1593       Double_t lDcaV0ToPrimVertexXi        = -1.;
1594       Double_t lDcaPosToPrimVertexXi       = -1.;
1595       Double_t lDcaNegToPrimVertexXi       = -1.;
1596       Double_t lV0CosineOfPointingAngleXi  = -1. ;
1597       Double_t lPosV0Xi[3]                 = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
1598       Double_t lV0RadiusXi                 = -1000.0;
1599       Double_t lV0quality                  = 0.;
1600       // - 4th part of initialisation : Effective masses
1601       Double_t lInvMassXiMinus             = 0.;
1602       Double_t lInvMassXiPlus              = 0.;
1603       Double_t lInvMassOmegaMinus          = 0.;
1604       Double_t lInvMassOmegaPlus           = 0.;
1605       // - 5th part of initialisation : PID treatment
1606       Bool_t   lIsPosInXiProton            = kFALSE;
1607       Bool_t   lIsPosInXiPion              = kFALSE;
1608       Bool_t   lIsPosInOmegaProton         = kFALSE;
1609       Bool_t   lIsPosInOmegaPion           = kFALSE;
1610       Bool_t   lIsNegInXiProton            = kFALSE;
1611       Bool_t   lIsNegInXiPion              = kFALSE;
1612       Bool_t   lIsNegInOmegaProton         = kFALSE;
1613       Bool_t   lIsNegInOmegaPion           = kFALSE;
1614       Bool_t   lIsBachelorKaon             = kFALSE;
1615       Bool_t   lIsBachelorPion             = kFALSE; 
1616       Bool_t   lIsBachelorKaonForTPC       = kFALSE; 
1617       Bool_t   lIsBachelorPionForTPC       = kFALSE; 
1618       Bool_t   lIsNegPionForTPC            = kFALSE; 
1619       Bool_t   lIsPosPionForTPC            = kFALSE; 
1620       Bool_t   lIsNegProtonForTPC          = kFALSE; 
1621       Bool_t   lIsPosProtonForTPC          = kFALSE; 
1622       // - 6th part of initialisation : extra info for QA
1623       Double_t lXiMomX         = 0.;
1624       Double_t lXiMomY         = 0.;
1625       Double_t lXiMomZ         = 0.;
1626       Double_t lXiTransvMom    = 0.;
1627       Double_t lXiTotMom       = 0.;
1628       Double_t lV0PMomX        = 0.;
1629       Double_t lV0PMomY        = 0.;
1630       Double_t lV0PMomZ        = 0.;
1631       Double_t lV0NMomX        = 0.;
1632       Double_t lV0NMomY        = 0.;
1633       Double_t lV0NMomZ        = 0.;
1634       Double_t lV0TotMom       = 0.;
1635       Double_t lBachMomX       = 0.;
1636       Double_t lBachMomY       = 0.;
1637       Double_t lBachMomZ       = 0.;
1638       Double_t lBachTransvMom  = 0.;
1639       Double_t lBachTotMom     = 0.;
1640       Double_t lpTrackTransvMom  = 0.;
1641       Double_t lnTrackTransvMom  = 0.;
1642       Short_t  lChargeXi       = -2;
1643       Double_t lV0toXiCosineOfPointingAngle = 0.;
1644       Double_t lRapXi   = -20.0, lRapOmega = -20.0, lEta = -20.0, lTheta = 360., lPhi = 720.;
1645       Double_t lAlphaXi = -200., lPtArmXi  = -200.0;
1646       Double_t etaPos = 0., etaNeg = 0., etaBach = 0.;
1647   
1648       if (fAnalysisType == "ESD") { 
1649   
1650           // -------------------------------------
1651           // - Load the cascades from the handler
1652           AliESDcascade *xi = lESDevent->GetCascade(iXi);
1653           if (!xi) continue;
1654
1655           //----------------------------------------------------------------------------        
1656           // - Assigning the necessary variables for specific AliESDcascade data members        
1657           lV0quality = 0.;
1658           xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis: cascade = Xi-decay
1659           lEffMassXi               = xi->GetEffMassXi();
1660           lDcaXiDaughters          = xi->GetDcaXiDaughters();
1661           lXiCosineOfPointingAngle = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
1662                                                                        //Take care : the best available vertex should be used (like in AliCascadeVertexer)
1663           xi->GetXYZcascade( lPosXi[0],  lPosXi[1], lPosXi[2] ); 
1664           lXiRadius                = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
1665                 
1666           //-------------------------------------------------------------------------------------------------------------------------------
1667           // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1668           UInt_t lIdxPosXi      = (UInt_t) TMath::Abs( xi->GetPindex() );
1669           UInt_t lIdxNegXi      = (UInt_t) TMath::Abs( xi->GetNindex() );
1670           UInt_t lBachIdx       = (UInt_t) TMath::Abs( xi->GetBindex() );
1671                                       //Care track label can be negative in MC production (linked with the track quality)
1672                                       //However = normally, not the case for track index ...
1673           // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1674           if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }
1675           if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }
1676           // - Get the track for the daughters
1677           AliESDtrack *pTrackXi    = lESDevent->GetTrack( lIdxPosXi );
1678           AliESDtrack *nTrackXi    = lESDevent->GetTrack( lIdxNegXi );
1679           AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );
1680           if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1681                AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
1682                continue;
1683           }
1684           // - Get the TPCnumber of cluster for the daughters
1685           lPosTPCClusters   = pTrackXi->GetTPCNcls();
1686           lNegTPCClusters   = nTrackXi->GetTPCNcls();
1687           lBachTPCClusters  = bachTrackXi->GetTPCNcls();
1688
1689           //-------------------------------------
1690           // - Rejection of a poor quality tracks
1691           if (fkQualityCutTPCrefit) {
1692                 // - Poor quality related to TPCrefit
1693                 ULong_t pStatus    = pTrackXi->GetStatus();
1694                 ULong_t nStatus    = nTrackXi->GetStatus();
1695                 ULong_t bachStatus = bachTrackXi->GetStatus();
1696                 if ((pStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1697                 if ((nStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1698                 if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1699           }
1700           if (fkQualityCutnTPCcls) {
1701                 // - Poor quality related to TPC clusters
1702                 if (lPosTPCClusters  < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }
1703                 if (lNegTPCClusters  < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }
1704                 if (lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach.   track has less than 80 TPC clusters ... continue!"); continue; }
1705           }
1706
1707           //-----------------------------------
1708           const AliExternalTrackParam *pExtTrack    = pTrackXi->GetInnerParam();
1709           const AliExternalTrackParam *nExtTrack    = nTrackXi->GetInnerParam();
1710           const AliExternalTrackParam *bachExtTrack = bachTrackXi->GetInnerParam();
1711           if (pExtTrack) {
1712                 lInnerWallMomCascDghters[0] = pExtTrack->GetP() * pExtTrack->Charge();
1713                 lTPCSignalCascDghters   [0] = pTrackXi->GetTPCsignal();
1714           }
1715           if (nExtTrack) {
1716                 lInnerWallMomCascDghters[1] = nExtTrack->GetP() * nExtTrack->Charge();
1717                 lTPCSignalCascDghters   [1] = nTrackXi->GetTPCsignal();
1718            }
1719            if (bachExtTrack) {
1720                 lInnerWallMomCascDghters[2] = bachExtTrack->GetP() * bachExtTrack->Charge();
1721                 lTPCSignalCascDghters   [2] = bachTrackXi->GetTPCsignal();
1722            }
1723            etaPos  = pTrackXi->Eta();
1724            etaNeg  = nTrackXi->Eta();
1725            etaBach = bachTrackXi->Eta();
1726            lInvMassLambdaAsCascDghter = xi->GetEffMass(); //This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
1727            lDcaV0DaughtersXi          = xi->GetDcaV0Daughters(); 
1728            lV0CosineOfPointingAngleXi = xi->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],
1729                                                                        lBestPrimaryVtxPos[1],
1730                                                                        lBestPrimaryVtxPos[2] );
1731            lDcaV0ToPrimVertexXi = xi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
1732            lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); //Note: AliExternalTrackParam::GetD returns an algebraic value ...
1733            xi->GetXYZ( lPosV0Xi[0],  lPosV0Xi[1], lPosV0Xi[2] ); 
1734            lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );      
1735            lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); 
1736            lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); 
1737
1738            //-----------------------------------------
1739            // - Extra-selection for cascade candidates
1740            if (fkExtraSelections) { //in AliCascadeVertexer
1741                 if (lDcaXiDaughters > 0.3) continue;                                              // in AliCascadeVertexer
1742                 if (lXiCosineOfPointingAngle < 0.999 ) continue;                                  // in AliCascadeVertexer
1743                 if (lDcaV0ToPrimVertexXi < 0.05) continue;                                        // in AliCascadeVertexer
1744                 if (lDcaBachToPrimVertexXi < 0.03) continue;                                      // in AliCascadeVertexer
1745                 if (lDcaV0DaughtersXi > 1.) continue;                                             // in AliV0vertexer
1746                 if ((fCollidingSystem == "pp") && (lV0toXiCosineOfPointingAngle < 0.998)) continue; // in AliV0vertexer
1747                 if ((fCollidingSystem == "pPb") && (lV0CosineOfPointingAngleXi < 0.998)) continue;  // in AliV0vertexer
1748                 if (lDcaPosToPrimVertexXi < 0.1) continue;                                        // in AliV0vertexer
1749                 if (lDcaNegToPrimVertexXi < 0.1) continue;                                        // in AliV0vertexer
1750                 if (lXiRadius < .9) continue;                                                     // in AliCascadeVertexer
1751                 if (lV0RadiusXi < 0.9) continue;                                                  // in AliV0vertexer
1752            }
1753
1754            //---------------------------------------------------------------------------------------------------        
1755            // - Around effective masses. Change mass hypotheses to cover all the possibilities:  Xi-/+, Omega-/+
1756            if ( bachTrackXi->Charge() < 0 )     {
1757                 //Calculate the effective mass of the Xi- candidate: Xi- hyp. (pdg code 3312)
1758                 lV0quality = 0.;
1759                 xi->ChangeMassHypothesis(lV0quality , 3312);    
1760                 lInvMassXiMinus = xi->GetEffMassXi();
1761                 //Calculate the effective mass of the Xi- candidate: Omega- hyp. (pdg code 3334)
1762                 lV0quality = 0.;
1763                 xi->ChangeMassHypothesis(lV0quality , 3334);    
1764                 lInvMassOmegaMinus = xi->GetEffMassXi();
1765                 //Back to "default" hyp. (Xi-)
1766                 lV0quality = 0.;
1767                 xi->ChangeMassHypothesis(lV0quality , 3312); 
1768            } // end if negative bachelor
1769            if ( bachTrackXi->Charge() >  0 ) {
1770                 //Calculate the effective mass of the Xi- candidate: Xi+ hyp. (pdg code -3312)
1771                 lV0quality = 0.;
1772                 xi->ChangeMassHypothesis(lV0quality , -3312);   
1773                 lInvMassXiPlus = xi->GetEffMassXi();
1774                 //Calculate the effective mass of the Xi- candidate: Omega+ hyp. (pdg code -3334)
1775                 lV0quality = 0.;
1776                 xi->ChangeMassHypothesis(lV0quality , -3334);   
1777                 lInvMassOmegaPlus = xi->GetEffMassXi();
1778                 //Back to "default" hyp. (Xi-)
1779                 lV0quality = 0.;
1780                 xi->ChangeMassHypothesis(lV0quality , -3312);   
1781            } // end if positive bachelor
1782
1783            //--------------------------------
1784            // - PID on the daughter tracks
1785            // - Combined PID ->  removed, add when will be used
1786
1787            // - TPC PID : 3-sigma bands on Bethe-Bloch curve
1788            //Bachelor
1789            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
1790            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
1791            //Negative V0 daughter
1792            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
1793            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
1794            //Positive V0 daughter
1795            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
1796            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
1797            /*
1798            const AliExternalTrackParam *pInnerWallTrackXi    = pTrackXi    ->GetInnerParam();
1799            const AliExternalTrackParam *nInnerWallTrackXi    = nTrackXi    ->GetInnerParam();
1800            const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
1801            if (pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ) { 
1802                 Double_t pMomInnerWall    = pInnerWallTrackXi   ->GetP();
1803                 Double_t nMomInnerWall    = nInnerWallTrackXi   ->GetP();
1804                 Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
1805                 //Bachelor
1806                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3)                              lIsBachelorPionForTPC = kTRUE;
1807                 if (bachMomInnerWall < 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
1808                 if (bachMomInnerWall > 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;                
1809                 //Negative V0 daughter
1810                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 3  )                           lIsNegPionForTPC   = kTRUE;
1811                 if (nMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 )   lIsNegProtonForTPC = kTRUE;
1812                 if (nMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 )   lIsNegProtonForTPC = kTRUE;       
1813                 //Positive V0 daughter
1814                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 3 )                            lIsPosPionForTPC   = kTRUE;
1815                 if (pMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5)     lIsPosProtonForTPC = kTRUE;
1816                 if (pMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3)     lIsPosProtonForTPC = kTRUE;
1817            }*/
1818                 
1819            //---------------------------------
1820            // - Extra info for QA (ESD)
1821            // Miscellaneous pieces of info that may help regarding data quality assessment.
1822            // Cascade transverse and total momentum
1823            xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
1824            lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
1825            lXiTotMom    = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
1826            // V0 total momentum
1827            xi->GetNPxPyPz(lV0NMomX,lV0NMomY,lV0NMomZ);
1828            xi->GetPPxPyPz(lV0PMomX,lV0PMomY,lV0PMomZ);
1829            lV0TotMom = TMath::Sqrt(TMath::Power(lV0NMomX+lV0PMomX,2) + TMath::Power(lV0NMomY+lV0PMomY,2) + TMath::Power(lV0NMomZ+lV0PMomZ,2));
1830            // Bachelor total momentum
1831            xi->GetBPxPyPz(  lBachMomX,  lBachMomY,  lBachMomZ );
1832            lBachTransvMom  = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
1833            lBachTotMom     = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
1834            lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX   + lV0NMomY*lV0NMomY );
1835            lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX   + lV0PMomY*lV0PMomY );
1836            lChargeXi       = xi->Charge();
1837            lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
1838            lRapXi    = xi->RapXi();
1839            lRapOmega = xi->RapOmega();
1840            lEta      = xi->Eta();
1841            lTheta    = xi->Theta()*180.0/TMath::Pi();
1842            lPhi      = xi->Phi()*180.0/TMath::Pi();
1843            lAlphaXi  = xi->AlphaXi();
1844            lPtArmXi  = xi->PtArmXi();
1845            // Extra-cut = Anti-splitting cut for lambda daughters
1846            Bool_t kAntiSplittingLambda = kFALSE;        
1847            if (kAntiSplittingLambda) { // not used
1848                Double_t lNMomX = 0., lNMomY = 0., lNMomZ = 0.;
1849                Double_t lPMomX = 0., lPMomY = 0., lPMomZ = 0.;
1850                xi->GetPPxPyPz(lPMomX, lPMomY, lPMomZ); 
1851                xi->GetNPxPyPz(lNMomX, lNMomY, lNMomZ); 
1852                if ( xi->Charge() < 0) {// Xi- or Omega-
1853                    if (TMath::Abs(lBachTransvMom - TMath::Sqrt( lNMomX*lNMomX + lNMomY*lNMomY )  ) < 0.075) continue;
1854                } else {                //Xi+ or Omega+
1855                    if(TMath::Abs(lBachTransvMom - TMath::Sqrt( lPMomX*lPMomX + lPMomY*lPMomY ) ) < 0.075) continue;
1856                }
1857            }
1858
1859     } // end of ESD treatment
1860  
1861     else if (fAnalysisType == "AOD") {
1862
1863            // -------------------------------------
1864            // - Load the cascades from the handler
1865            const AliAODcascade *xi = lAODevent->GetCascade(iXi);
1866            if (!xi) continue;
1867                 
1868            //----------------------------------------------------------------------------        
1869            // - Assigning the necessary variables for specific AliESDcascade data members               
1870            lEffMassXi              = xi->MassXi(); // default working hypothesis : cascade = Xi- decay
1871            lDcaXiDaughters         = xi->DcaXiDaughters();
1872            lXiCosineOfPointingAngle = xi->CosPointingAngleXi( lBestPrimaryVtxPos[0], 
1873                                                               lBestPrimaryVtxPos[1], 
1874                                                               lBestPrimaryVtxPos[2] );
1875            lPosXi[0] = xi->DecayVertexXiX();
1876            lPosXi[1] = xi->DecayVertexXiY();
1877            lPosXi[2] = xi->DecayVertexXiZ();
1878            lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
1879
1880            //-------------------------------------------------------------------------------------------------------------------------------
1881            // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1882            AliAODTrack *pTrackXi    = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );
1883            AliAODTrack *nTrackXi    = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );
1884            AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );
1885            if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1886                 AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");
1887                 continue;
1888            }
1889            UInt_t lIdxPosXi  = (UInt_t) TMath::Abs( pTrackXi->GetID() );  
1890            UInt_t lIdxNegXi  = (UInt_t) TMath::Abs( nTrackXi->GetID() );
1891            UInt_t lBachIdx   = (UInt_t) TMath::Abs( bachTrackXi->GetID() );
1892                                                 // Care track label can be negative in MC production (linked with the track quality)
1893                                                 // However = normally, not the case for track index ...
1894            // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1895            if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }
1896            if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }
1897            // - Get the TPCnumber of cluster for the daughters
1898            lPosTPCClusters   = pTrackXi->GetTPCNcls(); // FIXME: Is this ok? or something like in LambdaK0PbPb task AOD?
1899            lNegTPCClusters   = nTrackXi->GetTPCNcls();
1900            lBachTPCClusters  = bachTrackXi->GetTPCNcls();
1901
1902            //-------------------------------------
1903            // - Rejection of a poor quality tracks
1904            if (fkQualityCutTPCrefit) {
1905                 // - Poor quality related to TPCrefit
1906                 if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1907                 if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1908                 if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1909            }
1910            if (fkQualityCutnTPCcls) {
1911                 // - Poor quality related to TPC clusters
1912                 if (lPosTPCClusters  < fMinnTPCcls) { //AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!");
1913                     continue; }
1914                 if (lNegTPCClusters  < fMinnTPCcls) { //AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!");
1915                     continue; }
1916                 if (lBachTPCClusters < fMinnTPCcls) { //AliWarning("Pb / Bach.   track has less than 80 TPC clusters ... continue!");
1917                     continue; }
1918            }
1919
1920            //---------------------------------------
1921            // - Around the tracks: Bach + V0 (AOD). Necessary variables for AODcascade data members coming from the AODv0 part (inheritance)
1922            etaPos  = pTrackXi->Eta();
1923            etaNeg  = nTrackXi->Eta();
1924            etaBach = bachTrackXi->Eta();
1925            lChargeXi = xi->ChargeXi();
1926            if ( lChargeXi < 0) lInvMassLambdaAsCascDghter = xi->MassLambda();
1927            else                lInvMassLambdaAsCascDghter = xi->MassAntiLambda();
1928            lDcaV0DaughtersXi      = xi->DcaV0Daughters(); 
1929            lDcaV0ToPrimVertexXi   = xi->DcaV0ToPrimVertex();
1930            lDcaBachToPrimVertexXi = xi->DcaBachToPrimVertex(); 
1931            lPosV0Xi[0] = xi->DecayVertexV0X();
1932            lPosV0Xi[1] = xi->DecayVertexV0Y();
1933            lPosV0Xi[2] = xi->DecayVertexV0Z(); 
1934            lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
1935            lV0CosineOfPointingAngleXi = xi->CosPointingAngle( lBestPrimaryVtxPos ); 
1936            lDcaPosToPrimVertexXi      = xi->DcaPosToPrimVertex(); 
1937            lDcaNegToPrimVertexXi      = xi->DcaNegToPrimVertex(); 
1938
1939            //----------------------------------------------------------------------------------------------------       
1940            // - Around effective masses. Change mass hypotheses to cover all the possibilities:  Xi-/+, Omega -/+
1941            if ( lChargeXi < 0 ) lInvMassXiMinus    = xi->MassXi();
1942            if ( lChargeXi > 0 ) lInvMassXiPlus     = xi->MassXi();
1943            if ( lChargeXi < 0 ) lInvMassOmegaMinus = xi->MassOmega();
1944            if ( lChargeXi > 0 ) lInvMassOmegaPlus  = xi->MassOmega();
1945
1946            //--------------------------------
1947            // - PID on the daughter tracks
1948            // - Combined PID ->  removed, add when will be used
1949
1950            // - TPC PID : 3-sigma bands on Bethe-Bloch curve
1951            //Bachelor
1952            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
1953            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
1954            //Negative V0 daughter
1955            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
1956            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
1957            //Positive V0 daughter
1958            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
1959            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
1960
1961            //---------------------------------
1962            // - Extra info for QA (AOD)
1963            // Miscellaneous pieces of info that may help regarding data quality assessment.
1964            // Cascade transverse and total momentum     
1965            lXiMomX = xi->MomXiX();
1966            lXiMomY = xi->MomXiY();
1967            lXiMomZ = xi->MomXiZ();
1968            lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
1969            lXiTotMom    = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
1970            Double_t lV0MomX = xi->MomV0X();
1971            Double_t lV0MomY = xi->MomV0Y();
1972            Double_t lV0MomZ = xi->MomV0Z();
1973            lV0TotMom = TMath::Sqrt(TMath::Power(lV0MomX,2)+TMath::Power(lV0MomY,2)+TMath::Power(lV0MomZ,2));
1974            lBachMomX = xi->MomBachX();
1975            lBachMomY = xi->MomBachY();
1976            lBachMomZ = xi->MomBachZ();          
1977            lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
1978            lBachTotMom    = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
1979            lV0NMomX = xi->MomNegX();
1980            lV0NMomY = xi->MomNegY();
1981            lV0PMomX = xi->MomPosX();
1982            lV0PMomY = xi->MomPosY();
1983            lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX   + lV0NMomY*lV0NMomY );
1984            lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX   + lV0PMomY*lV0PMomY );
1985            lV0toXiCosineOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );
1986            lRapXi    = xi->RapXi();
1987            lRapOmega = xi->RapOmega();
1988            lEta      = xi->Eta();                       // Will not work ! need a method Pz(), Py() Px() 
1989            lTheta    = xi->Theta() *180.0/TMath::Pi();  // in AODcascade.
1990            lPhi      = xi->Phi()   *180.0/TMath::Pi();  // Here, we will get eta, theta, phi for the V0 ...
1991            lAlphaXi  = xi->AlphaXi();
1992            lPtArmXi  = xi->PtArmXi();
1993
1994     } // end of AOD treatment
1995
1996     // Cut on pt of the three daughter tracks
1997     if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;
1998     if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
1999     if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
2000       
2001     // Cut on pseudorapidity of the three daughter tracks
2002     if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;
2003     if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;
2004     if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;
2005       
2006       
2007     //----------------------------------
2008     // Calculate proper lenght for cascade
2009     Double_t cascadeMass = 0.;
2010     if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
2011          ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )  ) cascadeMass = 1.321;
2012     if ( ( (lChargeXi<0) && lIsBachelorKaonForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC ) ||
2013          ( (lChargeXi>0) && lIsBachelorKaonForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )  ) cascadeMass = 1.672;
2014     Double_t lctau =  TMath::Sqrt(TMath::Power((lPosXi[0]-lBestPrimaryVtxPos[0]),2)+TMath::Power((lPosXi[1]-lBestPrimaryVtxPos[1]),2)+TMath::Power(( lPosXi[2]-lBestPrimaryVtxPos[2]),2));
2015     if (lXiTotMom!=0) lctau = lctau*cascadeMass/lXiTotMom;
2016     else lctau = -1.;
2017
2018     //-------------------------------------------------
2019     // Calculate proper lenght for Lambda (reconstructed)
2020     Float_t lambdaMass = 1.115683; // PDG mass
2021     Float_t distV0Xi =  TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2)+TMath::Power((lPosV0Xi[2]-lPosXi[2]),2));
2022     Float_t lctauV0 = -1.;
2023     if (lV0TotMom!=0) lctauV0 = distV0Xi*lambdaMass/lV0TotMom;
2024     Float_t distTV0Xi =  TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));
2025
2026     //--------------
2027     /*// For AliEVE      
2028          if(lChargeXi < 0&& lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
2029              if (lXiTransvMom>2.&&lXiTransvMom<4.&&(lInvMassXiMinus<1.322&&lInvMassXiMinus>1.320)&&(lXiRadius<8.&&lXiRadius>3.)) {
2030                          // FIXME : Just to know which file is currently open : locate the file containing Xi
2031                   cout << "Name of the file containing Xi candidate(s) :" 
2032                        << CurrentFileName() 
2033                        << " / entry: "     << Entry()
2034                        << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
2035                        << " AliESDcascade number " << iXi 
2036                        << " : mass(Xi-) = " << lInvMassXiMinus
2037                        << " / charge = "   << lChargeXi
2038                        << " / pt(Casc) = " << lXiTransvMom
2039                        << " / Decay 2d R(Xi) = " << lXiRadius 
2040                        << endl;
2041              }
2042          }
2043          if(lChargeXi < 0&& lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
2044              if (lXiTransvMom>2&&lXiTransvMom<4&&(lInvMassOmegaMinus<1.674&&lInvMassOmegaMinus>1.670)&&(lXiRadius<8.&&lXiRadius>3.)) {
2045                   cout << "Name of the file containing Omega candidate(s) :"
2046                        << CurrentFileName()
2047                        << " / entry: "     << Entry()
2048                        << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
2049                        << " AliESDcascade number " << iXi 
2050                        << " : mass(Omega-) = " << lInvMassOmegaMinus
2051                        << " / charge = "   << lChargeXi
2052                        << " / pt(Casc) = " << lXiTransvMom
2053                        << " / Decay 2d R(Xi) = " << lXiRadius
2054                        << endl;
2055
2056              }
2057          }*/
2058           
2059
2060     // - 
2061     fHistPosV0TPCClusters->Fill( lPosTPCClusters );
2062     fHistNegV0TPCClusters->Fill( lNegTPCClusters );
2063     fHistBachTPCClusters->Fill( lBachTPCClusters );
2064     f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[0] , lTPCSignalCascDghters[0] );
2065     f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[1] , lTPCSignalCascDghters[1] );
2066     f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[2] , lTPCSignalCascDghters[2] );
2067
2068     //----------------
2069     //Plot with PID on  
2070     if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
2071          ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )  ) {
2072                                        // NOTE : 
2073                                        // with this condition, it could happen that a cascade candidate satisfies the wrong requirement,
2074                                        // e.g. one looks at a Xi- candidate for which lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC = kFALSE
2075                                        // Expectation: it should be excluded, but lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC = kTRUE
2076                                        // then this bad Xi-candidate will contribute anyway (OR condition).
2077                                        // Hence: the extra condition on the sign of the Cascade
2078            //if (TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.010 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.010)
2079            fHistEffMassXi->Fill( lEffMassXi );
2080            fHistDcaXiDaughters->Fill( lDcaXiDaughters );                    // Flag CascadeVtxer: Cut Variable e 
2081            fHistDcaBachToPrimVertex->Fill( lDcaBachToPrimVertexXi   );      // Flag CascadeVtxer: Cut Variable d
2082            fHistXiCosineOfPointingAngle->Fill( lXiCosineOfPointingAngle );  // Flag CascadeVtxer: Cut Variable f
2083            fHistXiRadius->Fill( lXiRadius );                                // Flag CascadeVtxer: Cut Variable g+h
2084            fHistMassLambdaAsCascDghter->Fill( lInvMassLambdaAsCascDghter ); // Flag CascadeVtxer: Cut Variable c
2085            fHistDcaV0DaughtersXi->Fill( lDcaV0DaughtersXi );
2086            fHistV0CosineOfPointingAngleXi->Fill( lV0CosineOfPointingAngleXi ); 
2087            fHistV0RadiusXi->Fill( lV0RadiusXi );
2088            fHistDcaV0ToPrimVertexXi->Fill( lDcaV0ToPrimVertexXi );          // Flag CascadeVtxer: Cut Variable b
2089            fHistDcaPosToPrimVertexXi->Fill( lDcaPosToPrimVertexXi );
2090            fHistDcaNegToPrimVertexXi->Fill( lDcaNegToPrimVertexXi );
2091            fHistChargeXi->Fill( lChargeXi );
2092            fHistV0toXiCosineOfPointingAngle->Fill( lV0toXiCosineOfPointingAngle );
2093            if ( TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.012 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.012) { // One InvMass should be different from 0
2094                 fHistXiTransvMom->Fill( lXiTransvMom );
2095                 fHistXiTotMom->Fill( lXiTotMom );
2096                 fHistBachTransvMomXi->Fill( lBachTransvMom );
2097                 fHistBachTotMomXi->Fill( lBachTotMom );
2098                 fHistRapXi->Fill( lRapXi );
2099                 fHistEtaXi->Fill( lEta );
2100                 if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) {
2101                       fHistEtaBachXi->Fill( etaBach );
2102                       fHistEtaPosXi->Fill( etaPos );
2103                       fHistEtaNegXi->Fill( etaNeg );
2104                 }
2105                 fHistThetaXi->Fill( lTheta );
2106                 fHistPhiXi->Fill( lPhi );
2107            }
2108            if ( TMath::Abs( lInvMassOmegaMinus-1.672 ) < 0.012 || TMath::Abs( lInvMassOmegaPlus-1.672 ) < 0.012 ) { // One InvMass should be different from 0
2109                 fHistRapOmega->Fill( lRapOmega ); 
2110            }
2111            f2dHistArmenteros->Fill( lAlphaXi, lPtArmXi );
2112     } // end with PID ...
2113
2114     //-----------------------
2115     // - Invariant mass plots
2116     //Plots 1D
2117     if ( lChargeXi < 0 ) {
2118          fHistMassXiMinus->Fill( lInvMassXiMinus );
2119          fHistMassOmegaMinus->Fill( lInvMassOmegaMinus );
2120          f2dHistDcaXiDaughtersvsInvMass->Fill(lDcaXiDaughters,lInvMassXiMinus);
2121          f2dHistDcaBachToPrimVertexvsInvMass->Fill(lDcaBachToPrimVertexXi,lInvMassXiMinus); 
2122          f2dHistXiCosineOfPointingAnglevsInvMass->Fill(lXiCosineOfPointingAngle,lInvMassXiMinus);
2123          f2dHistMassLambdaAsCascDghtervsInvMass->Fill(lInvMassLambdaAsCascDghter,lInvMassXiMinus);
2124          f2dHistDcaV0DaughtersXivsInvMass->Fill(lDcaV0DaughtersXi,lInvMassXiMinus);
2125          f2dHistDcaV0ToPrimVertexXivsInvMass->Fill(lDcaV0ToPrimVertexXi,lInvMassXiMinus);
2126     }
2127     if ( lChargeXi > 0 ) {
2128       fHistMassXiPlus->Fill( lInvMassXiPlus );
2129       fHistMassOmegaPlus->Fill( lInvMassOmegaPlus );
2130     }
2131     //Plots 2D, 3D
2132     if ( lChargeXi < 0 ) {
2133       f2dHistEffMassLambdaVsEffMassXiMinus->Fill( lInvMassLambdaAsCascDghter, lInvMassXiMinus ); 
2134       f2dHistEffMassXiVsEffMassOmegaMinus ->Fill( lInvMassXiMinus, lInvMassOmegaMinus );
2135       f2dHistXiRadiusVsEffMassXiMinus     ->Fill( lXiRadius, lInvMassXiMinus );
2136       f2dHistXiRadiusVsEffMassOmegaMinus  ->Fill( lXiRadius, lInvMassOmegaMinus );
2137     } else {
2138       f2dHistEffMassLambdaVsEffMassXiPlus ->Fill( lInvMassLambdaAsCascDghter, lInvMassXiPlus );
2139       f2dHistEffMassXiVsEffMassOmegaPlus  ->Fill( lInvMassXiPlus, lInvMassOmegaPlus );
2140       f2dHistXiRadiusVsEffMassXiPlus      ->Fill( lXiRadius, lInvMassXiPlus);
2141       f2dHistXiRadiusVsEffMassOmegaPlus   ->Fill( lXiRadius, lInvMassOmegaPlus );
2142     }
2143
2144     //---------------------------------------------     
2145     // - Filling the AliCFContainers related to PID
2146     Double_t lContainerPIDVars[3] = {0.0};
2147     // Xi Minus         
2148     if ( lChargeXi < 0 ) {
2149           lContainerPIDVars[0] = lXiTransvMom;
2150           lContainerPIDVars[1] = lInvMassXiMinus;
2151           lContainerPIDVars[2] = lRapXi;
2152           //No PID
2153           fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 0); // No PID
2154           //TPC PID
2155           if ( lIsBachelorPionForTPC )                                           fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track              
2156           if ( lIsBachelorPionForTPC && lIsPosProtonForTPC )                     fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2157           if ( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2158           //Combined PID
2159           if ( lIsBachelorPion )                                      fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor     
2160           if ( lIsBachelorPion && lIsPosInXiProton )                  fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2161           if (lIsBachelorPion && lIsPosInXiProton && lIsNegInXiPion ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2162     }
2163     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;    
2164     // Xi Plus          
2165     if ( lChargeXi > 0 ) {
2166           lContainerPIDVars[0] = lXiTransvMom;
2167           lContainerPIDVars[1] = lInvMassXiPlus;
2168           lContainerPIDVars[2] = lRapXi;
2169           //No PID
2170           fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 0); // No PID
2171           //TPC PID
2172           if ( lIsBachelorPionForTPC )                                           fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2173           if ( lIsBachelorPionForTPC && lIsNegProtonForTPC )                     fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2174           if ( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2175           //Combined PID
2176           if ( lIsBachelorPion )                                      fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2177           if ( lIsBachelorPion && lIsNegInXiProton )                  fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2178           if (lIsBachelorPion && lIsNegInXiProton && lIsPosInXiPion ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2179     }
2180     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; 
2181     // Omega Minus              
2182     if ( lChargeXi < 0 ) {
2183           lContainerPIDVars[0] = lXiTransvMom;
2184           lContainerPIDVars[1] = lInvMassOmegaMinus;
2185           lContainerPIDVars[2] = lRapOmega;
2186           //No PID
2187           fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 0); // No PID
2188           //TPC PID
2189           if ( lIsBachelorKaonForTPC )                                           fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2190           if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC )                     fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2191           if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2192           //Combined PID
2193           if ( lIsBachelorKaon )                                            fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2194           if ( lIsBachelorKaon && lIsPosInOmegaProton )                     fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2195           if (lIsBachelorKaon && lIsPosInOmegaProton && lIsNegInOmegaPion ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2196     }
2197     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
2198     // Omega Plus               
2199     if ( lChargeXi > 0 ) {
2200       lContainerPIDVars[0] = lXiTransvMom;
2201       lContainerPIDVars[1] = lInvMassOmegaPlus;
2202       lContainerPIDVars[2] = lRapOmega;
2203         // No PID
2204       fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 0); // No PID
2205         // TPC PID
2206       if ( lIsBachelorKaonForTPC  )
2207         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2208       if( lIsBachelorKaonForTPC && 
2209           lIsNegProtonForTPC     )
2210         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2211       if ( lIsBachelorKaonForTPC && 
2212            lIsNegProtonForTPC    && 
2213            lIsPosPionForTPC       )
2214         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2215         // Combined PID
2216       if ( lIsBachelorKaon        )
2217         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2218       if ( lIsBachelorKaon       && 
2219            lIsNegInOmegaProton    )
2220         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2221       if (lIsBachelorKaon     && 
2222           lIsNegInOmegaProton && 
2223           lIsPosInOmegaPion    )
2224         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2225     }
2226                 
2227     //--------------------------------------------------------------------
2228     // Filling the AliCFContainer (optimisation of topological selections)
2229     Double_t lContainerCutVars[19] = {0.0};
2230                         
2231     lContainerCutVars[0]  = lDcaXiDaughters;
2232     lContainerCutVars[1]  = lDcaBachToPrimVertexXi;
2233     lContainerCutVars[2]  = lXiCosineOfPointingAngle;
2234     lContainerCutVars[3]  = lXiRadius;
2235     lContainerCutVars[4]  = lInvMassLambdaAsCascDghter;
2236     lContainerCutVars[5]  = lDcaV0DaughtersXi;
2237     if (fCollidingSystem == "pp")       lContainerCutVars[6]  = lV0toXiCosineOfPointingAngle;
2238     else if (fCollidingSystem == "pPb") lContainerCutVars[6]  = lV0CosineOfPointingAngleXi;
2239     lContainerCutVars[7]  = lV0RadiusXi;
2240     lContainerCutVars[8]  = lDcaV0ToPrimVertexXi;       
2241     lContainerCutVars[9]  = lDcaPosToPrimVertexXi;
2242     lContainerCutVars[10] = lDcaNegToPrimVertexXi;
2243     lContainerCutVars[13] = lXiTransvMom;
2244     lContainerCutVars[16] = lctau;
2245     lContainerCutVars[17] = lctauV0;
2246     lContainerCutVars[18] = distTV0Xi;
2247  
2248     if ( lChargeXi < 0 ) {
2249          lContainerCutVars[11] = lInvMassXiMinus;
2250          lContainerCutVars[12] = lInvMassOmegaMinus;
2251          lContainerCutVars[14] = lRapXi;
2252          lContainerCutVars[15] = -1.;
2253          if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,0); // for Xi-
2254          lContainerCutVars[11] = lInvMassXiMinus;
2255          lContainerCutVars[12] = lInvMassOmegaMinus;
2256          lContainerCutVars[14] = -1.;
2257          lContainerCutVars[15] = lRapOmega;
2258          if (lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,2); // for Omega-
2259     } else {
2260          lContainerCutVars[11] = lInvMassXiPlus;
2261          lContainerCutVars[12] = lInvMassOmegaPlus; 
2262          lContainerCutVars[14] = lRapXi;
2263          lContainerCutVars[15] = -1.; 
2264          if (lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,1); // for Xi+
2265          lContainerCutVars[11] = lInvMassXiPlus;
2266          lContainerCutVars[12] = lInvMassOmegaPlus;
2267          lContainerCutVars[14] = -1.;
2268          lContainerCutVars[15] = lRapOmega;
2269          if (lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,3); // for Omega+ 
2270     }                 
2271   } //end of the Cascade loop (ESD or AOD)
2272     
2273   // Post output data.
2274  PostData(1, fListHistCascade);
2275  PostData(2, fCFContCascadePIDXiMinus);
2276  PostData(3, fCFContCascadePIDXiPlus);
2277  PostData(4, fCFContCascadePIDOmegaMinus);
2278  PostData(5, fCFContCascadePIDOmegaPlus);
2279  PostData(6, fCFContCascadeCuts);
2280 }
2281
2282 //________________________________________________________________________
2283 Int_t AliAnalysisTaskCheckCascadepp276::DoESDTrackWithTPCrefitMultiplicity(const AliESDEvent *lESDevent) {
2284     // Checking the number of tracks with TPCrefit for each event
2285     // Needed for a rough assessment of the event multiplicity
2286         
2287     Int_t nTrackWithTPCrefitMultiplicity = 0;
2288     for (Int_t iTrackIdx = 0; iTrackIdx < (InputEvent())->GetNumberOfTracks(); iTrackIdx++) {
2289       AliESDtrack *esdTrack     = 0x0;
2290       esdTrack  = lESDevent->GetTrack( iTrackIdx );
2291       if (!esdTrack) { AliWarning("Pb / Could not retrieve one track within the track loop for TPCrefit check ..."); continue; }
2292
2293       ULong_t lTrackStatus    = esdTrack->GetStatus();
2294       if ((lTrackStatus&AliESDtrack::kTPCrefit)    == 0) continue;
2295       else nTrackWithTPCrefitMultiplicity++;
2296         // FIXME :
2297         // The goal here is to get a better assessment of the event multiplicity.
2298         // (InputEvent())->GetNumberOfTracks() takes into account ITS std alone tracks + global tracks
2299         // This may introduce a bias. Hence the number of TPC refit tracks.
2300         // Note : the event multiplicity = analysis on its own... See Jacek's or Jan Fiete's analysis on dN/d(eta)
2301
2302     } // end loop over all event tracks
2303     return  nTrackWithTPCrefitMultiplicity;
2304 }
2305
2306
2307 //________________________________________________________________________
2308 void AliAnalysisTaskCheckCascadepp276::Terminate(Option_t *) 
2309 {
2310   // Draw result to the screen
2311   // Called once at the end of the query
2312
2313 /*  TList *cRetrievedList = 0x0;
2314          cRetrievedList = (TList*)GetOutputData(1);
2315         if(!cRetrievedList){
2316                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: ouput data container list not available\n"); return;
2317         }
2318   fHistTrackMultiplicity = dynamic_cast<TH1F*> (   cRetrievedList->FindObject("fHistTrackMultiplicity") );
2319   if (!fHistTrackMultiplicity) {
2320                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistTrackMultiplicity not available\n"); return;
2321         }
2322   fHistMassXiMinus    = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiMinus") ); 
2323         if (!fHistMassXiMinus) {
2324                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiMinus not available\n"); return;
2325         }
2326   fHistMassXiPlus     = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiPlus") );
2327         if (!fHistMassXiPlus) {
2328                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiPlus not available\n"); return;
2329         }       
2330   fHistMassOmegaMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaMinus") );
2331         if (!fHistMassOmegaMinus) {
2332                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaMinus not available\n"); return;
2333         }
2334   fHistMassOmegaPlus  = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaPlus") );       
2335         if (!fHistMassOmegaPlus) {
2336                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaPlus not available\n"); return;
2337         }
2338   
2339   TCanvas *canCheckCascade = new TCanvas("AliAnalysisTaskCheckCascadep276","CheckCascade overview",10,10,1010,660);
2340   canCheckCascade->Divide(2,2);
2341   
2342   canCheckCascade->cd(1);
2343   canCheckCascade->cd(1)->SetLogy();
2344   fHistTrackMultiplicity->SetMarkerStyle(kFullStar);  
2345   fHistTrackMultiplicity->GetXaxis()->SetLabelFont(42);
2346   fHistTrackMultiplicity->GetYaxis()->SetLabelFont(42);
2347   fHistTrackMultiplicity->SetTitleFont(42, "xy");
2348   fHistTrackMultiplicity->GetXaxis()->SetTitleOffset(1.1);
2349   fHistTrackMultiplicity->DrawCopy("H");
2350   
2351   canCheckCascade->cd(2);  
2352   fHistMassXiMinus ->SetMarkerStyle(kFullCircle);
2353   fHistMassXiMinus ->SetMarkerSize(0.5);
2354   fHistMassXiMinus ->GetXaxis()->SetLabelFont(42);
2355   fHistMassXiMinus ->GetYaxis()->SetLabelFont(42);
2356   fHistMassXiMinus ->SetTitleFont(42, "xy");
2357   fHistMassXiMinus ->GetXaxis()->SetTitleOffset(1.1);
2358   fHistMassXiMinus ->GetYaxis()->SetTitleOffset(1.3);
2359   //fHistMassXiMinus->Rebin(2);
2360   fHistMassXiMinus ->GetXaxis()->SetRangeUser(1.24, 1.42);
2361   fHistMassXiMinus ->DrawCopy("E");
2362   
2363   fHistMassXiPlus ->SetMarkerStyle(kOpenCircle);
2364   fHistMassXiPlus ->SetMarkerColor(kRed+2);
2365   fHistMassXiPlus ->SetLineColor(kRed+2);
2366   fHistMassXiPlus ->SetMarkerSize(0.5);
2367   //fHistMassXiPlus ->Rebin(2);
2368   fHistMassXiPlus ->DrawCopy("ESAME");
2369   
2370   
2371   TLegend *legendXi =new TLegend(0.67,0.34,0.97,0.54);
2372                 legendXi->SetTextFont(42);
2373                 legendXi->SetTextSize(0.05);
2374                 legendXi->SetFillColor(kWhite);
2375                 legendXi->AddEntry( fHistMassXiMinus,"#Xi^{-} candidates","lp");
2376                 legendXi->AddEntry( fHistMassXiPlus,"#Xi^{+} candidates","lp");
2377                 legendXi->Draw();
2378   
2379   
2380   canCheckCascade->cd(3);  
2381   fHistMassOmegaPlus ->SetMarkerStyle(kOpenCircle);
2382   fHistMassOmegaPlus ->SetMarkerColor(kRed+2);
2383   fHistMassOmegaPlus ->SetLineColor(kRed+2);
2384   fHistMassOmegaPlus ->SetMarkerSize(0.5);
2385   fHistMassOmegaPlus ->GetXaxis()->SetLabelFont(42);
2386   fHistMassOmegaPlus ->GetYaxis()->SetLabelFont(42);
2387   fHistMassOmegaPlus ->SetTitleFont(42, "xy");
2388   fHistMassOmegaPlus ->GetXaxis()->SetTitleOffset(1.1);
2389   fHistMassOmegaPlus ->GetYaxis()->SetTitleOffset(1.25);
2390   //fHistMassOmegaPlus ->Rebin(2);
2391   fHistMassOmegaPlus ->GetXaxis()->SetRangeUser(1.6, 1.84);
2392   fHistMassOmegaPlus ->DrawCopy("E");
2393   
2394   fHistMassOmegaMinus->SetMarkerStyle(kFullCircle);
2395   fHistMassOmegaMinus->SetMarkerSize(0.5);
2396   //fHistMassOmegaMinus->Rebin(2);
2397   fHistMassOmegaMinus->DrawCopy("ESAME");
2398
2399   
2400    TLegend *legendOmega = new TLegend(0.67,0.34,0.97,0.54);
2401                 legendOmega->SetTextFont(42);
2402                 legendOmega->SetTextSize(0.05);
2403                 legendOmega->SetFillColor(kWhite);
2404                 legendOmega->AddEntry( fHistMassOmegaMinus,"#Omega^{-} candidates","lp");
2405                 legendOmega->AddEntry( fHistMassOmegaPlus,"#Omega^{+} candidates","lp");
2406                 legendOmega->Draw();
2407      */
2408 }