]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/Cascades/AliAnalysisTaskCheckCascadePbPb.cxx
Helper class: extra info commit
[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 = lAODevent->GetTrack(itrack);
1314       if (track->TestFilterBit(AliAODTrack::kTrkGlobalNoDCA)) lPrimaryTrackMultiplicity++; // kTrkGlobal tight DCA cut --> mult is much lower than the one selectied with standard cuts in ESDs
1315       if (track->IsOn(AliAODTrack::kTPCrefit)) nTrackWithTPCrefitMultiplicity++;
1316     }
1317  
1318 //    lSPDTrackletsMultiplicity = lAODevent->GetTracklets()->GetNumberOfTracklets();
1319
1320     centrality = lAODevent->GetCentrality();
1321     aodV0 = lAODevent->GetVZEROData();
1322     multV0A=aodV0->GetMTotV0A();
1323     multV0C=aodV0->GetMTotV0C();
1324
1325   } else {
1326
1327     Printf("Analysis type (ESD or AOD) not specified \n");
1328     return;
1329
1330   }
1331
1332   fHistCascadeMultiplicityBeforeEvSel->Fill (ncascades);
1333  
1334   //  Printf("Centrality percentile V0M for this event %f)\n",  centrality->GetCentralityPercentile("V0M"));
1335   Float_t lcentrality = 0.;
1336
1337   if (fkUseCleaning) lcentrality = centrality->GetCentralityPercentile(fCentrEstimator.Data());
1338   else {
1339     lcentrality = centrality->GetCentralityPercentileUnchecked(fCentrEstimator.Data());
1340     if (centrality->GetQuality()>1) {
1341       PostData(1, fListHistCascade);
1342       PostData(2, fCFContCascadePIDXiMinus);
1343       PostData(3, fCFContCascadePIDXiPlus);
1344       PostData(4, fCFContCascadePIDOmegaMinus);
1345       PostData(5, fCFContCascadePIDOmegaPlus);
1346       PostData(6, fCFContCascadeCuts);
1347
1348       return;
1349     }
1350   }
1351   if (lcentrality<fCentrLowLim||lcentrality>=fCentrUpLim) { 
1352     PostData(1, fListHistCascade);
1353     PostData(2, fCFContCascadePIDXiMinus);
1354     PostData(3, fCFContCascadePIDXiPlus);
1355     PostData(4, fCFContCascadePIDOmegaMinus);
1356     PostData(5, fCFContCascadePIDOmegaPlus);
1357     PostData(6, fCFContCascadeCuts);
1358
1359     return;
1360   }
1361
1362   fV0Ampl->Fill(multV0A+multV0C);
1363   
1364   //-------------------------------------------------
1365
1366   fHistTrackMultiplicityForCentrEvt         ->Fill( nTrackMultiplicity             );
1367   fHistTPCrefitTrackMultiplicityForCentrEvt ->Fill( nTrackWithTPCrefitMultiplicity );
1368   fHistCascadeMultiplicityForCentrEvt       ->Fill( ncascades                      );
1369
1370   // ---------------------------------------------------------------
1371
1372   // I - Global characteristics of the events + general histos (filled for any selected events and/or for the analysed events)
1373
1374        // - I.Step 1 : Characteristics of the event : prim. Vtx + magnetic field (ESD)
1375        //-------------
1376
1377   if (fAnalysisType == "ESD") {
1378     const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
1379     // get the vtx stored in ESD found with tracks
1380     lPrimaryTrackingESDVtx->GetXYZ( lTrkgPrimaryVtxPos );
1381         
1382     const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex();     
1383     // get the best primary vertex available for the event
1384     // As done in AliCascadeVertexer, we keep the one which is the best one available.
1385     // between : Tracking vertex > SPD vertex > TPC vertex > default SPD vertex
1386     // This one will be used for next calculations (DCA essentially)
1387     lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
1388     lStatusTrackingPrimVtx  = lPrimaryTrackingESDVtx->GetStatus();
1389
1390     // FIXME : remove TPC-only primary vertex : retain only events with tracking + SPD vertex
1391     if (fkQualityCutNoTPConlyPrimVtx) {
1392       const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
1393       if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() ){
1394         AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1395         PostData(1, fListHistCascade); 
1396         PostData(2, fCFContCascadePIDXiMinus);
1397         PostData(3, fCFContCascadePIDXiPlus);
1398         PostData(4, fCFContCascadePIDOmegaMinus);
1399         PostData(5, fCFContCascadePIDOmegaPlus);
1400         PostData(6, fCFContCascadeCuts);
1401
1402         return;
1403       }
1404     }
1405         
1406         // NOTE : For older evts
1407         
1408         // As previously done in AliCascadeVertexer, we keep, between both retrieved vertices (SPD or Tracking) 
1409         // the one which is the best one available.
1410         // This one will be used for next calculations (DCA essentially)
1411         // At that time, the TPC-only primary vertex was not considered
1412         
1413         
1414     lMagneticField = lESDevent->GetMagneticField( );
1415     // FIXME if(TMath::Abs(lMagneticField ) < 10e-6) continue;
1416     lPrimaryTrackMultiplicity = fESDtrackCuts->CountAcceptedTracks(lESDevent);    
1417   } else if (fAnalysisType == "AOD") {
1418
1419     const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex();
1420     if (!lPrimaryBestAODVtx){
1421         AliWarning("No prim. vertex in AOD... return!");
1422         PostData(1, fListHistCascade);
1423         PostData(2, fCFContCascadePIDXiMinus);
1424         PostData(3, fCFContCascadePIDXiPlus);
1425         PostData(4, fCFContCascadePIDOmegaMinus);
1426         PostData(5, fCFContCascadePIDOmegaPlus);
1427         PostData(6, fCFContCascadeCuts);
1428
1429         return;
1430     }
1431         
1432     // get the best primary vertex available for the event GetVertex(0)
1433     // This one will be used for next calculations (DCA essentially)
1434     lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );
1435         
1436     lStatusTrackingPrimVtx  = -1;
1437     lTrkgPrimaryVtxPos[0]   = -100.0;
1438     lTrkgPrimaryVtxPos[1]   = -100.0;
1439     lTrkgPrimaryVtxPos[2]   = -100.0;   
1440     lMagneticField = lAODevent->GetMagneticField();  
1441
1442   }
1443
1444   // Quality cut on the z-position of the prim vertex.
1445   if (fkQualityCutZprimVtxPos) {
1446     if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange ) {
1447       AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1448       PostData(1, fListHistCascade);
1449       PostData(2, fCFContCascadePIDXiMinus);
1450       PostData(3, fCFContCascadePIDXiPlus);
1451       PostData(4, fCFContCascadePIDOmegaMinus);
1452       PostData(5, fCFContCascadePIDOmegaPlus);
1453       PostData(6, fCFContCascadeCuts);
1454
1455       return;
1456     }
1457   }
1458
1459        // - I.Step 2 : Filling histos that characterize the selected event : x,y,z prim. Vtx distrib. (ESD)
1460        //-------------
1461
1462   fHistCascadeMultiplicityForSelEvt ->Fill( ncascades );
1463   fHistPosBestPrimaryVtxXForSelEvt  ->Fill( lBestPrimaryVtxPos[0] );
1464   fHistPosBestPrimaryVtxYForSelEvt  ->Fill( lBestPrimaryVtxPos[1] );
1465   fHistPosBestPrimaryVtxZForSelEvt  ->Fill( lBestPrimaryVtxPos[2] );
1466   
1467   // ---------------------------------------------------------------
1468
1469   fHistEvtsInCentralityBinsvsNtracks->Fill(lcentrality,lPrimaryTrackMultiplicity);
1470   
1471
1472
1473   // II - Calculation Part dedicated to Xi vertices
1474   
1475   for (Int_t iXi = 0; iXi < ncascades; iXi++) {// This is the begining of the Cascade loop (ESD or AOD)
1476            
1477     // -------------------------------------
1478     // II.Init - Initialisation of the local variables that will be needed for ESD/AOD
1479
1480   
1481         // - 0th part of initialisation : around primary vertex ...
1482         
1483     Double_t lTrkgPrimaryVtxRadius3D = -500.0;
1484     Double_t lBestPrimaryVtxRadius3D = -500.0;
1485
1486         // - 1st part of initialisation : variables needed to store AliESDCascade data members
1487     Double_t lEffMassXi      = 0. ;
1488     Double_t lChi2Xi         = -1. ;
1489     Double_t lDcaXiDaughters = -1. ;
1490     Double_t lXiCosineOfPointingAngle = -1. ;
1491     Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
1492     Double_t lXiRadius = -1000. ;
1493         
1494         // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
1495     UShort_t    lPosTPCClusters    = -1; // For ESD only ...
1496     UShort_t    lNegTPCClusters    = -1; // For ESD only ...
1497     UShort_t    lBachTPCClusters   = -1; // For ESD only ...
1498         
1499     Double_t lInnerWallMomCascDghters[3] = {-100., -100., -100.};
1500     Double_t lTPCSignalCascDghters   [3] = {-100., -100., -100.};
1501        
1502         
1503         // - 3rd part of initialisation : about V0 part in cascades
1504     Double_t lInvMassLambdaAsCascDghter = 0.;
1505     Double_t lV0Chi2Xi         = -1. ;
1506     Double_t lDcaV0DaughtersXi = -1.;
1507                 
1508     Double_t lDcaBachToPrimVertexXi = -1., lDcaV0ToPrimVertexXi = -1.;
1509     Double_t lDcaPosToPrimVertexXi  = -1.;
1510     Double_t lDcaNegToPrimVertexXi  = -1.;
1511     Double_t lV0CosineOfPointingAngle = -1. ;
1512     Double_t lV0toXiCosineOfPointingAngle = 0. ;
1513
1514     Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
1515     Double_t lV0RadiusXi = -1000.0;
1516     Double_t lV0quality  = 0.;
1517
1518         
1519         // - 4th part of initialisation : Effective masses
1520     Double_t lInvMassXiMinus    = 0.;
1521     Double_t lInvMassXiPlus     = 0.;
1522     Double_t lInvMassOmegaMinus = 0.;
1523     Double_t lInvMassOmegaPlus  = 0.;
1524   
1525         // - 5th part of initialisation : PID treatment
1526     Bool_t   lIsPosInXiProton      = kFALSE;
1527     Bool_t   lIsPosInXiPion        = kFALSE;
1528     Bool_t   lIsPosInOmegaProton   = kFALSE;
1529     Bool_t   lIsPosInOmegaPion     = kFALSE;
1530                         
1531     Bool_t   lIsNegInXiProton      = kFALSE;
1532     Bool_t   lIsNegInXiPion        = kFALSE;
1533     Bool_t   lIsNegInOmegaProton   = kFALSE;
1534     Bool_t   lIsNegInOmegaPion     = kFALSE;
1535
1536     Bool_t   lIsBachelorKaon       = kFALSE;
1537     Bool_t   lIsBachelorPion       = kFALSE; 
1538         
1539     Bool_t   lIsBachelorKaonForTPC = kFALSE; 
1540     Bool_t   lIsBachelorPionForTPC = kFALSE; 
1541     Bool_t   lIsNegPionForTPC      = kFALSE; 
1542     Bool_t   lIsPosPionForTPC      = kFALSE; 
1543     Bool_t   lIsNegProtonForTPC    = kFALSE; 
1544     Bool_t   lIsPosProtonForTPC    = kFALSE; 
1545
1546         // - 6th part of initialisation : extra info for QA
1547     Double_t lXiMomX       = 0., lXiMomY = 0., lXiMomZ = 0.;
1548     Double_t lXiTransvMom  = 0. ;
1549     Double_t lXiTotMom     = 0. ;
1550     
1551     Double_t lV0PMomX       = 0., lV0PMomY = 0., lV0PMomZ = 0.;
1552     Double_t lV0NMomX       = 0., lV0NMomY = 0., lV0NMomZ = 0.;
1553     Double_t lV0TotMom     = 0. ;
1554
1555                 
1556     Double_t lBachMomX       = 0., lBachMomY  = 0., lBachMomZ   = 0.;
1557     Double_t lBachTransvMom  = 0.;
1558     Double_t lBachTotMom     = 0.;
1559
1560     Double_t lpTrackTransvMom  = 0.;
1561     Double_t lnTrackTransvMom  = 0.;
1562         
1563     Short_t  lChargeXi = -2;
1564         
1565     Double_t lRapXi   = -20.0, lRapOmega = -20.0,  lEta = -20.0, lTheta = 360., lPhi = 720. ;
1566     Double_t lAlphaXi = -200., lPtArmXi  = -200.0;
1567
1568     Float_t  etaBach = 0.;
1569     Float_t  etaPos  = 0.;
1570     Float_t  etaNeg  = 0.; 
1571         
1572         // - 7th part of initialisation : variables for the AliCFContainer dedicated to cascade cut optmisiation
1573   
1574     if (fAnalysisType == "ESD") { 
1575   
1576     // -------------------------------------
1577     // II.ESD - Calculation Part dedicated to Xi vertices (ESD)
1578   
1579       AliESDcascade *xi = lESDevent->GetCascade(iXi);
1580       if (!xi) continue;
1581         
1582         
1583                 // - II.Step 1 : around primary vertex
1584                 //-------------
1585       lTrkgPrimaryVtxRadius3D = TMath::Sqrt(  lTrkgPrimaryVtxPos[0] * lTrkgPrimaryVtxPos[0] +
1586                                               lTrkgPrimaryVtxPos[1] * lTrkgPrimaryVtxPos[1] +
1587                                               lTrkgPrimaryVtxPos[2] * lTrkgPrimaryVtxPos[2] );
1588
1589       lBestPrimaryVtxRadius3D = TMath::Sqrt(  lBestPrimaryVtxPos[0] * lBestPrimaryVtxPos[0] +
1590                                               lBestPrimaryVtxPos[1] * lBestPrimaryVtxPos[1] +
1591                                               lBestPrimaryVtxPos[2] * lBestPrimaryVtxPos[2] );
1592
1593
1594         
1595                 // - II.Step 2 : Assigning the necessary variables for specific AliESDcascade data members (ESD)        
1596                 //-------------
1597       lV0quality = 0.;
1598       xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis : cascade = Xi- decay
1599
1600       lEffMassXi                = xi->GetEffMassXi();
1601       lChi2Xi                   = xi->GetChi2Xi();
1602       lDcaXiDaughters           = xi->GetDcaXiDaughters();
1603       lXiCosineOfPointingAngle  = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0],
1604                                                                        lBestPrimaryVtxPos[1],
1605                                                                        lBestPrimaryVtxPos[2] );
1606                 // Take care : the best available vertex should be used (like in AliCascadeVertexer)
1607         
1608       xi->GetXYZcascade( lPosXi[0],  lPosXi[1], lPosXi[2] ); 
1609       lXiRadius         = TMath::Sqrt( lPosXi[0]*lPosXi[0]  +  lPosXi[1]*lPosXi[1] );
1610                 
1611                 
1612
1613                 // - II.Step 3 : around the tracks : Bach + V0 (ESD)
1614                 // ~ Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1615                 //-------------
1616                 
1617       UInt_t lIdxPosXi  = (UInt_t) TMath::Abs( xi->GetPindex() );
1618       UInt_t lIdxNegXi  = (UInt_t) TMath::Abs( xi->GetNindex() );
1619       UInt_t lBachIdx   = (UInt_t) TMath::Abs( xi->GetBindex() );
1620                 // Care track label can be negative in MC production (linked with the track quality)
1621                 // However = normally, not the case for track index ...
1622         
1623                 // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1624       if (lBachIdx == lIdxNegXi) {
1625         AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
1626       }
1627       if (lBachIdx == lIdxPosXi) {
1628         AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
1629       }
1630         
1631       AliESDtrack *pTrackXi             = lESDevent->GetTrack( lIdxPosXi );
1632       AliESDtrack *nTrackXi             = lESDevent->GetTrack( lIdxNegXi );
1633       AliESDtrack *bachTrackXi          = lESDevent->GetTrack( lBachIdx );
1634       if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1635         AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
1636         continue;
1637       }
1638         
1639       lPosTPCClusters   = pTrackXi->GetTPCNcls();
1640       lNegTPCClusters   = nTrackXi->GetTPCNcls();
1641       lBachTPCClusters  = bachTrackXi->GetTPCNcls();
1642       
1643                 // FIXME : rejection of a poor quality tracks
1644       if (fkQualityCutTPCrefit) {
1645                 // 1 - Poor quality related to TPCrefit
1646         ULong_t pStatus    = pTrackXi->GetStatus();
1647         ULong_t nStatus    = nTrackXi->GetStatus();
1648         ULong_t bachStatus = bachTrackXi->GetStatus();
1649         if ((pStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1650         if ((nStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1651         if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1652       }
1653       if (fkQualityCutnTPCcls) {
1654                 // 2 - Poor quality related to TPC clusters
1655         if (lPosTPCClusters  < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than minn TPC clusters ... continue!"); continue; }
1656         if (lNegTPCClusters  < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than minn TPC clusters ... continue!"); continue; }
1657         if (lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach.   track has less than minn TPC clusters ... continue!"); continue; }
1658       }
1659
1660       etaPos  = pTrackXi->Eta();             
1661       etaNeg  = nTrackXi->Eta();
1662       etaBach = bachTrackXi->Eta();
1663     
1664         
1665       const AliExternalTrackParam *pExtTrack    = pTrackXi    ->GetInnerParam();
1666       const AliExternalTrackParam *nExtTrack    = nTrackXi    ->GetInnerParam();
1667       const AliExternalTrackParam *bachExtTrack = bachTrackXi ->GetInnerParam();
1668        
1669       if (pExtTrack) {
1670         lInnerWallMomCascDghters[0] = pExtTrack ->GetP() * pExtTrack ->Charge();
1671         lTPCSignalCascDghters   [0] = pTrackXi  ->GetTPCsignal();
1672       }
1673       if (nExtTrack) {
1674         lInnerWallMomCascDghters[1] = nExtTrack ->GetP() * nExtTrack ->Charge();
1675         lTPCSignalCascDghters   [1] = nTrackXi  ->GetTPCsignal();
1676       }
1677       if (bachExtTrack) {
1678         lInnerWallMomCascDghters[2] = bachExtTrack ->GetP() * bachExtTrack ->Charge();
1679         lTPCSignalCascDghters   [2] = bachTrackXi  ->GetTPCsignal();
1680       }
1681
1682
1683       lInvMassLambdaAsCascDghter        = xi->GetEffMass();
1684                 // This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
1685       lDcaV0DaughtersXi                 = xi->GetDcaV0Daughters(); 
1686       lV0Chi2Xi                         = xi->GetChi2V0();
1687         
1688       lV0CosineOfPointingAngle  = xi->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],
1689                                                                          lBestPrimaryVtxPos[1],
1690                                                                          lBestPrimaryVtxPos[2] );
1691  
1692       lDcaV0ToPrimVertexXi              = xi->GetD( lBestPrimaryVtxPos[0], 
1693                                                     lBestPrimaryVtxPos[1], 
1694                                                     lBestPrimaryVtxPos[2] );
1695                 
1696       lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD(   lBestPrimaryVtxPos[0], 
1697                                                                 lBestPrimaryVtxPos[1], 
1698                                                                 lMagneticField  ) ); 
1699                 // Note : AliExternalTrackParam::GetD returns an algebraic value ...
1700                 
1701       xi->GetXYZ( lPosV0Xi[0],  lPosV0Xi[1], lPosV0Xi[2] ); 
1702       lV0RadiusXi               = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0]  +  lPosV0Xi[1]*lPosV0Xi[1] );
1703         
1704       lDcaPosToPrimVertexXi     = TMath::Abs( pTrackXi  ->GetD( lBestPrimaryVtxPos[0], 
1705                                                                 lBestPrimaryVtxPos[1], 
1706                                                                 lMagneticField  )     ); 
1707         
1708       lDcaNegToPrimVertexXi     = TMath::Abs( nTrackXi  ->GetD( lBestPrimaryVtxPos[0], 
1709                                                                 lBestPrimaryVtxPos[1], 
1710                                                                 lMagneticField  )     ); 
1711                 
1712                 // - II.Step 3' : extra-selection for cascade candidates
1713       if (fkExtraSelections) {
1714         // if(lChi2Xi > 2000) continue; // in AliCascadeVertexer   
1715         // if(lV0Chi2Xi > 2000) continue; // in AliV0vertexer
1716                 
1717         if (lDcaXiDaughters > 0.3) continue; // in AliCascadeVertexer 
1718         if (lXiCosineOfPointingAngle < 0.999 ) continue; // in AliCascadeVertexer
1719         if (lDcaV0ToPrimVertexXi < 0.05) continue; // in AliCascadeVertexer
1720         if (lDcaBachToPrimVertexXi < 0.03) continue; // in AliCascadeVertexer
1721         // if (TMath::Abs(lInvMassLambdaAsCascDghter-1.11568) > 0.006 ) continue;  // in AliCascadeVertexer 
1722
1723         if (lDcaV0DaughtersXi > 1.) continue; // in AliV0vertexer 
1724         if (lV0toXiCosineOfPointingAngle < 0.998) continue; // in AliV0vertexer
1725         if (lDcaPosToPrimVertexXi < 0.1) continue; // in AliV0vertexer
1726         if (lDcaNegToPrimVertexXi < 0.1) continue; // in AliV0vertexer
1727
1728
1729         if(lXiRadius < .9) continue; // in AliCascadeVertexer
1730         // if(lXiRadius > 100) continue; // in AliCascadeVertexer
1731         if(lV0RadiusXi < 0.9) continue; // in AliV0vertexer  
1732         // if(lV0RadiusXi > 100) continue; // in AliV0vertexer
1733
1734       }
1735         
1736         
1737         
1738                 // - II.Step 4 : around effective masses (ESD)
1739                 // ~ change mass hypotheses to cover all the possibilities :  Xi-/+, Omega -/+
1740                 //-------------
1741
1742         
1743       if ( bachTrackXi->Charge() < 0 )  {
1744         lV0quality = 0.;
1745         xi->ChangeMassHypothesis(lV0quality , 3312);    
1746                         // Calculate the effective mass of the Xi- candidate. 
1747                         // pdg code 3312 = Xi-
1748         lInvMassXiMinus = xi->GetEffMassXi();
1749                 
1750         lV0quality = 0.;
1751         xi->ChangeMassHypothesis(lV0quality , 3334);    
1752                         // Calculate the effective mass of the Xi- candidate. 
1753                         // pdg code 3334 = Omega-
1754         lInvMassOmegaMinus = xi->GetEffMassXi();
1755                                         
1756         lV0quality = 0.;
1757         xi->ChangeMassHypothesis(lV0quality , 3312);    // Back to default hyp.
1758       }// end if negative bachelor
1759         
1760         
1761       if ( bachTrackXi->Charge() >  0 ) {
1762         lV0quality = 0.;
1763         xi->ChangeMassHypothesis(lV0quality , -3312);   
1764                         // Calculate the effective mass of the Xi+ candidate. 
1765                         // pdg code -3312 = Xi+
1766         lInvMassXiPlus = xi->GetEffMassXi();
1767                 
1768         lV0quality = 0.;
1769         xi->ChangeMassHypothesis(lV0quality , -3334);   
1770                         // Calculate the effective mass of the Xi+ candidate. 
1771                         // pdg code -3334  = Omega+
1772         lInvMassOmegaPlus = xi->GetEffMassXi();
1773                 
1774         lV0quality = 0.;
1775         xi->ChangeMassHypothesis(lV0quality , -3312);   // Back to "default" hyp.
1776       }// end if positive bachelor
1777
1778                 // - II.Step 5 : PID on the daughter tracks
1779                 //-------------
1780 /*      
1781         // A - Combined PID */ // removed, add when will be used
1782         
1783         // B - TPC PID : 3-sigma bands on Bethe-Bloch curve
1784         
1785         // Bachelor
1786       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
1787       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
1788       
1789         // Negative V0 daughter
1790       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
1791       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
1792        
1793         // Positive V0 daughter
1794       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
1795       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
1796         
1797       /*
1798       const AliExternalTrackParam *pInnerWallTrackXi    = pTrackXi    ->GetInnerParam();
1799       const AliExternalTrackParam *nInnerWallTrackXi    = nTrackXi    ->GetInnerParam();
1800       const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
1801       if (pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ) {
1802                 
1803         Double_t pMomInnerWall    = pInnerWallTrackXi   ->GetP();
1804         Double_t nMomInnerWall    = nInnerWallTrackXi   ->GetP();
1805         Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
1806               
1807         // Bachelor
1808         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3)                              lIsBachelorPionForTPC = kTRUE;
1809         if (bachMomInnerWall < 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
1810         if (bachMomInnerWall > 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;
1811                 
1812         // Negative V0 daughter
1813         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 3  )                           lIsNegPionForTPC   = kTRUE;
1814         if (nMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 )   lIsNegProtonForTPC = kTRUE;
1815         if (nMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 )   lIsNegProtonForTPC = kTRUE;
1816                 
1817         // Positive V0 daughter
1818         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 3 )                            lIsPosPionForTPC   = kTRUE;
1819         if (pMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5)     lIsPosProtonForTPC = kTRUE;
1820         if (pMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3)     lIsPosProtonForTPC = kTRUE;
1821       }
1822       */
1823                 
1824                 // - II.Step 6 : extra info for QA (ESD)
1825                 // miscellaneous pieces of info that may help regarding data quality assessment.
1826                 //-------------
1827
1828       xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
1829       lXiTransvMom      = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY );
1830       lXiTotMom         = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY   + lXiMomZ*lXiMomZ );
1831
1832       xi->GetNPxPyPz(lV0NMomX,lV0NMomY,lV0NMomZ);
1833       xi->GetPPxPyPz(lV0PMomX,lV0PMomY,lV0PMomZ);
1834       lV0TotMom = TMath::Sqrt(TMath::Power(lV0NMomX+lV0PMomX,2)+TMath::Power(lV0NMomY+lV0PMomY,2)+TMath::Power(lV0NMomZ+lV0PMomZ,2));
1835                 
1836       xi->GetBPxPyPz(  lBachMomX,  lBachMomY,  lBachMomZ );
1837       lBachTransvMom  = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY );
1838       lBachTotMom       = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY  +  lBachMomZ*lBachMomZ  );
1839
1840       lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX   + lV0NMomY*lV0NMomY );
1841       lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX   + lV0PMomY*lV0PMomY );
1842
1843
1844       lChargeXi = xi->Charge();
1845
1846       lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
1847         
1848       lRapXi    = xi->RapXi();
1849       lRapOmega = xi->RapOmega();
1850       lEta      = xi->Eta();
1851       lTheta    = xi->Theta() *180.0/TMath::Pi();
1852       lPhi      = xi->Phi()   *180.0/TMath::Pi();
1853       lAlphaXi  = xi->AlphaXi();
1854       lPtArmXi  = xi->PtArmXi();
1855         
1856         
1857         //FIXME : Extra-cut = Anti-splitting cut for lambda daughters
1858       Bool_t kAntiSplittingLambda = kFALSE;
1859         
1860       if (kAntiSplittingLambda) { // not used
1861         Double_t lNMomX = 0., lNMomY = 0., lNMomZ = 0.;
1862         Double_t lPMomX = 0., lPMomY = 0., lPMomZ = 0.;
1863                 
1864         xi->GetPPxPyPz(lPMomX, lPMomY, lPMomZ); 
1865         xi->GetNPxPyPz(lNMomX, lNMomY, lNMomZ); 
1866                 
1867         if ( xi->Charge() < 0) {// Xi- or Omega-
1868           if (TMath::Abs(lBachTransvMom - TMath::Sqrt( lNMomX*lNMomX + lNMomY*lNMomY )  ) < 0.075) continue;
1869         } else {                //Xi+ or Omega+
1870           if(TMath::Abs(lBachTransvMom - TMath::Sqrt( lPMomX*lPMomX + lPMomY*lPMomY ) ) < 0.075) continue;
1871         }
1872       }
1873         
1874       //FIXME : Just to know which file is currently open : locate the file containing Xi
1875       // cout << "Name of the file containing Xi candidate(s) :" 
1876       //        << CurrentFileName() 
1877       //        << " / entry: "     << Entry()
1878       //        << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
1879       //        << " : mass(Xi) = " << xi->GetEffMassXi() 
1880       //        << " / charge = "   << lChargeXi
1881       //        << " / pt(Casc) = " << lXiTransvMom
1882       //        << " / Decay 2d R(Xi) = " << lXiRadius 
1883       //        << " / Track Index(Pos)  = " << lIdxPosXi << "/ Nb(TPC clusters) = " << lPosTPCClusters 
1884       //        << " / Track Index(Neg)  = " << lIdxNegXi << "/ Nb(TPC clusters) = " << lNegTPCClusters 
1885       //        << " / Track Index(Bach) = " << lBachIdx  << "/ Nb(TPC clusters) = " << lBachTPCClusters 
1886       //        << endl;
1887
1888         
1889     } else if (fAnalysisType == "AOD") {
1890
1891       // II.AOD - Calculation Part dedicated to Xi vertices 
1892         
1893       const AliAODcascade *xi = lAODevent->GetCascade(iXi);
1894       if (!xi) continue;
1895                 
1896                 // - II.Step 1 : Characteristics of the event : prim. Vtx + magnetic field (AOD)
1897                 //-------------
1898         
1899
1900       lTrkgPrimaryVtxRadius3D = -500. ;
1901       // We don't have the different prim. vertex at the AOD level -> nothing to do.
1902
1903       lBestPrimaryVtxRadius3D = TMath::Sqrt(  lBestPrimaryVtxPos[0] * lBestPrimaryVtxPos[0] +
1904                                               lBestPrimaryVtxPos[1] * lBestPrimaryVtxPos[1] +
1905                                               lBestPrimaryVtxPos[2] * lBestPrimaryVtxPos[2] );
1906                 
1907         
1908                 // - II.Step 2 : Assigning the necessary variables for specific AliAODcascade data members (AOD)        
1909                 //-------------
1910         
1911       lEffMassXi                = xi->MassXi(); // default working hypothesis : cascade = Xi- decay
1912       lChi2Xi                   = xi->Chi2Xi();
1913       lDcaXiDaughters           = xi->DcaXiDaughters();
1914       lXiCosineOfPointingAngle  = xi->CosPointingAngleXi( lBestPrimaryVtxPos[0], 
1915                                                           lBestPrimaryVtxPos[1], 
1916                                                           lBestPrimaryVtxPos[2] );
1917                                         // Take care : 
1918                                         // the best available vertex should be used (like in AliCascadeVertexer)
1919
1920       lPosXi[0] = xi->DecayVertexXiX();
1921       lPosXi[1] = xi->DecayVertexXiY();
1922       lPosXi[2] = xi->DecayVertexXiZ();
1923       lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0]  +  lPosXi[1]*lPosXi[1] );
1924                 
1925       AliAODTrack *pTrackXi    = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );
1926       AliAODTrack *nTrackXi    = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );
1927       AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );
1928       if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1929         AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");
1930         continue;
1931       }
1932
1933       UInt_t lIdxPosXi  = (UInt_t) TMath::Abs( pTrackXi->GetID() );  
1934       UInt_t lIdxNegXi  = (UInt_t) TMath::Abs( nTrackXi->GetID() );
1935       UInt_t lBachIdx   = (UInt_t) TMath::Abs( bachTrackXi->GetID() );
1936
1937                 // Care track label can be negative in MC production (linked with the track quality)
1938                 // However = normally, not the case for track index ...
1939
1940                 // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1941       if (lBachIdx == lIdxNegXi) {
1942         AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
1943       }
1944       if (lBachIdx == lIdxPosXi) {
1945         AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
1946       }
1947
1948       lPosTPCClusters   = pTrackXi->GetTPCNcls(); // FIXME: Is this ok? or something like in LambdaK0PbPb task AOD?
1949       lNegTPCClusters   = nTrackXi->GetTPCNcls();
1950       lBachTPCClusters  = bachTrackXi->GetTPCNcls();
1951
1952                 // Rejection of a poor quality tracks
1953       if (fkQualityCutTPCrefit) {
1954                 // 1 - Poor quality related to TPCrefit
1955         if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1956         if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1957         if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1958       }
1959       if (fkQualityCutnTPCcls) {
1960                 // 2 - Poor quality related to TPC clusters
1961         if (lPosTPCClusters  < fMinnTPCcls) { //AliWarning("Pb / V0 Pos. track has less than minn TPC clusters ... continue!");
1962           continue; }
1963         if (lNegTPCClusters  < fMinnTPCcls) { //AliWarning("Pb / V0 Neg. track has less than minn TPC clusters ... continue!");
1964           continue; }
1965         if (lBachTPCClusters < fMinnTPCcls) { //AliWarning("Pb / Bach.   track has less than minn TPC clusters ... continue!");
1966           continue; }
1967       }
1968
1969       etaPos  = pTrackXi->Eta();
1970       etaNeg  = nTrackXi->Eta();
1971       etaBach = bachTrackXi->Eta();
1972
1973
1974
1975                 // - II.Step 3 : around the tracks : Bach + V0 (AOD)
1976                 // ~ Necessary variables for AODcascade data members coming from the AODv0 part (inheritance)
1977                 //-------------
1978                 
1979       lChargeXi                         = xi->ChargeXi();
1980         
1981       if ( lChargeXi < 0)       
1982         lInvMassLambdaAsCascDghter      = xi->MassLambda();
1983       else                      
1984         lInvMassLambdaAsCascDghter      = xi->MassAntiLambda();
1985
1986       lDcaV0DaughtersXi                 = xi->DcaV0Daughters(); 
1987       lV0Chi2Xi                         = xi->Chi2V0();
1988
1989       lDcaV0ToPrimVertexXi              = xi->DcaV0ToPrimVertex();
1990         
1991       lDcaBachToPrimVertexXi            = xi->DcaBachToPrimVertex(); 
1992         
1993         
1994       lPosV0Xi[0] = xi->DecayVertexV0X();
1995       lPosV0Xi[1] = xi->DecayVertexV0Y();
1996       lPosV0Xi[2] = xi->DecayVertexV0Z(); 
1997       lV0RadiusXi       = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0]  +  lPosV0Xi[1]*lPosV0Xi[1] );
1998
1999       lV0CosineOfPointingAngle        = xi->CosPointingAngle( lBestPrimaryVtxPos ); 
2000
2001       lDcaPosToPrimVertexXi             = xi->DcaPosToPrimVertex(); 
2002       lDcaNegToPrimVertexXi             = xi->DcaNegToPrimVertex(); 
2003
2004                 // - II.Step 4 : around effective masses (AOD)
2005                 // ~ change mass hypotheses to cover all the possibilities :  Xi-/+, Omega -/+
2006                 //-------------
2007
2008       if ( lChargeXi < 0 )              lInvMassXiMinus         = xi->MassXi();
2009       if ( lChargeXi > 0 )              lInvMassXiPlus          = xi->MassXi();
2010       if ( lChargeXi < 0 )              lInvMassOmegaMinus      = xi->MassOmega();
2011       if ( lChargeXi > 0 )              lInvMassOmegaPlus       = xi->MassOmega();
2012
2013
2014                 // - II.Step 5 : PID on the daughters 
2015                 //-------------
2016         
2017         // Combined PID
2018         
2019         
2020         // TPC PID: 4-sigma bands on Bethe-Bloch curve
2021
2022         // Bachelor
2023       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
2024       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
2025
2026         // Negative V0 daughter
2027       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
2028       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
2029
2030         // Positive V0 daughter
2031       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
2032       if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
2033
2034         
2035                 // - II.Step 6 : extra info for QA (AOD)
2036                 // miscellaneous pieces onf info that may help regarding data quality assessment.
2037                 //-------------
2038       lXiMomX = xi->MomXiX();
2039       lXiMomY = xi->MomXiY();
2040       lXiMomZ = xi->MomXiZ();
2041       lXiTransvMom      = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY );
2042       lXiTotMom         = TMath::Sqrt( lXiMomX*lXiMomX   + lXiMomY*lXiMomY   + lXiMomZ*lXiMomZ );
2043
2044       Double_t lV0MomX = xi->MomV0X();
2045       Double_t lV0MomY = xi->MomV0Y();
2046       Double_t lV0MomZ = xi->MomV0Z();
2047       lV0TotMom = TMath::Sqrt(TMath::Power(lV0MomX,2)+TMath::Power(lV0MomY,2)+TMath::Power(lV0MomZ,2));
2048
2049       lBachMomX = xi->MomBachX();
2050       lBachMomY = xi->MomBachY();
2051       lBachMomZ = xi->MomBachZ();               
2052       lBachTransvMom  = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY );
2053       lBachTotMom       = TMath::Sqrt( lBachMomX*lBachMomX   + lBachMomY*lBachMomY  +  lBachMomZ*lBachMomZ  );
2054
2055       lV0NMomX = xi->MomNegX();
2056       lV0NMomY = xi->MomNegY();
2057       lV0PMomX = xi->MomPosX();
2058       lV0PMomY = xi->MomPosY(); 
2059
2060       lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX   + lV0NMomY*lV0NMomY );
2061       lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX   + lV0PMomY*lV0PMomY );
2062         
2063       lV0toXiCosineOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );
2064
2065       lRapXi    = xi->RapXi();
2066       lRapOmega = xi->RapOmega();
2067       lEta      = xi->Eta();                            // Will not work ! need a method Pz(), Py() Px() 
2068       lTheta    = xi->Theta() *180.0/TMath::Pi();       // in AODcascade.
2069       lPhi      = xi->Phi()   *180.0/TMath::Pi();       // Here, we will get eta, theta, phi for the V0 ...
2070       lAlphaXi  = xi->AlphaXi();
2071       lPtArmXi  = xi->PtArmXi();
2072
2073                 // II.Step 7 - Complementary info for monitoring the cascade cut variables
2074         // TPC clusters
2075         
2076     }// end of AOD treatment
2077
2078     // Cut on pt of the three daughter tracks
2079     if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;
2080     if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
2081     if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
2082  
2083
2084     // Cut on pseudorapidity of the three daughter tracks
2085     if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;
2086     if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;
2087     if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;
2088
2089
2090     // Calculate proper time for cascade
2091
2092     Double_t cascadeMass = 0.;
2093
2094     if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
2095          ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )  ) cascadeMass = 1.321;
2096
2097     if ( ( (lChargeXi<0) && lIsBachelorKaonForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC ) ||
2098          ( (lChargeXi>0) && lIsBachelorKaonForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )  ) cascadeMass = 1.672;
2099
2100     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));
2101     if (lXiTotMom!=0)         lctau = lctau*cascadeMass/lXiTotMom;
2102     else lctau = -1.;
2103
2104
2105     // Calculate proper time for Lambda (reconstructed)
2106      Float_t lambdaMass = 1.115683; // PDG mass
2107      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));
2108      Float_t lctauV0 = -1.;
2109      if (lV0TotMom!=0) lctauV0 = distV0Xi*lambdaMass/lV0TotMom;
2110
2111      Float_t distTV0Xi =  TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));
2112
2113
2114     // -------------------------------------
2115     // II.Fill - Filling the TH1,2,3Fs, HnSparses, CFContainers, FOR events with CASCADES !
2116     // For AliEVE      
2117 /*         if(lChargeXi < 0&& lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
2118             if (lXiTransvMom>2.&&lXiTransvMom<4.&&(lInvMassXiMinus<1.322&&lInvMassXiMinus>1.320)&&(lXiRadius<8.&&lXiRadius>3.)) {
2119         //                 // FIXME : Just to know which file is currently open : locate the file containing Xi
2120          cout << "Name of the file containing Xi candidate(s) :" 
2121                  << CurrentFileName() 
2122                  << " / entry: "     << Entry()
2123                  << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
2124                  << " AliESDcascade number " << iXi 
2125                  << " : mass(Xi-) = " << lInvMassXiMinus
2126                  << " / charge = "   << lChargeXi
2127                  << " / pt(Casc) = " << lXiTransvMom
2128                  << " / Decay 2d R(Xi) = " << lXiRadius 
2129                  << endl;
2130           }
2131          }
2132          if(lChargeXi < 0&& lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
2133            if (lXiTransvMom>2&&lXiTransvMom<4&&(lInvMassOmegaMinus<1.674&&lInvMassOmegaMinus>1.670)&&(lXiRadius<8.&&lXiRadius>3.)) {
2134          cout << "Name of the file containing Omega candidate(s) :"
2135                  << CurrentFileName()
2136                  << " / entry: "     << Entry()
2137                  << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
2138                  << " AliESDcascade number " << iXi 
2139                  << " : mass(Omega-) = " << lInvMassOmegaMinus
2140                  << " / charge = "   << lChargeXi
2141                  << " / pt(Casc) = " << lXiTransvMom
2142                  << " / Decay 2d R(Xi) = " << lXiRadius
2143                  << endl;
2144
2145            }
2146          }
2147 */
2148           
2149
2150         // - II.Fill.Step 1      : primary vertex
2151   
2152     fHistTPCrefitTrackMultiplicityForCascadeEvt->Fill( nTrackWithTPCrefitMultiplicity );
2153         
2154     fHistPosV0TPCClusters           ->Fill( lPosTPCClusters  );
2155     fHistNegV0TPCClusters           ->Fill( lNegTPCClusters  );
2156     fHistBachTPCClusters            ->Fill( lBachTPCClusters );
2157        
2158     f2dHistTPCdEdxOfCascDghters     ->Fill( lInnerWallMomCascDghters[0] , lTPCSignalCascDghters[0]  );
2159     f2dHistTPCdEdxOfCascDghters     ->Fill( lInnerWallMomCascDghters[1] , lTPCSignalCascDghters[1]  );
2160     f2dHistTPCdEdxOfCascDghters     ->Fill( lInnerWallMomCascDghters[2] , lTPCSignalCascDghters[2]  );
2161         
2162     fHistVtxStatus                  ->Fill( lStatusTrackingPrimVtx   );  // 1 if tracking vtx = ok
2163
2164     if ( lStatusTrackingPrimVtx ) {
2165       fHistPosTrkgPrimaryVtxXForCascadeEvt  ->Fill( lTrkgPrimaryVtxPos[0]    );
2166       fHistPosTrkgPrimaryVtxYForCascadeEvt  ->Fill( lTrkgPrimaryVtxPos[1]    );
2167       fHistPosTrkgPrimaryVtxZForCascadeEvt  ->Fill( lTrkgPrimaryVtxPos[2]    );
2168       fHistTrkgPrimaryVtxRadius             ->Fill( lTrkgPrimaryVtxRadius3D );
2169     }
2170
2171     fHistPosBestPrimaryVtxXForCascadeEvt   ->Fill( lBestPrimaryVtxPos[0]    );
2172     fHistPosBestPrimaryVtxYForCascadeEvt   ->Fill( lBestPrimaryVtxPos[1]    );
2173     fHistPosBestPrimaryVtxZForCascadeEvt   ->Fill( lBestPrimaryVtxPos[2]    );
2174     fHistBestPrimaryVtxRadius              ->Fill( lBestPrimaryVtxRadius3D  );
2175         
2176     f2dHistTrkgPrimVtxVsBestPrimVtx->Fill( lTrkgPrimaryVtxRadius3D, lBestPrimaryVtxRadius3D );
2177
2178         // **************************** With PID on ? ... for the signal region ? ************FIXME**************************************
2179     if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
2180          ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )  )
2181                 // NOTE : 
2182                 // with this condition, it could happen that a cascade candidate satisfies the wrong requirement,
2183                 // e.g. one looks at a Xi- candidate for which lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC = kFALSE
2184                 //      Expectation: it should be excluded.
2185                 //      but lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC = kTRUE
2186                 //      then this bad Xi-candidate will contribute anyway (OR condition).
2187                 // Hence : the extra condition on the sign of the Cascade
2188                                                                                                  {
2189                 //         if( TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.010 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.010)
2190                         
2191                 // II.Fill.Step 2
2192       fHistEffMassXi                    ->Fill( lEffMassXi               );
2193       fHistChi2Xi                       ->Fill( lChi2Xi                  );     // Flag CascadeVtxer: Cut Variable a
2194       fHistDcaXiDaughters               ->Fill( lDcaXiDaughters          );     // Flag CascadeVtxer: Cut Variable e 
2195       fHistDcaBachToPrimVertex          ->Fill( lDcaBachToPrimVertexXi   );     // Flag CascadeVtxer: Cut Variable d
2196       fHistXiCosineOfPointingAngle      ->Fill( lXiCosineOfPointingAngle );     // Flag CascadeVtxer: Cut Variable f
2197       fHistXiRadius                     ->Fill( lXiRadius                );     // Flag CascadeVtxer: Cut Variable g+h
2198                 
2199                 
2200                 // II.Fill.Step 3
2201       fHistMassLambdaAsCascDghter       ->Fill( lInvMassLambdaAsCascDghter );   // Flag CascadeVtxer: Cut Variable c
2202       fHistV0Chi2Xi                     ->Fill( lV0Chi2Xi                  );   
2203       fHistDcaV0DaughtersXi             ->Fill( lDcaV0DaughtersXi          );
2204       fHistV0CosineOfPointingAngle      ->Fill( lV0CosineOfPointingAngle   ); 
2205       fHistV0RadiusXi                   ->Fill( lV0RadiusXi                );
2206                 
2207       fHistDcaV0ToPrimVertexXi  ->Fill( lDcaV0ToPrimVertexXi       );   // Flag CascadeVtxer: Cut Variable b
2208       fHistDcaPosToPrimVertexXi ->Fill( lDcaPosToPrimVertexXi      );
2209       fHistDcaNegToPrimVertexXi ->Fill( lDcaNegToPrimVertexXi      );
2210                 
2211         
2212                 // II.Fill.Step 4 : extra QA info
2213                 
2214       fHistChargeXi                   ->Fill( lChargeXi      );
2215       fHistV0toXiCosineOfPointingAngle->Fill( lV0toXiCosineOfPointingAngle );
2216         
2217       if ( TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.012 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.012) {// One InvMass should be different from 0
2218         fHistXiTransvMom        ->Fill( lXiTransvMom   );
2219         fHistXiTotMom           ->Fill( lXiTotMom      );
2220         
2221         fHistBachTransvMomXi    ->Fill( lBachTransvMom );
2222         fHistPosTransvMomXi    ->Fill( lpTrackTransvMom );
2223         fHistNegTransvMomXi    ->Fill( lnTrackTransvMom );
2224         fHistBachTotMomXi       ->Fill( lBachTotMom    );
2225         
2226         fHistRapXi              ->Fill( lRapXi         );
2227         fHistEtaXi              ->Fill( lEta           );
2228         fHistThetaXi            ->Fill( lTheta         );
2229         fHistPhiXi              ->Fill( lPhi           );
2230       }
2231
2232       if ( TMath::Abs( lInvMassOmegaMinus-1.672 ) < 0.012 || TMath::Abs( lInvMassOmegaPlus-1.672 ) < 0.012 ) {// One InvMass should be different from 0
2233         fHistRapOmega           ->Fill( lRapOmega            ); 
2234       }
2235         
2236       f2dHistArmenteros         ->Fill( lAlphaXi, lPtArmXi   );
2237     }// end with PID ...
2238         
2239         // II.Fill.Step 5 : inv mass plots 1D
2240     if ( lChargeXi < 0 ) {
2241       fHistMassXiMinus         ->Fill( lInvMassXiMinus    );
2242       fHistMassOmegaMinus      ->Fill( lInvMassOmegaMinus );
2243       if(lIsBachelorPion)       fHistMassWithCombPIDXiMinus    ->Fill( lInvMassXiMinus    );
2244       if(lIsBachelorKaon)       fHistMassWithCombPIDOmegaMinus ->Fill( lInvMassOmegaMinus );
2245
2246       fHistDcaXiDaughtersvsInvMass->Fill(lDcaXiDaughters,lInvMassXiMinus);
2247       fHistDcaBachToPrimVertexvsInvMass->Fill(lDcaBachToPrimVertexXi,lInvMassXiMinus); 
2248       fHistXiCosineOfPointingAnglevsInvMass->Fill(lXiCosineOfPointingAngle,lInvMassXiMinus);
2249       fHistMassLambdaAsCascDghtervsInvMass->Fill(lInvMassLambdaAsCascDghter,lInvMassXiMinus);
2250       fHistDcaV0DaughtersXivsInvMass->Fill(lDcaV0DaughtersXi,lInvMassXiMinus);
2251       fHistDcaV0ToPrimVertexXivsInvMass->Fill(lDcaV0ToPrimVertexXi,lInvMassXiMinus);
2252     }
2253         
2254     if ( lChargeXi > 0 ) {
2255       fHistMassXiPlus                  ->Fill( lInvMassXiPlus     );
2256       fHistMassOmegaPlus               ->Fill( lInvMassOmegaPlus  );
2257       if(lIsBachelorPion)       fHistMassWithCombPIDXiPlus     ->Fill( lInvMassXiPlus     );
2258       if(lIsBachelorKaon)       fHistMassWithCombPIDOmegaPlus  ->Fill( lInvMassOmegaPlus  );
2259     }
2260         
2261         
2262         // II.Fill.Step 6 : inv mass plots 2D, 3D
2263     if ( lChargeXi < 0 ) {
2264       f2dHistEffMassLambdaVsEffMassXiMinus->Fill( lInvMassLambdaAsCascDghter, lInvMassXiMinus ); 
2265       f2dHistEffMassXiVsEffMassOmegaMinus ->Fill( lInvMassXiMinus, lInvMassOmegaMinus );
2266       f2dHistXiRadiusVsEffMassXiMinus     ->Fill( lXiRadius, lInvMassXiMinus );
2267       f2dHistXiRadiusVsEffMassOmegaMinus  ->Fill( lXiRadius, lInvMassOmegaMinus );
2268 //      f3dHistXiPtVsEffMassVsYXiMinus      ->Fill( lXiTransvMom, lInvMassXiMinus,    lRapXi    );
2269 //      f3dHistXiPtVsEffMassVsYOmegaMinus   ->Fill( lXiTransvMom, lInvMassOmegaMinus, lRapOmega );
2270     } else {
2271       f2dHistEffMassLambdaVsEffMassXiPlus ->Fill( lInvMassLambdaAsCascDghter, lInvMassXiPlus );
2272       f2dHistEffMassXiVsEffMassOmegaPlus  ->Fill( lInvMassXiPlus, lInvMassOmegaPlus );
2273       f2dHistXiRadiusVsEffMassXiPlus      ->Fill( lXiRadius, lInvMassXiPlus);
2274       f2dHistXiRadiusVsEffMassOmegaPlus   ->Fill( lXiRadius, lInvMassOmegaPlus );
2275 //      f3dHistXiPtVsEffMassVsYXiPlus       ->Fill( lXiTransvMom, lInvMassXiPlus,    lRapXi    );
2276 //      f3dHistXiPtVsEffMassVsYOmegaPlus    ->Fill( lXiTransvMom, lInvMassOmegaPlus, lRapOmega );
2277     }
2278         
2279         // - Filling the AliCFContainers related to PID
2280         
2281     Double_t lContainerPIDVars[4] = {0.0};
2282         
2283         // Xi Minus             
2284     if ( lChargeXi < 0 ) {
2285       lContainerPIDVars[0] = lXiTransvMom       ;
2286       lContainerPIDVars[1] = lInvMassXiMinus    ;
2287       lContainerPIDVars[2] = lRapXi             ;
2288       lContainerPIDVars[3] = lcentrality;
2289                         
2290                 // No PID
2291       fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 0); // No PID
2292                 // TPC PID
2293       if ( lIsBachelorPionForTPC  )
2294         fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2295                 
2296       if ( lIsBachelorPionForTPC && 
2297            lIsPosProtonForTPC     )
2298         fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2299                 
2300       if ( lIsBachelorPionForTPC && 
2301            lIsPosProtonForTPC    && 
2302            lIsNegPionForTPC       )
2303         fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2304                 
2305                 // Combined PID
2306       if ( lIsBachelorPion        )
2307         fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2308                 
2309       if ( lIsBachelorPion       && 
2310            lIsPosInXiProton    )
2311         fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2312                 
2313       if (lIsBachelorPion     && 
2314           lIsPosInXiProton && 
2315           lIsNegInXiPion    )
2316         fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2317     }
2318         
2319     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; lContainerPIDVars[3] = 0.;
2320         
2321     // Xi Plus          
2322     if ( lChargeXi > 0 ) {
2323       lContainerPIDVars[0] = lXiTransvMom       ;
2324       lContainerPIDVars[1] = lInvMassXiPlus     ;
2325       lContainerPIDVars[2] = lRapXi             ;
2326       lContainerPIDVars[3] = lcentrality;
2327                         
2328                 // No PID
2329       fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 0); // No PID
2330                 // TPC PID
2331       if ( lIsBachelorPionForTPC  )
2332         fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2333                 
2334       if ( lIsBachelorPionForTPC && 
2335            lIsNegProtonForTPC     )
2336         fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2337                 
2338       if ( lIsBachelorPionForTPC && 
2339            lIsNegProtonForTPC    && 
2340            lIsPosPionForTPC       )
2341         fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2342                 
2343                 // Combined PID
2344       if ( lIsBachelorPion        )
2345         fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2346                 
2347       if ( lIsBachelorPion       && 
2348           lIsNegInXiProton    )
2349         fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2350                 
2351       if (lIsBachelorPion     && 
2352           lIsNegInXiProton && 
2353           lIsPosInXiPion    )
2354         fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2355     }
2356         
2357     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; lContainerPIDVars[3] = 0.;
2358         
2359         // Omega Minus          
2360     if ( lChargeXi < 0 ) {
2361       lContainerPIDVars[0] = lXiTransvMom       ;
2362       lContainerPIDVars[1] = lInvMassOmegaMinus ;
2363       lContainerPIDVars[2] = lRapOmega          ;
2364       lContainerPIDVars[3] = lcentrality;
2365                 
2366                 // No PID
2367       fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 0); // No PID
2368                 // TPC PID
2369       if ( lIsBachelorKaonForTPC  )
2370         fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2371                 
2372       if ( lIsBachelorKaonForTPC && 
2373            lIsPosProtonForTPC     )
2374         fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2375                 
2376       if ( lIsBachelorKaonForTPC && 
2377            lIsPosProtonForTPC    && 
2378            lIsNegPionForTPC       )
2379         fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2380                 
2381                 // Combined PID
2382       if ( lIsBachelorKaon        )
2383         fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2384                 
2385       if ( lIsBachelorKaon       && 
2386            lIsPosInOmegaProton    )
2387         fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2388                 
2389       if (lIsBachelorKaon     && 
2390           lIsPosInOmegaProton && 
2391           lIsNegInOmegaPion    )
2392         fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2393     }
2394         
2395     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; lContainerPIDVars[3] = 0.;
2396         
2397         // Omega Plus           
2398     if ( lChargeXi > 0 ) {
2399       lContainerPIDVars[0] = lXiTransvMom       ;
2400       lContainerPIDVars[1] = lInvMassOmegaPlus ;
2401       lContainerPIDVars[2] = lRapOmega          ;
2402       lContainerPIDVars[3] = lcentrality;
2403                         
2404                 // No PID
2405       fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 0); // No PID
2406                 // TPC PID
2407       if ( lIsBachelorKaonForTPC  )
2408         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2409                 
2410       if( lIsBachelorKaonForTPC && 
2411           lIsNegProtonForTPC     )
2412         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2413                 
2414       if ( lIsBachelorKaonForTPC && 
2415            lIsNegProtonForTPC    && 
2416            lIsPosPionForTPC       )
2417         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2418                 
2419                 // Combined PID
2420       if ( lIsBachelorKaon        )
2421         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2422                 
2423       if ( lIsBachelorKaon       && 
2424            lIsNegInOmegaProton    )
2425         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2426                 
2427       if (lIsBachelorKaon     && 
2428           lIsNegInOmegaProton && 
2429           lIsPosInOmegaPion    )
2430         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2431     }
2432         
2433                 
2434         // II.Fill.Step 7 : filling the AliCFContainer (optimisation of topological selections)
2435        Double_t lContainerCutVars[22] = {0.0};
2436                         
2437        lContainerCutVars[0]  = lDcaXiDaughters;
2438        lContainerCutVars[1]  = lDcaBachToPrimVertexXi;
2439        lContainerCutVars[2]  = lXiCosineOfPointingAngle;
2440        lContainerCutVars[3]  = lXiRadius;
2441        lContainerCutVars[4]  = lInvMassLambdaAsCascDghter;
2442        lContainerCutVars[5]  = lDcaV0DaughtersXi;
2443        lContainerCutVars[6]  = lV0CosineOfPointingAngle;//lV0toXiCosineOfPointingAngle;
2444        lContainerCutVars[7]  = lV0RadiusXi;
2445        lContainerCutVars[8]  = lDcaV0ToPrimVertexXi;    
2446        lContainerCutVars[9]  = lDcaPosToPrimVertexXi;
2447        lContainerCutVars[10] = lDcaNegToPrimVertexXi;
2448        
2449        lContainerCutVars[13] = lXiTransvMom;
2450         
2451        lContainerCutVars[16] = lBestPrimaryVtxPos[2];
2452        lContainerCutVars[17] = lcentrality;  
2453        lContainerCutVars[18] = lPrimaryTrackMultiplicity;       
2454 //       lContainerCutVars[19] = lBachTPCClusters;                
2455        
2456        lContainerCutVars[19] = lctau;
2457        lContainerCutVars[20] = lctauV0;
2458        lContainerCutVars[21] = distTV0Xi;
2459  
2460        if ( lChargeXi < 0 ) {
2461          lContainerCutVars[11] = lInvMassXiMinus;
2462          lContainerCutVars[12] = lInvMassOmegaMinus;//1.63;
2463          lContainerCutVars[14] = lRapXi;
2464          lContainerCutVars[15] = -1.;
2465          if ( lIsBachelorPionForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC ) {
2466            fCFContCascadeCuts->Fill(lContainerCutVars,0); // for Xi-
2467            fHistEtaBachXiM->Fill(etaBach); 
2468            fHistEtaPosXiM->Fill(etaPos);
2469            fHistEtaNegXiM->Fill(etaNeg);
2470            }
2471          lContainerCutVars[11] = lInvMassXiMinus;
2472          lContainerCutVars[12] = lInvMassOmegaMinus;
2473          lContainerCutVars[14] = -1.;
2474          lContainerCutVars[15] = lRapOmega;
2475          if ( lIsBachelorKaonForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC )
2476            fCFContCascadeCuts->Fill(lContainerCutVars,2); // for Omega-
2477        } else {
2478          lContainerCutVars[11] = lInvMassXiPlus;
2479          lContainerCutVars[12] = lInvMassOmegaPlus;//1.63;
2480          lContainerCutVars[14] = lRapXi;
2481          lContainerCutVars[15] = -1.; 
2482          if ( lIsBachelorPionForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )
2483            fCFContCascadeCuts->Fill(lContainerCutVars,1); // for Xi+
2484
2485          lContainerCutVars[11] = lInvMassXiPlus;//1.26;
2486          lContainerCutVars[12] = lInvMassOmegaPlus;
2487          lContainerCutVars[14] = -1.;
2488          lContainerCutVars[15] = lRapOmega;
2489          if ( lIsBachelorKaonForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )
2490            fCFContCascadeCuts->Fill(lContainerCutVars,3); // for Omega+
2491        }
2492                         
2493    }// end of the Cascade loop (ESD or AOD)
2494     
2495   
2496   // Post output data.
2497  PostData(1, fListHistCascade);
2498  PostData(2, fCFContCascadePIDXiMinus);
2499  PostData(3, fCFContCascadePIDXiPlus);
2500  PostData(4, fCFContCascadePIDOmegaMinus);
2501  PostData(5, fCFContCascadePIDOmegaPlus);   
2502  PostData(6, fCFContCascadeCuts); 
2503 }
2504
2505 //________________________________________________________________________
2506 Int_t AliAnalysisTaskCheckCascadePbPb::DoESDTrackWithTPCrefitMultiplicity(const AliESDEvent *lESDevent) {
2507     // Checking the number of tracks with TPCrefit for each event
2508     // Needed for a rough assessment of the event multiplicity
2509         
2510     Int_t nTrackWithTPCrefitMultiplicity = 0;
2511     for (Int_t iTrackIdx = 0; iTrackIdx < (InputEvent())->GetNumberOfTracks(); iTrackIdx++) {
2512       AliESDtrack *esdTrack     = 0x0;
2513       esdTrack  = lESDevent->GetTrack( iTrackIdx );
2514       if (!esdTrack) { AliWarning("Pb / Could not retrieve one track within the track loop for TPCrefit check ..."); continue; }
2515
2516       ULong_t lTrackStatus    = esdTrack->GetStatus();
2517       if ((lTrackStatus&AliESDtrack::kTPCrefit)    == 0) continue;
2518       else nTrackWithTPCrefitMultiplicity++;
2519                     // FIXME :
2520                     // The goal here is to get a better assessment of the event multiplicity.
2521                     // (InputEvent())->GetNumberOfTracks() takes into account ITS std alone tracks + global tracks
2522                     // This may introduce a bias. Hence the number of TPC refit tracks.
2523                     // Note : the event multiplicity = analysis on its own... See Jacek's or Jan Fiete's analysis on dN/d(eta)
2524
2525     }// end loop over all event tracks
2526     return  nTrackWithTPCrefitMultiplicity;
2527 }
2528
2529 //________________________________________________________________________
2530 void AliAnalysisTaskCheckCascadePbPb::Terminate(Option_t *) 
2531 {
2532   // Draw result to the screen
2533   // Called once at the end of the query
2534
2535   TList *cRetrievedList = 0x0;
2536          cRetrievedList = (TList*)GetOutputData(1);
2537         if(!cRetrievedList){
2538                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: ouput data container list not available\n"); return;
2539         }
2540
2541   fHistTrackMultiplicityForCentrEvt = dynamic_cast<TH1F*> (   cRetrievedList->FindObject("fHistTrackMultiplicityForCentrEvt") );
2542   if (!fHistTrackMultiplicityForCentrEvt) {
2543                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: fHistTrackMultiplicityForCentrEvt not available\n"); return;
2544         }
2545  
2546   fHistCascadeMultiplicityForCentrEvt = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistCascadeMultiplicityForCentrEvt") );
2547         if (!fHistCascadeMultiplicityForCentrEvt) {
2548                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: fHistCascadeMultiplicityForCentrEvt not available\n"); return;
2549         }
2550         
2551   fHistMassXiMinus    = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiMinus") ); 
2552         if (!fHistMassXiMinus) {
2553                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: fHistMassXiMinus not available\n"); return;
2554         }
2555   fHistMassXiPlus     = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiPlus") );
2556         if (!fHistMassXiPlus) {
2557                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: fHistMassXiPlus not available\n"); return;
2558         }       
2559   fHistMassOmegaMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaMinus") );
2560         if (!fHistMassOmegaMinus) {
2561                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: fHistMassOmegaMinus not available\n"); return;
2562         }
2563   fHistMassOmegaPlus  = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaPlus") );       
2564         if (!fHistMassOmegaPlus) {
2565                 AliWarning("ERROR - AliAnalysisTaskCheckCascadePbPb: fHistMassOmegaPlus not available\n"); return;
2566         }
2567   
2568   TCanvas *canCheckCascade = new TCanvas("AliAnalysisTaskCheckCascadePbPb","CheckCascade overview",10,10,1010,660);
2569   canCheckCascade->Divide(2,2);
2570   
2571   canCheckCascade->cd(1);
2572   canCheckCascade->cd(1)->SetLogy();
2573   fHistTrackMultiplicityForCentrEvt->SetMarkerStyle(kFullStar);  
2574   fHistTrackMultiplicityForCentrEvt->GetXaxis()->SetLabelFont(42);
2575   fHistTrackMultiplicityForCentrEvt->GetYaxis()->SetLabelFont(42);
2576   fHistTrackMultiplicityForCentrEvt->SetTitleFont(42, "xy");
2577   fHistTrackMultiplicityForCentrEvt->GetXaxis()->SetTitleOffset(1.1);
2578   fHistTrackMultiplicityForCentrEvt->DrawCopy("H");
2579   
2580   canCheckCascade->cd(2);  
2581   canCheckCascade->cd(2)->SetLogy();
2582   fHistCascadeMultiplicityForCentrEvt->SetMarkerStyle(kOpenSquare);
2583   fHistCascadeMultiplicityForCentrEvt->GetXaxis()->SetLabelFont(42);
2584   fHistCascadeMultiplicityForCentrEvt->GetYaxis()->SetLabelFont(42);
2585   fHistCascadeMultiplicityForCentrEvt->SetTitleFont(42, "xy");
2586   fHistCascadeMultiplicityForCentrEvt->GetXaxis()->SetTitleOffset(1.1);
2587   fHistCascadeMultiplicityForCentrEvt->DrawCopy("E");
2588   
2589   canCheckCascade->cd(3);  
2590   fHistMassXiMinus ->SetMarkerStyle(kFullCircle);
2591   fHistMassXiMinus ->SetMarkerSize(0.5);
2592   fHistMassXiMinus ->GetXaxis()->SetLabelFont(42);
2593   fHistMassXiMinus ->GetYaxis()->SetLabelFont(42);
2594   fHistMassXiMinus ->SetTitleFont(42, "xy");
2595   fHistMassXiMinus ->GetXaxis()->SetTitleOffset(1.1);
2596   fHistMassXiMinus ->GetYaxis()->SetTitleOffset(1.3);
2597    // fHistMassXiMinus->Rebin(2);
2598   fHistMassXiMinus ->GetXaxis()->SetRangeUser(1.24, 1.42);
2599   fHistMassXiMinus ->DrawCopy("E");
2600   
2601   fHistMassXiPlus ->SetMarkerStyle(kOpenCircle);
2602   fHistMassXiPlus ->SetMarkerColor(kRed+2);
2603   fHistMassXiPlus ->SetLineColor(kRed+2);
2604   fHistMassXiPlus ->SetMarkerSize(0.5);
2605   // fHistMassXiPlus ->Rebin(2);
2606   fHistMassXiPlus ->DrawCopy("ESAME");
2607   
2608   
2609   TLegend *legendXi =new TLegend(0.67,0.34,0.97,0.54);
2610                 legendXi->SetTextFont(42);
2611                 legendXi->SetTextSize(0.05);
2612                 legendXi->SetFillColor(kWhite);
2613                 legendXi->AddEntry( fHistMassXiMinus,"#Xi^{-} candidates","lp");
2614                 legendXi->AddEntry( fHistMassXiPlus,"#Xi^{+} candidates","lp");
2615                 legendXi->Draw();
2616   
2617   
2618   canCheckCascade->cd(4);  
2619   fHistMassOmegaPlus ->SetMarkerStyle(kOpenCircle);
2620   fHistMassOmegaPlus ->SetMarkerColor(kRed+2);
2621   fHistMassOmegaPlus ->SetLineColor(kRed+2);
2622   fHistMassOmegaPlus ->SetMarkerSize(0.5);
2623   fHistMassOmegaPlus ->GetXaxis()->SetLabelFont(42);
2624   fHistMassOmegaPlus ->GetYaxis()->SetLabelFont(42);
2625   fHistMassOmegaPlus ->SetTitleFont(42, "xy");
2626   fHistMassOmegaPlus ->GetXaxis()->SetTitleOffset(1.1);
2627   fHistMassOmegaPlus ->GetYaxis()->SetTitleOffset(1.25);
2628   // fHistMassOmegaPlus ->Rebin(2);
2629   fHistMassOmegaPlus ->GetXaxis()->SetRangeUser(1.6, 1.84);
2630   fHistMassOmegaPlus ->DrawCopy("E");
2631   
2632   fHistMassOmegaMinus->SetMarkerStyle(kFullCircle);
2633   fHistMassOmegaMinus->SetMarkerSize(0.5);
2634   // fHistMassOmegaMinus->Rebin(2);
2635   fHistMassOmegaMinus->DrawCopy("ESAME");
2636
2637   
2638    TLegend *legendOmega = new TLegend(0.67,0.34,0.97,0.54);
2639                 legendOmega->SetTextFont(42);
2640                 legendOmega->SetTextSize(0.05);
2641                 legendOmega->SetFillColor(kWhite);
2642                 legendOmega->AddEntry( fHistMassOmegaMinus,"#Omega^{-} candidates","lp");
2643                 legendOmega->AddEntry( fHistMassOmegaPlus,"#Omega^{+} candidates","lp");
2644                 legendOmega->Draw();
2645
2646 }