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