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