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