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