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