]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/Cascades/AliAnalysisTaskCheckCascadepp276.cxx
Moved Zvtx-histo position + possibility to run on the same train with different Zvtx...
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Cascades / AliAnalysisTaskCheckCascadepp276.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 //            AliAnalysisTaskCheckCascadepp276 class
16 //
17 //            Origin AliAnalysisTaskCheckCascade which has four roles :
18 //              1. QAing the Cascades from ESD and AOD
19 //                 Origin:  AliAnalysisTaskESDCheckV0 by Boris Hippolyte Nov2007, hippolyt@in2p3.fr
20 //              2. Prepare the plots which stand as raw material for yield extraction (wi/wo PID)
21 //              3. Supply an AliCFContainer meant to define the optimised topological selections
22 //              4. Rough azimuthal correlation study (Eta, Phi)
23 //              Adapted to Cascade : A.Maire Mar2008, antonin.maire@ires.in2p3.fr
24 //              Modified :           A.Maire Mar2010 
25 //
26 //              Adapted to PbPb analysis: M. Nicassio, maria.nicassio@ba.infn.it
27 //               Feb-August2011
28 //                - Physics selection moved to the run.C macro
29 //                - Centrality selection added (+ setters) and histos
30 //                - flag and setters added (CF container usage, vertex range)
31 //                - histo added and histo/container binning changed 
32 //                - protection in the destructor for CAF usage          
33 //                - AliWarning disabled
34 //                - number of tracklets from AOD also          
35 //                - automatic settings for PID
36 //               September2011
37 //                - proper time histos/container added (V0 and Cascades)
38 //                - cosine PA V0 wrt Xi vertex in the container  
39 //               November2011
40 //                - re-run V0's and cascade's vertexers (SetCuts instead SetDefaultCuts!!)
41 //                - problems of libraries on Grid --> code copied in the task (from AliRoot v5-10-AN
42 //                  where new pt dependent V0's cosPA cut implemented by Iouri) 
43 //                - AOD analysis part completed 
44 //
45 //
46 //              Adapted to pp 2.76 analysis: D. Colella, domenico.colella@ba.infn.it
47 //               Gen-now 2012
48 //                - Physics selection re-moved here (mainly for normalization in the efficiency calcuation)
49 //                - Centrality selection deleted
50 //                - 
51 //
52 //-----------------------------------------------------------------
53
54 class TTree;
55 class TParticle;
56 class TVector3;
57
58 class AliESDVertex;
59 class AliAODVertex;
60 class AliESDv0;
61 class AliAODv0;
62
63 #include <Riostream.h>
64 #include "TList.h"
65 #include "TH1.h"
66 #include "TH2.h"
67 #include "TH3.h"
68 #include "THnSparse.h"
69 #include "TVector3.h"
70 #include "TCanvas.h"
71 #include "TMath.h"
72 #include "TLegend.h"
73
74 #include "AliLog.h"
75 #include "AliESDEvent.h"
76 #include "AliAODEvent.h"
77 #include "AliV0vertexer.h"
78 #include "AliCascadeVertexer.h"
79 #include "AliESDtrackCuts.h"
80 #include "AliPIDResponse.h"
81
82 #include "AliESDVZERO.h"
83
84 #include "AliInputEventHandler.h"
85 #include "AliAnalysisManager.h"
86 #include "AliMCEventHandler.h"
87 #include "AliESDInputHandler.h" 
88 #include "AliAODInputHandler.h"
89 #include "AliCFContainer.h"
90 #include "AliMultiplicity.h"
91
92 #include "AliESDcascade.h"
93 #include "AliAODcascade.h"
94 #include "AliAODTrack.h"
95
96 #include "AliAnalysisTaskCheckCascadepp276.h"
97
98
99 using std::cout;
100 using std::endl;
101
102 ClassImp(AliAnalysisTaskCheckCascadepp276)
103
104
105
106 //________________________________________________________________________
107 AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276() 
108   : AliAnalysisTaskSE(), 
109     fAnalysisType               ("ESD"),
110     fESDtrackCuts               (0),
111     fPIDResponse                (0),
112     fkRerunV0CascVertexers      (0),
113     fkSDDSelectionOn            (kTRUE),
114     fkQualityCutZprimVtxPos     (kTRUE),
115     fkQualityCutNoTPConlyPrimVtx(kTRUE),
116     fkQualityCutTPCrefit        (kTRUE),
117     fkQualityCutnTPCcls         (kTRUE),
118     fkQualityCutPileup          (kTRUE),
119     fwithSDD                    (kTRUE),
120     fMinnTPCcls                 (0),
121     fkExtraSelections           (0),
122     fVtxRange                   (0),
123     fVtxRangeMin                (0),
124     fMinPtCutOnDaughterTracks   (0),
125     fEtaCutOnDaughterTracks     (0),
126
127     // - Plots initialisation
128     fListHistCascade(0),
129       // Cascades multiplicity plots
130       fHistCascadeMultiplicityBeforeAnySel(0),
131       fHistCascadeMultiplicityAfterSDDSel(0),
132       fHistCascadeMultiplicityAfterPhysicsSel(0),
133       fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
134       fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
135       fHistCascadeMultiplicityAfterVertexCutSel(0),
136       // Tracks multiplicity plots
137       fHistTrackMultiplicityBeforeAnySel(0),
138       fHistTrackMultiplicityAfterSDDSel(0),
139       fHistTrackMultiplicityAfterPhysicsSel(0),
140       fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
141       fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
142       fHistTrackMultiplicityAfterVertexCutSel(0),
143       // Vertex position plots (BestVertex)
144       fHistPVx(0), fHistPVy(0), fHistPVz(0),
145       fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),    
146       // TPC cluster distributions for daughters
147       fHistPosV0TPCClusters(0), 
148       fHistNegV0TPCClusters(0), 
149       fHistBachTPCClusters(0),
150       // Cut's variables distributions
151       fHistEffMassXi(0), 
152       fHistDcaXiDaughters(0), 
153       fHistDcaBachToPrimVertex(0), 
154       fHistXiCosineOfPointingAngle(0), 
155       fHistXiRadius(0),
156       fHistMassLambdaAsCascDghter(0),
157       fHistDcaV0DaughtersXi(0),
158       fHistDcaV0ToPrimVertexXi(0), 
159       fHistV0CosineOfPointingAngleXi(0),
160       fHistV0RadiusXi(0),
161       fHistDcaPosToPrimVertexXi(0), 
162       fHistDcaNegToPrimVertexXi(0), 
163       // Invariant mass distributions
164       fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),
165       // Transverse and total momentum distributions
166       fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),
167       // Others QA plots
168       fHistChargeXi(0),
169       fHistV0toXiCosineOfPointingAngle(0),
170       fHistRapXi(0), fHistRapOmega(0), 
171       fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),
172       fHistThetaXi(0), 
173       fHistPhiXi(0),
174       f2dHistArmenteros(0),                     
175       f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),
176       f2dHistEffMassLambdaVsEffMassXiPlus(0),  f2dHistEffMassXiVsEffMassOmegaPlus(0),
177       f2dHistXiRadiusVsEffMassXiMinus(0),      f2dHistXiRadiusVsEffMassXiPlus(0),
178       f2dHistXiRadiusVsEffMassOmegaMinus(0),   f2dHistXiRadiusVsEffMassOmegaPlus(0),
179       f2dHistTPCdEdxOfCascDghters(0),
180       f2dHistDcaXiDaughtersvsInvMass(0), 
181       f2dHistDcaBachToPrimVertexvsInvMass(0), 
182       f2dHistXiCosineOfPointingAnglevsInvMass(0),
183       f2dHistMassLambdaAsCascDghtervsInvMass(0),
184       f2dHistDcaV0DaughtersXivsInvMass(0),
185       f2dHistDcaV0ToPrimVertexXivsInvMass(0),
186       // Containers for cuts study 
187       fCFContCascadePIDXiMinus(0),
188       fCFContCascadePIDXiPlus(0),
189       fCFContCascadePIDOmegaMinus(0),
190       fCFContCascadePIDOmegaPlus(0),
191       fCFContCascadeCuts(0)
192     
193     {
194      // Dummy Constructor
195         for(Int_t iV0selIdx   = 0; iV0selIdx   < 7; iV0selIdx++   ) { fV0Sels          [iV0selIdx   ] = -1.; }
196         for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels        [iCascSelIdx ] = -1.; }
197     }
198
199
200 //________________________________________________________________________
201 AliAnalysisTaskCheckCascadepp276::AliAnalysisTaskCheckCascadepp276(const char *name) 
202   : AliAnalysisTaskSE(name), 
203     fAnalysisType               ("ESD"), 
204     fESDtrackCuts               (0), 
205     fPIDResponse                (0),
206     fkRerunV0CascVertexers      (0),
207     fkSDDSelectionOn            (kTRUE),
208     fkQualityCutZprimVtxPos     (kTRUE),
209     fkQualityCutNoTPConlyPrimVtx(kTRUE),
210     fkQualityCutTPCrefit        (kTRUE),
211     fkQualityCutnTPCcls         (kTRUE),
212     fkQualityCutPileup          (kTRUE),
213     fwithSDD                    (kTRUE),
214     fMinnTPCcls                 (0),
215     fkExtraSelections           (0),
216     fVtxRange                   (0),
217     fVtxRangeMin                (0),
218     fMinPtCutOnDaughterTracks   (0),
219     fEtaCutOnDaughterTracks     (0),
220      
221     // - Plots initialisation
222     fListHistCascade(0),
223
224       // Cascades multiplicity plots
225       fHistCascadeMultiplicityBeforeAnySel(0),
226       fHistCascadeMultiplicityAfterSDDSel(0),
227       fHistCascadeMultiplicityAfterPhysicsSel(0),
228       fHistCascadeMultiplicityForSelEvtNoTPCOnly(0),
229       fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
230       fHistCascadeMultiplicityAfterVertexCutSel(0),
231       // Tracks multiplicity plots
232       fHistTrackMultiplicityBeforeAnySel(0),
233       fHistTrackMultiplicityAfterSDDSel(0),
234       fHistTrackMultiplicityAfterPhysicsSel(0),
235       fHistTrackMultiplicityForSelEvtNoTPCOnly(0),
236       fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup(0),
237       fHistTrackMultiplicityAfterVertexCutSel(0),
238       // Vertex position plots (BestVertex)
239       fHistPVx(0), fHistPVy(0), fHistPVz(0),
240       fHistPVxAnalysis(0), fHistPVyAnalysis(0), fHistPVzAnalysis(0),
241       // TPC cluster distributions for daughters
242       fHistPosV0TPCClusters(0), fHistNegV0TPCClusters(0), fHistBachTPCClusters(0),
243       // Cut's variables distributions
244       fHistEffMassXi(0),
245       fHistDcaXiDaughters(0),
246       fHistDcaBachToPrimVertex(0),
247       fHistXiCosineOfPointingAngle(0),
248       fHistXiRadius(0),
249       fHistMassLambdaAsCascDghter(0),
250       fHistDcaV0DaughtersXi(0),
251       fHistDcaV0ToPrimVertexXi(0),
252       fHistV0CosineOfPointingAngleXi(0),
253       fHistV0RadiusXi(0),
254       fHistDcaPosToPrimVertexXi(0),
255       fHistDcaNegToPrimVertexXi(0),
256       // Invariant mass distributions
257       fHistMassXiMinus(0), fHistMassXiPlus(0), fHistMassOmegaMinus(0), fHistMassOmegaPlus(0),
258       // Transverse and total momentum distributions
259       fHistXiTransvMom(0), fHistXiTotMom(0), fHistBachTransvMomXi(0), fHistBachTotMomXi(0),
260       // Others QA plots
261       fHistChargeXi(0),
262       fHistV0toXiCosineOfPointingAngle(0),
263       fHistRapXi(0), fHistRapOmega(0),
264       fHistEtaXi(0), fHistEtaBachXi(0), fHistEtaPosXi(0), fHistEtaNegXi(0),
265       fHistThetaXi(0),
266       fHistPhiXi(0),
267       f2dHistArmenteros(0),
268       f2dHistEffMassLambdaVsEffMassXiMinus(0), f2dHistEffMassXiVsEffMassOmegaMinus(0),
269       f2dHistEffMassLambdaVsEffMassXiPlus(0),  f2dHistEffMassXiVsEffMassOmegaPlus(0),
270       f2dHistXiRadiusVsEffMassXiMinus(0),      f2dHistXiRadiusVsEffMassXiPlus(0),
271       f2dHistXiRadiusVsEffMassOmegaMinus(0),   f2dHistXiRadiusVsEffMassOmegaPlus(0),
272       f2dHistTPCdEdxOfCascDghters(0),
273       f2dHistDcaXiDaughtersvsInvMass(0),
274       f2dHistDcaBachToPrimVertexvsInvMass(0),
275       f2dHistXiCosineOfPointingAnglevsInvMass(0),
276       f2dHistMassLambdaAsCascDghtervsInvMass(0),
277       f2dHistDcaV0DaughtersXivsInvMass(0),
278       f2dHistDcaV0ToPrimVertexXivsInvMass(0),
279       // Containers for cuts study 
280       fCFContCascadePIDXiMinus(0),
281       fCFContCascadePIDXiPlus(0),
282       fCFContCascadePIDOmegaMinus(0),
283       fCFContCascadePIDOmegaPlus(0),
284       fCFContCascadeCuts(0)
285     
286     //_____Costructor____
287     {
288      // Define input and output slots here
289      // Input slot #0 works with a TChain
290      // DefineInput(0, TChain::Class());
291      // Output slot #1 writes into a TList container (cascade)
292         // default p-p values
293         fV0Sels[0] =  33.  ;     // max allowed chi2
294         fV0Sels[1] =   0.073;    // min allowed impact parameter for the 1st daughter 
295         fV0Sels[2] =   0.073;    // min allowed impact parameter for the 2nd daughter 
296         fV0Sels[3] =   1.18;     // max allowed DCA between the daughter tracks       
297         fV0Sels[4] =    .983;    // min allowed cosine of V0's pointing angle         
298         fV0Sels[5] =   2.67;     // min radius of the fiducial volume                 
299         fV0Sels[6] = 100.;       // max radius of the fiducial volume                 
300
301         fCascSels[0] =  33.;     // max allowed chi2 (same as PDC07)
302         fCascSels[1] =   0.03;   // min allowed V0 impact parameter                    
303         fCascSels[2] =   0.008;  // "window" around the Lambda mass                    
304         fCascSels[3] =   0.0204; // min allowed bachelor's impact parameter          
305         fCascSels[4] =   1.68;   // max allowed DCA between the V0 and the bachelor    
306         fCascSels[5] =   0.9826; // min allowed cosine of the cascade pointing angle   
307         fCascSels[6] =   0.38;   // min radius of the fiducial volume                  
308         fCascSels[7] = 100.;     // max radius of the fiducial volume                  
309
310      // Output slot #0 writes into a TList container (Cascade)
311      DefineOutput(1, TList::Class());
312      DefineOutput(2, AliCFContainer::Class());
313      DefineOutput(3, AliCFContainer::Class());
314      DefineOutput(4, AliCFContainer::Class());
315      DefineOutput(5, AliCFContainer::Class());
316      DefineOutput(6, AliCFContainer::Class());
317      AliLog::SetClassDebugLevel("AliAnalysisTaskCheckCascadepp276",1);
318     } 
319
320
321     //_____Destructor_____
322     AliAnalysisTaskCheckCascadepp276::~AliAnalysisTaskCheckCascadepp276() {
323       // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.
324       // They will be deleted when fListCascade is deleted by the TSelector dtor
325       // Because of TList::SetOwner() ...   
326        if (fListHistCascade && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())           { delete fListHistCascade; fListHistCascade = 0x0; }
327        if (fCFContCascadePIDXiMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())   { delete fCFContCascadePIDXiMinus; fCFContCascadePIDXiMinus = 0x0; }
328        if (fCFContCascadePIDXiPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())    { delete fCFContCascadePIDXiPlus; fCFContCascadePIDXiPlus = 0x0; }
329        if (fCFContCascadePIDOmegaMinus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){ delete fCFContCascadePIDOmegaMinus; fCFContCascadePIDOmegaMinus = 0x0; }
330        if (fCFContCascadePIDOmegaPlus && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { delete fCFContCascadePIDOmegaPlus; fCFContCascadePIDOmegaPlus = 0x0; }  
331        if (fCFContCascadeCuts && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())         { delete fCFContCascadeCuts; fCFContCascadeCuts = 0x0; }
332        if (fESDtrackCuts)                                                                          { delete fESDtrackCuts; fESDtrackCuts = 0x0; }
333     }
334
335
336 //________________________________________________________________________
337 void AliAnalysisTaskCheckCascadepp276::UserCreateOutputObjects() {
338   // Create histograms
339   // Called once
340
341
342  fListHistCascade = new TList();
343  fListHistCascade->SetOwner();  // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
344
345  //-----------------------------------------------
346  // Particle Identification Setup (new PID object)
347  //-----------------------------------------------
348  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
349  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
350  fPIDResponse = inputHandler->GetPIDResponse();
351
352  // Only used to get the number of primary reconstructed tracks
353  if (fAnalysisType == "ESD" && (! fESDtrackCuts )){
354    fESDtrackCuts = new AliESDtrackCuts();
355  }
356
357  //---------------------------------------------------
358  // Initialize cuts to re-run V0 and cascade vertexers
359  //---------------------------------------------------
360  // Not validated; to be checked
361  fV0Sels[0] =  33.  ;     // max allowed chi2
362  fV0Sels[1] =   0.073;    // min allowed impact parameter for the 1st daughter 
363  fV0Sels[2] =   0.073;    // min allowed impact parameter for the 2nd daughter 
364  fV0Sels[3] =   1.18;     // max allowed DCA between the daughter tracks       
365  fV0Sels[4] =    .983;    // min allowed cosine of V0's pointing angle         
366  fV0Sels[5] =   2.67;     // min radius of the fiducial volume                 
367  fV0Sels[6] = 100.;       // max radius of the fiducial volume                 
368
369  fCascSels[0] =  33.;     // max allowed chi2 (same as PDC07)
370  fCascSels[1] =   0.03;   // min allowed V0 impact parameter                    
371  fCascSels[2] =   0.008;  // "window" around the Lambda mass                    
372  fCascSels[3] =   0.0204; // min allowed bachelor's impact parameter           //check cuts 
373  fCascSels[4] =   1.68;   // max allowed DCA between the V0 and the bachelor    
374  fCascSels[5] =   0.9826; // min allowed cosine of the cascade pointing angle   
375  fCascSels[6] =   0.38;   // min radius of the fiducial volume                  
376  fCascSels[7] = 100.;     // max radius of the fiducial volume 
377
378  //----------------------
379  // Initialize the histos
380  //----------------------
381  
382  // - Cascades multiplicity plots 
383  if(! fHistCascadeMultiplicityBeforeAnySel) {
384         fHistCascadeMultiplicityBeforeAnySel = new TH1F("fHistCascadeMultiplicityBeforeAnySel",
385                         "Cascades per event (before any selections);Nbr of Cascades/Evt;Events",                
386                         50, 0, 50);
387         fListHistCascade->Add(fHistCascadeMultiplicityBeforeAnySel);
388  }
389  if(! fHistCascadeMultiplicityAfterSDDSel) {
390         fHistCascadeMultiplicityAfterSDDSel = new TH1F("fHistCascadeMultiplicityAfterSDDSel", 
391                         "Cascades per event (after the SDD selection);Nbr of Cascades/Evt;Events", 
392                         50, 0, 50);             
393         fListHistCascade->Add(fHistCascadeMultiplicityAfterSDDSel);
394  }
395  if(! fHistCascadeMultiplicityAfterPhysicsSel) {
396         fHistCascadeMultiplicityAfterPhysicsSel = new TH1F("fHistCascadeMultiplicityAfterPhysicsSel",
397                         "Cascades per event (after physics selection);Nbr of Cascades/Evt;Events",
398                         50, 0, 50);
399         fListHistCascade->Add(fHistCascadeMultiplicityAfterPhysicsSel);
400  }
401  if(! fHistCascadeMultiplicityForSelEvtNoTPCOnly) {
402         fHistCascadeMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnly",
403                         "Cascades per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",
404                         50, 0, 50);
405         fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnly);
406  }
407  if(! fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup) {
408         fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup",
409                         "Cascades per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",
410                         50, 0, 50);
411         fListHistCascade->Add(fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup);
412  }
413  if(! fHistCascadeMultiplicityAfterVertexCutSel) {
414         fHistCascadeMultiplicityAfterVertexCutSel = new TH1F("fHistCascadeMultiplicityAfterVertexCutSel",
415                                                              "Cascades per event (after vertex cut selection);Nbr of Cascades/Evt;Events",
416                                                              50, 0, 50);
417         fListHistCascade->Add(fHistCascadeMultiplicityAfterVertexCutSel);
418  }
419  // - Tracks multiplicity plots 
420  if(! fHistTrackMultiplicityBeforeAnySel) {
421         fHistTrackMultiplicityBeforeAnySel = new TH1F("fHistTrackMultiplicityBeforeAnySel", 
422                         "Tracks per event (before any selections);Nbr of Cascades/Evt;Events", 
423                         200, 0, 200);           
424         fListHistCascade->Add(fHistTrackMultiplicityBeforeAnySel);
425  } 
426  if(! fHistTrackMultiplicityAfterSDDSel) {
427         fHistTrackMultiplicityAfterSDDSel = new TH1F("fHistTrackMultiplicityAfterSDDSel",                  
428                         "Tracks per event (after the SDD selection);Nbr of Cascades/Evt;Events",
429                         200, 0, 200);
430         fListHistCascade->Add(fHistTrackMultiplicityAfterSDDSel);
431  }
432  if(! fHistTrackMultiplicityAfterPhysicsSel) {
433         fHistTrackMultiplicityAfterPhysicsSel = new TH1F("fHistTrackMultiplicityAfterPhysicsSel",
434                         "Tracks per event (after physics selection);Nbr of Cascades/Evt;Events",
435                         200, 0, 200);
436         fListHistCascade->Add(fHistTrackMultiplicityAfterPhysicsSel);
437  }
438  if(! fHistTrackMultiplicityForSelEvtNoTPCOnly) {
439         fHistTrackMultiplicityForSelEvtNoTPCOnly = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnly",
440                         "Tracks per event (for selected events with well-established PV);Nbr of Cascades/Evt;Events",
441                         200, 0, 200);
442         fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnly);
443  }
444  if(! fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup) {
445         fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup",
446                         "Tracks per event (for selected events with well-establisched PV and no pile-up);Nbr of Cascades/Evt;Events",
447                         200, 0, 200);
448         fListHistCascade->Add(fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
449  }
450  if(! fHistTrackMultiplicityAfterVertexCutSel) {
451         fHistTrackMultiplicityAfterVertexCutSel = new TH1F("fHistTrackMultiplicityAfterVertexCutSel",
452                                                            "Tracks per event (after vertex cut selection);Nbr of Cascades/Evt;Events",
453                                                            200, 0, 200);
454         fListHistCascade->Add(fHistTrackMultiplicityAfterVertexCutSel);
455  }
456  // - Vertex position plots
457  if(! fHistPVx ){
458         fHistPVx = new TH1F("fHistPVx", "Best PV position in x; x (cm); Events", 2000, -0.5, 0.5);
459         fListHistCascade->Add(fHistPVx);
460  }
461  if(! fHistPVy ){
462         fHistPVy = new TH1F("fHistPVy", "Best PV position in y; y (cm); Events", 2000, -0.5, 0.5);
463         fListHistCascade->Add(fHistPVy);
464  }
465  if(! fHistPVz ){
466         fHistPVz = new TH1F("fHistPVz", "Best PV position in z; z (cm); Events", 400, -20, 20);
467         fListHistCascade->Add(fHistPVz);
468  } 
469  if(! fHistPVxAnalysis ){
470         fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", "Best PV position in x (after events selections); x (cm); Events", 2000, -0.5, 0.5);
471         fListHistCascade->Add(fHistPVxAnalysis);
472  }
473  if(! fHistPVyAnalysis ){
474         fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", "Best PV position in y (after events selections); y (cm); Events", 2000, -0.5, 0.5);
475         fListHistCascade->Add(fHistPVyAnalysis);
476  }
477  if(! fHistPVzAnalysis ){
478         fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", "Best PV position in z (after events selections); z (cm); Events", 400, -20, 20);
479         fListHistCascade->Add(fHistPVzAnalysis);
480  }
481  // - TPC clusetr sdistributions for daughters (histos for events containing at least ONE CASCADE)
482  if(! fHistPosV0TPCClusters ){
483         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);
484         fListHistCascade->Add(fHistPosV0TPCClusters);
485  }
486  if(! fHistNegV0TPCClusters ){
487         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);
488         fListHistCascade->Add(fHistNegV0TPCClusters);
489  }
490  if(! fHistBachTPCClusters ){
491         fHistBachTPCClusters = new TH1F("fHistBachTPCClusters", "TPC clusters for Bachelor track; Nbr of TPC clusters (Bach); Track counts", 165, 0.0, 165.0);
492         fListHistCascade->Add(fHistBachTPCClusters);
493  }
494  // - Cut's variables distributions (typical histos for cascades): as example only for the Xi (both particle and anti-particle)
495  if(! fHistEffMassXi) {
496      fHistEffMassXi = new TH1F("fHistEffMassXi", "Xi candidates; Invariant Mass (GeV/c^{2}); Counts", 400, 1.2, 2.0);
497      fListHistCascade->Add(fHistEffMassXi);
498  }  
499  if(! fHistDcaXiDaughters ){
500      fHistDcaXiDaughters = new TH1F("fHistDcaXiDaughters", "DCA between Xi daughters; DCA (cm); Counts", 210, 0., 2.1);
501      fListHistCascade->Add(fHistDcaXiDaughters);
502  }
503  if(! fHistDcaBachToPrimVertex) {
504      fHistDcaBachToPrimVertex = new TH1F("fHistDcaBachToPrimVertex", "Impact parameter of Bach. to Prim. Vertex; DCA (cm); Counts", 250, 0., 0.25);
505      fListHistCascade->Add(fHistDcaBachToPrimVertex);
506  }
507  if(! fHistXiCosineOfPointingAngle) {
508      fHistXiCosineOfPointingAngle = new TH1F("fHistXiCosineOfPointingAngle", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Counts", 301, 0.97, 1.0001);
509      fListHistCascade->Add(fHistXiCosineOfPointingAngle);
510  }
511  if(! fHistXiRadius ){
512      fHistXiRadius = new TH1F("fHistXiRadius", "Cascade decay transv. radius; r (cm); Counts" , 1050, 0., 105.0);
513      fListHistCascade->Add(fHistXiRadius);
514  }
515  if(! fHistMassLambdaAsCascDghter) {
516      fHistMassLambdaAsCascDghter = new TH1F("fHistMassLambdaAsCascDghter", "#Lambda associated to cascade candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.0, 1.3);
517      fListHistCascade->Add(fHistMassLambdaAsCascDghter);
518  }
519  if(! fHistDcaV0DaughtersXi) {
520      fHistDcaV0DaughtersXi = new TH1F("fHistDcaV0DaughtersXi", "DCA between V0 daughters, in cascade; DCA (cm); Counts", 320, 0., 1.6);
521      fListHistCascade->Add(fHistDcaV0DaughtersXi);
522  }
523  if(! fHistDcaV0ToPrimVertexXi) {
524      fHistDcaV0ToPrimVertexXi = new TH1F("fHistDcaV0ToPrimVertexXi", "Impact parameter of V0  to Prim. Vertex, in cascade; DCA (cm); Counts", 200, 0., 1.);
525      fListHistCascade->Add(fHistDcaV0ToPrimVertexXi);
526  }
527  if(! fHistV0CosineOfPointingAngleXi) {
528      fHistV0CosineOfPointingAngleXi = new TH1F("fHistV0CosineOfPointingAngleXi", "Cosine of V0 Pointing Angle, in cascade; Cos(V0 Point. Angl); Counts", 201, 0.8, 1.001);
529      fListHistCascade->Add(fHistV0CosineOfPointingAngleXi);
530  }
531  if(! fHistV0RadiusXi) {
532      fHistV0RadiusXi = new TH1F("fHistV0RadiusXi", "V0 decay radius, in cascade; radius (cm); Counts", 1050, 0., 105.0);
533      fListHistCascade->Add(fHistV0RadiusXi);
534  }
535  if(! fHistDcaPosToPrimVertexXi) {
536      fHistDcaPosToPrimVertexXi = new TH1F("fHistDcaPosToPrimVertexXi", "Impact parameter of V0 pos daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);
537      fListHistCascade->Add(fHistDcaPosToPrimVertexXi);
538  }
539  if(! fHistDcaNegToPrimVertexXi) {
540      fHistDcaNegToPrimVertexXi = new TH1F("fHistDcaNegToPrimVertexXi", "Impact parameter of V0 neg daughter to Prim. Vertex; DCA (cm); Counts", 300, 0, 3);
541      fListHistCascade->Add(fHistDcaNegToPrimVertexXi);
542  }
543  // - Effective mass histos for cascades.
544     //By cascade hyp  
545  if(! fHistMassXiMinus) {
546      fHistMassXiMinus = new TH1F("fHistMassXiMinus", "#Xi^{-} candidates; M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);
547      fListHistCascade->Add(fHistMassXiMinus);
548  } 
549  if(! fHistMassXiPlus) {
550      fHistMassXiPlus = new TH1F("fHistMassXiPlus", "#Xi^{+} candidates; M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts", 400, 1.2, 2.0);
551      fListHistCascade->Add(fHistMassXiPlus);
552  }
553  if(! fHistMassOmegaMinus) {
554      fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus", "#Omega^{-} candidates; M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500, 1.5, 2.5);
555      fListHistCascade->Add(fHistMassOmegaMinus);
556  }
557  if(! fHistMassOmegaPlus) {
558      fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus", "#Omega^{+} candidates;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2}); Counts", 500, 1.5, 2.5);
559      fListHistCascade->Add(fHistMassOmegaPlus);
560  }
561  // - Transverse and total momentum distributions
562  if(! fHistXiTransvMom ){
563      fHistXiTransvMom = new TH1F("fHistXiTransvMom", "#Xi transverse momentum (cand. around the mass peak); p_{t}(#Xi) (GeV/c); Counts", 100, 0.0, 10.0);
564      fListHistCascade->Add(fHistXiTransvMom);
565  }
566  if(! fHistXiTotMom ){
567      fHistXiTotMom = new TH1F("fHistXiTotMom", "#Xi momentum norm (cand. around the mass peak); p_{tot}(#Xi) (GeV/c); Counts", 150, 0.0, 15.0);
568      fListHistCascade->Add(fHistXiTotMom);
569  }
570  if(! fHistBachTransvMomXi ){
571      fHistBachTransvMomXi = new TH1F("fHistBachTransvMomXi", "#Xi Bach. transverse momentum (cand. around the mass peak); p_{t}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);
572      fListHistCascade->Add(fHistBachTransvMomXi);
573  }
574  if(! fHistBachTotMomXi ){
575      fHistBachTotMomXi = new TH1F("fHistBachTotMomXi", "#Xi Bach. momentum norm (cand. around the mass peak); p_{tot}(Bach.) (GeV/c); Counts", 100, 0.0, 5.0);
576      fListHistCascade->Add(fHistBachTotMomXi);
577  }
578  // - Others QA plots
579     //TH1
580  if(! fHistChargeXi ){
581      fHistChargeXi = new TH1F("fHistChargeXi", "Charge of Xi candidates; Sign; Counts", 5, -2.0, 3.0);
582      fListHistCascade->Add(fHistChargeXi);
583  }
584  if(! fHistV0toXiCosineOfPointingAngle) {
585      fHistV0toXiCosineOfPointingAngle = new TH1F("fHistV0toXiCosineOfPointingAngle", "Cos. of V0 Ptng Angl / Xi vtx ; Cos(V0 Point. Angl / Xi vtx); Counts", 1101, 0.89, 1.0001);
586      fListHistCascade->Add(fHistV0toXiCosineOfPointingAngle);
587  }
588  if(! fHistRapXi ){
589      fHistRapXi = new TH1F("fHistRapXi", "Rapidity of #Xi candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);
590      fListHistCascade->Add(fHistRapXi);
591  }
592  if(! fHistRapOmega ){
593      fHistRapOmega = new TH1F("fHistRapOmega", "Rapidity of #Omega candidates (around the mass peak); y; Counts", 20, -1.0, 1.0);
594      fListHistCascade->Add(fHistRapOmega);
595  }
596  if(! fHistEtaXi ){
597      fHistEtaXi = new TH1F("fHistEtaXi", "Pseudo-rap. of #Xi candidates (around the mass peak); #eta; Counts", 20, -1.0, 1.0);
598      fListHistCascade->Add(fHistEtaXi);
599  }
600  if(! fHistEtaBachXi){
601      fHistEtaBachXi = new TH1F("fHistEtaBachXi", "Pseudo-rap. of #Xi bachelor; #eta; Counts", 40, -2.0, 2.0);
602      fListHistCascade->Add(fHistEtaBachXi);
603  }
604  if(! fHistEtaPosXi){
605      fHistEtaPosXi = new TH1F("fHistEtaPosXi", "Pseudo-rap. of #Xi positive meson daughter; #eta; Counts", 40, -2.0, 2.0);
606      fListHistCascade->Add(fHistEtaPosXi);
607  }
608  if(! fHistEtaNegXi){
609      fHistEtaNegXi = new TH1F("fHistEtaNegXi", "Pseudo-rap. of #Xi negative meson daughter; #eta; Counts", 40, -2.0, 2.0);
610      fListHistCascade->Add(fHistEtaNegXi);
611  }
612  if(! fHistThetaXi ){
613      fHistThetaXi = new TH1F("fHistThetaXi", "#theta of #Xi candidates (around the mass peak); #theta (deg); Counts", 180, 0., 180.0);
614      fListHistCascade->Add(fHistThetaXi);
615  }
616  if(! fHistPhiXi ){
617      fHistPhiXi = new TH1F("fHistPhiXi", "#phi of #Xi candidates (around the mass peak); #phi (deg); Counts", 360, 0., 360.);
618      fListHistCascade->Add(fHistPhiXi);
619  }
620  if(! f2dHistArmenteros) {
621      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);
622      fListHistCascade->Add(f2dHistArmenteros);
623  }
624     //TH2
625  if(! f2dHistEffMassLambdaVsEffMassXiMinus) {
626      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);
627      fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiMinus);
628  }
629  if(! f2dHistEffMassXiVsEffMassOmegaMinus) {
630      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);
631      fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaMinus);
632  }
633  if(! f2dHistEffMassLambdaVsEffMassXiPlus) {
634      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);
635      fListHistCascade->Add(f2dHistEffMassLambdaVsEffMassXiPlus);
636  }
637  if(! f2dHistEffMassXiVsEffMassOmegaPlus) {
638      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);
639      fListHistCascade->Add(f2dHistEffMassXiVsEffMassOmegaPlus);
640  }
641  if(! f2dHistXiRadiusVsEffMassXiMinus) {
642      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);
643      fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiMinus);
644  }
645  if(! f2dHistXiRadiusVsEffMassXiPlus) {
646      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);
647      fListHistCascade->Add(f2dHistXiRadiusVsEffMassXiPlus);
648  }
649  if(! f2dHistXiRadiusVsEffMassOmegaMinus) {
650      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);
651      fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaMinus);
652  }
653  if(! f2dHistXiRadiusVsEffMassOmegaPlus) {
654      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);
655      fListHistCascade->Add(f2dHistXiRadiusVsEffMassOmegaPlus);
656  }
657  if(! f2dHistTPCdEdxOfCascDghters){
658      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.);
659      fListHistCascade->Add(f2dHistTPCdEdxOfCascDghters);
660  }
661  if(! f2dHistDcaXiDaughtersvsInvMass){
662      f2dHistDcaXiDaughtersvsInvMass = new TH2F("f2dHistDcaXiDaughtersvsInvMass", "DCA between Xi Daughters; DCA (cm); Number of Cascades", 100, 0., 0.5, 400, 1.2, 2.0);
663      fListHistCascade->Add(f2dHistDcaXiDaughtersvsInvMass);
664  }
665  if(! f2dHistDcaBachToPrimVertexvsInvMass) {
666      f2dHistDcaBachToPrimVertexvsInvMass = new TH2F("f2dHistDcaBachToPrimVertexvsInvMass", "DCA of Bach. to Prim. Vertex; DCA (cm); Number of Cascades", 250, 0., 0.25, 400, 1.2, 2.0);
667      fListHistCascade->Add(f2dHistDcaBachToPrimVertexvsInvMass);
668  }
669  if(! f2dHistXiCosineOfPointingAnglevsInvMass){
670      f2dHistXiCosineOfPointingAnglevsInvMass = new TH2F("f2dHistXiCosineOfPointingAnglevsInvMass", "Cosine of Xi Pointing Angle; Cos (Xi Point.Angl); Number of Xis", 200, 0.99, 1.0, 400, 1.2, 2.0);
671      fListHistCascade->Add(f2dHistXiCosineOfPointingAnglevsInvMass);
672  }
673  if(! f2dHistMassLambdaAsCascDghtervsInvMass){ 
674      f2dHistMassLambdaAsCascDghtervsInvMass = new TH2F("f2dHistMassLambdaAsCascDghtervsInvMass","#Lambda associated to Casc. candidates; Eff. Mass (GeV/c^{2}); Counts", 300, 1.00, 1.3, 400, 1.2, 2.0);
675      fListHistCascade->Add(f2dHistMassLambdaAsCascDghtervsInvMass);
676  }
677  if(! f2dHistDcaV0DaughtersXivsInvMass){
678      f2dHistDcaV0DaughtersXivsInvMass = new TH2F("f2dHistDcaV0DaughtersXivsInvMass", "DCA between V0 daughters, in cascade; DCA (cm); Number of V0s", 120, 0., 0.6, 400, 1.2, 2.0);
679      fListHistCascade->Add(f2dHistDcaV0DaughtersXivsInvMass);
680  }
681  if(! f2dHistDcaV0ToPrimVertexXivsInvMass){
682      f2dHistDcaV0ToPrimVertexXivsInvMass = new TH2F("f2dHistDcaV0ToPrimVertexXivsInvMass", "DCA of V0 to Prim. Vertex, in cascade; DCA (cm); Number of Cascades", 200, 0., 1., 400, 1.2, 2.0);
683      fListHistCascade->Add(f2dHistDcaV0ToPrimVertexXivsInvMass);
684  }
685  // - CFContainer PID study Xi minus
686  if(!fCFContCascadePIDXiMinus)  {
687    const Int_t  lNbSteps      =  7 ;
688    const Int_t  lNbVariables  =  3 ;
689      //Array for the number of bins in each dimension :
690    Int_t lNbBinsPerVar[3] = {0};
691    lNbBinsPerVar[0] = 100;
692    lNbBinsPerVar[1] = 800;
693    lNbBinsPerVar[2] = 22;
694    if (fkSDDSelectionOn) {
695         if (fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
696         else if (!fwithSDD) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar ); 
697    } else if (fkSDDSelectionOn) fCFContCascadePIDXiMinus = new AliCFContainer(Form("fCFContCascadePIDXiMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
698      //Setting the bin limits 
699    fCFContCascadePIDXiMinus->SetBinLimits(0,   0.0  ,  10.0 );  // Pt(Cascade)
700    fCFContCascadePIDXiMinus->SetBinLimits(1,   1.2  ,   2.0 );  // Xi Effective mass
701    fCFContCascadePIDXiMinus->SetBinLimits(2,  -1.1  ,   1.1 );  // Rapidity
702      //Setting the step title : one per PID case
703    fCFContCascadePIDXiMinus->SetStepTitle(0, "No PID");
704    fCFContCascadePIDXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
705    fCFContCascadePIDXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
706    fCFContCascadePIDXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
707    fCFContCascadePIDXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");
708    fCFContCascadePIDXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
709    fCFContCascadePIDXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");  
710      //Setting the variable title, per axis
711    fCFContCascadePIDXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
712    fCFContCascadePIDXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");
713    fCFContCascadePIDXiMinus->SetVarTitle(2, "Y_{#Xi}");
714    fListHistCascade->Add(fCFContCascadePIDXiMinus);
715  }
716  // - CFContainer PID study Xi plus
717  if (!fCFContCascadePIDXiPlus) {
718    const Int_t  lNbSteps      =  7 ;
719    const Int_t  lNbVariables  =  3 ;
720      //Array for the number of bins in each dimension :
721    Int_t lNbBinsPerVar[3] = {0};
722    lNbBinsPerVar[0] = 100;
723    lNbBinsPerVar[1] = 800;
724    lNbBinsPerVar[2] = 22;
725    if (fkSDDSelectionOn) {
726         if (fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
727         else if (!fwithSDD) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
728    } else if (fkSDDSelectionOn) fCFContCascadePIDXiPlus = new AliCFContainer(Form("fCFContCascadePIDXiPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
729      //Setting the bin limits 
730    fCFContCascadePIDXiPlus->SetBinLimits(0,   0.0  ,  10.0 );   // Pt(Cascade)
731    fCFContCascadePIDXiPlus->SetBinLimits(1,   1.2  ,   2.0 );   // Xi Effective mass
732    fCFContCascadePIDXiPlus->SetBinLimits(2,  -1.1  ,   1.1 );   // Rapidity
733      //Setting the step title : one per PID case
734    fCFContCascadePIDXiPlus->SetStepTitle(0, "No PID");
735    fCFContCascadePIDXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
736    fCFContCascadePIDXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
737    fCFContCascadePIDXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
738    fCFContCascadePIDXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");
739    fCFContCascadePIDXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
740    fCFContCascadePIDXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
741      //Setting the variable title, per axis
742    fCFContCascadePIDXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
743    fCFContCascadePIDXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");
744    fCFContCascadePIDXiPlus->SetVarTitle(2, "Y_{#Xi}");
745    fListHistCascade->Add(fCFContCascadePIDXiPlus);
746  }
747  // - CFContainer PID study Omega minus
748  if(!fCFContCascadePIDOmegaMinus)  {
749    const Int_t  lNbSteps      =  7 ;
750    const Int_t  lNbVariables  =  3 ;
751      //Array for the number of bins in each dimension :
752    Int_t lNbBinsPerVar[3] = {0};
753    lNbBinsPerVar[0] = 100;
754    lNbBinsPerVar[1] = 1000;
755    lNbBinsPerVar[2] = 22;
756    if (fkSDDSelectionOn) {
757         if (fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
758         else if (!fwithSDD) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
759    } else if (fkSDDSelectionOn) fCFContCascadePIDOmegaMinus = new AliCFContainer(Form("fCFContCascadePIDOmegaMinus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
760      //Setting the bin limits 
761    fCFContCascadePIDOmegaMinus->SetBinLimits(0,   0.0  ,  10.0 );       // Pt(Cascade)
762    fCFContCascadePIDOmegaMinus->SetBinLimits(1,   1.5  ,   2.5 );       // Omega Effective mass
763    fCFContCascadePIDOmegaMinus->SetBinLimits(2,  -1.1  ,   1.1 );       // Rapidity
764      //Setting the step title : one per PID case
765    fCFContCascadePIDOmegaMinus->SetStepTitle(0, "No PID");
766    fCFContCascadePIDOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
767    fCFContCascadePIDOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
768    fCFContCascadePIDOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
769    fCFContCascadePIDOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");
770    fCFContCascadePIDOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
771    fCFContCascadePIDOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
772      //Setting the variable title, per axis
773    fCFContCascadePIDOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
774    fCFContCascadePIDOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");
775    fCFContCascadePIDOmegaMinus->SetVarTitle(2, "Y_{#Omega}");
776    fListHistCascade->Add(fCFContCascadePIDOmegaMinus);
777  }
778  // - CFContainer PID study Omega plus
779  if(!fCFContCascadePIDOmegaPlus)  {
780    const Int_t  lNbSteps      =  7 ;
781    const Int_t  lNbVariables  =  3 ;
782      //Array for the number of bins in each dimension :
783    Int_t lNbBinsPerVar[3] = {0};
784    lNbBinsPerVar[0] = 100;
785    lNbBinsPerVar[1] = 1000;
786    lNbBinsPerVar[2] = 22; 
787    if (fkSDDSelectionOn) {
788         if (fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
789         else if (!fwithSDD) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
790    } else if (fkSDDSelectionOn) fCFContCascadePIDOmegaPlus = new AliCFContainer(Form("fCFContCascadePIDOmegaPlus_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
791      //Setting the bin limits 
792    fCFContCascadePIDOmegaPlus->SetBinLimits(0,   0.0  ,  10.0 );        // Pt(Cascade)
793    fCFContCascadePIDOmegaPlus->SetBinLimits(1,   1.5  ,   2.5 );        // Omega Effective mass
794    fCFContCascadePIDOmegaPlus->SetBinLimits(2,  -1.1  ,   1.1 );        // Rapidity 
795      //Setting the step title : one per PID case
796    fCFContCascadePIDOmegaPlus->SetStepTitle(0, "No PID");
797    fCFContCascadePIDOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
798    fCFContCascadePIDOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
799    fCFContCascadePIDOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
800    fCFContCascadePIDOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");
801    fCFContCascadePIDOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
802    fCFContCascadePIDOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
803      //Setting the variable title, per axis
804    fCFContCascadePIDOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
805    fCFContCascadePIDOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");
806    fCFContCascadePIDOmegaPlus->SetVarTitle(2, "Y_{#Omega}");  
807    fListHistCascade->Add(fCFContCascadePIDOmegaPlus);
808  }
809  // - CFContainer: towards the optimisation of topological selections
810  if(! fCFContCascadeCuts) {
811         // Container meant to store all the relevant distributions corresponding to the cut variables.
812         // NB: overflow/underflow of variables on which we want to cut later should be 0!!! 
813    const Int_t  lNbSteps      =  4 ;
814    const Int_t  lNbVariables  =  19 ;
815      //Array for the number of bins in each dimension :
816    Int_t lNbBinsPerVar[lNbVariables] = {0};
817    lNbBinsPerVar[0]  = 25;     //DcaCascDaughters             :  [0.0,2.4,3.0]       -> Rec.Cut = 2.0;
818    lNbBinsPerVar[1]  = 25;     //DcaBachToPrimVertex          :  [0.0,0.24,100.0]    -> Rec.Cut = 0.01; 
819    lNbBinsPerVar[2]  = 30;     //CascCosineOfPointingAngle    :  [0.97,1.0]          -> Rec.Cut = 0.98;
820    lNbBinsPerVar[3]  = 40;     //CascRadius                   :  [0.0,3.9,1000.0]    -> Rec.Cut = 0.2;
821    lNbBinsPerVar[4]  = 30;     //InvMassLambdaAsCascDghter    :  [1.1,1.3]           -> Rec.Cut = 0.008;
822    lNbBinsPerVar[5]  = 20;     //DcaV0Daughters               :  [0.0,2.0]           -> Rec.Cut = 1.5;
823    lNbBinsPerVar[6]  = 201;    //V0CosineOfPointingAngle      :  [0.89,1.0]          -> Rec.Cut = 0.9;
824    lNbBinsPerVar[7]  = 40;     //V0Radius                     :  [0.0,3.9,1000.0]    -> Rec.Cut = 0.2;
825    lNbBinsPerVar[8]  = 40;     //DcaV0ToPrimVertex            :  [0.0,0.39,110.0]    -> Rec.Cut = 0.01;  
826    lNbBinsPerVar[9]  = 25;     //DcaPosToPrimVertex           :  [0.0,0.24,100.0]    -> Rec.Cut = 0.05;
827    lNbBinsPerVar[10] = 25;     //DcaNegToPrimVertex           :  [0.0,0.24,100.0]    -> Rec.Cut = 0.05
828    lNbBinsPerVar[11] = 150;    //InvMassXi                    :   2-MeV/c2 bins
829    lNbBinsPerVar[12] = 120;    //InvMassOmega                 :   2-MeV/c2 bins
830    lNbBinsPerVar[13] = 100;    //XiTransvMom                  :  [0.0,10.0]
831    lNbBinsPerVar[14] = 110;    //Y(Xi)                        :   0.02 in rapidity units
832    lNbBinsPerVar[15] = 110;    //Y(Omega)                     :   0.02 in rapidity units
833    lNbBinsPerVar[16] = 112;    //Proper lenght of cascade       
834    lNbBinsPerVar[17] = 112;    //Proper lenght of V0
835    lNbBinsPerVar[18] = 112;    //Distance V0-Xi in transverse plane
836    if (fkSDDSelectionOn) {
837         if (fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDon",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
838         else if (!fwithSDD) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_wSDDoff",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
839    } else if (fkSDDSelectionOn) fCFContCascadeCuts = new AliCFContainer(Form("fCFContCascadeCuts_minnTPCcls%i_vtxlim%.1f-%.1f_minptdghtrk%.1f_etacutdghtrk%.1f_woSDD",fMinnTPCcls,fVtxRange,fVtxRangeMin,fMinPtCutOnDaughterTracks,fEtaCutOnDaughterTracks),"Container for Cascade cuts", lNbSteps, lNbVariables, lNbBinsPerVar);
840      //Setting the bin limits 
841      //0 -  DcaXiDaughters
842    Double_t *lBinLim0  = new Double_t[ lNbBinsPerVar[0] + 1 ];
843         for(Int_t i=0; i< lNbBinsPerVar[0]; i++) lBinLim0[i] = (Double_t)0.0 + (2.4 - 0.0)/(lNbBinsPerVar[0] - 1) * (Double_t)i;
844         lBinLim0[ lNbBinsPerVar[0] ] = 3.0;
845    fCFContCascadeCuts -> SetBinLimits(0, lBinLim0);  
846    delete [] lBinLim0;
847      //1 - DcaToPrimVertexXi
848    Double_t *lBinLim1  = new Double_t[ lNbBinsPerVar[1] + 1 ];
849         for(Int_t i=0; i<lNbBinsPerVar[1]; i++) lBinLim1[i] = (Double_t)0.0 + (0.24  - 0.0)/(lNbBinsPerVar[1] - 1) * (Double_t)i;
850         lBinLim1[ lNbBinsPerVar[1] ] = 100.0;
851    fCFContCascadeCuts -> SetBinLimits(1, lBinLim1);  
852    delete [] lBinLim1;    
853      //2 - CascCosineOfPointingAngle 
854    fCFContCascadeCuts->SetBinLimits(2, 0.97, 1.);
855      //3 - CascRadius
856    Double_t *lBinLim3  = new Double_t[ lNbBinsPerVar[3]+1 ];
857         for(Int_t i=0; i< lNbBinsPerVar[3]; i++)   lBinLim3[i]  = (Double_t)0.0   + (3.9  - 0.0 )/(lNbBinsPerVar[3] - 1)  * (Double_t)i ;
858         lBinLim3[ lNbBinsPerVar[3] ] = 1000.0;
859    fCFContCascadeCuts -> SetBinLimits(3,  lBinLim3 );        
860    delete [] lBinLim3;
861      //4 - InvMassLambdaAsCascDghter
862    fCFContCascadeCuts->SetBinLimits(4, 1.1, 1.13);
863      //5 - DcaV0Daughters
864    fCFContCascadeCuts -> SetBinLimits(5, 0., 2.);
865      //6 - V0CosineOfPointingAngle
866    fCFContCascadeCuts -> SetBinLimits(6, 0.8, 1.001);
867      //7 - V0Radius
868    Double_t *lBinLim7 = new Double_t[ lNbBinsPerVar[7] + 1];
869         for(Int_t i=0; i< lNbBinsPerVar[7];i++) lBinLim7[i] = (Double_t)0.0 + (3.9 - 0.0)/(lNbBinsPerVar[7] - 1) * (Double_t)i;
870         lBinLim7[ lNbBinsPerVar[7] ] = 1000.0;
871    fCFContCascadeCuts -> SetBinLimits(7, lBinLim7); 
872    delete [] lBinLim7;
873      //8 - DcaV0ToPrimVertex
874    Double_t *lBinLim8  = new Double_t[ lNbBinsPerVar[8]+1 ];
875         for(Int_t i=0; i< lNbBinsPerVar[8];i++)   lBinLim8[i]  = (Double_t)0.0   + (0.39  - 0.0 )/(lNbBinsPerVar[8]-1)  * (Double_t)i ;
876         lBinLim8[ lNbBinsPerVar[8]  ] = 100.0;
877    fCFContCascadeCuts -> SetBinLimits(8,  lBinLim8 );    
878    delete [] lBinLim8;
879      //9 - DcaPosToPrimVertex
880    Double_t *lBinLim9  = new Double_t[ lNbBinsPerVar[9]+1 ];
881         for(Int_t i=0; i< lNbBinsPerVar[9];i++)   lBinLim9[i]  = (Double_t)0.0   + (0.24  - 0.0 )/(lNbBinsPerVar[9]-1)  * (Double_t)i ;
882         lBinLim9[ lNbBinsPerVar[9]  ] = 100.0;
883    fCFContCascadeCuts -> SetBinLimits(9,  lBinLim9 );        
884    delete [] lBinLim9;
885      //10 - DcaNegToPrimVertex
886    Double_t *lBinLim10  = new Double_t[ lNbBinsPerVar[10]+1 ];
887         for(Int_t i=0; i< lNbBinsPerVar[10];i++)   lBinLim10[i]  = (Double_t)0.0   + (0.24  - 0.0 )/(lNbBinsPerVar[10]-1)  * (Double_t)i ;
888         lBinLim10[ lNbBinsPerVar[10]  ] = 100.0;
889    fCFContCascadeCuts -> SetBinLimits(10,  lBinLim10 );            // DcaPosToPrimVertexXi : 0.0 to 0.25 
890    delete [] lBinLim10;
891      //11 - InvMassXi
892    fCFContCascadeCuts->SetBinLimits(11, 1.25, 1.40);
893      //12 - InvMassOmega
894    fCFContCascadeCuts->SetBinLimits(12, 1.62, 1.74);
895      //13 - XiTransvMom
896    fCFContCascadeCuts->SetBinLimits(13, 0.0, 10.0); 
897      //14 - Y(Xi)
898    fCFContCascadeCuts->SetBinLimits(14, -1.1, 1.1);
899      //15 - Y(Omega)
900    fCFContCascadeCuts->SetBinLimits(15, -1.1, 1.1);
901      //16 - Proper time of cascade
902    Double_t *lBinLim16  = new Double_t[ lNbBinsPerVar[16]+1 ];
903    for(Int_t i=0; i< lNbBinsPerVar[16];i++) lBinLim16[i] = (Double_t) -1. + (110. + 1.0 ) / (lNbBinsPerVar[16] - 1) * (Double_t) i;
904    lBinLim16[ lNbBinsPerVar[16] ] = 2000.0;
905    fCFContCascadeCuts->SetBinLimits(16, lBinLim16);
906      //17 - Proper time of V0
907    fCFContCascadeCuts->SetBinLimits(17, lBinLim16);
908      //18 - Distance V0-Xi in transverse plane
909    fCFContCascadeCuts->SetBinLimits(18, lBinLim16);
910      // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)
911    fCFContCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates");
912    fCFContCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates");
913    fCFContCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates");
914    fCFContCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates");
915      // Setting the variable title, per axis
916    fCFContCascadeCuts->SetVarTitle(0,  "Dca(cascade daughters) (cm)");
917    fCFContCascadeCuts->SetVarTitle(1,  "ImpactParamToPV(bachelor) (cm)");
918    fCFContCascadeCuts->SetVarTitle(2,  "cos(cascade PA)");
919    fCFContCascadeCuts->SetVarTitle(3,  "R_{2d}(cascade decay) (cm)");
920    fCFContCascadeCuts->SetVarTitle(4,  "M_{#Lambda}(as casc dghter) (GeV/c^{2})");
921    fCFContCascadeCuts->SetVarTitle(5,  "Dca(V0 daughters) in Xi (cm)");
922    fCFContCascadeCuts->SetVarTitle(6,  "cos(V0 PA) in cascade");
923    fCFContCascadeCuts->SetVarTitle(7,  "R_{2d}(V0 decay) (cm)");
924    fCFContCascadeCuts->SetVarTitle(8,  "ImpactParamToPV(V0) (cm)");
925    fCFContCascadeCuts->SetVarTitle(9,  "ImpactParamToPV(Pos) (cm)");
926    fCFContCascadeCuts->SetVarTitle(10, "ImpactParamToPV(Neg) (cm)");
927    fCFContCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");
928    fCFContCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");
929    fCFContCascadeCuts->SetVarTitle(13, "pt(cascade) (GeV/c)");
930    fCFContCascadeCuts->SetVarTitle(14, "Y(Xi)");
931    fCFContCascadeCuts->SetVarTitle(15, "Y(Omega)");
932    fCFContCascadeCuts->SetVarTitle(16, "mL/p (cascade) (cm)");
933    fCFContCascadeCuts->SetVarTitle(17, "mL/p (V0) (cm)");
934    fCFContCascadeCuts->SetVarTitle(18, "Distance V0-Cascade in transverse plane (cm)");
935    fListHistCascade->Add(fCFContCascadeCuts);
936  }
937
938  PostData(1, fListHistCascade);
939  PostData(2, fCFContCascadePIDXiMinus);
940  PostData(3, fCFContCascadePIDXiPlus);
941  PostData(4, fCFContCascadePIDOmegaMinus);
942  PostData(5, fCFContCascadePIDOmegaPlus);
943  PostData(6, fCFContCascadeCuts);
944 } // end UserCreateOutputObjects
945
946
947 //________________________________________________________________________
948 void AliAnalysisTaskCheckCascadepp276::UserExec(Option_t *) {
949
950   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
951   // Main loop (called for each event)
952   //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
953   
954   //----------------
955   //Define variables 
956   AliESDEvent *lESDevent = 0x0;
957   AliAODEvent *lAODevent = 0x0;
958
959   //---------------------
960   //Check the PIDresponse
961   if(!fPIDResponse) {
962        AliError("Cannot get pid response");
963        return;
964   }
965
966   ///////////////////
967   // EVENT SELECTIONS
968   ///////////////////
969   // In order:
970   // 1) SDD selection
971   // 2) Physics selection
972   // 3) Select only looking at events with well-established PV
973   // 4) Pileup selection
974   // 5) |Z| < 10 cm
975
976   //----------------------
977   // Before any selections
978   //----------------------
979   //- Define the variables
980   Int_t ncascadesBeforeAnySel = 0;
981   Int_t nTrackMultiplicityBeforeAnySel = 0;
982   if (fAnalysisType == "ESD") {
983       // - Load the InputEvent and check
984       lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
985       if (!lESDevent) {
986          AliWarning("ERROR: lESDevent not available \n");
987          return;
988       }
989       // - Take the number of cascades and tracks before any events selection
990       ncascadesBeforeAnySel = lESDevent->GetNumberOfCascades();
991       nTrackMultiplicityBeforeAnySel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
992   } else if (fAnalysisType == "AOD") {
993       // - Load the InputEvent and check
994       lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() );
995       if (!lAODevent) {
996           AliWarning("ERROR: lAODevent not available \n");
997           return;
998       }
999       // - Take the number of cascades and tracks before any events selection
1000       ncascadesBeforeAnySel  = lAODevent->GetNumberOfCascades();
1001       nTrackMultiplicityBeforeAnySel = -100;  //FIXME: I can't find the equivalent method for the AOD  
1002   } else {
1003       Printf("Analysis type (ESD or AOD) not specified \n");
1004       return;
1005   }
1006   // - Fill the plots
1007   fHistCascadeMultiplicityBeforeAnySel->Fill(ncascadesBeforeAnySel);
1008   fHistTrackMultiplicityBeforeAnySel->Fill(nTrackMultiplicityBeforeAnySel);
1009  
1010   //--------------
1011   // SDD selection
1012   //--------------
1013   // - Define the variables
1014   Int_t ncascadesAfterSDDSel = 0;
1015   Int_t nTrackMultiplicityAfterSDDSel = 0;
1016   // - Selection for ESD and AOD
1017   if (fAnalysisType == "ESD") {
1018      if (fkSDDSelectionOn) {
1019         TString trcl = lESDevent->GetFiredTriggerClasses();
1020         //cout<<"Fired Trigger Classes: "<<trcl<<endl;
1021         if (fwithSDD){
1022           if(!(trcl.Contains("ALLNOTRD"))) {
1023                cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. =>  RETURN!! (Exclude it)..."<<endl;
1024                PostData(1, fListHistCascade);
1025                PostData(2, fCFContCascadePIDXiMinus);
1026                PostData(3, fCFContCascadePIDXiPlus);
1027                PostData(4, fCFContCascadePIDOmegaMinus);
1028                PostData(5, fCFContCascadePIDOmegaPlus);
1029                PostData(6, fCFContCascadeCuts);
1030                return;
1031           }
1032         } else if (!fwithSDD){
1033           if((trcl.Contains("ALLNOTRD"))) {
1034                cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. =>  RETURN!! (Exclude it)..."<<endl;
1035                PostData(1, fListHistCascade);
1036                PostData(2, fCFContCascadePIDXiMinus);
1037                PostData(3, fCFContCascadePIDXiPlus);
1038                PostData(4, fCFContCascadePIDOmegaMinus);
1039                PostData(5, fCFContCascadePIDOmegaPlus);
1040                PostData(6, fCFContCascadeCuts);
1041                return;
1042           }
1043         }
1044      }
1045      // - Take the number of cascades and tracks after the SDD selection
1046      ncascadesAfterSDDSel = lESDevent->GetNumberOfCascades();
1047      nTrackMultiplicityAfterSDDSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1048   } else if (fAnalysisType == "AOD") {
1049      if (fkSDDSelectionOn) {
1050         TString trcl = lAODevent->GetFiredTriggerClasses();
1051         if (fwithSDD){
1052            if(!(trcl.Contains("ALLNOTRD"))) {
1053                 PostData(1, fListHistCascade);
1054                 PostData(2, fCFContCascadePIDXiMinus);
1055                 PostData(3, fCFContCascadePIDXiPlus);
1056                 PostData(4, fCFContCascadePIDOmegaMinus);
1057                 PostData(5, fCFContCascadePIDOmegaPlus);
1058                 PostData(6, fCFContCascadeCuts);
1059                 cout<<"We are selecting events with SDD turn ON. This event has the SDD turn OFF. =>  RETURN!! (Exclude it)..."<<endl;
1060                 return;
1061            }
1062         } else if (!fwithSDD) {
1063            if((trcl.Contains("ALLNOTRD"))) {
1064                 PostData(1, fListHistCascade);
1065                 PostData(2, fCFContCascadePIDXiMinus);
1066                 PostData(3, fCFContCascadePIDXiPlus);
1067                 PostData(4, fCFContCascadePIDOmegaMinus);
1068                 PostData(5, fCFContCascadePIDOmegaPlus);
1069                 PostData(6, fCFContCascadeCuts);
1070                 cout<<"We are selecting events with SDD turn OFF. This event has the SDD turn ON. =>  RETURN!! (Exclude it)..."<<endl;
1071                 return;
1072            }
1073         }
1074      }
1075      // - Take the number of cascades and tracks after the SDD selection
1076      ncascadesAfterSDDSel = lAODevent->GetNumberOfCascades();
1077      nTrackMultiplicityAfterSDDSel = -100; //FIXME: I can't find the equivalent method for the AOD
1078   }
1079   // - Fill the plots
1080   fHistCascadeMultiplicityAfterSDDSel->Fill(ncascadesAfterSDDSel);
1081   fHistTrackMultiplicityAfterSDDSel->Fill(nTrackMultiplicityAfterSDDSel);
1082
1083   //----------------------------------------------
1084   // Physics selection (+ re-vertexer for the ESD)
1085   //----------------------------------------------
1086   // - Define the variables
1087   Int_t ncascadesAfterPhysicsSel = 0;
1088   Int_t nTrackMultiplicityAfterPhysicsSel = 0;
1089   // - Selection for ESD and AOD
1090   if (fAnalysisType == "ESD") {
1091       UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1092       Bool_t isSelected = 0;
1093       isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
1094       if(! isSelected){
1095           PostData(1, fListHistCascade);
1096           PostData(2, fCFContCascadePIDXiMinus);
1097           PostData(3, fCFContCascadePIDXiPlus);
1098           PostData(4, fCFContCascadePIDOmegaMinus);
1099           PostData(5, fCFContCascadePIDOmegaPlus);
1100           PostData(6, fCFContCascadeCuts);
1101           cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. =>  RETURN!! (Exclude it)..."<<endl;
1102           return;
1103       }
1104       // - Take the number of cascades and tracks after physics selection
1105       ncascadesAfterPhysicsSel = lESDevent->GetNumberOfCascades();    
1106       nTrackMultiplicityAfterPhysicsSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);  
1107       // - Cascade vertexer (ESD)
1108       // Relaunch V0 and Cascade vertexers
1109       if (fkRerunV0CascVertexers) { 
1110             lESDevent->ResetCascades();
1111             lESDevent->ResetV0s();
1112             //AliV0vertexer *lV0vtxer = new AliV0vertexer();
1113             //AliCascadeVertexer *lCascVtxer = new AliCascadeVertexer();
1114             //lV0vtxer->GetCuts(fV0Sels);
1115             //lCascVtxer->GetCuts(fCascSels);
1116             //lV0vtxer->SetCuts(fV0Sels);      // NB don't use SetDefaultCuts!! because it acts on static variables 
1117             //lCascVtxer->SetCuts(fCascSels);
1118             //lV0vtxer->Tracks2V0vertices(lESDevent);
1119             //lCascVtxer->V0sTracks2CascadeVertices(lESDevent);
1120             //delete lV0vtxer;
1121             //delete lCascVtxer;
1122       }         
1123   } else if (fAnalysisType == "AOD") {
1124       UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1125       Bool_t isSelected = 0;
1126       isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
1127       if(! isSelected){
1128           PostData(1, fListHistCascade);
1129           PostData(2, fCFContCascadePIDXiMinus);
1130           PostData(3, fCFContCascadePIDXiPlus);
1131           PostData(4, fCFContCascadePIDOmegaMinus);
1132           PostData(5, fCFContCascadePIDOmegaPlus);
1133           PostData(6, fCFContCascadeCuts);
1134           cout<<"We are selecting the events that past tha Physics Selection. This event does not pass the Physics Selection. =>  RETURN!! (Exclude it)..."<<endl;
1135           return;
1136       }    
1137       // - Take the number of cascades and tracks after the physics selection
1138       ncascadesAfterPhysicsSel = lAODevent->GetNumberOfCascades();
1139       nTrackMultiplicityAfterPhysicsSel = -100;  //FIXME: I can't find the equivalent method for the AOD    
1140   } 
1141   // - Fill the plots
1142   fHistCascadeMultiplicityAfterPhysicsSel->Fill(ncascadesAfterPhysicsSel);
1143   fHistTrackMultiplicityAfterPhysicsSel->Fill(nTrackMultiplicityAfterPhysicsSel);
1144
1145   //------------------------------
1146   // Well-established PV selection
1147   //------------------------------
1148   // - Define variables
1149   Int_t ncascadesForSelEvtNoTPCOnly = 0;
1150   Int_t nTrackMultiplicityForSelEvtNoTPCOnly = 0;
1151   // - Selection for ESD and AOD
1152   if (fAnalysisType == "ESD") {
1153       // - Vertex coordinates: get the PVs stored in the ESD found with tracks and SPD
1154       const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
1155       const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
1156       // - Select only looking at events with well-established PV
1157       if (fkQualityCutNoTPConlyPrimVtx) {
1158           if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() ){
1159               AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1160               PostData(1, fListHistCascade);
1161               PostData(2, fCFContCascadePIDXiMinus);
1162               PostData(3, fCFContCascadePIDXiPlus);
1163               PostData(4, fCFContCascadePIDOmegaMinus);
1164               PostData(5, fCFContCascadePIDOmegaPlus);
1165               PostData(6, fCFContCascadeCuts);
1166               return;
1167           }
1168       }
1169       // - Take the number of cascades and tracks after TPConly selection
1170       ncascadesForSelEvtNoTPCOnly = lESDevent->GetNumberOfCascades();
1171       nTrackMultiplicityForSelEvtNoTPCOnly = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1172   } else if (fAnalysisType == "AOD") {
1173       // - Vertex coordinates: get the PVs stored in the AOD found with tracks and SPD
1174       const AliAODVertex *lPrimarySPDVtx = lAODevent->GetPrimaryVertexSPD();
1175       const AliAODVertex *lPrimaryTrackingAODVtx = lAODevent->GetPrimaryVertex();
1176       // - Select only looking at events with well-established PV
1177       if (fkQualityCutNoTPConlyPrimVtx) {
1178           if (!lPrimarySPDVtx && !lPrimaryTrackingAODVtx) {
1179               AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1180               PostData(1, fListHistCascade);
1181               PostData(2, fCFContCascadePIDXiMinus);
1182               PostData(3, fCFContCascadePIDXiPlus);
1183               PostData(4, fCFContCascadePIDOmegaMinus);
1184               PostData(5, fCFContCascadePIDOmegaPlus);
1185               PostData(6, fCFContCascadeCuts);
1186               return;
1187           }
1188       }
1189       // - Take the number of cascades and tracks after TPConly selection
1190       ncascadesForSelEvtNoTPCOnly = lAODevent->GetNumberOfCascades();
1191       nTrackMultiplicityForSelEvtNoTPCOnly = -100;  //FIXME: I can't find the equivalent method for the AOD
1192   }
1193   // - Fill the plots
1194   fHistCascadeMultiplicityForSelEvtNoTPCOnly->Fill(ncascadesForSelEvtNoTPCOnly);
1195   fHistTrackMultiplicityForSelEvtNoTPCOnly->Fill(nTrackMultiplicityForSelEvtNoTPCOnly);
1196     
1197   //----------------
1198   // Pilup selection
1199   //----------------
1200   // - Define variables
1201   Int_t ncascadesForSelEvtNoTPCOnlyNoPileup = 0;
1202   Int_t nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = 0;
1203   // - Selection for ESD and AOD
1204   if (fAnalysisType == "ESD") {
1205       if (fkQualityCutPileup) {
1206           if(lESDevent->IsPileupFromSPD()){
1207               AliWarning("Pb / Pile-up event ... return!");
1208               PostData(1, fListHistCascade);
1209               PostData(2, fCFContCascadePIDXiMinus);
1210               PostData(3, fCFContCascadePIDXiPlus);
1211               PostData(4, fCFContCascadePIDOmegaMinus);
1212               PostData(5, fCFContCascadePIDOmegaPlus);
1213               PostData(6, fCFContCascadeCuts);
1214               return;
1215           }
1216       }
1217       // - Take the number of cascades and tracks after Pileup selection
1218       ncascadesForSelEvtNoTPCOnlyNoPileup = lESDevent->GetNumberOfCascades();
1219       nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5);
1220   } else if (fAnalysisType == "AOD") {
1221       if (fkQualityCutPileup) {
1222           if(lAODevent->IsPileupFromSPD()){
1223               AliWarning("Pb / Pile-up event ... return!");
1224               PostData(1, fListHistCascade);
1225               PostData(2, fCFContCascadePIDXiMinus);
1226               PostData(3, fCFContCascadePIDXiPlus);
1227               PostData(4, fCFContCascadePIDOmegaMinus);
1228               PostData(5, fCFContCascadePIDOmegaPlus);
1229               PostData(6, fCFContCascadeCuts);
1230               return;
1231           }
1232       }
1233       // - Take the number of cascades and tracks after Pileup selection
1234       ncascadesForSelEvtNoTPCOnlyNoPileup = lAODevent->GetNumberOfCascades();
1235       nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup = -100;   //FIXME: I can't find the equivalent method for the AOD
1236   }
1237   fHistCascadeMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(ncascadesForSelEvtNoTPCOnlyNoPileup);
1238   fHistTrackMultiplicityForSelEvtNoTPCOnlyNoPileup->Fill(nTrackMultiplicityForSelEvtNoTPCOnlyNoPileup);
1239     
1240   //----------------------------------------------------
1241   // Vertex Z position selection (+ magnetic field info)
1242   //----------------------------------------------------
1243   // - Define variables
1244   Double_t lBestPrimaryVtxPos[3]  = {-100.0, -100.0, -100.0};
1245   Double_t lMagneticField         = -10.;
1246   Double_t tPrimaryVtxPosition[3] = {-100.0, -100.0, -100.0};
1247   Int_t ncascadesAfterVertexSel          = 0;
1248   Int_t nTrackMultiplicityAfterVertexSel = 0; 
1249   // - Selection for ESD and AOD
1250   if (fAnalysisType == "ESD") {
1251       // - Vertex coordinates: get the best primary vertex available for the event 
1252       const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex(); 
1253       if (!lPrimaryBestESDVtx){
1254           AliWarning("No prim. vertex in ESD... return!");
1255           PostData(1, fListHistCascade);
1256           PostData(2, fCFContCascadePIDXiMinus);
1257           PostData(3, fCFContCascadePIDXiPlus);
1258           PostData(4, fCFContCascadePIDOmegaMinus);
1259           PostData(5, fCFContCascadePIDOmegaPlus);
1260           PostData(6, fCFContCascadeCuts);
1261           return;
1262       }
1263       lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
1264       // - Fill the vertex plots before any event selection on vertex position
1265       const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
1266       tPrimaryVtxPosition[0] = primaryVtx->GetX();
1267       tPrimaryVtxPosition[1] = primaryVtx->GetY();
1268       tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1269           fHistPVx->Fill( tPrimaryVtxPosition[0] );
1270           fHistPVy->Fill( tPrimaryVtxPosition[1] );
1271           fHistPVz->Fill( tPrimaryVtxPosition[2] );       
1272       // - Get magnetic filed info
1273       lMagneticField = lESDevent->GetMagneticField();
1274       //if(TMath::Abs(lMagneticField ) < 10e-6) continue;
1275       // - Selection on the primary vertex Z position 
1276       if (fkQualityCutZprimVtxPos) {
1277           if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
1278                AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1279                PostData(1, fListHistCascade);
1280                PostData(2, fCFContCascadePIDXiMinus);
1281                PostData(3, fCFContCascadePIDXiPlus);
1282                PostData(4, fCFContCascadePIDOmegaMinus);
1283                PostData(5, fCFContCascadePIDOmegaPlus);
1284                PostData(6, fCFContCascadeCuts);
1285                return;
1286           }
1287       }
1288       // - Take the number of cascades and tracks after vertex Z position selection
1289       ncascadesAfterVertexSel = lESDevent->GetNumberOfCascades();
1290       nTrackMultiplicityAfterVertexSel = fESDtrackCuts->GetReferenceMultiplicity(lESDevent,AliESDtrackCuts::kTrackletsITSTPC,0.5); 
1291   } else if (fAnalysisType == "AOD") {
1292       // - Vertex coordinates: get the best primary vertex available for the event
1293       const AliAODVertex *lPrimaryBestAODVtx = lAODevent->GetPrimaryVertex();
1294       if (!lPrimaryBestAODVtx){
1295           AliWarning("No prim. vertex in AOD... return!");
1296           PostData(1, fListHistCascade);
1297           PostData(2, fCFContCascadePIDXiMinus);
1298           PostData(3, fCFContCascadePIDXiPlus);
1299           PostData(4, fCFContCascadePIDOmegaMinus);
1300           PostData(5, fCFContCascadePIDOmegaPlus);
1301           PostData(6, fCFContCascadeCuts);
1302           return;
1303       }
1304       lPrimaryBestAODVtx->GetXYZ( lBestPrimaryVtxPos );
1305       // - Fill the vertex plots before any event selection on vertex position
1306       const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
1307       tPrimaryVtxPosition[0] = primaryVtx->GetX();
1308       tPrimaryVtxPosition[1] = primaryVtx->GetY();
1309       tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1310           fHistPVx->Fill( tPrimaryVtxPosition[0] );
1311           fHistPVy->Fill( tPrimaryVtxPosition[1] );
1312           fHistPVz->Fill( tPrimaryVtxPosition[2] );
1313       // - Get magnetic filed info
1314       lMagneticField = lAODevent->GetMagneticField();
1315       //if(TMath::Abs(lMagneticField ) < 10e-6) continue;
1316       // - Selection on the primary vertex Z position 
1317       if (fkQualityCutZprimVtxPos) {
1318           if (TMath::Abs(lBestPrimaryVtxPos[2]) > fVtxRange || TMath::Abs(lBestPrimaryVtxPos[2]) < fVtxRangeMin) {
1319               AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
1320               PostData(1, fListHistCascade);
1321               PostData(2, fCFContCascadePIDXiMinus);
1322               PostData(3, fCFContCascadePIDXiPlus);
1323               PostData(4, fCFContCascadePIDOmegaMinus);
1324               PostData(5, fCFContCascadePIDOmegaPlus);
1325               PostData(6, fCFContCascadeCuts);
1326               return;
1327           }
1328       }
1329       // - Take the number of cascades and tracks after vertex Z position selection
1330       ncascadesAfterVertexSel = lAODevent->GetNumberOfCascades();
1331       nTrackMultiplicityAfterVertexSel = -100; //FIXME: I can't find the equivalent method for the AOD
1332   } 
1333   // - Fill the plots
1334   fHistCascadeMultiplicityAfterVertexCutSel->Fill(ncascadesAfterVertexSel);
1335   fHistTrackMultiplicityAfterVertexCutSel->Fill(nTrackMultiplicityAfterVertexSel);
1336
1337   // - Vertex position plots: after any event selections
1338   tPrimaryVtxPosition[0] = -100.0;
1339   tPrimaryVtxPosition[1] = -100.0;
1340   tPrimaryVtxPosition[2] = -100.0;
1341   if (fAnalysisType == "ESD") {
1342        const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
1343        tPrimaryVtxPosition[0] = primaryVtx->GetX();
1344        tPrimaryVtxPosition[1] = primaryVtx->GetY();
1345        tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1346   } else if (fAnalysisType == "AOD") {
1347        const AliVVertex *primaryVtx = lAODevent->GetPrimaryVertex();
1348        tPrimaryVtxPosition[0] = primaryVtx->GetX();
1349        tPrimaryVtxPosition[1] = primaryVtx->GetY();
1350        tPrimaryVtxPosition[2] = primaryVtx->GetZ();
1351   }
1352   fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] );
1353   fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] );
1354   fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] );
1355   
1356
1357
1358   //////////////////////////////
1359   // CASCADE RECONSTRUCTION PART
1360   //////////////////////////////
1361   
1362   //%%%%%%%%%%%%%
1363   // Cascade loop
1364   Int_t ncascades = 0;
1365   if      (fAnalysisType == "ESD") ncascades = lESDevent->GetNumberOfCascades();
1366   else if (fAnalysisType == "AOD") ncascades = lAODevent->GetNumberOfCascades();
1367
1368   for (Int_t iXi = 0; iXi < ncascades; iXi++) {// This is the begining of the Cascade loop (ESD or AOD)
1369            
1370       // -----------------------------------------------------------------------
1371       // - Initialisation of the local variables that will be needed for ESD/AOD
1372
1373       // - 0th part of initialisation : around primary vertex ...
1374       //Double_t lBestPrimaryVtxRadius3D     = -500.0;
1375       // - 1st part of initialisation : variables needed to store AliESDCascade data members
1376       Double_t lEffMassXi                  = 0.;
1377       Double_t lDcaXiDaughters             = -1.;
1378       Double_t lXiCosineOfPointingAngle    = -1.;
1379       Double_t lPosXi[3]                   = { -1000.0, -1000.0, -1000.0 };
1380       Double_t lXiRadius                   = -1000. ;
1381       // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
1382       UShort_t lPosTPCClusters             = -1; // For ESD only ...
1383       UShort_t lNegTPCClusters             = -1; // For ESD only ...
1384       UShort_t lBachTPCClusters            = -1; // For ESD only ...
1385       Double_t lInnerWallMomCascDghters[3] = {-100., -100., -100.};
1386       Double_t lTPCSignalCascDghters   [3] = {-100., -100., -100.};
1387       // - 3rd part of initialisation : about V0 part in cascades
1388       Double_t lInvMassLambdaAsCascDghter  = 0.;
1389       Double_t lDcaV0DaughtersXi           = -1.;
1390       Double_t lDcaBachToPrimVertexXi      = -1.;
1391       Double_t lDcaV0ToPrimVertexXi        = -1.;
1392       Double_t lDcaPosToPrimVertexXi       = -1.;
1393       Double_t lDcaNegToPrimVertexXi       = -1.;
1394       Double_t lV0CosineOfPointingAngleXi  = -1. ;
1395       Double_t lPosV0Xi[3]                 = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
1396       Double_t lV0RadiusXi                 = -1000.0;
1397       Double_t lV0quality                  = 0.;
1398       // - 4th part of initialisation : Effective masses
1399       Double_t lInvMassXiMinus             = 0.;
1400       Double_t lInvMassXiPlus              = 0.;
1401       Double_t lInvMassOmegaMinus          = 0.;
1402       Double_t lInvMassOmegaPlus           = 0.;
1403       // - 5th part of initialisation : PID treatment
1404       Bool_t   lIsPosInXiProton            = kFALSE;
1405       Bool_t   lIsPosInXiPion              = kFALSE;
1406       Bool_t   lIsPosInOmegaProton         = kFALSE;
1407       Bool_t   lIsPosInOmegaPion           = kFALSE;
1408       Bool_t   lIsNegInXiProton            = kFALSE;
1409       Bool_t   lIsNegInXiPion              = kFALSE;
1410       Bool_t   lIsNegInOmegaProton         = kFALSE;
1411       Bool_t   lIsNegInOmegaPion           = kFALSE;
1412       Bool_t   lIsBachelorKaon             = kFALSE;
1413       Bool_t   lIsBachelorPion             = kFALSE; 
1414       Bool_t   lIsBachelorKaonForTPC       = kFALSE; 
1415       Bool_t   lIsBachelorPionForTPC       = kFALSE; 
1416       Bool_t   lIsNegPionForTPC            = kFALSE; 
1417       Bool_t   lIsPosPionForTPC            = kFALSE; 
1418       Bool_t   lIsNegProtonForTPC          = kFALSE; 
1419       Bool_t   lIsPosProtonForTPC          = kFALSE; 
1420       // - 6th part of initialisation : extra info for QA
1421       Double_t lXiMomX         = 0.;
1422       Double_t lXiMomY         = 0.;
1423       Double_t lXiMomZ         = 0.;
1424       Double_t lXiTransvMom    = 0.;
1425       Double_t lXiTotMom       = 0.;
1426       Double_t lV0PMomX        = 0.;
1427       Double_t lV0PMomY        = 0.;
1428       Double_t lV0PMomZ        = 0.;
1429       Double_t lV0NMomX        = 0.;
1430       Double_t lV0NMomY        = 0.;
1431       Double_t lV0NMomZ        = 0.;
1432       Double_t lV0TotMom       = 0.;
1433       Double_t lBachMomX       = 0.;
1434       Double_t lBachMomY       = 0.;
1435       Double_t lBachMomZ       = 0.;
1436       Double_t lBachTransvMom  = 0.;
1437       Double_t lBachTotMom     = 0.;
1438       Double_t lpTrackTransvMom  = 0.;
1439       Double_t lnTrackTransvMom  = 0.;
1440       Short_t  lChargeXi       = -2;
1441       Double_t lV0toXiCosineOfPointingAngle = 0.;
1442       Double_t lRapXi   = -20.0, lRapOmega = -20.0, lEta = -20.0, lTheta = 360., lPhi = 720.;
1443       Double_t lAlphaXi = -200., lPtArmXi  = -200.0;
1444       Double_t etaPos = 0., etaNeg = 0., etaBach = 0.;
1445   
1446       if (fAnalysisType == "ESD") { 
1447   
1448           // -------------------------------------
1449           // - Load the cascades from the handler
1450           AliESDcascade *xi = lESDevent->GetCascade(iXi);
1451           if (!xi) continue;
1452
1453           //----------------------------------------------------------------------------        
1454           // - Assigning the necessary variables for specific AliESDcascade data members        
1455           lV0quality = 0.;
1456           xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis: cascade = Xi-decay
1457           lEffMassXi               = xi->GetEffMassXi();
1458           lDcaXiDaughters          = xi->GetDcaXiDaughters();
1459           lXiCosineOfPointingAngle = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
1460                                                                        //Take care : the best available vertex should be used (like in AliCascadeVertexer)
1461           xi->GetXYZcascade( lPosXi[0],  lPosXi[1], lPosXi[2] ); 
1462           lXiRadius                = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
1463                 
1464           //-------------------------------------------------------------------------------------------------------------------------------
1465           // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1466           UInt_t lIdxPosXi      = (UInt_t) TMath::Abs( xi->GetPindex() );
1467           UInt_t lIdxNegXi      = (UInt_t) TMath::Abs( xi->GetNindex() );
1468           UInt_t lBachIdx       = (UInt_t) TMath::Abs( xi->GetBindex() );
1469                                       //Care track label can be negative in MC production (linked with the track quality)
1470                                       //However = normally, not the case for track index ...
1471           // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1472           if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }
1473           if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }
1474           // - Get the track for the daughters
1475           AliESDtrack *pTrackXi    = lESDevent->GetTrack( lIdxPosXi );
1476           AliESDtrack *nTrackXi    = lESDevent->GetTrack( lIdxNegXi );
1477           AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );
1478           if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1479                AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
1480                continue;
1481           }
1482           // - Get the TPCnumber of cluster for the daughters
1483           lPosTPCClusters   = pTrackXi->GetTPCNcls();
1484           lNegTPCClusters   = nTrackXi->GetTPCNcls();
1485           lBachTPCClusters  = bachTrackXi->GetTPCNcls();
1486
1487           //-------------------------------------
1488           // - Rejection of a poor quality tracks
1489           if (fkQualityCutTPCrefit) {
1490                 // - Poor quality related to TPCrefit
1491                 ULong_t pStatus    = pTrackXi->GetStatus();
1492                 ULong_t nStatus    = nTrackXi->GetStatus();
1493                 ULong_t bachStatus = bachTrackXi->GetStatus();
1494                 if ((pStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1495                 if ((nStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1496                 if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1497           }
1498           if (fkQualityCutnTPCcls) {
1499                 // - Poor quality related to TPC clusters
1500                 if (lPosTPCClusters  < fMinnTPCcls) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }
1501                 if (lNegTPCClusters  < fMinnTPCcls) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }
1502                 if (lBachTPCClusters < fMinnTPCcls) { AliWarning("Pb / Bach.   track has less than 80 TPC clusters ... continue!"); continue; }
1503           }
1504
1505           //-----------------------------------
1506           const AliExternalTrackParam *pExtTrack    = pTrackXi->GetInnerParam();
1507           const AliExternalTrackParam *nExtTrack    = nTrackXi->GetInnerParam();
1508           const AliExternalTrackParam *bachExtTrack = bachTrackXi->GetInnerParam();
1509           if (pExtTrack) {
1510                 lInnerWallMomCascDghters[0] = pExtTrack->GetP() * pExtTrack->Charge();
1511                 lTPCSignalCascDghters   [0] = pTrackXi->GetTPCsignal();
1512           }
1513           if (nExtTrack) {
1514                 lInnerWallMomCascDghters[1] = nExtTrack->GetP() * nExtTrack->Charge();
1515                 lTPCSignalCascDghters   [1] = nTrackXi->GetTPCsignal();
1516            }
1517            if (bachExtTrack) {
1518                 lInnerWallMomCascDghters[2] = bachExtTrack->GetP() * bachExtTrack->Charge();
1519                 lTPCSignalCascDghters   [2] = bachTrackXi->GetTPCsignal();
1520            }
1521            etaPos  = pTrackXi->Eta();
1522            etaNeg  = nTrackXi->Eta();
1523            etaBach = bachTrackXi->Eta();
1524            lInvMassLambdaAsCascDghter = xi->GetEffMass(); //This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
1525            lDcaV0DaughtersXi          = xi->GetDcaV0Daughters(); 
1526            lV0CosineOfPointingAngleXi = xi->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],
1527                                                                        lBestPrimaryVtxPos[1],
1528                                                                        lBestPrimaryVtxPos[2] );
1529            lDcaV0ToPrimVertexXi = xi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lBestPrimaryVtxPos[2] );
1530            lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); //Note: AliExternalTrackParam::GetD returns an algebraic value ...
1531            xi->GetXYZ( lPosV0Xi[0],  lPosV0Xi[1], lPosV0Xi[2] ); 
1532            lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );      
1533            lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); 
1534            lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi ->GetD( lBestPrimaryVtxPos[0], lBestPrimaryVtxPos[1], lMagneticField ) ); 
1535
1536            //-----------------------------------------
1537            // - Extra-selection for cascade candidates
1538            if (fkExtraSelections) { //in AliCascadeVertexer
1539                if (lDcaXiDaughters > 0.3) continue;  
1540                if (lXiCosineOfPointingAngle < 0.999 ) continue; 
1541                if (lDcaV0ToPrimVertexXi < 0.05) continue; 
1542                if (lDcaBachToPrimVertexXi < 0.03) continue; 
1543                //if (TMath::Abs(lInvMassLambdaAsCascDghter-1.11568) > 0.006 ) continue;   
1544                if (lDcaV0DaughtersXi > 1.) continue;  
1545                if (lV0CosineOfPointingAngleXi < 0.998) continue; 
1546                if (lDcaPosToPrimVertexXi < 0.1) continue; 
1547                if (lDcaNegToPrimVertexXi < 0.1) continue; 
1548                if (lXiRadius < .9) continue; 
1549                //if (lXiRadius > 100) continue; 
1550                if (lV0RadiusXi < 0.9) continue;   
1551                //if (lV0RadiusXi > 100) continue; 
1552            }
1553
1554            //----------------------------------------------------------------------------------------------------       
1555            // - Around effective masses. Change mass hypotheses to cover all the possibilities:  Xi-/+, Omega -/+
1556            if ( bachTrackXi->Charge() < 0 )     {
1557                 //Calculate the effective mass of the Xi- candidate: Xi- hyp. (pdg code 3312)
1558                 lV0quality = 0.;
1559                 xi->ChangeMassHypothesis(lV0quality , 3312);    
1560                 lInvMassXiMinus = xi->GetEffMassXi();
1561                 //Calculate the effective mass of the Xi- candidate: Omega- hyp. (pdg code 3334)
1562                 lV0quality = 0.;
1563                 xi->ChangeMassHypothesis(lV0quality , 3334);    
1564                 lInvMassOmegaMinus = xi->GetEffMassXi();
1565                 //Back to "default" hyp. (Xi-)
1566                 lV0quality = 0.;
1567                 xi->ChangeMassHypothesis(lV0quality , 3312); 
1568            } // end if negative bachelor
1569            if ( bachTrackXi->Charge() >  0 ) {
1570                 //Calculate the effective mass of the Xi- candidate: Xi+ hyp. (pdg code -3312)
1571                 lV0quality = 0.;
1572                 xi->ChangeMassHypothesis(lV0quality , -3312);   
1573                 lInvMassXiPlus = xi->GetEffMassXi();
1574                 //Calculate the effective mass of the Xi- candidate: Omega+ hyp. (pdg code -3334)
1575                 lV0quality = 0.;
1576                 xi->ChangeMassHypothesis(lV0quality , -3334);   
1577                 lInvMassOmegaPlus = xi->GetEffMassXi();
1578                 //Back to "default" hyp. (Xi-)
1579                 lV0quality = 0.;
1580                 xi->ChangeMassHypothesis(lV0quality , -3312);   
1581            } // end if positive bachelor
1582
1583            //--------------------------------
1584            // - PID on the daughter tracks
1585            // - Combined PID ->  removed, add when will be used
1586
1587            // - TPC PID : 3-sigma bands on Bethe-Bloch curve
1588            //Bachelor
1589            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
1590            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
1591            //Negative V0 daughter
1592            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
1593            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
1594            //Positive V0 daughter
1595            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
1596            if (TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
1597            /*
1598            const AliExternalTrackParam *pInnerWallTrackXi    = pTrackXi    ->GetInnerParam();
1599            const AliExternalTrackParam *nInnerWallTrackXi    = nTrackXi    ->GetInnerParam();
1600            const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
1601            if (pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ) { 
1602                 Double_t pMomInnerWall    = pInnerWallTrackXi   ->GetP();
1603                 Double_t nMomInnerWall    = nInnerWallTrackXi   ->GetP();
1604                 Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
1605                 //Bachelor
1606                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3)                              lIsBachelorPionForTPC = kTRUE;
1607                 if (bachMomInnerWall < 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
1608                 if (bachMomInnerWall > 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;                
1609                 //Negative V0 daughter
1610                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 3  )                           lIsNegPionForTPC   = kTRUE;
1611                 if (nMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 )   lIsNegProtonForTPC = kTRUE;
1612                 if (nMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 )   lIsNegProtonForTPC = kTRUE;       
1613                 //Positive V0 daughter
1614                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 3 )                            lIsPosPionForTPC   = kTRUE;
1615                 if (pMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5)     lIsPosProtonForTPC = kTRUE;
1616                 if (pMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3)     lIsPosProtonForTPC = kTRUE;
1617            }*/
1618                 
1619            //---------------------------------
1620            // - Extra info for QA (ESD)
1621            // Miscellaneous pieces of info that may help regarding data quality assessment.
1622            // Cascade transverse and total momentum
1623            xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
1624            lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
1625            lXiTotMom    = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
1626            // V0 total momentum
1627            xi->GetNPxPyPz(lV0NMomX,lV0NMomY,lV0NMomZ);
1628            xi->GetPPxPyPz(lV0PMomX,lV0PMomY,lV0PMomZ);
1629            lV0TotMom = TMath::Sqrt(TMath::Power(lV0NMomX+lV0PMomX,2) + TMath::Power(lV0NMomY+lV0PMomY,2) + TMath::Power(lV0NMomZ+lV0PMomZ,2));
1630            // Bachelor total momentum
1631            xi->GetBPxPyPz(  lBachMomX,  lBachMomY,  lBachMomZ );
1632            lBachTransvMom  = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
1633            lBachTotMom     = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
1634            lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX   + lV0NMomY*lV0NMomY );
1635            lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX   + lV0PMomY*lV0PMomY );
1636            lChargeXi       = xi->Charge();
1637            lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
1638            lRapXi    = xi->RapXi();
1639            lRapOmega = xi->RapOmega();
1640            lEta      = xi->Eta();
1641            lTheta    = xi->Theta()*180.0/TMath::Pi();
1642            lPhi      = xi->Phi()*180.0/TMath::Pi();
1643            lAlphaXi  = xi->AlphaXi();
1644            lPtArmXi  = xi->PtArmXi();
1645            // Extra-cut = Anti-splitting cut for lambda daughters
1646            Bool_t kAntiSplittingLambda = kFALSE;        
1647            if (kAntiSplittingLambda) { // not used
1648                Double_t lNMomX = 0., lNMomY = 0., lNMomZ = 0.;
1649                Double_t lPMomX = 0., lPMomY = 0., lPMomZ = 0.;
1650                xi->GetPPxPyPz(lPMomX, lPMomY, lPMomZ); 
1651                xi->GetNPxPyPz(lNMomX, lNMomY, lNMomZ); 
1652                if ( xi->Charge() < 0) {// Xi- or Omega-
1653                    if (TMath::Abs(lBachTransvMom - TMath::Sqrt( lNMomX*lNMomX + lNMomY*lNMomY )  ) < 0.075) continue;
1654                } else {                //Xi+ or Omega+
1655                    if(TMath::Abs(lBachTransvMom - TMath::Sqrt( lPMomX*lPMomX + lPMomY*lPMomY ) ) < 0.075) continue;
1656                }
1657            }
1658
1659     } // end of ESD treatment
1660  
1661     else if (fAnalysisType == "AOD") {
1662
1663            // -------------------------------------
1664            // - Load the cascades from the handler
1665            const AliAODcascade *xi = lAODevent->GetCascade(iXi);
1666            if (!xi) continue;
1667                 
1668            //----------------------------------------------------------------------------        
1669            // - Assigning the necessary variables for specific AliESDcascade data members               
1670            lEffMassXi              = xi->MassXi(); // default working hypothesis : cascade = Xi- decay
1671            lDcaXiDaughters         = xi->DcaXiDaughters();
1672            lXiCosineOfPointingAngle = xi->CosPointingAngleXi( lBestPrimaryVtxPos[0], 
1673                                                               lBestPrimaryVtxPos[1], 
1674                                                               lBestPrimaryVtxPos[2] );
1675            lPosXi[0] = xi->DecayVertexXiX();
1676            lPosXi[1] = xi->DecayVertexXiY();
1677            lPosXi[2] = xi->DecayVertexXiZ();
1678            lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
1679
1680            //-------------------------------------------------------------------------------------------------------------------------------
1681            // - Around the tracks: Bach + V0 (ESD). Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1682            AliAODTrack *pTrackXi    = dynamic_cast<AliAODTrack*>( xi->GetDaughter(0) );
1683            AliAODTrack *nTrackXi    = dynamic_cast<AliAODTrack*>( xi->GetDaughter(1) );
1684            AliAODTrack *bachTrackXi = dynamic_cast<AliAODTrack*>( xi->GetDecayVertexXi()->GetDaughter(0) );
1685            if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1686                 AliWarning("ERROR: Could not retrieve one of the 3 AOD daughter tracks of the cascade ...");
1687                 continue;
1688            }
1689            UInt_t lIdxPosXi  = (UInt_t) TMath::Abs( pTrackXi->GetID() );  
1690            UInt_t lIdxNegXi  = (UInt_t) TMath::Abs( nTrackXi->GetID() );
1691            UInt_t lBachIdx   = (UInt_t) TMath::Abs( bachTrackXi->GetID() );
1692                                                 // Care track label can be negative in MC production (linked with the track quality)
1693                                                 // However = normally, not the case for track index ...
1694            // - Rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1695            if (lBachIdx == lIdxNegXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue; }
1696            if (lBachIdx == lIdxPosXi) { AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue; }
1697            // - Get the TPCnumber of cluster for the daughters
1698            lPosTPCClusters   = pTrackXi->GetTPCNcls(); // FIXME: Is this ok? or something like in LambdaK0PbPb task AOD?
1699            lNegTPCClusters   = nTrackXi->GetTPCNcls();
1700            lBachTPCClusters  = bachTrackXi->GetTPCNcls();
1701
1702            //-------------------------------------
1703            // - Rejection of a poor quality tracks
1704            if (fkQualityCutTPCrefit) {
1705                 // - Poor quality related to TPCrefit
1706                 if (!(pTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1707                 if (!(nTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1708                 if (!(bachTrackXi->IsOn(AliAODTrack::kTPCrefit))) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1709            }
1710            if (fkQualityCutnTPCcls) {
1711                 // - Poor quality related to TPC clusters
1712                 if (lPosTPCClusters  < fMinnTPCcls) { //AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!");
1713                     continue; }
1714                 if (lNegTPCClusters  < fMinnTPCcls) { //AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!");
1715                     continue; }
1716                 if (lBachTPCClusters < fMinnTPCcls) { //AliWarning("Pb / Bach.   track has less than 80 TPC clusters ... continue!");
1717                     continue; }
1718            }
1719
1720            //---------------------------------------
1721            // - Around the tracks: Bach + V0 (AOD). Necessary variables for AODcascade data members coming from the AODv0 part (inheritance)
1722            etaPos  = pTrackXi->Eta();
1723            etaNeg  = nTrackXi->Eta();
1724            etaBach = bachTrackXi->Eta();
1725            lChargeXi = xi->ChargeXi();
1726            if ( lChargeXi < 0) lInvMassLambdaAsCascDghter = xi->MassLambda();
1727            else                lInvMassLambdaAsCascDghter = xi->MassAntiLambda();
1728            lDcaV0DaughtersXi      = xi->DcaV0Daughters(); 
1729            lDcaV0ToPrimVertexXi   = xi->DcaV0ToPrimVertex();
1730            lDcaBachToPrimVertexXi = xi->DcaBachToPrimVertex(); 
1731            lPosV0Xi[0] = xi->DecayVertexV0X();
1732            lPosV0Xi[1] = xi->DecayVertexV0Y();
1733            lPosV0Xi[2] = xi->DecayVertexV0Z(); 
1734            lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
1735            lV0CosineOfPointingAngleXi = xi->CosPointingAngle( lBestPrimaryVtxPos ); 
1736            lDcaPosToPrimVertexXi      = xi->DcaPosToPrimVertex(); 
1737            lDcaNegToPrimVertexXi      = xi->DcaNegToPrimVertex(); 
1738
1739            //----------------------------------------------------------------------------------------------------       
1740            // - Around effective masses. Change mass hypotheses to cover all the possibilities:  Xi-/+, Omega -/+
1741            if ( lChargeXi < 0 ) lInvMassXiMinus    = xi->MassXi();
1742            if ( lChargeXi > 0 ) lInvMassXiPlus     = xi->MassXi();
1743            if ( lChargeXi < 0 ) lInvMassOmegaMinus = xi->MassOmega();
1744            if ( lChargeXi > 0 ) lInvMassOmegaPlus  = xi->MassOmega();
1745
1746            //--------------------------------
1747            // - PID on the daughter tracks
1748            // - Combined PID ->  removed, add when will be used
1749
1750            // - TPC PID : 3-sigma bands on Bethe-Bloch curve
1751            //Bachelor
1752            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
1753            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
1754            //Negative V0 daughter
1755            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
1756            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
1757            //Positive V0 daughter
1758            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
1759            if(TMath::Abs(fPIDResponse->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
1760
1761            //---------------------------------
1762            // - Extra info for QA (AOD)
1763            // Miscellaneous pieces of info that may help regarding data quality assessment.
1764            // Cascade transverse and total momentum     
1765            lXiMomX = xi->MomXiX();
1766            lXiMomY = xi->MomXiY();
1767            lXiMomZ = xi->MomXiZ();
1768            lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
1769            lXiTotMom    = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
1770            Double_t lV0MomX = xi->MomV0X();
1771            Double_t lV0MomY = xi->MomV0Y();
1772            Double_t lV0MomZ = xi->MomV0Z();
1773            lV0TotMom = TMath::Sqrt(TMath::Power(lV0MomX,2)+TMath::Power(lV0MomY,2)+TMath::Power(lV0MomZ,2));
1774            lBachMomX = xi->MomBachX();
1775            lBachMomY = xi->MomBachY();
1776            lBachMomZ = xi->MomBachZ();          
1777            lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
1778            lBachTotMom    = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
1779            lV0NMomX = xi->MomNegX();
1780            lV0NMomY = xi->MomNegY();
1781            lV0PMomX = xi->MomPosX();
1782            lV0PMomY = xi->MomPosY();
1783            lnTrackTransvMom = TMath::Sqrt( lV0NMomX*lV0NMomX   + lV0NMomY*lV0NMomY );
1784            lpTrackTransvMom = TMath::Sqrt( lV0PMomX*lV0PMomX   + lV0PMomY*lV0PMomY );
1785            lV0toXiCosineOfPointingAngle = xi->CosPointingAngle( xi->GetDecayVertexXi() );
1786            lRapXi    = xi->RapXi();
1787            lRapOmega = xi->RapOmega();
1788            lEta      = xi->Eta();                       // Will not work ! need a method Pz(), Py() Px() 
1789            lTheta    = xi->Theta() *180.0/TMath::Pi();  // in AODcascade.
1790            lPhi      = xi->Phi()   *180.0/TMath::Pi();  // Here, we will get eta, theta, phi for the V0 ...
1791            lAlphaXi  = xi->AlphaXi();
1792            lPtArmXi  = xi->PtArmXi();
1793
1794     } // end of AOD treatment
1795
1796     // Cut on pt of the three daughter tracks
1797     if (lBachTransvMom<fMinPtCutOnDaughterTracks) continue;
1798     if (lpTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
1799     if (lnTrackTransvMom<fMinPtCutOnDaughterTracks) continue;
1800       
1801     // Cut on pseudorapidity of the three daughter tracks
1802     if (TMath::Abs(etaBach)>fEtaCutOnDaughterTracks) continue;
1803     if (TMath::Abs(etaPos)>fEtaCutOnDaughterTracks) continue;
1804     if (TMath::Abs(etaNeg)>fEtaCutOnDaughterTracks) continue;
1805       
1806       
1807     //----------------------------------
1808     // Calculate proper lenght for cascade
1809     Double_t cascadeMass = 0.;
1810     if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
1811          ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )  ) cascadeMass = 1.321;
1812     if ( ( (lChargeXi<0) && lIsBachelorKaonForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC ) ||
1813          ( (lChargeXi>0) && lIsBachelorKaonForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )  ) cascadeMass = 1.672;
1814     Double_t lctau =  TMath::Sqrt(TMath::Power((lPosXi[0]-lBestPrimaryVtxPos[0]),2)+TMath::Power((lPosXi[1]-lBestPrimaryVtxPos[1]),2)+TMath::Power(( lPosXi[2]-lBestPrimaryVtxPos[2]),2));
1815     if (lXiTotMom!=0) lctau = lctau*cascadeMass/lXiTotMom;
1816     else lctau = -1.;
1817
1818     //-------------------------------------------------
1819     // Calculate proper lenght for Lambda (reconstructed)
1820     Float_t lambdaMass = 1.115683; // PDG mass
1821     Float_t distV0Xi =  TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2)+TMath::Power((lPosV0Xi[2]-lPosXi[2]),2));
1822     Float_t lctauV0 = -1.;
1823     if (lV0TotMom!=0) lctauV0 = distV0Xi*lambdaMass/lV0TotMom;
1824     Float_t distTV0Xi =  TMath::Sqrt(TMath::Power((lPosV0Xi[0]-lPosXi[0]),2)+TMath::Power((lPosV0Xi[1]-lPosXi[1]),2));
1825
1826     //--------------
1827     /*// For AliEVE      
1828          if(lChargeXi < 0&& lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
1829              if (lXiTransvMom>2.&&lXiTransvMom<4.&&(lInvMassXiMinus<1.322&&lInvMassXiMinus>1.320)&&(lXiRadius<8.&&lXiRadius>3.)) {
1830                          // FIXME : Just to know which file is currently open : locate the file containing Xi
1831                   cout << "Name of the file containing Xi candidate(s) :" 
1832                        << CurrentFileName() 
1833                        << " / entry: "     << Entry()
1834                        << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
1835                        << " AliESDcascade number " << iXi 
1836                        << " : mass(Xi-) = " << lInvMassXiMinus
1837                        << " / charge = "   << lChargeXi
1838                        << " / pt(Casc) = " << lXiTransvMom
1839                        << " / Decay 2d R(Xi) = " << lXiRadius 
1840                        << endl;
1841              }
1842          }
1843          if(lChargeXi < 0&& lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) {
1844              if (lXiTransvMom>2&&lXiTransvMom<4&&(lInvMassOmegaMinus<1.674&&lInvMassOmegaMinus>1.670)&&(lXiRadius<8.&&lXiRadius>3.)) {
1845                   cout << "Name of the file containing Omega candidate(s) :"
1846                        << CurrentFileName()
1847                        << " / entry: "     << Entry()
1848                        << " / in file: "   << lESDevent->GetEventNumberInFile()   // <- Cvetan / From Mihaela: AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetReadEntry();
1849                        << " AliESDcascade number " << iXi 
1850                        << " : mass(Omega-) = " << lInvMassOmegaMinus
1851                        << " / charge = "   << lChargeXi
1852                        << " / pt(Casc) = " << lXiTransvMom
1853                        << " / Decay 2d R(Xi) = " << lXiRadius
1854                        << endl;
1855
1856              }
1857          }*/
1858           
1859
1860     // - 
1861     fHistPosV0TPCClusters->Fill( lPosTPCClusters );
1862     fHistNegV0TPCClusters->Fill( lNegTPCClusters );
1863     fHistBachTPCClusters->Fill( lBachTPCClusters );
1864     f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[0] , lTPCSignalCascDghters[0] );
1865     f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[1] , lTPCSignalCascDghters[1] );
1866     f2dHistTPCdEdxOfCascDghters->Fill( lInnerWallMomCascDghters[2] , lTPCSignalCascDghters[2] );
1867
1868     //----------------
1869     //Plot with PID on  
1870     if ( ( (lChargeXi<0) && lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) ||
1871          ( (lChargeXi>0) && lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC )  ) {
1872                                        // NOTE : 
1873                                        // with this condition, it could happen that a cascade candidate satisfies the wrong requirement,
1874                                        // e.g. one looks at a Xi- candidate for which lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC = kFALSE
1875                                        // Expectation: it should be excluded, but lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC = kTRUE
1876                                        // then this bad Xi-candidate will contribute anyway (OR condition).
1877                                        // Hence: the extra condition on the sign of the Cascade
1878            //if (TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.010 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.010)
1879            fHistEffMassXi->Fill( lEffMassXi );
1880            fHistDcaXiDaughters->Fill( lDcaXiDaughters );                    // Flag CascadeVtxer: Cut Variable e 
1881            fHistDcaBachToPrimVertex->Fill( lDcaBachToPrimVertexXi   );      // Flag CascadeVtxer: Cut Variable d
1882            fHistXiCosineOfPointingAngle->Fill( lXiCosineOfPointingAngle );  // Flag CascadeVtxer: Cut Variable f
1883            fHistXiRadius->Fill( lXiRadius );                                // Flag CascadeVtxer: Cut Variable g+h
1884            fHistMassLambdaAsCascDghter->Fill( lInvMassLambdaAsCascDghter ); // Flag CascadeVtxer: Cut Variable c
1885            fHistDcaV0DaughtersXi->Fill( lDcaV0DaughtersXi );
1886            fHistV0CosineOfPointingAngleXi->Fill( lV0CosineOfPointingAngleXi ); 
1887            fHistV0RadiusXi->Fill( lV0RadiusXi );
1888            fHistDcaV0ToPrimVertexXi->Fill( lDcaV0ToPrimVertexXi );          // Flag CascadeVtxer: Cut Variable b
1889            fHistDcaPosToPrimVertexXi->Fill( lDcaPosToPrimVertexXi );
1890            fHistDcaNegToPrimVertexXi->Fill( lDcaNegToPrimVertexXi );
1891            fHistChargeXi->Fill( lChargeXi );
1892            fHistV0toXiCosineOfPointingAngle->Fill( lV0toXiCosineOfPointingAngle );
1893            if ( TMath::Abs( lInvMassXiMinus-1.3217 ) < 0.012 || TMath::Abs( lInvMassXiPlus-1.3217 ) < 0.012) { // One InvMass should be different from 0
1894                 fHistXiTransvMom->Fill( lXiTransvMom );
1895                 fHistXiTotMom->Fill( lXiTotMom );
1896                 fHistBachTransvMomXi->Fill( lBachTransvMom );
1897                 fHistBachTotMomXi->Fill( lBachTotMom );
1898                 fHistRapXi->Fill( lRapXi );
1899                 fHistEtaXi->Fill( lEta );
1900                 if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) {
1901                       fHistEtaBachXi->Fill( etaBach );
1902                       fHistEtaPosXi->Fill( etaPos );
1903                       fHistEtaNegXi->Fill( etaNeg );
1904                 }
1905                 fHistThetaXi->Fill( lTheta );
1906                 fHistPhiXi->Fill( lPhi );
1907            }
1908            if ( TMath::Abs( lInvMassOmegaMinus-1.672 ) < 0.012 || TMath::Abs( lInvMassOmegaPlus-1.672 ) < 0.012 ) { // One InvMass should be different from 0
1909                 fHistRapOmega->Fill( lRapOmega ); 
1910            }
1911            f2dHistArmenteros->Fill( lAlphaXi, lPtArmXi );
1912     } // end with PID ...
1913
1914     //-----------------------
1915     // - Invariant mass plots
1916     //Plots 1D
1917     if ( lChargeXi < 0 ) {
1918          fHistMassXiMinus->Fill( lInvMassXiMinus );
1919          fHistMassOmegaMinus->Fill( lInvMassOmegaMinus );
1920          f2dHistDcaXiDaughtersvsInvMass->Fill(lDcaXiDaughters,lInvMassXiMinus);
1921          f2dHistDcaBachToPrimVertexvsInvMass->Fill(lDcaBachToPrimVertexXi,lInvMassXiMinus); 
1922          f2dHistXiCosineOfPointingAnglevsInvMass->Fill(lXiCosineOfPointingAngle,lInvMassXiMinus);
1923          f2dHistMassLambdaAsCascDghtervsInvMass->Fill(lInvMassLambdaAsCascDghter,lInvMassXiMinus);
1924          f2dHistDcaV0DaughtersXivsInvMass->Fill(lDcaV0DaughtersXi,lInvMassXiMinus);
1925          f2dHistDcaV0ToPrimVertexXivsInvMass->Fill(lDcaV0ToPrimVertexXi,lInvMassXiMinus);
1926     }
1927     if ( lChargeXi > 0 ) {
1928       fHistMassXiPlus->Fill( lInvMassXiPlus );
1929       fHistMassOmegaPlus->Fill( lInvMassOmegaPlus );
1930     }
1931     //Plots 2D, 3D
1932     if ( lChargeXi < 0 ) {
1933       f2dHistEffMassLambdaVsEffMassXiMinus->Fill( lInvMassLambdaAsCascDghter, lInvMassXiMinus ); 
1934       f2dHistEffMassXiVsEffMassOmegaMinus ->Fill( lInvMassXiMinus, lInvMassOmegaMinus );
1935       f2dHistXiRadiusVsEffMassXiMinus     ->Fill( lXiRadius, lInvMassXiMinus );
1936       f2dHistXiRadiusVsEffMassOmegaMinus  ->Fill( lXiRadius, lInvMassOmegaMinus );
1937     } else {
1938       f2dHistEffMassLambdaVsEffMassXiPlus ->Fill( lInvMassLambdaAsCascDghter, lInvMassXiPlus );
1939       f2dHistEffMassXiVsEffMassOmegaPlus  ->Fill( lInvMassXiPlus, lInvMassOmegaPlus );
1940       f2dHistXiRadiusVsEffMassXiPlus      ->Fill( lXiRadius, lInvMassXiPlus);
1941       f2dHistXiRadiusVsEffMassOmegaPlus   ->Fill( lXiRadius, lInvMassOmegaPlus );
1942     }
1943
1944     //---------------------------------------------     
1945     // - Filling the AliCFContainers related to PID
1946     Double_t lContainerPIDVars[3] = {0.0};
1947     // Xi Minus         
1948     if ( lChargeXi < 0 ) {
1949           lContainerPIDVars[0] = lXiTransvMom;
1950           lContainerPIDVars[1] = lInvMassXiMinus;
1951           lContainerPIDVars[2] = lRapXi;
1952           //No PID
1953           fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 0); // No PID
1954           //TPC PID
1955           if ( lIsBachelorPionForTPC )                                           fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track              
1956           if ( lIsBachelorPionForTPC && lIsPosProtonForTPC )                     fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
1957           if ( lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
1958           //Combined PID
1959           if ( lIsBachelorPion )                                      fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor     
1960           if ( lIsBachelorPion && lIsPosInXiProton )                  fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
1961           if (lIsBachelorPion && lIsPosInXiProton && lIsNegInXiPion ) fCFContCascadePIDXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
1962     }
1963     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;    
1964     // Xi Plus          
1965     if ( lChargeXi > 0 ) {
1966           lContainerPIDVars[0] = lXiTransvMom;
1967           lContainerPIDVars[1] = lInvMassXiPlus;
1968           lContainerPIDVars[2] = lRapXi;
1969           //No PID
1970           fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 0); // No PID
1971           //TPC PID
1972           if ( lIsBachelorPionForTPC )                                           fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
1973           if ( lIsBachelorPionForTPC && lIsNegProtonForTPC )                     fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
1974           if ( lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
1975           //Combined PID
1976           if ( lIsBachelorPion )                                      fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
1977           if ( lIsBachelorPion && lIsNegInXiProton )                  fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
1978           if (lIsBachelorPion && lIsNegInXiProton && lIsPosInXiPion ) fCFContCascadePIDXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
1979     }
1980     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; 
1981     // Omega Minus              
1982     if ( lChargeXi < 0 ) {
1983           lContainerPIDVars[0] = lXiTransvMom;
1984           lContainerPIDVars[1] = lInvMassOmegaMinus;
1985           lContainerPIDVars[2] = lRapOmega;
1986           //No PID
1987           fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 0); // No PID
1988           //TPC PID
1989           if ( lIsBachelorKaonForTPC )                                           fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
1990           if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC )                     fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
1991           if ( lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
1992           //Combined PID
1993           if ( lIsBachelorKaon )                                            fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
1994           if ( lIsBachelorKaon && lIsPosInOmegaProton )                     fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
1995           if (lIsBachelorKaon && lIsPosInOmegaProton && lIsNegInOmegaPion ) fCFContCascadePIDOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
1996     }
1997     lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.;
1998     // Omega Plus               
1999     if ( lChargeXi > 0 ) {
2000       lContainerPIDVars[0] = lXiTransvMom;
2001       lContainerPIDVars[1] = lInvMassOmegaPlus;
2002       lContainerPIDVars[2] = lRapOmega;
2003         // No PID
2004       fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 0); // No PID
2005         // TPC PID
2006       if ( lIsBachelorKaonForTPC  )
2007         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2008       if( lIsBachelorKaonForTPC && 
2009           lIsNegProtonForTPC     )
2010         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2011       if ( lIsBachelorKaonForTPC && 
2012            lIsNegProtonForTPC    && 
2013            lIsPosPionForTPC       )
2014         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2015         // Combined PID
2016       if ( lIsBachelorKaon        )
2017         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2018       if ( lIsBachelorKaon       && 
2019            lIsNegInOmegaProton    )
2020         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2021       if (lIsBachelorKaon     && 
2022           lIsNegInOmegaProton && 
2023           lIsPosInOmegaPion    )
2024         fCFContCascadePIDOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2025     }
2026                 
2027     //--------------------------------------------------------------------
2028     // Filling the AliCFContainer (optimisation of topological selections)
2029     Double_t lContainerCutVars[19] = {0.0};
2030                         
2031     lContainerCutVars[0]  = lDcaXiDaughters;
2032     lContainerCutVars[1]  = lDcaBachToPrimVertexXi;
2033     lContainerCutVars[2]  = lXiCosineOfPointingAngle;
2034     lContainerCutVars[3]  = lXiRadius;
2035     lContainerCutVars[4]  = lInvMassLambdaAsCascDghter;
2036     lContainerCutVars[5]  = lDcaV0DaughtersXi;
2037     lContainerCutVars[6]  = lV0toXiCosineOfPointingAngle;
2038     lContainerCutVars[7]  = lV0RadiusXi;
2039     lContainerCutVars[8]  = lDcaV0ToPrimVertexXi;       
2040     lContainerCutVars[9]  = lDcaPosToPrimVertexXi;
2041     lContainerCutVars[10] = lDcaNegToPrimVertexXi;
2042     lContainerCutVars[13] = lXiTransvMom;
2043     lContainerCutVars[16] = lctau;
2044     lContainerCutVars[17] = lctauV0;
2045     lContainerCutVars[18] = distTV0Xi;
2046  
2047     if ( lChargeXi < 0 ) {
2048          lContainerCutVars[11] = lInvMassXiMinus;
2049          lContainerCutVars[12] = lInvMassOmegaMinus;
2050          lContainerCutVars[14] = lRapXi;
2051          lContainerCutVars[15] = -1.;
2052          if (lIsBachelorPionForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,0); // for Xi-
2053          lContainerCutVars[11] = lInvMassXiMinus;
2054          lContainerCutVars[12] = lInvMassOmegaMinus;
2055          lContainerCutVars[14] = -1.;
2056          lContainerCutVars[15] = lRapOmega;
2057          if (lIsBachelorKaonForTPC && lIsPosProtonForTPC && lIsNegPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,2); // for Omega-
2058     } else {
2059          lContainerCutVars[11] = lInvMassXiPlus;
2060          lContainerCutVars[12] = lInvMassOmegaPlus; 
2061          lContainerCutVars[14] = lRapXi;
2062          lContainerCutVars[15] = -1.; 
2063          if (lIsBachelorPionForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,1); // for Xi+
2064          lContainerCutVars[11] = lInvMassXiPlus;
2065          lContainerCutVars[12] = lInvMassOmegaPlus;
2066          lContainerCutVars[14] = -1.;
2067          lContainerCutVars[15] = lRapOmega;
2068          if (lIsBachelorKaonForTPC && lIsNegProtonForTPC && lIsPosPionForTPC) fCFContCascadeCuts->Fill(lContainerCutVars,3); // for Omega+ 
2069     }                 
2070   } //end of the Cascade loop (ESD or AOD)
2071     
2072   // Post output data.
2073  PostData(1, fListHistCascade);
2074  PostData(2, fCFContCascadePIDXiMinus);
2075  PostData(3, fCFContCascadePIDXiPlus);
2076  PostData(4, fCFContCascadePIDOmegaMinus);
2077  PostData(5, fCFContCascadePIDOmegaPlus);
2078  PostData(6, fCFContCascadeCuts);
2079 }
2080
2081 //________________________________________________________________________
2082 Int_t AliAnalysisTaskCheckCascadepp276::DoESDTrackWithTPCrefitMultiplicity(const AliESDEvent *lESDevent) {
2083     // Checking the number of tracks with TPCrefit for each event
2084     // Needed for a rough assessment of the event multiplicity
2085         
2086     Int_t nTrackWithTPCrefitMultiplicity = 0;
2087     for (Int_t iTrackIdx = 0; iTrackIdx < (InputEvent())->GetNumberOfTracks(); iTrackIdx++) {
2088       AliESDtrack *esdTrack     = 0x0;
2089       esdTrack  = lESDevent->GetTrack( iTrackIdx );
2090       if (!esdTrack) { AliWarning("Pb / Could not retrieve one track within the track loop for TPCrefit check ..."); continue; }
2091
2092       ULong_t lTrackStatus    = esdTrack->GetStatus();
2093       if ((lTrackStatus&AliESDtrack::kTPCrefit)    == 0) continue;
2094       else nTrackWithTPCrefitMultiplicity++;
2095         // FIXME :
2096         // The goal here is to get a better assessment of the event multiplicity.
2097         // (InputEvent())->GetNumberOfTracks() takes into account ITS std alone tracks + global tracks
2098         // This may introduce a bias. Hence the number of TPC refit tracks.
2099         // Note : the event multiplicity = analysis on its own... See Jacek's or Jan Fiete's analysis on dN/d(eta)
2100
2101     } // end loop over all event tracks
2102     return  nTrackWithTPCrefitMultiplicity;
2103 }
2104
2105
2106 //________________________________________________________________________
2107 void AliAnalysisTaskCheckCascadepp276::Terminate(Option_t *) 
2108 {
2109   // Draw result to the screen
2110   // Called once at the end of the query
2111
2112 /*  TList *cRetrievedList = 0x0;
2113          cRetrievedList = (TList*)GetOutputData(1);
2114         if(!cRetrievedList){
2115                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: ouput data container list not available\n"); return;
2116         }
2117   fHistTrackMultiplicity = dynamic_cast<TH1F*> (   cRetrievedList->FindObject("fHistTrackMultiplicity") );
2118   if (!fHistTrackMultiplicity) {
2119                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistTrackMultiplicity not available\n"); return;
2120         }
2121   fHistMassXiMinus    = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiMinus") ); 
2122         if (!fHistMassXiMinus) {
2123                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiMinus not available\n"); return;
2124         }
2125   fHistMassXiPlus     = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassXiPlus") );
2126         if (!fHistMassXiPlus) {
2127                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassXiPlus not available\n"); return;
2128         }       
2129   fHistMassOmegaMinus = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaMinus") );
2130         if (!fHistMassOmegaMinus) {
2131                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaMinus not available\n"); return;
2132         }
2133   fHistMassOmegaPlus  = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistMassOmegaPlus") );       
2134         if (!fHistMassOmegaPlus) {
2135                 AliWarning("ERROR - AliAnalysisTaskCheckCascadepp276: fHistMassOmegaPlus not available\n"); return;
2136         }
2137   
2138   TCanvas *canCheckCascade = new TCanvas("AliAnalysisTaskCheckCascadep276","CheckCascade overview",10,10,1010,660);
2139   canCheckCascade->Divide(2,2);
2140   
2141   canCheckCascade->cd(1);
2142   canCheckCascade->cd(1)->SetLogy();
2143   fHistTrackMultiplicity->SetMarkerStyle(kFullStar);  
2144   fHistTrackMultiplicity->GetXaxis()->SetLabelFont(42);
2145   fHistTrackMultiplicity->GetYaxis()->SetLabelFont(42);
2146   fHistTrackMultiplicity->SetTitleFont(42, "xy");
2147   fHistTrackMultiplicity->GetXaxis()->SetTitleOffset(1.1);
2148   fHistTrackMultiplicity->DrawCopy("H");
2149   
2150   canCheckCascade->cd(2);  
2151   fHistMassXiMinus ->SetMarkerStyle(kFullCircle);
2152   fHistMassXiMinus ->SetMarkerSize(0.5);
2153   fHistMassXiMinus ->GetXaxis()->SetLabelFont(42);
2154   fHistMassXiMinus ->GetYaxis()->SetLabelFont(42);
2155   fHistMassXiMinus ->SetTitleFont(42, "xy");
2156   fHistMassXiMinus ->GetXaxis()->SetTitleOffset(1.1);
2157   fHistMassXiMinus ->GetYaxis()->SetTitleOffset(1.3);
2158   //fHistMassXiMinus->Rebin(2);
2159   fHistMassXiMinus ->GetXaxis()->SetRangeUser(1.24, 1.42);
2160   fHistMassXiMinus ->DrawCopy("E");
2161   
2162   fHistMassXiPlus ->SetMarkerStyle(kOpenCircle);
2163   fHistMassXiPlus ->SetMarkerColor(kRed+2);
2164   fHistMassXiPlus ->SetLineColor(kRed+2);
2165   fHistMassXiPlus ->SetMarkerSize(0.5);
2166   //fHistMassXiPlus ->Rebin(2);
2167   fHistMassXiPlus ->DrawCopy("ESAME");
2168   
2169   
2170   TLegend *legendXi =new TLegend(0.67,0.34,0.97,0.54);
2171                 legendXi->SetTextFont(42);
2172                 legendXi->SetTextSize(0.05);
2173                 legendXi->SetFillColor(kWhite);
2174                 legendXi->AddEntry( fHistMassXiMinus,"#Xi^{-} candidates","lp");
2175                 legendXi->AddEntry( fHistMassXiPlus,"#Xi^{+} candidates","lp");
2176                 legendXi->Draw();
2177   
2178   
2179   canCheckCascade->cd(3);  
2180   fHistMassOmegaPlus ->SetMarkerStyle(kOpenCircle);
2181   fHistMassOmegaPlus ->SetMarkerColor(kRed+2);
2182   fHistMassOmegaPlus ->SetLineColor(kRed+2);
2183   fHistMassOmegaPlus ->SetMarkerSize(0.5);
2184   fHistMassOmegaPlus ->GetXaxis()->SetLabelFont(42);
2185   fHistMassOmegaPlus ->GetYaxis()->SetLabelFont(42);
2186   fHistMassOmegaPlus ->SetTitleFont(42, "xy");
2187   fHistMassOmegaPlus ->GetXaxis()->SetTitleOffset(1.1);
2188   fHistMassOmegaPlus ->GetYaxis()->SetTitleOffset(1.25);
2189   //fHistMassOmegaPlus ->Rebin(2);
2190   fHistMassOmegaPlus ->GetXaxis()->SetRangeUser(1.6, 1.84);
2191   fHistMassOmegaPlus ->DrawCopy("E");
2192   
2193   fHistMassOmegaMinus->SetMarkerStyle(kFullCircle);
2194   fHistMassOmegaMinus->SetMarkerSize(0.5);
2195   //fHistMassOmegaMinus->Rebin(2);
2196   fHistMassOmegaMinus->DrawCopy("ESAME");
2197
2198   
2199    TLegend *legendOmega = new TLegend(0.67,0.34,0.97,0.54);
2200                 legendOmega->SetTextFont(42);
2201                 legendOmega->SetTextSize(0.05);
2202                 legendOmega->SetFillColor(kWhite);
2203                 legendOmega->AddEntry( fHistMassOmegaMinus,"#Omega^{-} candidates","lp");
2204                 legendOmega->AddEntry( fHistMassOmegaPlus,"#Omega^{+} candidates","lp");
2205                 legendOmega->Draw();
2206      */
2207 }