]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliAnalysisTaskCheckPerformanceCascade.cxx
SUMMARY : Commit of the 900 GeV strangeness paper
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliAnalysisTaskCheckPerformanceCascade.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 //               AliAnalysisTaskCheckPerformanceCascade class
16 //            This task is for a performance study of cascade identification.
17 //            It works with MC info and ESD.
18 //              Use with AOD tree = under development
19 //            Origin   : A.Maire Mar2009, antonin.maire@ires.in2p3.fr
20 //            Modified : A.Maire Jan2010, antonin.maire@ires.in2p3.fr
21 //-----------------------------------------------------------------
22
23
24 #include <Riostream.h>
25
26 #include "TList.h"
27 #include "TFile.h"
28 #include "TH1F.h"
29 #include "TH2F.h"
30 #include "TCanvas.h"
31 #include "TParticle.h"
32 #include "TMath.h"
33
34 #include "AliLog.h"
35 #include "AliHeader.h"
36 #include "AliMCEvent.h"
37 #include "AliStack.h"
38 #include "AliMultiplicity.h"
39 #include "AliInputEventHandler.h"
40 #include "AliAnalysisManager.h"
41
42 #include "AliCFContainer.h"
43 #include "AliESDpid.h"
44 //    #include "AliV0vertexer.h"
45 //    #include "AliCascadeVertexer.h"
46 #include "AliESDEvent.h"
47 #include "AliESDcascade.h"
48
49 #include "AliAODEvent.h"
50
51 #include "AliAnalysisTaskCheckPerformanceCascade.h"
52
53 ClassImp(AliAnalysisTaskCheckPerformanceCascade)
54
55
56
57      //_____Dummy constructor________________________________________________________________
58 AliAnalysisTaskCheckPerformanceCascade::AliAnalysisTaskCheckPerformanceCascade() 
59 : AliAnalysisTaskSE(), // <- take care to AliAnalysisTask( empty )
60   fDebugCascade(0), fAnalysisType("ESD"), fCollidingSystems(0), fESDpid(0), /*fPaveTextBookKeeping(0),*/
61     fkRerunV0CascVertexers      (0),
62     fkQualityCutZprimVtxPos     (kTRUE),
63     fkQualityCutNoTPConlyPrimVtx(kTRUE),
64     fkQualityCutTPCrefit        (kTRUE),
65     fkQualityCut80TPCcls        (kTRUE),
66     fkExtraSelections           (0),
67     
68         // - Cascade part initialisation
69 fListHistCascade(0),
70     fHistMCTrackMultiplicity(0), 
71
72     fHistEtaGenProton(0),
73     fHistEtaGenAntiProton(0),
74     
75    // Xi-
76    fHistEtaGenCascXiMinus(0),
77    f2dHistGenPtVsGenYGenXiMinus(0),
78    
79     fHistThetaGenCascXiMinus(0),
80     f2dHistGenPtVsGenYFdblXiMinus(0),
81     
82     fHistThetaLambdaXiMinus(0), 
83     fHistThetaBachXiMinus(0),
84     
85     fHistThetaMesDghterXiMinus(0), 
86     fHistThetaBarDghterXiMinus(0),
87     
88     fHistPtBachXiMinus(0),
89     fHistPtMesDghterXiMinus(0),
90     fHistPtBarDghterXiMinus(0),
91    
92    
93    // Xi+
94    fHistEtaGenCascXiPlus(0),
95    f2dHistGenPtVsGenYGenXiPlus(0),
96    
97     fHistThetaGenCascXiPlus(0), 
98     f2dHistGenPtVsGenYFdblXiPlus(0),
99     
100     fHistThetaLambdaXiPlus(0), 
101     fHistThetaBachXiPlus(0),
102     
103     fHistThetaMesDghterXiPlus(0), 
104     fHistThetaBarDghterXiPlus(0),
105     
106     fHistPtBachXiPlus(0),
107     fHistPtMesDghterXiPlus(0),
108     fHistPtBarDghterXiPlus(0),
109    
110    // Omega-
111    fHistEtaGenCascOmegaMinus(0),
112    f2dHistGenPtVsGenYGenOmegaMinus(0),
113    
114     fHistThetaGenCascOmegaMinus(0),
115     f2dHistGenPtVsGenYFdblOmegaMinus(0),
116     
117     fHistThetaLambdaOmegaMinus(0), 
118     fHistThetaBachOmegaMinus(0),
119     
120     fHistThetaMesDghterOmegaMinus(0), 
121     fHistThetaBarDghterOmegaMinus(0),
122     
123     fHistPtBachOmegaMinus(0),
124     fHistPtMesDghterOmegaMinus(0),
125     fHistPtBarDghterOmegaMinus(0),
126    
127    
128    // Omega+
129    fHistEtaGenCascOmegaPlus(0),
130    f2dHistGenPtVsGenYGenOmegaPlus(0),
131    
132     fHistThetaGenCascOmegaPlus(0),
133     f2dHistGenPtVsGenYFdblOmegaPlus(0),
134     
135     fHistThetaLambdaOmegaPlus(0), 
136     fHistThetaBachOmegaPlus(0),
137     
138     fHistThetaMesDghterOmegaPlus(0), 
139     fHistThetaBarDghterOmegaPlus(0),
140     
141     fHistPtBachOmegaPlus(0),
142     fHistPtMesDghterOmegaPlus(0),
143     fHistPtBarDghterOmegaPlus(0),
144
145 // Part 2 - Association to MC
146         
147     fHistMassXiMinus(0),
148     fHistMassXiPlus(0),
149     fHistMassOmegaMinus(0),
150     fHistMassOmegaPlus(0),
151     
152         // - Effective mass histos with combined PID
153     fHistMassWithCombPIDXiMinus(0), fHistMassWithCombPIDXiPlus(0),
154     fHistMassWithCombPIDOmegaMinus(0), fHistMassWithCombPIDOmegaPlus(0),
155         
156         // - PID Probability versus MC Pt(bachelor track)
157     f2dHistPIDprobaKaonVsMCPtBach(0), f2dHistPIDprobaPionVsMCPtBach(0),
158     
159         // - Effective mass histos with perfect MC PID on the bachelor
160     fHistMassWithMcPIDXiMinus(0), fHistMassWithMcPIDXiPlus(0),
161     fHistMassWithMcPIDOmegaMinus(0), fHistMassWithMcPIDOmegaPlus(0),
162         
163     
164         // - Effective mass histos for the cascade candidates associated with MC
165     fHistAsMCMassXiMinus(0),            
166     fHistAsMCMassXiPlus(0),             
167     fHistAsMCMassOmegaMinus(0),
168     fHistAsMCMassOmegaPlus(0),
169     
170         // - Generated Pt Vs generated y, for the cascade candidates associated with MC + Info Comb. PID
171     f2dHistAsMCandCombPIDGenPtVsGenYXiMinus(0),
172     f2dHistAsMCandCombPIDGenPtVsGenYXiPlus(0),
173     f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus(0),
174     f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus(0),
175            
176         // - Generated Pt Vs generated y, for the cascade candidates associated with MC
177     f2dHistAsMCGenPtVsGenYXiMinus(0),
178     f2dHistAsMCGenPtVsGenYXiPlus(0),
179     f2dHistAsMCGenPtVsGenYOmegaMinus(0),
180     f2dHistAsMCGenPtVsGenYOmegaPlus(0),
181     
182         // - Generated Eta of the the cascade candidates associated with MC
183     fHistAsMCGenEtaXiMinus(0),
184     fHistAsMCGenEtaXiPlus(0),
185     fHistAsMCGenEtaOmegaMinus(0),
186     fHistAsMCGenEtaOmegaPlus(0),
187         
188         // - Resolution in Pt as function of generated Pt
189     f2dHistAsMCResPtXiMinus(0),         
190     f2dHistAsMCResPtXiPlus(0),          
191     f2dHistAsMCResPtOmegaMinus(0),
192     f2dHistAsMCResPtOmegaPlus(0),       
193         
194         // - Resolution in R(2D) as function of generated R
195     f2dHistAsMCResRXiMinus(0),          
196     f2dHistAsMCResRXiPlus(0),           
197     f2dHistAsMCResROmegaMinus(0),
198     f2dHistAsMCResROmegaPlus(0),
199
200     fCFContCascadePIDAsXiMinus(0),
201     fCFContCascadePIDAsXiPlus(0),
202     fCFContCascadePIDAsOmegaMinus(0),
203     fCFContCascadePIDAsOmegaPlus(0),
204
205     fCFContAsCascadeCuts(0)
206
207 {
208 // Dummy constructor
209         for(Int_t iAlephIdx   = 0; iAlephIdx   < 5; iAlephIdx++   ) { fAlephParameters [iAlephIdx]    = -1.; }
210         for(Int_t iV0selIdx   = 0; iV0selIdx   < 7; iV0selIdx++   ) { fV0Sels          [iV0selIdx   ] = -1.; }
211         for(Int_t iCascSelIdx = 0; iCascSelIdx < 8; iCascSelIdx++ ) { fCascSels        [iCascSelIdx ] = -1.; }
212 }
213      
214        
215      
216      
217 //_____Non-default Constructor________________________________________________________________
218 AliAnalysisTaskCheckPerformanceCascade::AliAnalysisTaskCheckPerformanceCascade(const char *name) 
219   : AliAnalysisTaskSE(name),
220     fDebugCascade(0), fAnalysisType("ESD"), fCollidingSystems(0), fESDpid(0),  /*fPaveTextBookKeeping(0),*/
221     fkRerunV0CascVertexers      (0),
222     fkQualityCutZprimVtxPos     (kTRUE),
223     fkQualityCutNoTPConlyPrimVtx(kTRUE),
224     fkQualityCutTPCrefit        (kTRUE),
225     fkQualityCut80TPCcls        (kTRUE),
226     fkExtraSelections           (0),
227       
228         // - Cascade part initialisation
229 fListHistCascade(0),
230     fHistMCTrackMultiplicity(0), 
231
232     fHistEtaGenProton(0),
233     fHistEtaGenAntiProton(0),
234     
235 // Xi-
236    fHistEtaGenCascXiMinus(0),
237    f2dHistGenPtVsGenYGenXiMinus(0),
238    
239     fHistThetaGenCascXiMinus(0),
240     f2dHistGenPtVsGenYFdblXiMinus(0),
241     
242     fHistThetaLambdaXiMinus(0), 
243     fHistThetaBachXiMinus(0),
244     
245     fHistThetaMesDghterXiMinus(0), 
246     fHistThetaBarDghterXiMinus(0),
247     
248     fHistPtBachXiMinus(0),
249     fHistPtMesDghterXiMinus(0),
250     fHistPtBarDghterXiMinus(0),
251    
252    
253    // Xi+
254    fHistEtaGenCascXiPlus(0),
255    f2dHistGenPtVsGenYGenXiPlus(0),
256    
257     fHistThetaGenCascXiPlus(0), 
258     f2dHistGenPtVsGenYFdblXiPlus(0),
259     
260     fHistThetaLambdaXiPlus(0), 
261     fHistThetaBachXiPlus(0),
262     
263     fHistThetaMesDghterXiPlus(0), 
264     fHistThetaBarDghterXiPlus(0),
265     
266     fHistPtBachXiPlus(0),
267     fHistPtMesDghterXiPlus(0),
268     fHistPtBarDghterXiPlus(0),
269    
270    // Omega-
271    fHistEtaGenCascOmegaMinus(0),
272    f2dHistGenPtVsGenYGenOmegaMinus(0),
273    
274     fHistThetaGenCascOmegaMinus(0),
275     f2dHistGenPtVsGenYFdblOmegaMinus(0),
276     
277     fHistThetaLambdaOmegaMinus(0), 
278     fHistThetaBachOmegaMinus(0),
279     
280     fHistThetaMesDghterOmegaMinus(0), 
281     fHistThetaBarDghterOmegaMinus(0),
282     
283     fHistPtBachOmegaMinus(0),
284     fHistPtMesDghterOmegaMinus(0),
285     fHistPtBarDghterOmegaMinus(0),
286    
287    
288    // Omega+
289    fHistEtaGenCascOmegaPlus(0),
290    f2dHistGenPtVsGenYGenOmegaPlus(0),
291    
292     fHistThetaGenCascOmegaPlus(0),
293     f2dHistGenPtVsGenYFdblOmegaPlus(0),
294     
295     fHistThetaLambdaOmegaPlus(0), 
296     fHistThetaBachOmegaPlus(0),
297     
298     fHistThetaMesDghterOmegaPlus(0), 
299     fHistThetaBarDghterOmegaPlus(0),
300     
301     fHistPtBachOmegaPlus(0),
302     fHistPtMesDghterOmegaPlus(0),
303     fHistPtBarDghterOmegaPlus(0),
304
305 // Part 2 - Association to MC
306         
307     fHistMassXiMinus(0),
308     fHistMassXiPlus(0),
309     fHistMassOmegaMinus(0),
310     fHistMassOmegaPlus(0),
311     
312         // - Effective mass histos with combined PID
313     fHistMassWithCombPIDXiMinus(0), fHistMassWithCombPIDXiPlus(0),
314     fHistMassWithCombPIDOmegaMinus(0), fHistMassWithCombPIDOmegaPlus(0),
315         
316         // - PID Probability versus MC Pt(bachelor track)
317     f2dHistPIDprobaKaonVsMCPtBach(0), f2dHistPIDprobaPionVsMCPtBach(0),
318     
319         // - Effective mass histos with perfect MC PID on the bachelor
320     fHistMassWithMcPIDXiMinus(0), fHistMassWithMcPIDXiPlus(0),
321     fHistMassWithMcPIDOmegaMinus(0), fHistMassWithMcPIDOmegaPlus(0),
322         
323     
324         // - Effective mass histos for the cascade candidates associated with MC
325     fHistAsMCMassXiMinus(0),            
326     fHistAsMCMassXiPlus(0),             
327     fHistAsMCMassOmegaMinus(0),
328     fHistAsMCMassOmegaPlus(0),
329     
330         // - Generated Pt Vs generated y, for the cascade candidates associated with MC + Info Comb. PID
331     f2dHistAsMCandCombPIDGenPtVsGenYXiMinus(0),
332     f2dHistAsMCandCombPIDGenPtVsGenYXiPlus(0),
333     f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus(0),
334     f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus(0),
335            
336         // - Generated Pt Vs generated y, for the cascade candidates associated with MC
337     f2dHistAsMCGenPtVsGenYXiMinus(0),
338     f2dHistAsMCGenPtVsGenYXiPlus(0),
339     f2dHistAsMCGenPtVsGenYOmegaMinus(0),
340     f2dHistAsMCGenPtVsGenYOmegaPlus(0),
341     
342         // - Generated Eta of the the cascade candidates associated with MC
343     fHistAsMCGenEtaXiMinus(0),
344     fHistAsMCGenEtaXiPlus(0),
345     fHistAsMCGenEtaOmegaMinus(0),
346     fHistAsMCGenEtaOmegaPlus(0),
347         
348         // - Resolution in Pt as function of generated Pt
349     f2dHistAsMCResPtXiMinus(0),         
350     f2dHistAsMCResPtXiPlus(0),          
351     f2dHistAsMCResPtOmegaMinus(0),
352     f2dHistAsMCResPtOmegaPlus(0),       
353         
354         // - Resolution in R(2D) as function of generated R
355     f2dHistAsMCResRXiMinus(0),          
356     f2dHistAsMCResRXiPlus(0),           
357     f2dHistAsMCResROmegaMinus(0),
358     f2dHistAsMCResROmegaPlus(0),
359
360     fCFContCascadePIDAsXiMinus(0),
361     fCFContCascadePIDAsXiPlus(0),
362     fCFContCascadePIDAsOmegaMinus(0),
363     fCFContCascadePIDAsOmegaPlus(0),
364
365     fCFContAsCascadeCuts(0)
366
367 {
368   // Constructor
369
370   // Define input and output slots here
371   // Input slot #0 works with a TChain
372   // Output slot #1 writes into a TList container (cascade)
373         
374         for(Int_t iAlephIdx   = 0; iAlephIdx   < 5; iAlephIdx++   ) { fAlephParameters [iAlephIdx]    = -1.; }
375         
376         // Extra Loose
377 //         fV0Sels[0] =  33.  ;  // max allowed chi2
378 //         fV0Sels[1] =   0.01;  // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
379 //         fV0Sels[2] =   0.01;  // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
380 //         fV0Sels[3] =   2.0 ;  // max allowed DCA between the daughter tracks       (LHC09a4 : 0.5)
381 //         fV0Sels[4] =   0.0 ;  // min allowed cosine of V0's pointing angle         (LHC09a4 : 0.99)
382 //         fV0Sels[5] =   0.2 ;  // min radius of the fiducial volume                 (LHC09a4 : 0.2)
383 //         fV0Sels[6] = 100.  ;  // max radius of the fiducial volume                 (LHC09a4 : 100.0)
384 //         
385 //         fCascSels[0] =  33.   ;  // max allowed chi2 (same as PDC07)
386 //         fCascSels[1] =   0.02 ;  // min allowed V0 impact parameter                    (PDC07 : 0.05   / LHC09a4 : 0.025 )
387 //         fCascSels[2] =   0.008;  // "window" around the Lambda mass                    (PDC07 : 0.008  / LHC09a4 : 0.010 )
388 //         fCascSels[3] =   0.01 ;  // min allowed bachelor's impact parameter            (PDC07 : 0.035  / LHC09a4 : 0.025 )
389 //         fCascSels[4] =   0.5  ;  // max allowed DCA between the V0 and the bachelor    (PDC07 : 0.1    / LHC09a4 : 0.2   )
390 //         fCascSels[5] =   0.98 ;  // min allowed cosine of the cascade pointing angle   (PDC07 : 0.9985 / LHC09a4 : 0.998 )
391 //         fCascSels[6] =   0.2  ;  // min radius of the fiducial volume                  (PDC07 : 0.9    / LHC09a4 : 0.2   )
392 //         fCascSels[7] = 100.   ;  // max radius of the fiducial volume                  (PDC07 : 100    / LHC09a4 : 100   )
393         
394         // Hyper Loose
395         fV0Sels[0] =  33.  ;  // max allowed chi2
396         fV0Sels[1] =   0.001; // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
397         fV0Sels[2] =   0.001; // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
398         fV0Sels[3] =   5.0 ;  // max allowed DCA between the daughter tracks       (LHC09a4 : 0.5)
399         fV0Sels[4] =   0.0 ;  // min allowed cosine of V0's pointing angle         (LHC09a4 : 0.99)
400         fV0Sels[5] =   0.1 ;  // min radius of the fiducial volume                 (LHC09a4 : 0.2)
401         fV0Sels[6] = 100.  ;  // max radius of the fiducial volume                 (LHC09a4 : 100.0)
402         
403         fCascSels[0] =  33.   ;  // max allowed chi2 (same as PDC07)
404         fCascSels[1] =   0.001;  // min allowed V0 impact parameter                    (PDC07 : 0.05   / LHC09a4 : 0.025 )
405         fCascSels[2] =   0.008;  // "window" around the Lambda mass                    (PDC07 : 0.008  / LHC09a4 : 0.010 )
406         fCascSels[3] =   0.001;  // min allowed bachelor's impact parameter            (PDC07 : 0.035  / LHC09a4 : 0.025 )
407         fCascSels[4] =   5.0  ;  // max allowed DCA between the V0 and the bachelor    (PDC07 : 0.1    / LHC09a4 : 0.2   )
408         fCascSels[5] =   0.82 ;  //FIXME min allowed cosine of the cascade pointing angle   (PDC07 : 0.9985 / LHC09a4 : 0.998 )
409         fCascSels[6] =   0.1  ;  // min radius of the fiducial volume                  (PDC07 : 0.9    / LHC09a4 : 0.2   )
410         fCascSels[7] = 100.   ;  // max radius of the fiducial volume                  (PDC07 : 100    / LHC09a4 : 100   )
411
412   DefineOutput(1, TList::Class());
413  
414 }
415
416
417 AliAnalysisTaskCheckPerformanceCascade::~AliAnalysisTaskCheckPerformanceCascade()
418 {
419   //
420   // Destructor
421   //
422
423   // For all TH1, 2, 3 HnSparse and CFContainer are in the fListCascade TList.
424   // They will be deleted when fListCascade is deleted by the TSelector dtor
425   // Because of TList::SetOwner()
426
427   if (fListHistCascade)      { delete fListHistCascade;     fListHistCascade = 0x0;  }  
428   if (fESDpid)               { delete fESDpid;              fESDpid = 0x0;} // fESDpid is not stored into the TList
429   /*if (fPaveTextBookKeeping)  { delete fPaveTextBookKeeping; fPaveTextBookKeeping = 0x0; } // fPaveTextBookKeeping is not stored into the TList*/
430 }
431
432
433 //________________________________________________________________________
434 void AliAnalysisTaskCheckPerformanceCascade::UserCreateOutputObjects()
435 {
436   // Create histograms
437   // Called once
438
439         
440    // Option for AliLog
441         AliLog::SetGlobalLogLevel(AliLog::kError); 
442         // to suppress the extensive info prompted by a run with MC                     
443
444    // Definition of the output datamembers      
445    fListHistCascade = new TList();
446    fListHistCascade->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
447         
448 if(! fESDpid){
449
450         // Reasonable parameters extracted for p-p simulation (LHC09a4) - A.Kalweit
451         // fAlephParameters[0] = 4.23232575531564326e+00/50;//50*0.76176e-1;
452         // fAlephParameters[1] = 8.68482806165147636e+00;//10.632; 
453         // fAlephParameters[2] = 1.34000000000000005e-05;//0.13279e-4;
454         // fAlephParameters[3] = 2.30445734159456084e+00;//1.8631;
455         // fAlephParameters[4] = 2.25624744086878559e+00;//1.9479;
456         
457         // Param for LHC09d10 prod - A.Kalweit
458         fAlephParameters[0] = 2.15898e+00/50.;
459         fAlephParameters[1] = 1.75295e+01;
460         fAlephParameters[2] = 3.40030e-09;
461         fAlephParameters[3] = 1.96178e+00;
462         fAlephParameters[4] = 3.91720e+00; 
463         
464   fESDpid = new AliESDpid();
465   fESDpid->GetTPCResponse().SetBetheBlochParameters( fAlephParameters[0],
466                                                      fAlephParameters[1],
467                                                      fAlephParameters[2],
468                                                      fAlephParameters[3],
469                                                      fAlephParameters[4] );
470 }
471
472 /*
473 if( !fPaveTextBookKeeping){
474         fPaveTextBookKeeping = new TPaveText(0.1, 0.1, 0.9, 0.9,"NDC");
475         fPaveTextBookKeeping->SetName("fPaveTextBookKeeping");
476         fPaveTextBookKeeping->SetBorderSize(0);
477         fPaveTextBookKeeping->SetTextAlign(12);
478         fPaveTextBookKeeping->SetFillColor(kWhite);
479         fPaveTextBookKeeping->SetTextFont(42);        // regular Arial or Helvetica,
480         fPaveTextBookKeeping->SetTextColor(kGray+3);
481         
482         
483         fPaveTextBookKeeping->AddText( "Task CHECK PERFORMANCE CASCADE analysis" );
484         fPaveTextBookKeeping->AddText("- - - - - - - - - - - ");
485         fPaveTextBookKeeping->AddText( Form("AnalysisType : %s ", fAnalysisType.Data() ));
486         if(!fCollidingSystems)  fPaveTextBookKeeping->AddText("Colliding system : p-p collisions ");
487         else                    fPaveTextBookKeeping->AddText("Colliding system : A-A collisions ");
488
489         fPaveTextBookKeeping->AddText("- - - - - - - - - - - ");
490     
491         if(fkRerunV0CascVertexers){
492                 fPaveTextBookKeeping->AddText("A.1. With V0 vertexer : ");
493                 fPaveTextBookKeeping->AddText( Form("  - V0 #chi^{2} _________________ <  %.3f ",               fV0Sels[0] ));
494                 fPaveTextBookKeeping->AddText( Form("  - DCA(prim. Vtx/ 1^{st} daughter) ___ >  %.3f     cm ",  fV0Sels[1] ));
495                 fPaveTextBookKeeping->AddText( Form("  - DCA(prim. Vtx/ 2^{nd} daughter) __  >  %.3f     cm",   fV0Sels[2] ));
496                 fPaveTextBookKeeping->AddText( Form("  - DCA between V0 daughters ___ <  %.3f      cm",         fV0Sels[3] ));
497                 fPaveTextBookKeeping->AddText( Form("  - cos(V0 pointing angle) _______ >  %.3f ",              fV0Sels[4] ));
498                 fPaveTextBookKeeping->AddText( Form("  - R_{transv}(V0 decay) ________ >  %.3f             cm", fV0Sels[5] ));
499                 fPaveTextBookKeeping->AddText( Form("  - R_{transv}(V0 decay) ________ <  %.3f         cm",     fV0Sels[6] ));
500                 
501                 fPaveTextBookKeeping->AddText(" "); 
502                 
503                 fPaveTextBookKeeping->AddText("A.2. With Casc. vertexer : ");
504                 fPaveTextBookKeeping->AddText( Form("  - Casc. #chi^{2} ______________  <  %.3f ",                               fCascSels[0] ));
505                 fPaveTextBookKeeping->AddText( Form("  - DCA(prim. Vtx/ V0) _________ >  %.3f    cm",                            fCascSels[1] ));
506                 fPaveTextBookKeeping->AddText( Form("  - | M_{#Lambda}(reco) - M_{#Lambda}(pdg) | _______ <  %.3f    GeV/c^{2}", fCascSels[2] ));
507                 fPaveTextBookKeeping->AddText( Form("  - DCA(prim. Vtx/ Bach) _______ >  %.3f    cm",                            fCascSels[3] ));
508                 fPaveTextBookKeeping->AddText( Form("  - DCA between Bach/ #Lambda ______ <  %.3f    cm",                        fCascSels[4] ));
509                 fPaveTextBookKeeping->AddText( Form("  - cos(Casc. pointing angle) ____ >  %.3f ",                               fCascSels[5] ));
510                 fPaveTextBookKeeping->AddText( Form("  - R_{transv}(Casc. decay) ______ >  %.3f         cm",                     fCascSels[6] ));
511                 fPaveTextBookKeeping->AddText( Form("  - R_{transv}(Casc. decay) ______ <  %.3f     cm",                         fCascSels[7] ));
512         }
513         else{   fPaveTextBookKeeping->AddText("A. No rerunning of the V0/Casc. vertexers ... See std cuts in (AliRoot+Rec.C) used for this prod. cycle");}
514
515         fPaveTextBookKeeping->AddText("- - - - - - - - - - - ");
516         
517         if(fkQualityCutZprimVtxPos)      fPaveTextBookKeeping->AddText("B. Quality Cut(prim. Vtx z-Pos)    = ON  ");
518         else                             fPaveTextBookKeeping->AddText("B. Quality Cut(prim. Vtx z-Pos)    = Off ");
519         if(fkQualityCutNoTPConlyPrimVtx) fPaveTextBookKeeping->AddText("C. Quality Cut(No TPC prim. vtx) = ON  ");
520         else                             fPaveTextBookKeeping->AddText("C. Quality Cut(No TPC prim. vtx) = Off ");
521         if(fkQualityCutTPCrefit)         fPaveTextBookKeeping->AddText("D. Quality Cut(TPCrefit)               = ON  ");
522         else                             fPaveTextBookKeeping->AddText("D. Quality Cut(TPCrefit)               = Off ");
523         if(fkQualityCut80TPCcls)         fPaveTextBookKeeping->AddText("E. Quality Cut(80 TPC clusters)   = ON  ");
524         else                             fPaveTextBookKeeping->AddText("E. Quality Cut(80 TPC clusters)   = Off ");
525         if(fkExtraSelections)            fPaveTextBookKeeping->AddText("F. Extra Analysis Selections         = ON  ");
526         else                             fPaveTextBookKeeping->AddText("F. Extra Analysis Selections         = Off ");
527
528         fPaveTextBookKeeping->AddText("- - - - - - - - - - - ");
529
530         fPaveTextBookKeeping->AddText("G. TPC Aleph Param : ");
531         fPaveTextBookKeeping->AddText( Form("   - fAlephParam [0] =  %.5g", fAlephParameters[0] ));
532         fPaveTextBookKeeping->AddText( Form("   - fAlephParam [1] =  %.5g", fAlephParameters[1] ));
533         fPaveTextBookKeeping->AddText( Form("   - fAlephParam [2] =  %.5g", fAlephParameters[2] ));
534         fPaveTextBookKeeping->AddText( Form("   - fAlephParam [3] =  %.5g", fAlephParameters[3] ));
535         fPaveTextBookKeeping->AddText( Form("   - fAlephParam [4] =  %.5g", fAlephParameters[4] ));
536         
537         fListHistCascade->Add(fPaveTextBookKeeping);
538 }       
539 */
540                 
541   // - General
542   
543   if (!fHistMCTrackMultiplicity) {
544      fHistMCTrackMultiplicity = new TH1F("fHistMCTrackMultiplicity", "MC Track Multiplicity;Number of MC tracks;Events", 100, 0, 500);
545    //  fHistMCTrackMultiplicity = new TH1F("fHistMCTrackMultiplicity", "Multiplicity distribution;Number of tracks;Events", 200, 0, 40000); //HERE
546   fListHistCascade->Add(fHistMCTrackMultiplicity);
547   }
548   
549   if (!fHistEtaGenProton) {
550      fHistEtaGenProton = new TH1F("fHistEtaGenProton", "#eta of any gen. p^{+};#eta;Number of prim. protons", 200, -10, 10);
551      fListHistCascade->Add(fHistEtaGenProton);
552   }
553   
554   if (!fHistEtaGenAntiProton) {
555      fHistEtaGenAntiProton = new TH1F("fHistEtaGenAntiProton", "#eta of any gen. #bar{p}^{-};#eta;Number of prim. #bar{p}", 200, -10, 10);
556      fListHistCascade->Add(fHistEtaGenAntiProton);
557   }
558   
559
560
561
562
563
564   
565   //--------
566   // I - Xi- 
567   // - Pseudo-Rapidity distribution
568   if (!fHistEtaGenCascXiMinus) {
569      fHistEtaGenCascXiMinus = new TH1F("fHistEtaGenCascXiMinus", "#eta of any gen. #Xi^{-};#eta;Number of Casc", 200, -10, 10);
570      fListHistCascade->Add(fHistEtaGenCascXiMinus);
571   }
572   
573   if (!f2dHistGenPtVsGenYGenXiMinus) {
574      f2dHistGenPtVsGenYGenXiMinus = new TH2F("f2dHistGenPtVsGenYGenXiMinus", "MC P_{t} Vs MC Y of Gen #Xi^{-} ;Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
575      fListHistCascade->Add(f2dHistGenPtVsGenYGenXiMinus);
576   }
577   
578   
579   // - Info at the generation level of multi-strange particle
580   
581   if (!fHistThetaGenCascXiMinus) {
582      fHistThetaGenCascXiMinus = new TH1F("fHistThetaGenCascXiMinus", "#theta of gen. #Xi^{-};#theta;Number of Casc.", 200, -10, 190);
583      fListHistCascade->Add(fHistThetaGenCascXiMinus);
584   }
585
586   if (!f2dHistGenPtVsGenYFdblXiMinus) {
587      f2dHistGenPtVsGenYFdblXiMinus = new TH2F("f2dHistGenPtVsGenYFdblXiMinus", "MC P_{t} Vs MC Y of findable Gen #Xi^{-}; Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
588      fListHistCascade->Add(f2dHistGenPtVsGenYFdblXiMinus);
589   }
590   
591                 // - Theta distribution the daughters (control plots)
592   
593   if (!fHistThetaLambdaXiMinus) {
594      fHistThetaLambdaXiMinus = new TH1F("fHistThetaLambdaXiMinus", "#theta of gen. #Lambda (Xi dghter);#theta_{#Lambda};Number of #Lambda^0", 200, -10, 190);
595      fListHistCascade->Add(fHistThetaLambdaXiMinus);
596   }
597
598   if (!fHistThetaBachXiMinus) {
599      fHistThetaBachXiMinus = new TH1F("fHistThetaBachXiMinus", "#theta of gen. Bach.;#theta_{Bach};Number of Bach.", 200, -10, 190);
600      fListHistCascade->Add(fHistThetaBachXiMinus);
601   }
602   
603   if (!fHistThetaMesDghterXiMinus) {
604      fHistThetaMesDghterXiMinus = new TH1F("fHistThetaMesDghterXiMinus", "#theta of gen. Meson #Lambda dghter;#theta_{MesDght};Number of Mes.", 200, -10, 190);
605      fListHistCascade->Add(fHistThetaMesDghterXiMinus);
606   }
607   
608   if (!fHistThetaBarDghterXiMinus) {
609      fHistThetaBarDghterXiMinus = new TH1F("fHistThetaBarDghterXiMinus", "#theta of gen. Baryon #Lambda dghter;#theta_{BarDght};Number of Bar.", 200, -10, 190);
610      fListHistCascade->Add(fHistThetaBarDghterXiMinus);
611   }
612  
613                 // - Pt distribution (control plots)
614     
615   if (!fHistPtBachXiMinus) {
616      fHistPtBachXiMinus = new TH1F("fHistPtBachXiMinus", "p_{t} of gen. Bach.;pt_{Bach};Number of Bach.", 200, 0, 10);
617      fListHistCascade->Add(fHistPtBachXiMinus);
618   }
619   
620   if (!fHistPtMesDghterXiMinus) {
621      fHistPtMesDghterXiMinus = new TH1F("fHistPtMesDghterXiMinus", "p_{t} of gen. Meson #Lambda dghter;pt_{MesDght};Number of Mes.", 200, 0, 10);
622      fListHistCascade->Add(fHistPtMesDghterXiMinus);
623   }
624     
625   if (!fHistPtBarDghterXiMinus) {
626      fHistPtBarDghterXiMinus = new TH1F("fHistPtBarDghterXiMinus", "p_{t} of gen. Baryon #Lambda dghter;pt_{BarDght};Number of Bar.", 200, 0, 10);
627      fListHistCascade->Add(fHistPtBarDghterXiMinus);
628   }
629   
630   
631   
632   //--------
633   // II - Xi+ 
634   // - Pseudo-Rapidity distribution
635   if (!fHistEtaGenCascXiPlus) {
636      fHistEtaGenCascXiPlus = new TH1F("fHistEtaGenCascXiPlus", "#eta of any gen. #Xi^{+};#eta;Number of Casc", 200, -10, 10);
637      fListHistCascade->Add(fHistEtaGenCascXiPlus);
638   }
639   
640   if (!f2dHistGenPtVsGenYGenXiPlus) {
641      f2dHistGenPtVsGenYGenXiPlus = new TH2F("f2dHistGenPtVsGenYGenXiPlus", "MC P_{t} Vs MC Y of Gen #Xi^{+} ;Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
642      fListHistCascade->Add(f2dHistGenPtVsGenYGenXiPlus);
643   }
644   
645   
646   // - Info at the generation level of multi-strange particle
647   
648   if (!fHistThetaGenCascXiPlus) {
649      fHistThetaGenCascXiPlus = new TH1F("fHistThetaGenCascXiPlus", "#theta of gen. #Xi^{+};#theta;Number of Casc.", 200, -10, 190);
650      fListHistCascade->Add(fHistThetaGenCascXiPlus);
651   }
652  
653   if (!f2dHistGenPtVsGenYFdblXiPlus) {
654      f2dHistGenPtVsGenYFdblXiPlus = new TH2F("f2dHistGenPtVsGenYFdblXiPlus", "MC P_{t} Vs MC Y of findable Gen #Xi^{+} ;Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
655      fListHistCascade->Add(f2dHistGenPtVsGenYFdblXiPlus);
656   }
657   
658                 // - Theta distribution the daughters (control plots)
659   
660   if (!fHistThetaLambdaXiPlus) {
661      fHistThetaLambdaXiPlus = new TH1F("fHistThetaLambdaXiPlus", "#theta of gen. #Lambda (Xi dghter);#theta_{#Lambda};Number of #Lambda", 200, -10, 190);
662      fListHistCascade->Add(fHistThetaLambdaXiPlus);
663   }
664
665   if (!fHistThetaBachXiPlus) {
666      fHistThetaBachXiPlus = new TH1F("fHistThetaBachXiPlus", "#theta of gen. Bach.;#theta_{Bach};Number of Bach.", 200, -10, 190);
667      fListHistCascade->Add(fHistThetaBachXiPlus);
668   }
669   
670   if (!fHistThetaMesDghterXiPlus) {
671      fHistThetaMesDghterXiPlus = new TH1F("fHistThetaMesDghterXiPlus", "#theta of gen. Meson #Lambda dghter;#theta_{MesDght};Number of Mes.", 200, -10, 190);
672      fListHistCascade->Add(fHistThetaMesDghterXiPlus);
673   }
674   
675   if (!fHistThetaBarDghterXiPlus) {
676      fHistThetaBarDghterXiPlus = new TH1F("fHistThetaBarDghterXiPlus", "#theta of gen. Baryon #Lambda dghter;#theta_{BarDght};Number of Bar.", 200, -10, 190);
677      fListHistCascade->Add(fHistThetaBarDghterXiPlus);
678   }
679  
680                 // - Pt distribution (control plots)
681     
682   if (!fHistPtBachXiPlus) {
683      fHistPtBachXiPlus = new TH1F("fHistPtBachXiPlus", "p_{t} of gen. Bach.;pt_{Bach};Number of Bach.", 200, 0, 10);
684      fListHistCascade->Add(fHistPtBachXiPlus);
685   }
686   
687   if (!fHistPtMesDghterXiPlus) {
688      fHistPtMesDghterXiPlus = new TH1F("fHistPtMesDghterXiPlus", "p_{t} of gen. Meson #Lambda dghter);pt_{MesDght};Number of Mes.", 200, 0, 10);
689      fListHistCascade->Add(fHistPtMesDghterXiPlus);
690   }
691     
692   if (!fHistPtBarDghterXiPlus) {
693      fHistPtBarDghterXiPlus = new TH1F("fHistPtBarDghterXiPlus", "p_{t} of gen. Baryon #Lambda dghter);pt_{BarDght};Number of Bar.", 200, 0, 10);
694      fListHistCascade->Add(fHistPtBarDghterXiPlus);
695   }
696   
697   
698   //---------
699   // III - Omega- 
700   // - Pseudo-Rapidity distribution
701   if (!fHistEtaGenCascOmegaMinus) {
702      fHistEtaGenCascOmegaMinus = new TH1F("fHistEtaGenCascOmegaMinus", "#eta of any gen. #Omega^{-};#eta;Number of Casc", 200, -10, 10);
703      fListHistCascade->Add(fHistEtaGenCascOmegaMinus);
704   }
705   
706   if (!f2dHistGenPtVsGenYGenOmegaMinus) {
707      f2dHistGenPtVsGenYGenOmegaMinus = new TH2F("f2dHistGenPtVsGenYGenOmegaMinus", "MC P_{t} Vs MC Y of Gen #Omega^{-} ;Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
708      fListHistCascade->Add(f2dHistGenPtVsGenYGenOmegaMinus);
709   }
710   
711   
712   // - Info at the generation level of multi-strange particle
713   
714   if (!fHistThetaGenCascOmegaMinus) {
715      fHistThetaGenCascOmegaMinus = new TH1F("fHistThetaGenCascOmegaMinus", "#theta of gen. #Omega^{-};#theta;Number of Casc.", 200, -10, 190);
716      fListHistCascade->Add(fHistThetaGenCascOmegaMinus);
717   }
718  
719   if (!f2dHistGenPtVsGenYFdblOmegaMinus) {
720      f2dHistGenPtVsGenYFdblOmegaMinus = new TH2F("f2dHistGenPtVsGenYFdblOmegaMinus", "MC P_{t} Vs MC Y of findable Gen #Omega^{-}; Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
721      fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaMinus);
722   }
723   
724                 // - Theta distribution the daughters (control plots)
725   
726   if (!fHistThetaLambdaOmegaMinus) {
727      fHistThetaLambdaOmegaMinus = new TH1F("fHistThetaLambdaOmegaMinus", "#theta of gen. #Lambda (Omega dghter);#theta_{#Lambda};Number of #Lambda", 200, -10, 190);
728      fListHistCascade->Add(fHistThetaLambdaOmegaMinus);
729   }
730
731   if (!fHistThetaBachOmegaMinus) {
732      fHistThetaBachOmegaMinus = new TH1F("fHistThetaBachOmegaMinus", "#theta of gen. Bach.;#theta_{Bach};Number of Bach.", 200, -10, 190);
733      fListHistCascade->Add(fHistThetaBachOmegaMinus);
734   }
735   
736   if (!fHistThetaMesDghterOmegaMinus) {
737      fHistThetaMesDghterOmegaMinus = new TH1F("fHistThetaMesDghterOmegaMinus", "#theta of gen. Meson #Lambda dghter;#theta_{MesDght};Number of Mes.", 200, -10, 190);
738      fListHistCascade->Add(fHistThetaMesDghterOmegaMinus);
739   }
740   
741   if (!fHistThetaBarDghterOmegaMinus) {
742      fHistThetaBarDghterOmegaMinus = new TH1F("fHistThetaBarDghterOmegaMinus", "#theta of gen. Baryon #Lambda dghter;#theta_{BarDght};Number of Bar.", 200, -10, 190);
743      fListHistCascade->Add(fHistThetaBarDghterOmegaMinus);
744   }
745  
746                 // - Pt distribution (control plots)
747     
748   if (!fHistPtBachOmegaMinus) {
749      fHistPtBachOmegaMinus = new TH1F("fHistPtBachOmegaMinus", "p_{t} of gen. Bach.;pt_{Bach};Number of Bach.", 200, 0, 10);
750      fListHistCascade->Add(fHistPtBachOmegaMinus);
751   }
752   
753   if (!fHistPtMesDghterOmegaMinus) {
754      fHistPtMesDghterOmegaMinus = new TH1F("fHistPtMesDghterOmegaMinus", "p_{t} of gen. Meson #Lambda dghter);pt_{MesDght};Number of Mes.", 200, 0, 10);
755      fListHistCascade->Add(fHistPtMesDghterOmegaMinus);
756   }
757     
758   if (!fHistPtBarDghterOmegaMinus) {
759      fHistPtBarDghterOmegaMinus = new TH1F("fHistPtBarDghterOmegaMinus", "p_{t} of gen. Baryon #Lambda dghter);pt_{BarDght};Number of Bar.", 200, 0, 10);
760      fListHistCascade->Add(fHistPtBarDghterOmegaMinus);
761   }
762   
763   
764   //---------
765   // IV - Omega+ 
766   // - Pseudo-Rapidity distribution
767   if (!fHistEtaGenCascOmegaPlus) {
768      fHistEtaGenCascOmegaPlus = new TH1F("fHistEtaGenCascOmegaPlus", "#eta of any gen. #Omega^{+};#eta;Number of Casc", 200, -10, 10);
769      fListHistCascade->Add(fHistEtaGenCascOmegaPlus);
770   }
771   
772   if (!f2dHistGenPtVsGenYGenOmegaPlus) {
773      f2dHistGenPtVsGenYGenOmegaPlus = new TH2F("f2dHistGenPtVsGenYGenOmegaPlus", "MC P_{t} Vs MC Y of Gen #Omega^{+} ;Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
774      fListHistCascade->Add(f2dHistGenPtVsGenYGenOmegaPlus);
775   }
776   
777   
778   
779   // - Info at the generation level of multi-strange particle
780   
781   if (!fHistThetaGenCascOmegaPlus) {
782      fHistThetaGenCascOmegaPlus = new TH1F("fHistThetaGenCascOmegaPlus", "#theta of gen. #Omega^{+};#theta;Number of Casc.", 200, -10, 190);
783      fListHistCascade->Add(fHistThetaGenCascOmegaPlus);
784   }
785  
786   if (!f2dHistGenPtVsGenYFdblOmegaPlus) {
787      f2dHistGenPtVsGenYFdblOmegaPlus = new TH2F("f2dHistGenPtVsGenYFdblOmegaPlus", "MC P_{t} Vs MC Y of findable Gen #Omega^{+}; Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
788      fListHistCascade->Add(f2dHistGenPtVsGenYFdblOmegaPlus);
789   }
790
791   
792                 // - Theta distribution the daughters (control plots)
793   
794   if (!fHistThetaLambdaOmegaPlus) {
795      fHistThetaLambdaOmegaPlus = new TH1F("fHistThetaLambdaOmegaPlus", "#theta of gen. #Lambda (Omega dghter);#theta_{#Lambda};Number of #Lambda", 200, -10, 190);
796      fListHistCascade->Add(fHistThetaLambdaOmegaPlus);
797   }
798
799   if (!fHistThetaBachOmegaPlus) {
800      fHistThetaBachOmegaPlus = new TH1F("fHistThetaBachOmegaPlus", "#theta of gen. Bach.;#theta_{Bach};Number of Bach.", 200, -10, 190);
801      fListHistCascade->Add(fHistThetaBachOmegaPlus);
802   }
803   
804   if (!fHistThetaMesDghterOmegaPlus) {
805      fHistThetaMesDghterOmegaPlus = new TH1F("fHistThetaMesDghterOmegaPlus", "#theta of gen. Meson #Lambda dghter;#theta_{MesDght};Number of Mes.", 200, -10, 190);
806      fListHistCascade->Add(fHistThetaMesDghterOmegaPlus);
807   }
808   
809   if (!fHistThetaBarDghterOmegaPlus) {
810      fHistThetaBarDghterOmegaPlus = new TH1F("fHistThetaBarDghterOmegaPlus", "#theta of gen. Baryon #Lambda dghter;#theta_{BarDght};Number of Bar.", 200, -10, 190);
811      fListHistCascade->Add(fHistThetaBarDghterOmegaPlus);
812   }
813  
814                 // - Pt distribution (control plots)
815     
816   if (!fHistPtBachOmegaPlus) {
817      fHistPtBachOmegaPlus = new TH1F("fHistPtBachOmegaPlus", "p_{t} of gen. Bach.;pt_{Bach};Number of Bach.", 200, 0, 10);
818      fListHistCascade->Add(fHistPtBachOmegaPlus);
819   }
820   
821   if (!fHistPtMesDghterOmegaPlus) {
822      fHistPtMesDghterOmegaPlus = new TH1F("fHistPtMesDghterOmegaPlus", "p_{t} of gen. Meson #Lambda dghter);pt_{MesDght};Number of Mes.", 200, 0, 10);
823      fListHistCascade->Add(fHistPtMesDghterOmegaPlus);
824   }
825     
826   if (!fHistPtBarDghterOmegaPlus) {
827      fHistPtBarDghterOmegaPlus = new TH1F("fHistPtBarDghterOmegaPlus", "p_{t} of gen. Baryon #Lambda dghter);pt_{BarDght};Number of Bar.", 200, 0, 10);
828      fListHistCascade->Add(fHistPtBarDghterOmegaPlus);
829   }
830     
831   
832 //--------------------------------------------------------------------------------
833 // Part 2 - Any reconstructed cascades + reconstructed cascades associated with MC
834   
835                 // - Effective mass histos for cascades candidates.
836   
837   if (! fHistMassXiMinus) {
838           fHistMassXiMinus = new TH1F("fHistMassXiMinus","#Xi^{-} candidates;M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400,1.2,2.0);
839           fListHistCascade->Add(fHistMassXiMinus);
840   }
841   
842   if (! fHistMassXiPlus) {
843           fHistMassXiPlus = new TH1F("fHistMassXiPlus","#Xi^{+} candidates;M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts",400,1.2,2.0);
844           fListHistCascade->Add(fHistMassXiPlus);
845   }
846
847   if (! fHistMassOmegaMinus) {
848           fHistMassOmegaMinus = new TH1F("fHistMassOmegaMinus","#Omega^{-} candidates;M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500,1.5,2.5);
849           fListHistCascade->Add(fHistMassOmegaMinus);
850   }
851  
852   if (! fHistMassOmegaPlus) {
853           fHistMassOmegaPlus = new TH1F("fHistMassOmegaPlus","#Omega^{+} candidates;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2});Counts", 500,1.5,2.5);
854           fListHistCascade->Add(fHistMassOmegaPlus);
855   }
856   
857   
858   
859                 // - Effective mass histos with combined PID
860   
861   if (! fHistMassWithCombPIDXiMinus) {
862     fHistMassWithCombPIDXiMinus = new TH1F("fHistMassWithCombPIDXiMinus","#Xi^{-} candidates, with Bach. comb. PID;M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400,1.2,2.0);
863     fListHistCascade->Add(fHistMassWithCombPIDXiMinus);
864   }
865   
866   if (! fHistMassWithCombPIDXiPlus) {
867     fHistMassWithCombPIDXiPlus = new TH1F("fHistMassWithCombPIDXiPlus","#Xi^{+} candidates, with Bach. comb. PID;M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts",400,1.2,2.0);
868     fListHistCascade->Add(fHistMassWithCombPIDXiPlus);
869   }
870
871   if (! fHistMassWithCombPIDOmegaMinus) {
872         fHistMassWithCombPIDOmegaMinus = new TH1F("fHistMassWithCombPIDOmegaMinus","#Omega^{-} candidates, with Bach. comb. PID;M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500,1.5,2.5);
873     fListHistCascade->Add(fHistMassWithCombPIDOmegaMinus);
874   }
875  
876   if (! fHistMassWithCombPIDOmegaPlus) {
877         fHistMassWithCombPIDOmegaPlus = new TH1F("fHistMassWithCombPIDOmegaPlus","#Omega^{+} candidates, with Bach. comb. PID;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2});Counts", 500,1.5,2.5);
878     fListHistCascade->Add(fHistMassWithCombPIDOmegaPlus);
879   }
880   
881                 // - PID Probability versus MC Pt(bachelor track)
882   if(! f2dHistPIDprobaKaonVsMCPtBach ){
883         f2dHistPIDprobaKaonVsMCPtBach  = new TH2F( "f2dHistPIDprobaKaonVsMCPtBach" , "Comb. PID proba to be K^{#pm} Vs MC Bach. Pt ; Pt_{MC}(Bach.) (GeV/c); Comb. PID Proba (Bach. = K^{#pm})", 100, 0.0, 5.0, 110, 0.0, 1.10 );
884         fListHistCascade->Add(f2dHistPIDprobaKaonVsMCPtBach);
885   }
886   
887   if(! f2dHistPIDprobaPionVsMCPtBach ){
888         f2dHistPIDprobaPionVsMCPtBach  = new TH2F( "f2dHistPIDprobaPionVsMCPtBach" , "Comb. PID proba to be #pi^{#pm} Vs MC Bach. Pt ; Pt_{MC}(Bach.) (GeV/c); Comb. PID Proba (Bach. = #pi^{#pm})", 100, 0.0, 5.0, 110, 0.0, 1.10 );
889         fListHistCascade->Add(f2dHistPIDprobaPionVsMCPtBach);
890   }
891   
892   
893                 // - Effective mass histos with perfect MC PID on the bachelor
894   
895   if (! fHistMassWithMcPIDXiMinus) {
896     fHistMassWithMcPIDXiMinus = new TH1F("fHistMassWithMcPIDXiMinus","#Xi^{-} candidates, with Bach. MC PID;M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400,1.2,2.0);
897     fListHistCascade->Add(fHistMassWithMcPIDXiMinus);
898   }
899   
900   if (! fHistMassWithMcPIDXiPlus) {
901     fHistMassWithMcPIDXiPlus = new TH1F("fHistMassWithMcPIDXiPlus","#Xi^{+} candidates, with Bach. MC PID;M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts",400,1.2,2.0);
902     fListHistCascade->Add(fHistMassWithMcPIDXiPlus);
903   }
904
905   if (! fHistMassWithMcPIDOmegaMinus) {
906         fHistMassWithMcPIDOmegaMinus = new TH1F("fHistMassWithMcPIDOmegaMinus","#Omega^{-} candidates, with Bach. MC PID;M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500,1.5,2.5);
907     fListHistCascade->Add(fHistMassWithMcPIDOmegaMinus);
908   }
909  
910   if (! fHistMassWithMcPIDOmegaPlus) {
911         fHistMassWithMcPIDOmegaPlus = new TH1F("fHistMassWithMcPIDOmegaPlus","#Omega^{+} candidates, with Bach. MC PID;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2});Counts", 500,1.5,2.5);
912     fListHistCascade->Add(fHistMassWithMcPIDOmegaPlus);
913   }
914   
915   
916                 // - Effective mass histos for cascades candidates ASSOCIATED with MC.
917   
918   if (! fHistAsMCMassXiMinus) {
919           fHistAsMCMassXiMinus = new TH1F("fHistAsMCMassXiMinus","#Xi^{-} candidates associated to MC;M( #Lambda , #pi^{-} ) (GeV/c^{2});Counts", 400,1.2,2.0);
920           fListHistCascade->Add(fHistAsMCMassXiMinus);
921   }
922   
923   if (! fHistAsMCMassXiPlus) {
924           fHistAsMCMassXiPlus = new TH1F("fHistAsMCMassXiPlus","#Xi^{+} candidates associated to MC;M( #bar{#Lambda}^{0} , #pi^{+} ) (GeV/c^{2});Counts",400,1.2,2.0);
925           fListHistCascade->Add(fHistAsMCMassXiPlus);
926   }
927
928   if (! fHistAsMCMassOmegaMinus) {
929           fHistAsMCMassOmegaMinus = new TH1F("fHistAsMCMassOmegaMinus","#Omega^{-} candidates associated to MC;M( #Lambda , K^{-} ) (GeV/c^{2});Counts", 500,1.5,2.5);
930           fListHistCascade->Add(fHistAsMCMassOmegaMinus);
931   }
932  
933   if (! fHistAsMCMassOmegaPlus) {
934           fHistAsMCMassOmegaPlus = new TH1F("fHistAsMCMassOmegaPlus","#Omega^{+} candidates associated to MC;M( #bar{#Lambda}^{0} , K^{+} ) (GeV/c^{2});Counts", 500,1.5,2.5);
935           fListHistCascade->Add(fHistAsMCMassOmegaPlus);
936   }
937   
938                 
939                 // -  Generated Pt Vs generated Y of the cascade candidates associated with MC 
940                 //     + having the proper maximum proba of combined PID for the bachelor
941   
942   if (!f2dHistAsMCandCombPIDGenPtVsGenYXiMinus) {
943      f2dHistAsMCandCombPIDGenPtVsGenYXiMinus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYXiMinus", "MC P_{t} Vs MC Y of #Xi^{-} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
944      fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYXiMinus);
945   }
946   
947   if (!f2dHistAsMCandCombPIDGenPtVsGenYXiPlus) {
948      f2dHistAsMCandCombPIDGenPtVsGenYXiPlus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYXiPlus", "MC P_{t} Vs MC Y of #Xi^{+} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
949      fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYXiPlus);
950   }
951   
952   if (!f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus) {
953      f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus", "MC P_{t} Vs MC Y of #Omega^{-} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
954      fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus);
955   }
956   
957   if (!f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus) {
958      f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus = new TH2F("f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus", "MC P_{t} Vs MC Y of #Omega^{+} (associated+Bach.PID); Pt_{MC} (GeV/c); Y_{MC}", 200, 0., 10., 220, -1.1, 1.1);
959      fListHistCascade->Add(f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus);
960   }
961   
962
963                 // - Generated Pt Vs Generated Y, for the cascade candidates associated with MC
964   
965   if (!f2dHistAsMCGenPtVsGenYXiMinus) {
966         f2dHistAsMCGenPtVsGenYXiMinus = new TH2F("f2dHistAsMCGenPtVsGenYXiMinus", "MC P_{t} Vs MC Y of gen. #Xi^{-} (associated);Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
967           fListHistCascade->Add(f2dHistAsMCGenPtVsGenYXiMinus );
968   }
969   
970   if (!f2dHistAsMCGenPtVsGenYXiPlus) {
971           f2dHistAsMCGenPtVsGenYXiPlus = new TH2F("f2dHistAsMCGenPtVsGenYXiPlus", "MC P_{t} Vs MC Y of gen. #Xi^{+} (associated);Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
972           fListHistCascade->Add(f2dHistAsMCGenPtVsGenYXiPlus );
973   }
974   
975   if (!f2dHistAsMCGenPtVsGenYOmegaMinus) {
976           f2dHistAsMCGenPtVsGenYOmegaMinus = new TH2F("f2dHistAsMCGenPtVsGenYOmegaMinus", "MC P_{t} Vs MC Y of gen. #Omega^{-} (associated);Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
977           fListHistCascade->Add(f2dHistAsMCGenPtVsGenYOmegaMinus );
978   }
979   
980   if (!f2dHistAsMCGenPtVsGenYOmegaPlus) {
981           f2dHistAsMCGenPtVsGenYOmegaPlus = new TH2F("f2dHistAsMCGenPtVsGenYOmegaPlus", "MC P_{t} Vs MC Y of gen. #Omega^{+} (associated);Pt_{MC} (GeV/c); Rapidity, Y_{MC}",200, 0., 10., 220, -1.1, 1.1);
982           fListHistCascade->Add(f2dHistAsMCGenPtVsGenYOmegaPlus );
983   } 
984   
985   
986                 // - Generated Eta of the the cascade candidates associated with MC
987   if (!fHistAsMCGenEtaXiMinus) {
988           fHistAsMCGenEtaXiMinus = new TH1F("fHistAsMCGenEtaXiMinus", "#eta of gen. #Xi^{-} (associated);#eta;Number of Casc", 100, -5, 5);
989           fListHistCascade->Add( fHistAsMCGenEtaXiMinus );
990   }
991   
992   if (!fHistAsMCGenEtaXiPlus) {
993           fHistAsMCGenEtaXiPlus = new TH1F("fHistAsMCGenEtaXiPlus", "#eta of gen. #Xi^{+} (associated);#eta;Number of Casc", 100, -5, 5);
994           fListHistCascade->Add( fHistAsMCGenEtaXiPlus );
995   }
996   
997   if (!fHistAsMCGenEtaOmegaMinus) {
998           fHistAsMCGenEtaOmegaMinus = new TH1F("fHistAsMCGenEtaOmegaMinus", "#eta of gen. #Omega^{-} (associated);#eta;Number of Casc", 100, -5, 5);
999           fListHistCascade->Add( fHistAsMCGenEtaOmegaMinus );
1000   }
1001   
1002   if (!fHistAsMCGenEtaOmegaPlus) {
1003           fHistAsMCGenEtaOmegaPlus = new TH1F("fHistAsMCGenEtaOmegaPlus", "#eta of gen. #Omega^{+} (associated);#eta;Number of Casc", 100, -5, 5);
1004           fListHistCascade->Add( fHistAsMCGenEtaOmegaPlus );
1005   }
1006   
1007   
1008   
1009                 // - Resolution in Pt as function of generated Pt
1010   
1011   if(! f2dHistAsMCResPtXiMinus) {
1012           f2dHistAsMCResPtXiMinus = new TH2F( "f2dHistAsMCResPtXiMinus", "Resolution in Pt reconstruction for #Xi^{-}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
1013           fListHistCascade->Add(f2dHistAsMCResPtXiMinus);
1014   }
1015   
1016   if(! f2dHistAsMCResPtXiPlus) {
1017           f2dHistAsMCResPtXiPlus = new TH2F( "f2dHistAsMCResPtXiPlus", "Resolution in Pt reconstruction for #Xi^{+}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
1018           fListHistCascade->Add(f2dHistAsMCResPtXiPlus);
1019   }
1020   
1021   if(! f2dHistAsMCResPtOmegaMinus) {
1022           f2dHistAsMCResPtOmegaMinus = new TH2F( "f2dHistAsMCResPtOmegaMinus", "Resolution in Pt reconstruction for #Omega^{-}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
1023           fListHistCascade->Add(f2dHistAsMCResPtOmegaMinus);
1024   }
1025   
1026   if(! f2dHistAsMCResPtOmegaPlus) {
1027           f2dHistAsMCResPtOmegaPlus = new TH2F( "f2dHistAsMCResPtOmegaPlus", "Resolution in Pt reconstruction for #Omega^{+}; Pt_{MC} (GeV/c); (Pt_{reco} - Pt_{MC}) / Pt_{MC}", 200, 0., 10., 200, -0.1, 0.1);
1028           fListHistCascade->Add(f2dHistAsMCResPtOmegaPlus);
1029   }
1030   
1031                 // - Resolution in R(2D) as function of generated R
1032   
1033   if(! f2dHistAsMCResRXiMinus) {
1034           f2dHistAsMCResRXiMinus = new TH2F( "f2dHistAsMCResRXiMinus", "Resolution in transv. position for #Xi^{-}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
1035           fListHistCascade->Add(f2dHistAsMCResRXiMinus);
1036   }
1037   
1038   if(! f2dHistAsMCResRXiPlus) {
1039           f2dHistAsMCResRXiPlus = new TH2F( "f2dHistAsMCResRXiPlus", "Resolution in transv. position for #Xi^{+}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
1040           fListHistCascade->Add(f2dHistAsMCResRXiPlus);
1041   }
1042   
1043   if(! f2dHistAsMCResROmegaMinus) {
1044           f2dHistAsMCResROmegaMinus = new TH2F( "f2dHistAsMCResROmegaMinus", "Resolution in transv. position for #Omega^{-}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
1045           fListHistCascade->Add(f2dHistAsMCResROmegaMinus);
1046   }
1047   
1048   if(! f2dHistAsMCResROmegaPlus) {
1049           f2dHistAsMCResROmegaPlus = new TH2F( "f2dHistAsMCResROmegaPlus", "Resolution in transv. position for #Omega^{+}; R_{MC} (cm); (R_{reco} - R_{MC}) / R_{MC}", 450, 0., 45.0, 240, -0.3, 0.3);
1050           fListHistCascade->Add(f2dHistAsMCResROmegaPlus);
1051   }
1052   
1053   
1054   
1055   
1056                 // - PID container
1057 if(! fCFContCascadePIDAsXiMinus)  {
1058   const Int_t  lNbSteps      =  7 ;
1059   const Int_t  lNbVariables  =  4 ;
1060
1061   //array for the number of bins in each dimension :
1062   Int_t lNbBinsPerVar[4] = {0};
1063   lNbBinsPerVar[0] = 200;
1064   lNbBinsPerVar[1] = 400;
1065   lNbBinsPerVar[2] = 44;
1066   lNbBinsPerVar[3] = 250;
1067    
1068   
1069   fCFContCascadePIDAsXiMinus = new AliCFContainer("fCFContCascadePIDAsXiMinus","Pt_{cascade} Vs M_{#Xi^{-} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
1070   
1071   //setting the bin limits (valid  for v4-18-10-AN)
1072   fCFContCascadePIDAsXiMinus->SetBinLimits(0,   0.0  ,  10.0 ); // Pt(Cascade)
1073   fCFContCascadePIDAsXiMinus->SetBinLimits(1,   1.2  ,   2.0 ); // Xi Effective mass
1074   fCFContCascadePIDAsXiMinus->SetBinLimits(2,  -1.1  ,   1.1 ); // Rapidity
1075   if(fCollidingSystems) 
1076         fCFContCascadePIDAsXiMinus->SetBinLimits(3, 0.0, 20000.0  );    // TPCrefitTrackMultiplicity
1077   else
1078         fCFContCascadePIDAsXiMinus->SetBinLimits(3, 0.0, 250.0  );     // TPCrefitTrackMultiplicity
1079   
1080   // Setting the step title : one per PID case
1081   fCFContCascadePIDAsXiMinus->SetStepTitle(0, "No PID");
1082   fCFContCascadePIDAsXiMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
1083   fCFContCascadePIDAsXiMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
1084   fCFContCascadePIDAsXiMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
1085   fCFContCascadePIDAsXiMinus->SetStepTitle(4, "Comb. PID / Bachelor");
1086   fCFContCascadePIDAsXiMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
1087   fCFContCascadePIDAsXiMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
1088   
1089   // Setting the variable title, per axis
1090   fCFContCascadePIDAsXiMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
1091   fCFContCascadePIDAsXiMinus->SetVarTitle(1, "M( #Lambda , #pi^{-} ) (GeV/c^{2})");
1092   fCFContCascadePIDAsXiMinus->SetVarTitle(2, "Y_{#Xi}");
1093   fCFContCascadePIDAsXiMinus->SetVarTitle(3, "SPD tracklet Multiplicity");
1094   
1095   fListHistCascade->Add(fCFContCascadePIDAsXiMinus);
1096   
1097 }
1098
1099 if(! fCFContCascadePIDAsXiPlus)  {
1100   const Int_t  lNbSteps      =  7 ;
1101   const Int_t  lNbVariables  =  4 ;
1102
1103   //array for the number of bins in each dimension :
1104   Int_t lNbBinsPerVar[4] = {0};
1105   lNbBinsPerVar[0] = 200;
1106   lNbBinsPerVar[1] = 400;
1107   lNbBinsPerVar[2] = 44;
1108   lNbBinsPerVar[3] = 250;
1109    
1110   
1111   fCFContCascadePIDAsXiPlus = new AliCFContainer("fCFContCascadePIDAsXiPlus","Pt_{cascade} Vs M_{#Xi^{+} candidates} Vs Y_{#Xi}", lNbSteps, lNbVariables, lNbBinsPerVar );
1112   
1113   
1114   //setting the bin limits (valid  for v4-18-10-AN)
1115   fCFContCascadePIDAsXiPlus->SetBinLimits(0,   0.0  ,  10.0 );  // Pt(Cascade)
1116   fCFContCascadePIDAsXiPlus->SetBinLimits(1,   1.2  ,   2.0 );  // Xi Effective mass
1117   fCFContCascadePIDAsXiPlus->SetBinLimits(2,  -1.1  ,   1.1 );  // Rapidity
1118   if(fCollidingSystems) 
1119         fCFContCascadePIDAsXiPlus->SetBinLimits(3, 0.0, 20000.0  );    // TPCrefitTrackMultiplicity
1120   else
1121         fCFContCascadePIDAsXiPlus->SetBinLimits(3, 0.0, 250.0  );     // TPCrefitTrackMultiplicity
1122   
1123   // Setting the step title : one per PID case
1124   fCFContCascadePIDAsXiPlus->SetStepTitle(0, "No PID");
1125   fCFContCascadePIDAsXiPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
1126   fCFContCascadePIDAsXiPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
1127   fCFContCascadePIDAsXiPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
1128   fCFContCascadePIDAsXiPlus->SetStepTitle(4, "Comb. PID / Bachelor");
1129   fCFContCascadePIDAsXiPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
1130   fCFContCascadePIDAsXiPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
1131   
1132   // Setting the variable title, per axis
1133   fCFContCascadePIDAsXiPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
1134   fCFContCascadePIDAsXiPlus->SetVarTitle(1, "M( #Lambda , #pi^{+} ) (GeV/c^{2})");
1135   fCFContCascadePIDAsXiPlus->SetVarTitle(2, "Y_{#Xi}");
1136   fCFContCascadePIDAsXiPlus->SetVarTitle(3, "SPD tracklet Multiplicity");
1137   
1138   fListHistCascade->Add(fCFContCascadePIDAsXiPlus);
1139   
1140 }
1141
1142
1143 if(! fCFContCascadePIDAsOmegaMinus)  {
1144   const Int_t  lNbSteps      =  7 ;
1145   const Int_t  lNbVariables  =  4 ;
1146
1147   //array for the number of bins in each dimension :
1148   Int_t lNbBinsPerVar[4] = {0};
1149   lNbBinsPerVar[0] = 200;
1150   lNbBinsPerVar[1] = 500;
1151   lNbBinsPerVar[2] = 44;
1152   lNbBinsPerVar[3] = 250;
1153    
1154   
1155   fCFContCascadePIDAsOmegaMinus = new AliCFContainer("fCFContCascadePIDAsOmegaMinus","Pt_{cascade} Vs M_{#Omega^{-} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
1156   
1157   
1158   //setting the bin limits (valid  for v4-18-10-AN)
1159   fCFContCascadePIDAsOmegaMinus->SetBinLimits(0,   0.0  ,  10.0 );      // Pt(Cascade)
1160   fCFContCascadePIDAsOmegaMinus->SetBinLimits(1,   1.5  ,   2.5 );      // Omega Effective mass
1161   fCFContCascadePIDAsOmegaMinus->SetBinLimits(2,  -1.1  ,   1.1 );      // Rapidity
1162   if(fCollidingSystems) 
1163         fCFContCascadePIDAsOmegaMinus->SetBinLimits(3, 0.0, 20000.0  );    // TPCrefitTrackMultiplicity
1164   else
1165         fCFContCascadePIDAsOmegaMinus->SetBinLimits(3, 0.0, 250.0  );     // TPCrefitTrackMultiplicity
1166   
1167   // Setting the step title : one per PID case
1168   fCFContCascadePIDAsOmegaMinus->SetStepTitle(0, "No PID");
1169   fCFContCascadePIDAsOmegaMinus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
1170   fCFContCascadePIDAsOmegaMinus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
1171   fCFContCascadePIDAsOmegaMinus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
1172   fCFContCascadePIDAsOmegaMinus->SetStepTitle(4, "Comb. PID / Bachelor");
1173   fCFContCascadePIDAsOmegaMinus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
1174   fCFContCascadePIDAsOmegaMinus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
1175   
1176   // Setting the variable title, per axis
1177   fCFContCascadePIDAsOmegaMinus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
1178   fCFContCascadePIDAsOmegaMinus->SetVarTitle(1, "M( #Lambda , K^{-} ) (GeV/c^{2})");
1179   fCFContCascadePIDAsOmegaMinus->SetVarTitle(2, "Y_{#Omega}");
1180   fCFContCascadePIDAsOmegaMinus->SetVarTitle(3, "SPD tracklet Multiplicity");
1181   
1182   fListHistCascade->Add(fCFContCascadePIDAsOmegaMinus);
1183   
1184 }
1185
1186 if(! fCFContCascadePIDAsOmegaPlus)  {
1187   const Int_t  lNbSteps      =  7 ;
1188   const Int_t  lNbVariables  =  4 ;
1189
1190   //array for the number of bins in each dimension :
1191   Int_t lNbBinsPerVar[4]= {0};
1192   lNbBinsPerVar[0] = 200;
1193   lNbBinsPerVar[1] = 500;
1194   lNbBinsPerVar[2] = 44;
1195   lNbBinsPerVar[3] = 250;
1196    
1197   
1198   fCFContCascadePIDAsOmegaPlus = new AliCFContainer("fCFContCascadePIDAsOmegaPlus","Pt_{cascade} Vs M_{#Omega^{+} candidates} Vs Y_{#Omega}", lNbSteps, lNbVariables, lNbBinsPerVar );
1199   
1200   
1201   //setting the bin limits (valid  for v4-18-10-AN)
1202   fCFContCascadePIDAsOmegaPlus->SetBinLimits(0,   0.0  ,  10.0 );       // Pt(Cascade)
1203   fCFContCascadePIDAsOmegaPlus->SetBinLimits(1,   1.5  ,   2.5 );       // Omega Effective mass
1204   fCFContCascadePIDAsOmegaPlus->SetBinLimits(2,  -1.1  ,   1.1 );       // Rapidity
1205   if(fCollidingSystems) 
1206         fCFContCascadePIDAsOmegaPlus->SetBinLimits(3, 0.0, 20000.0  );    // TPCrefitTrackMultiplicity
1207   else
1208         fCFContCascadePIDAsOmegaPlus->SetBinLimits(3, 0.0, 250.0  );     // TPCrefitTrackMultiplicity
1209   
1210   // Setting the step title : one per PID case
1211   fCFContCascadePIDAsOmegaPlus->SetStepTitle(0, "No PID");
1212   fCFContCascadePIDAsOmegaPlus->SetStepTitle(1, "TPC PID / 4-#sigma cut on Bachelor track");
1213   fCFContCascadePIDAsOmegaPlus->SetStepTitle(2, "TPC PID / 4-#sigma cut on Bachelor+Baryon tracks");
1214   fCFContCascadePIDAsOmegaPlus->SetStepTitle(3, "TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks");
1215   fCFContCascadePIDAsOmegaPlus->SetStepTitle(4, "Comb. PID / Bachelor");
1216   fCFContCascadePIDAsOmegaPlus->SetStepTitle(5, "Comb. PID / Bachelor+Baryon");
1217   fCFContCascadePIDAsOmegaPlus->SetStepTitle(6, "Comb. PID / Bachelor+Baryon+Meson");
1218   
1219   // Setting the variable title, per axis
1220   fCFContCascadePIDAsOmegaPlus->SetVarTitle(0, "Pt_{cascade} (GeV/c)");
1221   fCFContCascadePIDAsOmegaPlus->SetVarTitle(1, "M( #Lambda , K^{+} ) (GeV/c^{2})");
1222   fCFContCascadePIDAsOmegaPlus->SetVarTitle(2, "Y_{#Omega}");
1223   fCFContCascadePIDAsOmegaPlus->SetVarTitle(3, "SPD tracklet Multiplicity");
1224   
1225   fListHistCascade->Add(fCFContCascadePIDAsOmegaPlus);
1226   
1227 }
1228
1229 // Part 3 : Towards the optimisation of topological selections -------
1230 if(! fCFContAsCascadeCuts){
1231    
1232         // Container meant to store all the relevant distributions corresponding to the cut variables.
1233         // So far, 20 variables have been identified.
1234         // The following will be done in quite a brut force way ... 
1235         // FIXME Improvement expected later (before Pb-Pb data at least)
1236         //          - Define a user binning to have less bins in each dimension
1237         //          - boolean for enabling/disbaling this CFContainer
1238   const Int_t  lNbSteps      =  4 ;
1239   const Int_t  lNbVariables  =  20 ;
1240   
1241   //array for the number of bins in each dimension :
1242   Int_t lNbBinsPerVar[20] = {0};
1243   lNbBinsPerVar[0]  = 25;
1244   lNbBinsPerVar[1]  = 25;
1245   lNbBinsPerVar[2]  = 20;
1246   lNbBinsPerVar[3]  = 40;
1247   lNbBinsPerVar[4]  = 30;
1248   lNbBinsPerVar[5]  = 25;
1249   
1250   lNbBinsPerVar[6]  = 20;
1251   lNbBinsPerVar[7]  = 40;
1252   lNbBinsPerVar[8]  = 40;
1253   lNbBinsPerVar[9]  = 25;
1254   lNbBinsPerVar[10] = 25;
1255   
1256   lNbBinsPerVar[11] = 75; // 2-MeV/c2 bins
1257   lNbBinsPerVar[12] = 60; // 2-MeV/c2 bins
1258   
1259   lNbBinsPerVar[13] = 100;
1260   
1261   lNbBinsPerVar[14] = 44; // 0.05 in rapidity units
1262   lNbBinsPerVar[15] = 44; // 0.05 in rapidity units
1263   
1264   lNbBinsPerVar[16] = 20;
1265  
1266   lNbBinsPerVar[17] = 50;
1267   lNbBinsPerVar[18] = 100;
1268   lNbBinsPerVar[19] = 24;
1269    
1270    
1271   fCFContAsCascadeCuts = new AliCFContainer("fCFContAsCascadeCuts","Cut Container for Asso. Cascades", lNbSteps, lNbVariables, lNbBinsPerVar );
1272   
1273   //0
1274   Double_t *lBinLim0  = new Double_t[ lNbBinsPerVar[0]+1 ];
1275         for(Int_t i=0; i< lNbBinsPerVar[0];i++)  lBinLim0[i]  = (Double_t)0.0   + (4.8  - 0.0 )/(lNbBinsPerVar[0]-1)  * (Double_t)i ;
1276         lBinLim0[ lNbBinsPerVar[0]  ] = 20.0;
1277   fCFContAsCascadeCuts -> SetBinLimits(0,  lBinLim0 );            // DcaXiDaughters : 0.0 to 5.0  
1278   delete [] lBinLim0;  
1279   //1
1280   Double_t *lBinLim1  = new Double_t[ lNbBinsPerVar[1]+1 ];
1281         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 ;
1282         lBinLim1[ lNbBinsPerVar[1]  ] = 100.0;
1283   fCFContAsCascadeCuts -> SetBinLimits(1,  lBinLim1 );            // DcaBachToPrimVertexXi : 0.0 to 0.25  
1284   delete [] lBinLim1;  
1285   //2 
1286   Double_t *lBinLim2  = new Double_t[ lNbBinsPerVar[2]+1 ];
1287         for(Int_t i=1; i< lNbBinsPerVar[2]+1;i++)   lBinLim2[i]  = (Double_t)0.81   + (1.0  - 0.81 )/(lNbBinsPerVar[2]-1)  * (Double_t) (i-1) ;   
1288         lBinLim2[0] = 0.0;
1289   fCFContAsCascadeCuts -> SetBinLimits(2,  lBinLim2 );            // XiCosineOfPointingAngle : 0.80 to 1.0        
1290   delete [] lBinLim2;  
1291   //3
1292   Double_t *lBinLim3  = new Double_t[ lNbBinsPerVar[3]+1 ];
1293         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 ;
1294         lBinLim3[ lNbBinsPerVar[3]  ] = 110.0;
1295   fCFContAsCascadeCuts -> SetBinLimits(3,  lBinLim3 );            // XiRadius : 0.0 to 4.0        
1296   delete [] lBinLim3;  
1297   //4
1298   fCFContAsCascadeCuts->SetBinLimits(4,    1.1  ,  1.13 );        // InvMassLambdaAsCascDghter
1299   //5
1300   Double_t *lBinLim5  = new Double_t[ lNbBinsPerVar[5]+1 ];
1301         for(Int_t i=0; i< lNbBinsPerVar[5];i++)   lBinLim5[i]  = (Double_t)0.0   + (4.8  - 0.0 )/(lNbBinsPerVar[5]-1)  * (Double_t)i ;
1302         lBinLim5[ lNbBinsPerVar[5]  ] = 20.0;
1303   fCFContAsCascadeCuts -> SetBinLimits(5,  lBinLim5 );            // DcaV0DaughtersXi : 0.0 to 5.0        
1304   delete [] lBinLim5;  
1305   
1306   
1307   //6
1308   Double_t *lBinLim6  = new Double_t[ lNbBinsPerVar[6]+1 ];
1309         for(Int_t i=1; i< lNbBinsPerVar[6]+1 ;i++)   lBinLim6[i]  = (Double_t)0.81   + (1.0  - 0.81 )/(lNbBinsPerVar[6]-1)  * (Double_t) (i-1) ;   
1310         lBinLim6[0] = 0.0;
1311   fCFContAsCascadeCuts -> SetBinLimits(6,  lBinLim6 );            // V0CosineOfPointingAngleXi : 0.80 to 1.0      
1312   delete [] lBinLim6;  
1313   //7
1314   Double_t *lBinLim7  = new Double_t[ lNbBinsPerVar[7]+1 ];
1315         for(Int_t i=0; i< lNbBinsPerVar[7];i++)   lBinLim7[i]  = (Double_t)0.0   + (7.8  - 0.0 )/(lNbBinsPerVar[7]-1)  * (Double_t)i ;
1316         lBinLim7[ lNbBinsPerVar[7]  ] = 100.0;
1317   fCFContAsCascadeCuts -> SetBinLimits(7,  lBinLim7 );            // V0RadiusXi : 0.0 to 8.0      
1318   delete [] lBinLim7;  
1319   //8
1320   Double_t *lBinLim8  = new Double_t[ lNbBinsPerVar[8]+1 ];
1321         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 ;
1322         lBinLim8[ lNbBinsPerVar[8]  ] = 100.0;
1323   fCFContAsCascadeCuts -> SetBinLimits(8,  lBinLim8 );            // DcaV0ToPrimVertexXi : 0.0 to 0.4     
1324   delete [] lBinLim8;  
1325   //9
1326   Double_t *lBinLim9  = new Double_t[ lNbBinsPerVar[9]+1 ];
1327         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 ;
1328         lBinLim9[ lNbBinsPerVar[9]  ] = 100.0;
1329   fCFContAsCascadeCuts -> SetBinLimits(9,  lBinLim9 );            // DcaPosToPrimVertexXi : 0.0 to 0.25   
1330   delete [] lBinLim9; 
1331   //10
1332   Double_t *lBinLim10  = new Double_t[ lNbBinsPerVar[10]+1 ];
1333         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 ;
1334         lBinLim10[ lNbBinsPerVar[10]  ] = 100.0;
1335   fCFContAsCascadeCuts -> SetBinLimits(10,  lBinLim10 );            // DcaPosToPrimVertexXi : 0.0 to 0.25 
1336   delete [] lBinLim10; 
1337   
1338   
1339   //11
1340   fCFContAsCascadeCuts->SetBinLimits(11,   1.25 ,  1.40 );      // InvMassXi
1341   fCFContAsCascadeCuts->SetBinLimits(12,   1.62  , 1.74 );      // InvMassOmega
1342   fCFContAsCascadeCuts->SetBinLimits(13,   0.0  , 10.0  );      // XiTransvMom 
1343   fCFContAsCascadeCuts->SetBinLimits(14,  -1.1  ,  1.1  );      // Y(Xi)
1344   fCFContAsCascadeCuts->SetBinLimits(15,  -1.1  ,  1.1  );      // Y(Omega)
1345   fCFContAsCascadeCuts->SetBinLimits(16, -10.0  , 10.0  );      // BestPrimaryVtxPosZ
1346   if(fCollidingSystems){
1347         fCFContAsCascadeCuts->SetBinLimits(17,   0.0, 10000.0  );    // TPCrefitTrackMultiplicity
1348         fCFContAsCascadeCuts->SetBinLimits(18,   0.0, 10000.0  );    // SPDTrackletsMultiplicity
1349   }
1350   else{  
1351         fCFContAsCascadeCuts->SetBinLimits(17,   0.0, 250.0  );     // TPCrefitTrackMultiplicity
1352         fCFContAsCascadeCuts->SetBinLimits(18,   0.0, 200.0  );     // SPDTrackletsMultiplicity
1353   }
1354   fCFContAsCascadeCuts->SetBinLimits(19,  68.0  ,164.0  );      // BachTPCClusters
1355   
1356   
1357   // Regular binning definition (valid for v4-18-10-AN on)
1358   /*
1359   //setting the bin limits
1360   fCFContAsCascadeCuts->SetBinLimits(0,    0.0  ,  2.5  );      // DcaXiDaughters
1361   fCFContAsCascadeCuts->SetBinLimits(1,    0.0  ,  0.25 );      // DcaBachToPrimVertexXi
1362   fCFContAsCascadeCuts->SetBinLimits(2,    0.99 ,  1.0  );      // XiCosineOfPointingAngle
1363   fCFContAsCascadeCuts->SetBinLimits(3,    0.0  ,  4.0  );      // XiRadius
1364   fCFContAsCascadeCuts->SetBinLimits(4,    1.1  ,  1.15 );      // InvMassLambdaAsCascDghter
1365   fCFContAsCascadeCuts->SetBinLimits(5,    0.0  ,  1.0  );      // DcaV0DaughtersXi
1366   fCFContAsCascadeCuts->SetBinLimits(6,    0.98 ,  1.0  );      // V0CosineOfPointingAngleXi
1367   fCFContAsCascadeCuts->SetBinLimits(7,    0.0  , 20.0  );      // V0RadiusXi
1368   fCFContAsCascadeCuts->SetBinLimits(8,    0.0  ,  1.0  );      // DcaV0ToPrimVertexXi
1369   fCFContAsCascadeCuts->SetBinLimits(9,    0.0  ,  0.25 );      // DcaPosToPrimVertexXi
1370   fCFContAsCascadeCuts->SetBinLimits(10,   0.0  ,  0.25 );      // DcaNegToPrimVertexXi
1371   fCFContAsCascadeCuts->SetBinLimits(11,   1.25 ,  1.40 );      // InvMassXi
1372   fCFContAsCascadeCuts->SetBinLimits(12,   1.62 ,  1.74 );      // InvMassOmega
1373   fCFContAsCascadeCuts->SetBinLimits(13,   0.0  , 10.0  );      // pt_MC(Xi)
1374   fCFContAsCascadeCuts->SetBinLimits(14,  -1.1  ,  1.1  );      // Y_MC(Xi)
1375   fCFContAsCascadeCuts->SetBinLimits(15,  -1.1  ,  1.1  );      // Y_MC(Omega)
1376   fCFContAsCascadeCuts->SetBinLimits(16, -10.0  , 10.0  );      // BestPrimaryVtxPosZ
1377   if(fCollidingSystems){
1378         fCFContAsCascadeCuts->SetBinLimits(17,   0.0, 10000.0  );    // TPCrefitTrackMultiplicity
1379         fCFContAsCascadeCuts->SetBinLimits(18,   0.0, 10000.0  );    // SPDTrackletsMultiplicity
1380   }
1381   else{  
1382         fCFContAsCascadeCuts->SetBinLimits(17,   0.0, 250.0  );     // TPCrefitTrackMultiplicity
1383         fCFContAsCascadeCuts->SetBinLimits(18,   0.0, 200.0  );     // SPDTrackletsMultiplicity
1384   }
1385   fCFContAsCascadeCuts->SetBinLimits(19,  25.0  ,165.0  );      // BachTPCClusters
1386   */
1387   
1388   // Setting the number of steps : one for each cascade species (Xi-, Xi+ and Omega-, Omega+)
1389   fCFContAsCascadeCuts->SetStepTitle(0, "#Xi^{-} candidates associated to MC");
1390   fCFContAsCascadeCuts->SetStepTitle(1, "#bar{#Xi}^{+} candidates associated to MC");
1391   fCFContAsCascadeCuts->SetStepTitle(2, "#Omega^{-} candidates associated to MC");
1392   fCFContAsCascadeCuts->SetStepTitle(3, "#bar{#Omega}^{+} candidates associated to MC");
1393   
1394   // Setting the variable title, per axis
1395   // fCFContAsCascadeCuts->SetVarTitle(40,  "Chi2Xi");
1396   fCFContAsCascadeCuts->SetVarTitle(0,  "Dca(XiDaughters) (cm)");
1397   fCFContAsCascadeCuts->SetVarTitle(1,  "Dca(Bach/PrimVertex) (cm)");
1398   fCFContAsCascadeCuts->SetVarTitle(2,  "cos(Xi pointing angle)");
1399   fCFContAsCascadeCuts->SetVarTitle(3,  "R_{2d}(Xi decay) (cm)");
1400   fCFContAsCascadeCuts->SetVarTitle(4,  "M_{#Lambda}(As Casc Dghter) (GeV/c^{2})");
1401    // fCFContAsCascadeCuts->SetVarTitle(40,  "V0Chi2Xi");
1402   fCFContAsCascadeCuts->SetVarTitle(5,  "Dca(V0 Daughters Xi) (cm)");
1403   
1404   fCFContAsCascadeCuts->SetVarTitle(6,  "cos(V0 pointing Angle) in Casc");
1405   fCFContAsCascadeCuts->SetVarTitle(7,  "R_{2d}(V0 decay) (cm)");
1406   fCFContAsCascadeCuts->SetVarTitle(8,  "Dca(V0/PrimVertex) (cm)");
1407   fCFContAsCascadeCuts->SetVarTitle(9,  "Dca(Pos/PrimVertex) (cm)");
1408   fCFContAsCascadeCuts->SetVarTitle(10, "Dca(Neg/PrimVertex) (cm)");
1409   
1410   fCFContAsCascadeCuts->SetVarTitle(11, "Inv. Mass(Xi) (GeV/c^{2})");
1411   fCFContAsCascadeCuts->SetVarTitle(12, "Inv. Mass(Omega) (GeV/c^{2})");
1412   
1413   fCFContAsCascadeCuts->SetVarTitle(13, "Pt_{MC}(Casc.) (GeV/c)");
1414   //fCFContAsCascadeCuts->SetVarTitle(40, "V0toXiCosineOfPointingAngle");
1415   
1416   fCFContAsCascadeCuts->SetVarTitle(14, "Y_{MC}(Xi)");
1417   fCFContAsCascadeCuts->SetVarTitle(15, "Y_{MC}(Omega)");
1418   
1419   fCFContAsCascadeCuts->SetVarTitle(16, "Z-position(BestPrimVtx) (cm)");
1420   
1421   fCFContAsCascadeCuts->SetVarTitle(17, "TPCrefit track Multiplicity");
1422   fCFContAsCascadeCuts->SetVarTitle(18, "SPD tracklets Multiplicity");
1423   fCFContAsCascadeCuts->SetVarTitle(19, "Bach.TPC Clusters");
1424   
1425   fListHistCascade->Add(fCFContAsCascadeCuts);
1426 }
1427
1428
1429 PostData(1, fListHistCascade); 
1430 }// end CreateOutputObjects
1431
1432
1433
1434
1435
1436
1437 //________________________________________________________________________
1438 void AliAnalysisTaskCheckPerformanceCascade::UserExec(Option_t *) 
1439 {
1440         
1441   // Main loop
1442   // Called for each event
1443         
1444         AliESDEvent *lESDevent = 0x0;
1445         AliAODEvent *lAODevent = 0x0;
1446         AliMCEvent  *lMCevent  = 0x0; 
1447         AliStack    *lMCstack  = 0x0; 
1448         Int_t ncascades = -1;
1449         
1450         
1451   // Connect to the InputEvent  
1452   // After these lines, we should have an ESD/AOD event + the number of cascades in it.
1453                 
1454         if(fAnalysisType == "ESD"){
1455                 lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
1456                 if (!lESDevent) {
1457                         Printf("ERROR: lESDevent not available \n");
1458                         cout << "Name of the file with pb :" <<  CurrentFileName() << endl;  // or AliAnalysisTaskSE::CurrentFileName()
1459                         return;
1460                 }
1461         }
1462   
1463         else if(fAnalysisType == "AOD"){  
1464                 lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() ); 
1465                 if (!lAODevent) {
1466                         Printf("ERROR: lAODevent not available \n");
1467                         cout << "Name of the file with pb :" <<  CurrentFileName() << endl;
1468                         return;
1469                 }
1470         }
1471         
1472
1473         lMCevent = MCEvent();
1474         if (!lMCevent) {
1475                 Printf("ERROR: Could not retrieve MC event \n");
1476                 cout << "Name of the file with pb :" <<  CurrentFileName() << endl;     
1477                 return;
1478         }
1479
1480         lMCstack = lMCevent->Stack();
1481         if (!lMCstack) {
1482                 Printf("ERROR: Could not retrieve MC stack \n");
1483                 cout << "Name of the file with pb :" <<  CurrentFileName() << endl;
1484                 return;
1485                 
1486         }
1487         
1488         
1489    // Temporary way : AOD awareness of the code to be developed  FIXME
1490    if(fAnalysisType == "AOD") return;
1491    
1492    
1493    
1494    
1495   //-------------------------------------------------
1496   // 0 - Trigger managment + global event selection
1497   // NOTE : Check the availability of the proper trigger 
1498
1499    // Note : Presuppose the presence of AliPhysicsSelectionTask
1500    
1501         UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1502         Bool_t isSelected = 0;
1503         isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
1504         if ( ! isSelected ) { 
1505                 PostData(1, fListHistCascade); 
1506                 return;
1507         }
1508         //else Printf("Event selected ... \n");
1509    
1510
1511   //-------------------------------------------------
1512   // 1 - Cascade vertexer (ESD)
1513         if(fkRerunV0CascVertexers){ // FIXME : relaunch V0 and Cascade vertexers
1514 //                 if(fAnalysisType == "ESD" ){
1515 //                         lESDevent->ResetCascades();
1516 //                         lESDevent->ResetV0s();
1517 // 
1518 //                         AliV0vertexer lV0vtxer;
1519 //                         AliCascadeVertexer lCascVtxer;
1520 // 
1521 //                         lV0vtxer.SetDefaultCuts(fV0Sels);
1522 //                         lCascVtxer.SetDefaultCuts(fCascSels);
1523 // 
1524 //                         lV0vtxer.Tracks2V0vertices(lESDevent);
1525 //                         lCascVtxer.V0sTracks2CascadeVertices(lESDevent);
1526 //                 }
1527         }
1528
1529
1530   //------------------------------------------------
1531   // 2 - Preparing the general info about of the event = prim. Vtx + magnetic field (ESD)
1532   
1533
1534 //      if(fAnalysisType == "ESD" ){
1535
1536         // Magnetic field
1537                 const Double_t lMagneticField = lESDevent->GetMagneticField( );
1538
1539         // Prim vertex
1540                 const AliESDVertex *lPrimaryTrackingVtx = lESDevent->GetPrimaryVertexTracks();  // get the vtx stored in ESD found with tracks
1541                 const AliESDVertex *lPrimarySPDVtx      = lESDevent->GetPrimaryVertexSPD();     // get the vtx stored in ESD found with SPD tracklets
1542
1543                 const AliESDVertex *lPrimaryBestVtx     = lESDevent->GetPrimaryVertex();
1544                         // get the best primary vertex available for the event
1545                         // As done in AliCascadeVertexer, we keep the one which is the best one available.
1546                         // between : Tracking vertex > SPD vertex > TPC vertex > default SPD vertex
1547                         Double_t lBestPrimaryVtxPos[3]   = {-100.0, -100.0, -100.0};
1548                 lPrimaryBestVtx->GetXYZ( lBestPrimaryVtxPos );
1549
1550                 // FIXME : quality cut on the z-position of the prim vertex.
1551                 if(fkQualityCutZprimVtxPos) {
1552                         if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0 ) { 
1553                                 AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !"); 
1554                                 PostData(1, fListHistCascade); 
1555                                 return;
1556                         }
1557                 }
1558                 // FIXME : remove TPC-only primary vertex : retain only events with tracking + SPD vertex
1559                 if(fkQualityCutNoTPConlyPrimVtx) {
1560                         if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingVtx->GetStatus() ){
1561                                 AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
1562                                 PostData(1, fListHistCascade); 
1563                                 return;
1564                         }
1565                 }
1566 //      }// if ESD
1567         
1568         
1569   //    cout << "Name of the accessed file :" <<  fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
1570
1571   //    cout << "Tree characteristics ..." << endl;
1572   //    fInputHandler->GetTree()->Print("toponly");
1573   //    fInputHandler->GetTree()->GetBranch("PrimaryVertex")->Print();
1574   //    fInputHandler->GetTree()->GetBranch("SPDVertex")->Print();
1575
1576
1577
1578   // ---------------------------------------------------------------
1579   // - Initialisation of the part dedicated to cascade vertices
1580
1581   if(fAnalysisType == "ESD")            ncascades = lESDevent->GetNumberOfCascades();
1582   else if(fAnalysisType == "AOD")       ncascades = lAODevent->GetNumberOfCascades();
1583         
1584   
1585   Int_t iNumberOfPrimaries = -1;
1586   iNumberOfPrimaries = lMCstack->GetNprimary();
1587   
1588         if(iNumberOfPrimaries < 1) return;
1589     
1590        fHistMCTrackMultiplicity->Fill( lMCstack->GetNtrack() );
1591    
1592    // For proton
1593    /*
1594    for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < iNumberOfPrimaries; iCurrentLabelStack++) 
1595         {// This is the begining of the loop on primaries, for protons
1596           
1597         TParticle* lCurrentParticle = lMCstack->Particle( iCurrentLabelStack );
1598         if(!lCurrentParticle){
1599                 Printf("Proton loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
1600                 continue;
1601                 
1602         }
1603         
1604         if( lCurrentParticle->GetPdgCode() == 2212 )
1605                 fHistEtaGenProton->Fill( lCurrentParticle->Eta() );
1606
1607         if( lCurrentParticle->GetPdgCode() == -2212 )
1608                 fHistEtaGenAntiProton->Fill( lCurrentParticle->Eta() );
1609         }// end loop over primary proton
1610    */
1611
1612       
1613        
1614 //__________________________________________________________________________    
1615 // Part 1 - Loop over the different types of GENERATED cascades (Xi-+, Omega-+) 
1616
1617         // - Initialisation of useful local variables
1618                 
1619         Int_t lPdgCodeCasc            = 0;
1620         Int_t lPdgCodeBach            = 0;
1621         Int_t lPdgCodeLambda          = 0;
1622         Int_t lPdgCodeDghtMesV0       = 0;
1623         Int_t lPdgCodeDghtBarV0       = 0;
1624         
1625         
1626         TH1F *lHistEtaGenCasc         = 0;      
1627         TH2F *l2dHistGenPtVsGenYGen   = 0;
1628                 
1629         TH1F *lHistThetaGenCasc       = 0;
1630         TH2F *l2dHistGenPtVsGenYFdbl  = 0;
1631         TH1F *lHistThetaLambda        = 0;
1632         TH1F *lHistThetaBach          = 0;
1633         TH1F *lHistThetaBarDghter     = 0;
1634         TH1F *lHistThetaMesDghter     = 0;
1635         TH1F *lHistPtBach             = 0;
1636         TH1F *lHistPtBarDghter        = 0;
1637         TH1F *lHistPtMesDghter        = 0;
1638
1639
1640 for(Int_t iCascType = 1; iCascType < 5; iCascType++)
1641 {
1642        
1643 switch (iCascType)
1644   {
1645     case 1: // Xi-
1646          lPdgCodeCasc       =   3312;  //Xi-
1647          lPdgCodeBach       =   -211;  //Pi-
1648          lPdgCodeLambda     =   3122;  //Lambda0
1649          lPdgCodeDghtMesV0  =   -211;  //Pi-
1650          lPdgCodeDghtBarV0  =   2212;  //Proton 
1651                 
1652                 // any Xi-
1653          lHistEtaGenCasc        = fHistEtaGenCascXiMinus;
1654          l2dHistGenPtVsGenYGen  = f2dHistGenPtVsGenYGenXiMinus;
1655         
1656                 // cascades generated within acceptance (cut in pt + theta)
1657          lHistThetaGenCasc      = fHistThetaGenCascXiMinus;
1658          l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblXiMinus;
1659          lHistThetaLambda       = fHistThetaLambdaXiMinus;
1660          lHistThetaBach         = fHistThetaBachXiMinus;
1661          lHistThetaBarDghter    = fHistThetaBarDghterXiMinus;
1662          lHistThetaMesDghter    = fHistThetaMesDghterXiMinus;
1663          lHistPtBach            = fHistPtBachXiMinus;
1664          lHistPtBarDghter       = fHistPtBarDghterXiMinus;
1665          lHistPtMesDghter       = fHistPtMesDghterXiMinus;
1666         break; 
1667            
1668     case 2: // Xi+
1669          lPdgCodeCasc        =  -3312;  //Xi+
1670          lPdgCodeBach        =    211;  //Pi+
1671          lPdgCodeLambda      =  -3122;  //AntiLambda0
1672          lPdgCodeDghtMesV0   =    211;  //Pi+
1673          lPdgCodeDghtBarV0   =  -2212;  //AntiProton  
1674          
1675                 // any Xi+
1676          lHistEtaGenCasc        = fHistEtaGenCascXiPlus;
1677          l2dHistGenPtVsGenYGen  = f2dHistGenPtVsGenYGenXiPlus;
1678         
1679                 // cascades generated within acceptance (cut in pt + theta)      
1680          lHistThetaGenCasc      = fHistThetaGenCascXiPlus;
1681          l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblXiPlus;
1682          lHistThetaLambda       = fHistThetaLambdaXiPlus;
1683          lHistThetaBach         = fHistThetaBachXiPlus;
1684          lHistThetaBarDghter    = fHistThetaBarDghterXiPlus;
1685          lHistThetaMesDghter    = fHistThetaMesDghterXiPlus;
1686          lHistPtBach            = fHistPtBachXiPlus;
1687          lHistPtBarDghter       = fHistPtBarDghterXiPlus;
1688          lHistPtMesDghter       = fHistPtMesDghterXiPlus;  
1689         break;
1690    
1691     case 3: // Omega-
1692          lPdgCodeCasc       =   3334;  //Omega-
1693          lPdgCodeBach       =   -321;  //K-
1694          lPdgCodeLambda     =   3122;  //Lambda0
1695          lPdgCodeDghtMesV0  =   -211;  //Pi-
1696          lPdgCodeDghtBarV0  =   2212;  //Proton 
1697          
1698                 // any Omega-
1699          lHistEtaGenCasc        = fHistEtaGenCascOmegaMinus;            
1700          l2dHistGenPtVsGenYGen  = f2dHistGenPtVsGenYGenOmegaMinus;      
1701         
1702                 // cascades generated within acceptance (cut in pt + theta)
1703          lHistThetaGenCasc      = fHistThetaGenCascOmegaMinus;
1704          l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblOmegaMinus;
1705          lHistThetaLambda       = fHistThetaLambdaOmegaMinus;
1706          lHistThetaBach         = fHistThetaBachOmegaMinus;
1707          lHistThetaBarDghter    = fHistThetaBarDghterOmegaMinus;
1708          lHistThetaMesDghter    = fHistThetaMesDghterOmegaMinus;
1709          lHistPtBach            = fHistPtBachOmegaMinus;
1710          lHistPtBarDghter       = fHistPtBarDghterOmegaMinus;
1711          lHistPtMesDghter       = fHistPtMesDghterOmegaMinus;   
1712         break;
1713     
1714     case 4:  // Omega+
1715          lPdgCodeCasc       =  -3334;  //Omega+
1716          lPdgCodeBach       =    321;  //K+
1717          lPdgCodeLambda     =  -3122;  //AntiLambda0
1718          lPdgCodeDghtMesV0  =    211;  //Pi+
1719          lPdgCodeDghtBarV0  =  -2212;  //AntiProton 
1720          
1721                 // any Omega+
1722          lHistEtaGenCasc        = fHistEtaGenCascOmegaPlus;
1723          l2dHistGenPtVsGenYGen  = f2dHistGenPtVsGenYGenOmegaPlus;               
1724                 
1725                 // cascades generated within acceptance (cut in pt + theta)
1726          lHistThetaGenCasc      = fHistThetaGenCascOmegaPlus;
1727          l2dHistGenPtVsGenYFdbl = f2dHistGenPtVsGenYFdblOmegaPlus;
1728          lHistThetaLambda       = fHistThetaLambdaOmegaPlus;
1729          lHistThetaBach         = fHistThetaBachOmegaPlus;
1730          lHistThetaBarDghter    = fHistThetaBarDghterOmegaPlus;
1731          lHistThetaMesDghter    = fHistThetaMesDghterOmegaPlus;
1732          lHistPtBach            = fHistPtBachOmegaPlus;
1733          lHistPtBarDghter       = fHistPtBarDghterOmegaPlus;
1734          lHistPtMesDghter       = fHistPtMesDghterOmegaPlus;  
1735         break;
1736
1737   }// end switch cascade
1738
1739
1740    for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < iNumberOfPrimaries; iCurrentLabelStack++) 
1741     {// This is the begining of the loop on primaries
1742       
1743         TParticle* lCurrentParticle = 0x0; 
1744                    lCurrentParticle = lMCstack->Particle( iCurrentLabelStack );
1745         if(!lCurrentParticle){
1746                 Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
1747                 continue;
1748                 
1749         }
1750          
1751         if( lCurrentParticle->GetPdgCode() == lPdgCodeCasc ){  // Here !
1752                 //cout << "Xi- within loop " << iCurrentLabelStack << "/ " << iNumberOfPrimaries << endl;
1753                 
1754                 // -  Xi level ... _____________________________________________________________
1755                 TParticle* xiMC = 0x0;
1756                            xiMC = lCurrentParticle;
1757                 if(!xiMC){
1758                         Printf("MC TParticle pointer to Cascade = 0x0 ! Skip ...");
1759                         continue;
1760                 
1761                 }
1762                 
1763                 // Fill the first histos : = any generated Xi, not necessarily within the acceptance
1764                 Double_t lRapXiMC = 0.5*TMath::Log((xiMC->Energy() + xiMC->Pz()) / (xiMC->Energy() - xiMC->Pz() +1.e-13));
1765                 
1766                 lHistEtaGenCasc         ->Fill( xiMC->Eta() );   
1767                 l2dHistGenPtVsGenYGen   ->Fill( xiMC->Pt(), lRapXiMC  );        
1768                         
1769                 
1770                 
1771                 // Check the emission of particle stays within the acceptance of the detector (cut in theta)
1772                 if( xiMC->Theta() < TMath::Pi()/4.0  ||    xiMC->Theta() > 3.0*TMath::Pi()/4.0 ) continue;      
1773                 if( xiMC->GetNDaughters() != 2) continue;
1774                 if( xiMC->GetDaughter(0) < 0 )  continue;
1775                 if( xiMC->GetDaughter(1) < 0 )  continue;
1776                 
1777                         TParticle* lDght0ofXi = lMCstack->Particle(  xiMC->GetDaughter(0) );
1778                         TParticle* lDght1ofXi = lMCstack->Particle(  xiMC->GetDaughter(1) );
1779                         
1780                 TParticle* lLambda = 0;
1781                 TParticle* lBach   = 0;
1782                         
1783                 // Xi - Case 1
1784                         if(     lDght0ofXi->GetPdgCode() == lPdgCodeLambda   &&  // Here !
1785                                 lDght1ofXi->GetPdgCode() == lPdgCodeBach ){      // Here !
1786                                 
1787                                 lLambda = lDght0ofXi;
1788                                 lBach   = lDght1ofXi;
1789                         }// end if dghter 0 = Lambda and    dghter 1 = Pi-  
1790                         
1791                 // Xi - Case 2
1792                         else if( lDght0ofXi->GetPdgCode() == lPdgCodeBach  &&      // Here !
1793                                  lDght1ofXi->GetPdgCode() == lPdgCodeLambda ){     // Here !
1794                         
1795                                 lBach   = lDght0ofXi;
1796                                 lLambda = lDght1ofXi;
1797                         }//  end if dghter 0 = Pi-  and   dghter 1 = Lambda
1798                         
1799                 // V0 otherwise - Case 3        
1800                         else continue;
1801                 
1802                         // Check the emission of particle stays within the acceptance of the detector (cut in pt + theta)
1803                         if( lLambda->Theta() < TMath::Pi()/4.0  ||    lLambda->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
1804                         if( lBach->Theta() < TMath::Pi()/4.0    ||    lBach->Theta() > 3.0*TMath::Pi()/4.0 )   continue;
1805                 
1806                         if( lBach->Pt() < 0.150 ) continue; //FIXME : maybe tuned for Xi but not for K- from Omega ...
1807                         
1808                 
1809                 
1810                 // -  V0 level ... _____________________________________________________________
1811                 TParticle* lDghtBarV0 = 0;
1812                 TParticle* lDghtMesV0 = 0;
1813                 
1814                 if( lLambda->GetNDaughters() != 2 )  continue;
1815                 if( lLambda->GetDaughter(0) < 0 )    continue;
1816                 if( lLambda->GetDaughter(1) < 0 )    continue;
1817                 
1818                 
1819                 TParticle* lDght0ofLambda = lMCstack->Particle(  lLambda->GetDaughter(0) );
1820                 TParticle* lDght1ofLambda = lMCstack->Particle(  lLambda->GetDaughter(1) );
1821                         
1822                 // V0 - Case 1
1823                         if(     lDght0ofLambda->GetPdgCode() == lPdgCodeDghtBarV0 &&    // Here !
1824                                 lDght1ofLambda->GetPdgCode() == lPdgCodeDghtMesV0 ){    // Here !
1825                         
1826                                 lDghtBarV0 = lDght0ofLambda;
1827                                 lDghtMesV0 = lDght1ofLambda;
1828                         }// end if dghter 0 = Proton  and   dghter 1 = Pi-  
1829                         
1830                 // V0 - Case 2
1831                         else if( lDght0ofLambda->GetPdgCode() == lPdgCodeDghtMesV0  &&     // Here !
1832                                  lDght1ofLambda->GetPdgCode() == lPdgCodeDghtBarV0 ){      // Here !
1833                         
1834                                 lDghtMesV0 = lDght0ofLambda;
1835                                 lDghtBarV0 = lDght1ofLambda;
1836                         }//  end if dghter 0 = Pi-  and   dghter 1 = proton
1837                         
1838                 // V0 otherwise - Case 3
1839                         else continue;
1840         
1841                         
1842                         // Check the emission of particle stays within the acceptance of the detector
1843                         if( lDghtBarV0->Theta() < TMath::Pi()/4.0  ||  lDghtBarV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
1844                         if( lDghtMesV0->Theta() < TMath::Pi()/4.0  ||  lDghtMesV0->Theta() > 3.0*TMath::Pi()/4.0 ) continue;
1845                         
1846                         if( lDghtBarV0->Pt() < 0.250 ) continue;
1847                         if( lDghtMesV0->Pt() < 0.150 ) continue;
1848                         
1849                         
1850                         
1851                 // - Just to know which file is currently open : locate the file containing Xi 
1852                 //cout << "Name of the file containing generated Xi :" <<  fInputHandler->GetTree()->GetCurrentFile()->GetName() 
1853                 //                                                   <<  endl;  
1854                         
1855                 Double_t lRadToDeg = 180.0/TMath::Pi(); 
1856                         
1857                 // - Filling histos ... _________________________________________________________________       
1858                         lHistThetaGenCasc       ->Fill( lRadToDeg * xiMC->Theta()  );
1859                         l2dHistGenPtVsGenYFdbl  ->Fill( xiMC->Pt(), lRapXiMC );
1860                         
1861                         // - Fill theta histos for Lambda and Bach
1862                         lHistThetaLambda        ->Fill( lRadToDeg * lLambda->Theta() );
1863                         lHistThetaBach          ->Fill( lRadToDeg *   lBach->Theta() );
1864                         
1865                         // - Fill theta histos for V0 daughters
1866                         lHistThetaBarDghter     ->Fill( lRadToDeg * lDghtBarV0->Theta() );
1867                         lHistThetaMesDghter     ->Fill( lRadToDeg * lDghtMesV0->Theta() );
1868                         
1869                         // - Fill pt histos.
1870                         lHistPtBach             ->Fill(      lBach->Pt() );
1871                         lHistPtBarDghter        ->Fill( lDghtBarV0->Pt() );
1872                         lHistPtMesDghter        ->Fill( lDghtMesV0->Pt() );
1873                                                 
1874                 }// end if current particle = Xi-
1875              
1876      }// This is the end of the loop on primaries
1877      
1878 // - Re-initialisation of the local TH1F pointers
1879 lHistEtaGenCasc         = 0x0;
1880 l2dHistGenPtVsGenYGen   = 0x0;
1881
1882 lHistThetaGenCasc       = 0x0;
1883 l2dHistGenPtVsGenYFdbl  = 0x0;
1884 lHistThetaLambda        = 0x0;
1885 lHistThetaBach          = 0x0;
1886 lHistThetaBarDghter     = 0x0;
1887 lHistThetaMesDghter     = 0x0;
1888 lHistPtBach             = 0x0;
1889 lHistPtBarDghter        = 0x0;
1890 lHistPtMesDghter        = 0x0;  
1891
1892 } // end of loop over the different types of cascades (Xi-+, Omega-+)
1893         
1894  
1895  
1896 //__________________________________________________________________________    
1897 // Part 2 - Loop over the reconstructed candidates
1898   
1899
1900 for (Int_t iXi = 0; iXi < ncascades; iXi++) 
1901 {// This is the begining of the Cascade loop
1902                 
1903         AliESDcascade *xiESD = lESDevent->GetCascade(iXi);
1904         if (!xiESD) continue;
1905         
1906         // - Step II.1 : Connection to daughter tracks of the current cascade
1907         //-------------
1908                         
1909                 UInt_t lIdxPosXi        = (UInt_t) TMath::Abs( xiESD->GetPindex() );
1910                 UInt_t lIdxNegXi        = (UInt_t) TMath::Abs( xiESD->GetNindex() );
1911                 UInt_t lBachIdx         = (UInt_t) TMath::Abs( xiESD->GetBindex() );
1912                 // abs value not needed ; the index should always be positive (!= label ...)
1913                 
1914                 
1915         // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1916         if(lBachIdx == lIdxNegXi) {
1917                 AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
1918         }
1919         if(lBachIdx == lIdxPosXi) {
1920                 AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
1921         }
1922       
1923         AliESDtrack *pTrackXi           = lESDevent->GetTrack( lIdxPosXi );
1924         AliESDtrack *nTrackXi           = lESDevent->GetTrack( lIdxNegXi );
1925         AliESDtrack *bachTrackXi        = lESDevent->GetTrack( lBachIdx  );
1926         if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1927                 Printf("ERROR: Could not retrieve one of the 3 daughter tracks of the cascade ...");
1928                 continue;
1929         }
1930         
1931         Int_t lPosTPCClusters   = pTrackXi->GetTPCNcls();
1932         Int_t lNegTPCClusters   = nTrackXi->GetTPCNcls();
1933         Int_t lBachTPCClusters  = bachTrackXi->GetTPCNcls(); 
1934
1935                 // FIXME : rejection of a poor quality tracks
1936         if(fkQualityCutTPCrefit){
1937                 // 1 - Poor quality related to TPCrefit
1938                 ULong_t pStatus    = pTrackXi->GetStatus();
1939                 ULong_t nStatus    = nTrackXi->GetStatus();
1940                 ULong_t bachStatus = bachTrackXi->GetStatus();
1941                 if ((pStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1942                 if ((nStatus&AliESDtrack::kTPCrefit)    == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1943                 if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach.   track has no TPCrefit ... continue!"); continue; }
1944         }
1945         if(fkQualityCut80TPCcls){
1946                 // 2 - Poor quality related to TPC clusters
1947                 if(lPosTPCClusters  < 80) { AliWarning("Pb / V0 Pos. track has less than 80 TPC clusters ... continue!"); continue; }
1948                 if(lNegTPCClusters  < 80) { AliWarning("Pb / V0 Neg. track has less than 80 TPC clusters ... continue!"); continue; }
1949                 if(lBachTPCClusters < 80) { AliWarning("Pb / Bach.   track has less than 80 TPC clusters ... continue!"); continue; }
1950         }
1951         
1952         // - Step II.2 : Info over reconstructed cascades
1953         //------------- 
1954         
1955         Double_t lInvMassXiMinus    = 0.;
1956         Double_t lInvMassXiPlus     = 0.;
1957         Double_t lInvMassOmegaMinus = 0.;
1958         Double_t lInvMassOmegaPlus  = 0.;
1959         
1960         Double_t lV0quality = 0.;
1961         
1962         if( bachTrackXi->Charge() < 0 ) {
1963                 lV0quality = 0.;
1964                 xiESD->ChangeMassHypothesis(lV0quality , 3312);         
1965                         // Calculate the effective mass of the Xi- candidate. 
1966                         // pdg code 3312 = Xi-
1967                 lInvMassXiMinus = xiESD->GetEffMassXi();
1968                 
1969                 lV0quality = 0.;
1970                 xiESD->ChangeMassHypothesis(lV0quality , 3334);         
1971                         // Calculate the effective mass of the Xi- candidate. 
1972                         // pdg code 3334 = Omega-
1973                 lInvMassOmegaMinus = xiESD->GetEffMassXi();
1974                                         
1975                 lV0quality = 0.;
1976                 xiESD->ChangeMassHypothesis(lV0quality , 3312);         // Back to default hyp.
1977                 
1978         }
1979         
1980         if( bachTrackXi->Charge() >  0 ){
1981                 lV0quality = 0.;
1982                 xiESD->ChangeMassHypothesis(lV0quality , -3312);        
1983                         // Calculate the effective mass of the Xi+ candidate. 
1984                         // pdg code -3312 = Xi+
1985                 lInvMassXiPlus = xiESD->GetEffMassXi();
1986                 
1987                 lV0quality = 0.;
1988                 xiESD->ChangeMassHypothesis(lV0quality , -3334);        
1989                         // Calculate the effective mass of the Xi+ candidate. 
1990                         // pdg code -3334  = Omega+
1991                 lInvMassOmegaPlus = xiESD->GetEffMassXi();
1992                 
1993                 lV0quality = 0.;
1994                 xiESD->ChangeMassHypothesis(lV0quality , -3312);        // Back to "default" hyp.
1995         }
1996                 
1997         Double_t lChargeXi = xiESD->Charge();
1998         
1999         if( lChargeXi < 0 )     fHistMassXiMinus        ->Fill( lInvMassXiMinus );
2000         if( lChargeXi > 0 )     fHistMassXiPlus         ->Fill( lInvMassXiPlus );
2001         if( lChargeXi < 0 )     fHistMassOmegaMinus     ->Fill( lInvMassOmegaMinus );
2002         if( lChargeXi > 0 )     fHistMassOmegaPlus      ->Fill( lInvMassOmegaPlus );
2003         
2004         
2005         // - Step II.3 : PID info
2006         //-------------
2007         
2008         
2009         // 3.1 - PID Information
2010
2011         Bool_t   lIsPosInXiProton      = kFALSE;
2012         Bool_t   lIsPosInXiPion        = kFALSE;
2013         Bool_t   lIsPosInOmegaProton   = kFALSE;
2014         Bool_t   lIsPosInOmegaPion     = kFALSE;
2015         
2016         Bool_t   lIsNegInXiProton      = kFALSE;
2017         Bool_t   lIsNegInXiPion        = kFALSE;
2018         Bool_t   lIsNegInOmegaProton   = kFALSE;
2019         Bool_t   lIsNegInOmegaPion     = kFALSE;
2020         
2021         Bool_t   lIsBachelorKaon       = kFALSE;
2022         Bool_t   lIsBachelorPion       = kFALSE; 
2023         
2024         Bool_t   lIsBachelorKaonForTPC = kFALSE; // For ESD only ...//FIXME : wait for availability in AOD
2025         Bool_t   lIsBachelorPionForTPC = kFALSE; // For ESD only ...
2026         Bool_t   lIsNegPionForTPC      = kFALSE; // For ESD only ...
2027         Bool_t   lIsPosPionForTPC      = kFALSE; // For ESD only ...
2028         Bool_t   lIsNegProtonForTPC    = kFALSE; // For ESD only ...
2029         Bool_t   lIsPosProtonForTPC    = kFALSE; // For ESD only ...
2030
2031         // 3.1.A - Combined PID
2032         // Reasonable guess for the priors for the cascade track sample (e-, mu, pi, K, p)
2033         Double_t lPriorsGuessXi[5]    = {0, 0, 2, 0, 1};
2034         Double_t lPriorsGuessOmega[5] = {0, 0, 1, 1, 1};
2035         
2036         // Combined VO-positive-daughter PID
2037         AliPID pPidXi;          pPidXi.SetPriors(    lPriorsGuessXi    );
2038         AliPID pPidOmega;       pPidOmega.SetPriors( lPriorsGuessOmega );
2039                 
2040         if( pTrackXi->IsOn(AliESDtrack::kESDpid) ){  // Combined PID exists
2041                 Double_t r[10] = {0.}; pTrackXi->GetESDpid(r);
2042                 pPidXi.SetProbabilities(r);
2043                 pPidOmega.SetProbabilities(r);
2044                 
2045                 // Check if the V0 positive track is a proton (case for Xi-)
2046                 Double_t pproton = pPidXi.GetProbability(AliPID::kProton);
2047                 if (pproton > pPidXi.GetProbability(AliPID::kElectron) &&
2048                     pproton > pPidXi.GetProbability(AliPID::kMuon)     &&
2049                     pproton > pPidXi.GetProbability(AliPID::kPion)     &&
2050                     pproton > pPidXi.GetProbability(AliPID::kKaon)     )     lIsPosInXiProton = kTRUE;
2051                 
2052                 // Check if the V0 positive track is a pi+ (case for Xi+)
2053                 Double_t ppion = pPidXi.GetProbability(AliPID::kPion);
2054                 if (ppion > pPidXi.GetProbability(AliPID::kElectron) &&
2055                     ppion > pPidXi.GetProbability(AliPID::kMuon)     &&
2056                     ppion > pPidXi.GetProbability(AliPID::kKaon)     &&
2057                     ppion > pPidXi.GetProbability(AliPID::kProton)   )     lIsPosInXiPion = kTRUE;
2058                 
2059                 
2060                 // Check if the V0 positive track is a proton (case for Omega-)
2061                 pproton = 0.;
2062                     pproton = pPidOmega.GetProbability(AliPID::kProton);
2063                 if (pproton > pPidOmega.GetProbability(AliPID::kElectron) &&
2064                     pproton > pPidOmega.GetProbability(AliPID::kMuon)     &&
2065                     pproton > pPidOmega.GetProbability(AliPID::kPion)     &&
2066                     pproton > pPidOmega.GetProbability(AliPID::kKaon)     )  lIsPosInOmegaProton = kTRUE;
2067                 
2068                 // Check if the V0 positive track is a pi+ (case for Omega+)
2069                 ppion = 0.;
2070                     ppion = pPidOmega.GetProbability(AliPID::kPion);
2071                 if (ppion > pPidOmega.GetProbability(AliPID::kElectron) &&
2072                     ppion > pPidOmega.GetProbability(AliPID::kMuon)     &&
2073                     ppion > pPidOmega.GetProbability(AliPID::kKaon)     &&
2074                     ppion > pPidOmega.GetProbability(AliPID::kProton)   )    lIsPosInOmegaPion = kTRUE;
2075                 
2076         }// end if V0 positive track with existing combined PID 
2077         
2078         
2079         // Combined VO-negative-daughter PID
2080         AliPID nPidXi;          nPidXi.SetPriors(    lPriorsGuessXi    );
2081         AliPID nPidOmega;       nPidOmega.SetPriors( lPriorsGuessOmega );
2082                 
2083         if( nTrackXi->IsOn(AliESDtrack::kESDpid) ){  // Combined PID exists
2084                 Double_t r[10] = {0.}; nTrackXi->GetESDpid(r);
2085                 nPidXi.SetProbabilities(r);
2086                 nPidOmega.SetProbabilities(r);
2087                 
2088                 // Check if the V0 negative track is a pi- (case for Xi-)
2089                 Double_t ppion = nPidXi.GetProbability(AliPID::kPion);
2090                 if (ppion > nPidXi.GetProbability(AliPID::kElectron) &&
2091                     ppion > nPidXi.GetProbability(AliPID::kMuon)     &&
2092                     ppion > nPidXi.GetProbability(AliPID::kKaon)     &&
2093                     ppion > nPidXi.GetProbability(AliPID::kProton)   )     lIsNegInXiPion = kTRUE;
2094
2095                 // Check if the V0 negative track is an anti-proton (case for Xi+)
2096                 Double_t pproton = nPidXi.GetProbability(AliPID::kProton);
2097                 if (pproton > nPidXi.GetProbability(AliPID::kElectron) &&
2098                     pproton > nPidXi.GetProbability(AliPID::kMuon)     &&
2099                     pproton > nPidXi.GetProbability(AliPID::kPion)     &&
2100                     pproton > nPidXi.GetProbability(AliPID::kKaon)     )     lIsNegInXiProton = kTRUE;
2101                 
2102                 // Check if the V0 negative track is a pi- (case for Omega-)
2103                 ppion = 0.;
2104                     ppion = nPidOmega.GetProbability(AliPID::kPion);
2105                 if (ppion > nPidOmega.GetProbability(AliPID::kElectron) &&
2106                     ppion > nPidOmega.GetProbability(AliPID::kMuon)     &&
2107                     ppion > nPidOmega.GetProbability(AliPID::kKaon)     &&
2108                     ppion > nPidOmega.GetProbability(AliPID::kProton)   )    lIsNegInOmegaPion = kTRUE;
2109                 
2110                 // Check if the V0 negative track is an anti-proton (case for Omega+)
2111                 pproton = 0.;
2112                     pproton = nPidOmega.GetProbability(AliPID::kProton);
2113                 if (pproton > nPidOmega.GetProbability(AliPID::kElectron) &&
2114                     pproton > nPidOmega.GetProbability(AliPID::kMuon)     &&
2115                     pproton > nPidOmega.GetProbability(AliPID::kPion)     &&
2116                     pproton > nPidOmega.GetProbability(AliPID::kKaon)     )  lIsNegInOmegaProton = kTRUE;
2117                 
2118         }// end if V0 negative track with existing combined PID 
2119         
2120                 
2121         // Combined bachelor PID
2122         AliPID bachPidXi;       bachPidXi.SetPriors(    lPriorsGuessXi    );
2123         AliPID bachPidOmega;    bachPidOmega.SetPriors( lPriorsGuessOmega );
2124         
2125         Double_t ppionBach = 0.0, pkaonBach = 0.0;
2126         
2127         if( bachTrackXi->IsOn(AliESDtrack::kESDpid) ){  // Combined PID exists
2128                 Double_t r[10] = {0.}; bachTrackXi->GetESDpid(r);
2129                 bachPidXi.SetProbabilities(r);
2130                 bachPidOmega.SetProbabilities(r);
2131                 // Check if the bachelor track is a pion
2132                     ppionBach = bachPidXi.GetProbability(AliPID::kPion);
2133                 if (ppionBach > bachPidXi.GetProbability(AliPID::kElectron) &&
2134                     ppionBach > bachPidXi.GetProbability(AliPID::kMuon)     &&
2135                     ppionBach > bachPidXi.GetProbability(AliPID::kKaon)     &&
2136                     ppionBach > bachPidXi.GetProbability(AliPID::kProton)   )     lIsBachelorPion = kTRUE;
2137                 // Check if the bachelor track is a kaon
2138                     pkaonBach = bachPidOmega.GetProbability(AliPID::kKaon);
2139                 if (pkaonBach > bachPidOmega.GetProbability(AliPID::kElectron) &&
2140                     pkaonBach > bachPidOmega.GetProbability(AliPID::kMuon)     &&
2141                     pkaonBach > bachPidOmega.GetProbability(AliPID::kPion)     &&
2142                     pkaonBach > bachPidOmega.GetProbability(AliPID::kProton)   )  lIsBachelorKaon = kTRUE;      
2143         }// end if bachelor track with existing combined PID
2144         
2145         
2146         // 3.1.B - TPC PID : 3-sigma bands on Bethe-Bloch curve
2147         
2148         // Bachelor
2149         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 4) lIsBachelorKaonForTPC = kTRUE;
2150         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 4) lIsBachelorPionForTPC = kTRUE;
2151         
2152         // Negative V0 daughter
2153         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 4) lIsNegPionForTPC   = kTRUE;
2154         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton )) < 4) lIsNegProtonForTPC = kTRUE;
2155         
2156         // Positive V0 daughter
2157         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 4) lIsPosPionForTPC   = kTRUE;
2158         if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 4) lIsPosProtonForTPC = kTRUE;
2159         
2160         /*
2161         const AliExternalTrackParam *pInnerWallTrackXi    = pTrackXi    ->GetInnerParam(); // Do not use GetTPCInnerWall
2162         const AliExternalTrackParam *nInnerWallTrackXi    = nTrackXi    ->GetInnerParam();
2163         const AliExternalTrackParam *bachInnerWallTrackXi = bachTrackXi ->GetInnerParam();
2164         if(pInnerWallTrackXi && nInnerWallTrackXi && bachInnerWallTrackXi ){
2165                 
2166                 Double_t pMomInnerWall    = pInnerWallTrackXi   ->GetP();
2167                 Double_t nMomInnerWall    = nInnerWallTrackXi   ->GetP();
2168                 Double_t bachMomInnerWall = bachInnerWallTrackXi->GetP();
2169                 
2170                 // Bachelor
2171                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kPion)) < 3)                              lIsBachelorPionForTPC = kTRUE;
2172                 if (bachMomInnerWall < 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 5) lIsBachelorKaonForTPC = kTRUE;
2173                 if (bachMomInnerWall > 0.350  && TMath::Abs(fESDpid->NumberOfSigmasTPC( bachTrackXi,AliPID::kKaon)) < 3) lIsBachelorKaonForTPC = kTRUE;
2174                 
2175                 // Negative V0 daughter
2176                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kPion   )) < 3  )                           lIsNegPionForTPC   = kTRUE;
2177                 if (nMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 5 )   lIsNegProtonForTPC = kTRUE;
2178                 if (nMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( nTrackXi,AliPID::kProton ) ) < 3 )   lIsNegProtonForTPC = kTRUE;
2179                 
2180                 // Positive V0 daughter
2181                 if (TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kPion   )) < 3 )                            lIsPosPionForTPC   = kTRUE;
2182                 if (pMomInnerWall < 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 5)     lIsPosProtonForTPC = kTRUE;
2183                 if (pMomInnerWall > 0.6  && TMath::Abs(fESDpid->NumberOfSigmasTPC( pTrackXi,AliPID::kProton )) < 3)     lIsPosProtonForTPC = kTRUE;
2184                 
2185         }
2186         */
2187                 
2188         // Combined PID TH1s
2189         if( lChargeXi < 0 && lIsBachelorPion )    fHistMassWithCombPIDXiMinus     ->Fill( lInvMassXiMinus    );
2190         if( lChargeXi > 0 && lIsBachelorPion )    fHistMassWithCombPIDXiPlus      ->Fill( lInvMassXiPlus     );
2191         if( lChargeXi < 0 && lIsBachelorKaon )    fHistMassWithCombPIDOmegaMinus  ->Fill( lInvMassOmegaMinus );
2192         if( lChargeXi > 0 && lIsBachelorKaon )    fHistMassWithCombPIDOmegaPlus   ->Fill( lInvMassOmegaPlus  );
2193          
2194         
2195         // 3.2 - PID proba Vs Pt(Bach)
2196         Int_t      lblBachForPID  = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
2197         TParticle* mcBachForPID   = lMCstack->Particle( lblBachForPID );
2198         Double_t   lmcPtBach      = mcBachForPID->Pt();
2199         
2200         if(lIsBachelorPion)   f2dHistPIDprobaPionVsMCPtBach->Fill( lmcPtBach, ppionBach );
2201         if(lIsBachelorKaon)   f2dHistPIDprobaKaonVsMCPtBach->Fill( lmcPtBach, pkaonBach );
2202         
2203                         
2204         // 3.3 - MC perfect PID
2205         Bool_t   lIsBachelorMCPiMinus  = kFALSE;
2206         Bool_t   lIsBachelorMCPiPlus   = kFALSE;
2207         Bool_t   lIsBachelorMCKMinus   = kFALSE;
2208         Bool_t   lIsBachelorMCKPlus    = kFALSE;        
2209         
2210         if( mcBachForPID->GetPdgCode() == -211) lIsBachelorMCPiMinus = kTRUE;
2211         if( mcBachForPID->GetPdgCode() ==  211) lIsBachelorMCPiPlus  = kTRUE;
2212         if( mcBachForPID->GetPdgCode() == -321) lIsBachelorMCKMinus  = kTRUE;
2213         if( mcBachForPID->GetPdgCode() ==  321) lIsBachelorMCKPlus   = kTRUE;
2214         
2215         if( lChargeXi < 0 && lIsBachelorMCPiMinus )    fHistMassWithMcPIDXiMinus     ->Fill( lInvMassXiMinus );
2216         if( lChargeXi > 0 && lIsBachelorMCPiPlus  )    fHistMassWithMcPIDXiPlus      ->Fill( lInvMassXiPlus );
2217         if( lChargeXi < 0 && lIsBachelorMCKMinus  )    fHistMassWithMcPIDOmegaMinus  ->Fill( lInvMassOmegaMinus );
2218         if( lChargeXi > 0 && lIsBachelorMCKPlus   )    fHistMassWithMcPIDOmegaPlus   ->Fill( lInvMassOmegaPlus );
2219         
2220         
2221         
2222         
2223         // - Step II.4 : MC association (care : lots of "continue;" below this line)
2224         //------------- 
2225         
2226         Bool_t lAssoXiMinus    = kFALSE;
2227         Bool_t lAssoXiPlus     = kFALSE;
2228         Bool_t lAssoOmegaMinus = kFALSE;
2229         Bool_t lAssoOmegaPlus  = kFALSE;
2230         
2231         
2232         if(fDebug > 5)
2233                 cout    << "MC EventNumber : " << lMCevent->Header()->GetEvent() 
2234                         << " / MC event Number in Run : " << lMCevent->Header()->GetEventNrInRun() << endl;
2235         
2236         // - Step 4.1 : level of the V0 daughters
2237                 
2238         Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );  
2239                 // Abs value = needed ! question of quality track association ...
2240         Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );
2241                 
2242         TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );
2243         TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );
2244         
2245
2246         // - Step 4.2 : level of the Xi daughters
2247                 
2248         Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ; 
2249         Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();
2250         
2251                 if( lblMotherPosV0Dghter != lblMotherNegV0Dghter) continue; // same mother
2252                 if( lblMotherPosV0Dghter < 0 ) continue; // mother != primary (!= -1)
2253                 if( lblMotherNegV0Dghter < 0 ) continue;
2254                                         
2255
2256                 // mothers = Lambda candidate ... a priori
2257         
2258         TParticle* mcMotherPosV0Dghter = lMCstack->Particle( lblMotherPosV0Dghter );
2259         TParticle* mcMotherNegV0Dghter = lMCstack->Particle( lblMotherNegV0Dghter );
2260
2261         Int_t      lblBach  = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
2262         TParticle* mcBach   = lMCstack->Particle( lblBach );    
2263                                 
2264
2265         // - Step 4.3 : level of Xi candidate
2266         
2267         Int_t lblGdMotherPosV0Dghter =   mcMotherPosV0Dghter->GetFirstMother() ;
2268         Int_t lblGdMotherNegV0Dghter =   mcMotherNegV0Dghter->GetFirstMother() ;
2269                         
2270                 if( lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter ) continue;
2271                 if( lblGdMotherPosV0Dghter < 0 ) continue; // primary lambda ...
2272                 if( lblGdMotherNegV0Dghter < 0 ) continue; // primary lambda ...
2273                         
2274                 
2275                 // Gd mothers = Xi candidate ... a priori
2276         
2277         TParticle* mcGdMotherPosV0Dghter = lMCstack->Particle( lblGdMotherPosV0Dghter );
2278         TParticle* mcGdMotherNegV0Dghter = lMCstack->Particle( lblGdMotherNegV0Dghter );
2279                                         
2280         Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetFirstMother()  );
2281         
2282                 if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters
2283         
2284         TParticle* mcMotherBach = lMCstack->Particle( lblMotherBach );
2285         
2286                 
2287         // - Step 4.4 : Manage boolean for association
2288         
2289         if( mcMotherBach                ->GetPdgCode() ==   3312 &&
2290             mcGdMotherPosV0Dghter       ->GetPdgCode() ==   3312 &&
2291             mcGdMotherNegV0Dghter       ->GetPdgCode() ==   3312)       lAssoXiMinus = kTRUE;
2292         
2293         else if( mcMotherBach           ->GetPdgCode() ==  -3312 &&
2294             mcGdMotherPosV0Dghter       ->GetPdgCode() ==  -3312 &&
2295             mcGdMotherNegV0Dghter       ->GetPdgCode() ==  -3312)       lAssoXiPlus = kTRUE;
2296         
2297         else if( mcMotherBach           ->GetPdgCode() ==   3334 &&
2298             mcGdMotherPosV0Dghter       ->GetPdgCode() ==   3334 &&
2299             mcGdMotherNegV0Dghter       ->GetPdgCode() ==   3334)       lAssoOmegaMinus = kTRUE;
2300                 
2301         else if( mcMotherBach           ->GetPdgCode() ==  -3334 &&
2302             mcGdMotherPosV0Dghter       ->GetPdgCode() ==  -3334 &&
2303             mcGdMotherNegV0Dghter       ->GetPdgCode() ==  -3334)       lAssoOmegaPlus = kTRUE;
2304         
2305         
2306         
2307         if(!lAssoXiMinus && !lAssoXiPlus && !lAssoOmegaMinus && !lAssoOmegaPlus) continue; // no association, skip the rest of the code 
2308         // If a proper association  exists ...
2309                 
2310         if(fDebug > 4){
2311                 cout << "XiMinus    = " << lAssoXiMinus    << endl;
2312                 cout << "XiPlus     = " << lAssoXiPlus     << endl;
2313                 cout << "OmegaMinus = " << lAssoOmegaMinus << endl;
2314                 cout << "OmegaPlus  = " << lAssoOmegaPlus  << endl 
2315                      << "----"          << endl;        
2316         }
2317
2318
2319         if(fDebug > 5){
2320                 cout << endl;
2321                 cout << "- V0 daughters - " << endl;
2322                 cout << "     + V0 Pos. / Label : " << lblPosV0Dghter 
2323                 << " - Pdg Code : " << mcPosV0Dghter->GetTitle() << endl;
2324                 cout << "     - V0 Neg. / Label : " << lblNegV0Dghter 
2325                 << " - Pdg Code : " << mcNegV0Dghter->GetTitle() << endl;
2326                 
2327                 cout << "- Xi daughters - " << endl;
2328                 cout << "     + V0 Pos. mother / Label : " << lblMotherPosV0Dghter 
2329                 << " - Pdg Code : " << mcMotherPosV0Dghter->GetTitle() << endl;
2330                 cout << "     - V0 Neg. mother / Label : " << lblMotherNegV0Dghter 
2331                 << " - Pdg Code : " << mcMotherNegV0Dghter->GetTitle() << endl;
2332                 
2333                 cout << "     --  Bach. / Label :" << lblBach 
2334                 << " -  Pdg Code : " << mcBach->GetTitle() << endl;
2335                 
2336                 cout << "- Xi candidate -" << endl;
2337                 cout << "    +  V0 Pos. Gd Mother / Label : " << lblGdMotherPosV0Dghter 
2338                 << " - Pdg Code : " << mcGdMotherPosV0Dghter->GetTitle() << endl;
2339                 cout << "    -  V0 Neg. Gd Mother / Label : "  << lblGdMotherNegV0Dghter 
2340                 << " - Pdg Code : "<< mcGdMotherNegV0Dghter->GetTitle() << endl;
2341                 
2342                 cout << "    --  Mother Bach. / Label : " << lblMotherBach 
2343                 << " - Pdg Code    : " << mcMotherBach->GetTitle() << endl;
2344                 cout << endl;
2345         }
2346
2347         
2348         // - Step 5 : Plots around the cascade candidates associated with MC
2349         //------------- 
2350         
2351         Double_t lmcPt             = mcMotherBach->Pt();
2352         Double_t lmcRapCasc        = 0.5*TMath::Log( (mcMotherBach->Energy() + mcMotherBach->Pz()) / 
2353                                                      (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) );
2354         Double_t lmcEta            = mcMotherBach->Eta();
2355         Double_t lmcTransvRadius   = mcBach->R(); // to get the decay point of Xi, = the production vertex of Bachelor ...
2356
2357         Double_t lrecoPt           = xiESD->Pt();
2358         Double_t lrecoTransvRadius = TMath::Sqrt( xiESD->Xv() * xiESD->Xv() + xiESD->Yv() * xiESD->Yv() );
2359
2360
2361         // - Histos for the cascade candidates associated with MC
2362         
2363         if( lChargeXi < 0 && lAssoXiMinus){     
2364                 fHistAsMCMassXiMinus          ->Fill( lInvMassXiMinus  );
2365                 if(lIsBachelorPion)     f2dHistAsMCandCombPIDGenPtVsGenYXiMinus->Fill( lmcPt, lmcRapCasc );
2366                 f2dHistAsMCGenPtVsGenYXiMinus ->Fill( lmcPt, lmcRapCasc);
2367                 fHistAsMCGenEtaXiMinus        ->Fill( lmcEta           );
2368                 f2dHistAsMCResPtXiMinus       ->Fill( lmcPt,           (lrecoPt - lmcPt)/ lmcPt );
2369                 f2dHistAsMCResRXiMinus        ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius    );
2370         }
2371         
2372         else if( lChargeXi > 0 && lAssoXiPlus){ 
2373                 fHistAsMCMassXiPlus           ->Fill( lInvMassXiPlus   );
2374                 if(lIsBachelorPion)     f2dHistAsMCandCombPIDGenPtVsGenYXiPlus->Fill( lmcPt, lmcRapCasc );
2375                 f2dHistAsMCGenPtVsGenYXiPlus  ->Fill( lmcPt, lmcRapCasc);
2376                 fHistAsMCGenEtaXiPlus         ->Fill( lmcEta           );
2377                 f2dHistAsMCResPtXiPlus        ->Fill( lmcPt,           (lrecoPt - lmcPt)/ lmcPt );
2378                 f2dHistAsMCResRXiPlus         ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius    );
2379         }
2380         
2381         else if( lChargeXi < 0 && lAssoOmegaMinus){     
2382                 fHistAsMCMassOmegaMinus          ->Fill( lInvMassOmegaMinus );
2383                 if(lIsBachelorKaon)     f2dHistAsMCandCombPIDGenPtVsGenYOmegaMinus->Fill( lmcPt, lmcRapCasc );
2384                 f2dHistAsMCGenPtVsGenYOmegaMinus ->Fill( lmcPt, lmcRapCasc  );
2385                 fHistAsMCGenEtaOmegaMinus        ->Fill( lmcEta             );
2386                 f2dHistAsMCResPtOmegaMinus       ->Fill( lmcPt,           (lrecoPt - lmcPt)/ lmcPt );
2387                 f2dHistAsMCResROmegaMinus        ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius    );
2388         }
2389         
2390         else if( lChargeXi > 0 && lAssoOmegaPlus){      
2391                 fHistAsMCMassOmegaPlus           ->Fill( lInvMassOmegaPlus );
2392                 if(lIsBachelorKaon)     f2dHistAsMCandCombPIDGenPtVsGenYOmegaPlus->Fill( lmcPt, lmcRapCasc );
2393                 f2dHistAsMCGenPtVsGenYOmegaPlus  ->Fill( lmcPt, lmcRapCasc   );
2394                 fHistAsMCGenEtaOmegaPlus         ->Fill( lmcEta            );
2395                 f2dHistAsMCResPtOmegaPlus        ->Fill( lmcPt,           (lrecoPt - lmcPt)/ lmcPt );
2396                 f2dHistAsMCResROmegaPlus         ->Fill( lmcTransvRadius, (lrecoTransvRadius - lmcTransvRadius)/ lmcTransvRadius    );
2397         }
2398         
2399         
2400         // - Step 6 : Containers = Cascade cuts + PID
2401         //------------- 
2402
2403         // Double_t lChi2Xi         = -1. ;
2404         Double_t lDcaXiDaughters            = -1. ;
2405         Double_t lDcaBachToPrimVertexXi     = -1. ;
2406         Double_t lXiCosineOfPointingAngle   = -1. ;
2407         Double_t lPosXi[3]                  = { -1000.0, -1000.0, -1000.0 };
2408         Double_t lXiRadius                  = -1000. ;
2409         
2410         Double_t lInvMassLambdaAsCascDghter = 0.;
2411         Double_t lDcaV0DaughtersXi          = -1.;
2412         // Double_t lV0Chi2Xi               = -1. ;
2413         Double_t lV0CosineOfPointingAngleXi = -1.;
2414         Double_t lPosV0Xi[3]                = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
2415         Double_t lV0RadiusXi                = -1000.;
2416         Double_t lDcaV0ToPrimVertexXi       = -1.;
2417         Double_t lDcaPosToPrimVertexXi      = -1.;
2418         Double_t lDcaNegToPrimVertexXi      = -1.;
2419
2420         Int_t    nTrackWithTPCrefitMultiplicity  =  0;
2421         Int_t    lSPDTrackletsMultiplicity       = -1;
2422
2423         
2424         // 6.2 - Definition of the needed variables
2425         
2426         //lChi2Xi                       = xiESD->GetChi2Xi();
2427         lDcaXiDaughters                 = xiESD->GetDcaXiDaughters();
2428         lDcaBachToPrimVertexXi          = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0], 
2429                                                                          lBestPrimaryVtxPos[1], 
2430                                                                          lMagneticField  ) ); 
2431                                         // NOTE : AliExternalTrackParam::GetD returns an algebraic value
2432         lXiCosineOfPointingAngle        = xiESD->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0],
2433                                                                                   lBestPrimaryVtxPos[1],
2434                                                                                   lBestPrimaryVtxPos[2] );
2435                                         // Take care : the best available vertex should be used (like in AliCascadeVertexer)
2436                 xiESD->GetXYZcascade( lPosXi[0],  lPosXi[1], lPosXi[2] ); 
2437         lXiRadius                       = TMath::Sqrt( lPosXi[0]*lPosXi[0]  +  lPosXi[1]*lPosXi[1] );
2438         lInvMassLambdaAsCascDghter      = xiESD->GetEffMass(); 
2439                                         // This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
2440         lDcaV0DaughtersXi               = xiESD->GetDcaV0Daughters();
2441         // lV0Chi2Xi                    = xiESD->GetChi2V0();
2442         lV0CosineOfPointingAngleXi      = xiESD->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0],
2443                                                                              lBestPrimaryVtxPos[1],
2444                                                                              lBestPrimaryVtxPos[2] );
2445                 xiESD->GetXYZ( lPosV0Xi[0],  lPosV0Xi[1], lPosV0Xi[2] ); 
2446         lV0RadiusXi                     = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0]  +  lPosV0Xi[1]*lPosV0Xi[1] );
2447         
2448         lDcaV0ToPrimVertexXi            = xiESD->GetD( lBestPrimaryVtxPos[0], 
2449                                                 lBestPrimaryVtxPos[1], 
2450                                                 lBestPrimaryVtxPos[2] );
2451         
2452         lDcaPosToPrimVertexXi           = TMath::Abs( pTrackXi   ->GetD( lBestPrimaryVtxPos[0],
2453                                                                          lBestPrimaryVtxPos[1],
2454                                                                          lMagneticField  )     );
2455         
2456         lDcaNegToPrimVertexXi           = TMath::Abs( nTrackXi   ->GetD( lBestPrimaryVtxPos[0], 
2457                                                                          lBestPrimaryVtxPos[1], 
2458                                                                          lMagneticField  )     );
2459         
2460         
2461         
2462         nTrackWithTPCrefitMultiplicity  = DoESDTrackWithTPCrefitMultiplicity(lESDevent);
2463         
2464         
2465         const AliMultiplicity *lAliMult = lESDevent->GetMultiplicity();
2466         lSPDTrackletsMultiplicity       = lAliMult->GetNumberOfTracklets();
2467         
2468
2469         // 6.3 - Filling the AliCFContainer (optimisation of topological selections + systematics)
2470         Double_t lContainerCutVars[20] = {0.0};
2471
2472         lContainerCutVars[0]  = lDcaXiDaughters;
2473         lContainerCutVars[1]  = lDcaBachToPrimVertexXi;
2474         lContainerCutVars[2]  = lXiCosineOfPointingAngle;
2475         lContainerCutVars[3]  = lXiRadius;
2476         lContainerCutVars[4]  = lInvMassLambdaAsCascDghter;
2477         lContainerCutVars[5]  = lDcaV0DaughtersXi;
2478         lContainerCutVars[6]  = lV0CosineOfPointingAngleXi;
2479         lContainerCutVars[7]  = lV0RadiusXi;
2480         lContainerCutVars[8]  = lDcaV0ToPrimVertexXi;   
2481         lContainerCutVars[9]  = lDcaPosToPrimVertexXi;
2482         lContainerCutVars[10] = lDcaNegToPrimVertexXi;
2483
2484         lContainerCutVars[13] = lmcPt;
2485
2486         lContainerCutVars[16] = lBestPrimaryVtxPos[2];
2487         lContainerCutVars[17] = nTrackWithTPCrefitMultiplicity;  // FIXME : nTrackWithTPCrefitMultiplicity not checked for AOD ...
2488         lContainerCutVars[18] = lSPDTrackletsMultiplicity;       // FIXME : SPDTrackletsMultiplicity is not available for AOD ... 
2489         lContainerCutVars[19] = lBachTPCClusters;                // FIXME : BachTPCClusters          is not available for AOD ... 
2490
2491         // All cases should be covered below
2492         if( lChargeXi < 0 && lAssoXiMinus    ) {
2493                 lContainerCutVars[11] = lInvMassXiMinus;
2494                 lContainerCutVars[12] = 1.63;
2495                 lContainerCutVars[14] = lmcRapCasc;
2496                 lContainerCutVars[15] = -1.;
2497                         if( lIsBachelorPionForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC )    
2498                                 fCFContAsCascadeCuts->Fill(lContainerCutVars,0); // for Xi-
2499         }
2500         if( lChargeXi > 0 && lAssoXiPlus     ){
2501                 lContainerCutVars[11] = lInvMassXiPlus;
2502                 lContainerCutVars[12] = 1.26;
2503                 lContainerCutVars[14] = lmcRapCasc;
2504                 lContainerCutVars[15] = -1.; 
2505                         if( lIsBachelorPionForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )    
2506                                 fCFContAsCascadeCuts->Fill(lContainerCutVars,1); // for Xi+
2507         }
2508         if( lChargeXi < 0 && lAssoOmegaMinus )  {
2509                 lContainerCutVars[11] = 1.63;
2510                 lContainerCutVars[12] = lInvMassOmegaMinus;
2511                 lContainerCutVars[14] = -1.;
2512                 lContainerCutVars[15] = lmcRapCasc;
2513                         if( lIsBachelorKaonForTPC   && lIsPosProtonForTPC    && lIsNegPionForTPC )    
2514                                 fCFContAsCascadeCuts->Fill(lContainerCutVars,2); // for Omega-
2515         }
2516         if( lChargeXi > 0 && lAssoOmegaPlus  ){
2517                 lContainerCutVars[11] = 1.26;
2518                 lContainerCutVars[12] = lInvMassOmegaPlus;
2519                 lContainerCutVars[14] = -1.;
2520                 lContainerCutVars[15] = lmcRapCasc;
2521                         if( lIsBachelorKaonForTPC   && lIsNegProtonForTPC    && lIsPosPionForTPC )    
2522                                 fCFContAsCascadeCuts->Fill(lContainerCutVars,3); // for Omega+
2523         }
2524         
2525         
2526         // 6.4 - Filling the AliCFContainers related to PID
2527
2528         Double_t lContainerPIDVars[4] = {0.0};
2529
2530         
2531         // Xi Minus             
2532         if( lChargeXi < 0 && lAssoXiMinus ) {
2533                 lContainerPIDVars[0] = lmcPt              ;
2534                 lContainerPIDVars[1] = lInvMassXiMinus    ;
2535                 lContainerPIDVars[2] = lmcRapCasc         ;
2536                 lContainerPIDVars[3] = lSPDTrackletsMultiplicity ;  // FIXME : SPDTrackletsMultiplicity is not available for AOD ... 
2537                         
2538                 // No PID
2539                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 0); // No PID
2540                 // TPC PID
2541                 if( lIsBachelorPionForTPC  )
2542                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2543                 
2544                 if( lIsBachelorPionForTPC && 
2545                     lIsPosProtonForTPC     )
2546                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2547                 
2548                 if( lIsBachelorPionForTPC && 
2549                     lIsPosProtonForTPC    && 
2550                     lIsNegPionForTPC       )
2551                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2552                 
2553                 // Combined PID
2554                 if( lIsBachelorPion        )
2555                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2556                 
2557                 if( lIsBachelorPion       && 
2558                     lIsPosInXiProton    )
2559                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2560                 
2561                 if(lIsBachelorPion     && 
2562                    lIsPosInXiProton && 
2563                    lIsNegInXiPion    )
2564                         fCFContCascadePIDAsXiMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2565         }
2566         
2567         lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; lContainerPIDVars[3] = 0.;
2568         
2569         // Xi Plus              
2570         if( lChargeXi > 0 && lAssoXiPlus ) {
2571                 lContainerPIDVars[0] = lmcPt              ;
2572                 lContainerPIDVars[1] = lInvMassXiPlus     ;
2573                 lContainerPIDVars[2] = lmcRapCasc           ;
2574                 lContainerPIDVars[3] = lSPDTrackletsMultiplicity ;    // FIXME : SPDTrackletsMultiplicity is not available for AOD ... 
2575                         
2576                 // No PID
2577                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 0); // No PID
2578                 // TPC PID
2579                 if( lIsBachelorPionForTPC  )
2580                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2581                 
2582                 if( lIsBachelorPionForTPC && 
2583                     lIsNegProtonForTPC     )
2584                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2585                 
2586                 if( lIsBachelorPionForTPC && 
2587                     lIsNegProtonForTPC    && 
2588                     lIsPosPionForTPC       )
2589                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2590                 
2591                 // Combined PID
2592                 if( lIsBachelorPion        )
2593                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2594                 
2595                 if( lIsBachelorPion       && 
2596                     lIsNegInXiProton    )
2597                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2598                 
2599                 if(lIsBachelorPion     && 
2600                    lIsNegInXiProton && 
2601                    lIsPosInXiPion    )
2602                         fCFContCascadePIDAsXiPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2603         }
2604         
2605         lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; lContainerPIDVars[3] = 0.;
2606         
2607         // Omega Minus          
2608         if( lChargeXi < 0 && lAssoOmegaMinus ) {
2609                 lContainerPIDVars[0] = lmcPt              ;
2610                 lContainerPIDVars[1] = lInvMassOmegaMinus ;
2611                 lContainerPIDVars[2] = lmcRapCasc         ;
2612                 lContainerPIDVars[3] = lSPDTrackletsMultiplicity ;    // FIXME : SPDTrackletsMultiplicity is not available for AOD ... 
2613                         
2614                 // No PID
2615                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 0); // No PID
2616                 // TPC PID
2617                 if( lIsBachelorKaonForTPC  )
2618                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2619                 
2620                 if( lIsBachelorKaonForTPC && 
2621                     lIsPosProtonForTPC     )
2622                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2623                 
2624                 if( lIsBachelorKaonForTPC && 
2625                     lIsPosProtonForTPC    && 
2626                     lIsNegPionForTPC       )
2627                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2628                 
2629                 // Combined PID
2630                 if( lIsBachelorKaon        )
2631                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2632                 
2633                 if( lIsBachelorKaon       && 
2634                     lIsPosInOmegaProton    )
2635                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2636                 
2637                 if(lIsBachelorKaon     && 
2638                    lIsPosInOmegaProton && 
2639                    lIsNegInOmegaPion    )
2640                         fCFContCascadePIDAsOmegaMinus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2641         }
2642         
2643         lContainerPIDVars[0] = 0.; lContainerPIDVars[1] = 0.; lContainerPIDVars[2] = 0.; lContainerPIDVars[3] = 0.;
2644         
2645         // Omega Plus           
2646         if( lChargeXi > 0 && lAssoOmegaPlus) {
2647                 lContainerPIDVars[0] = lmcPt              ;
2648                 lContainerPIDVars[1] = lInvMassOmegaPlus  ;
2649                 lContainerPIDVars[2] = lmcRapCasc         ;
2650                 lContainerPIDVars[3] = lSPDTrackletsMultiplicity ;    // FIXME : SPDTrackletsMultiplicity is not available for AOD ... 
2651                         
2652                 // No PID
2653                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 0); // No PID
2654                 // TPC PID
2655                 if( lIsBachelorKaonForTPC  )
2656                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 1); // TPC PID / 4-#sigma cut on Bachelor track
2657                 
2658                 if( lIsBachelorKaonForTPC && 
2659                     lIsNegProtonForTPC     )
2660                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 2); // TPC PID / 4-#sigma cut on Bachelor+Baryon tracks
2661                 
2662                 if( lIsBachelorKaonForTPC && 
2663                     lIsNegProtonForTPC    && 
2664                     lIsPosPionForTPC       )
2665                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 3); // TPC PID / 4-#sigma cut on Bachelor+Baryon+Meson tracks
2666                 
2667                 // Combined PID
2668                 if( lIsBachelorKaon        )
2669                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 4); // Comb. PID / Bachelor
2670                 
2671                 if( lIsBachelorKaon       && 
2672                     lIsNegInOmegaProton    )
2673                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 5); // Comb. PID / Bachelor+Baryon
2674                 
2675                 if(lIsBachelorKaon     && 
2676                    lIsNegInOmegaProton && 
2677                    lIsPosInOmegaPion    )
2678                         fCFContCascadePIDAsOmegaPlus->Fill(lContainerPIDVars, 6); // Comb. PID / Bachelor+Baryon+Meson
2679         }
2680         
2681         
2682         
2683 }// End of loop over reconstructed cascades
2684  
2685  
2686  
2687  
2688   // Post output data.
2689  PostData(1, fListHistCascade);
2690 }      
2691
2692
2693
2694 Int_t AliAnalysisTaskCheckPerformanceCascade::DoESDTrackWithTPCrefitMultiplicity(const AliESDEvent *lESDevent)
2695 {
2696     // Checking the number of tracks with TPCrefit for each event
2697     // Needed for a rough assessment of the event multiplicity
2698         
2699         Int_t nTrackWithTPCrefitMultiplicity = 0;
2700         for(Int_t iTrackIdx = 0; iTrackIdx < (InputEvent())->GetNumberOfTracks(); iTrackIdx++){
2701                 AliESDtrack *esdTrack   = 0x0;
2702                              esdTrack   = lESDevent->GetTrack( iTrackIdx );
2703                 if (!esdTrack) { AliWarning("Pb / Could not retrieve one track within the track loop for TPCrefit check ..."); continue; }
2704
2705                 ULong_t lTrackStatus    = esdTrack->GetStatus();
2706                             if ((lTrackStatus&AliESDtrack::kTPCrefit)    == 0) continue;
2707                             else nTrackWithTPCrefitMultiplicity++;
2708                     // FIXME :
2709                     // The goal here is to get a better assessment of the event multiplicity.
2710                     // (InputEvent())->GetNumberOfTracks() takes into account ITS std alone tracks + global tracks
2711                     // This may introduce a bias. Hence the number of TPC refit tracks.
2712                     // Note : the event multiplicity = analysis on its own... See Jacek's or Jan Fiete's analysis on dN/d(pt) and dN/d(eta)
2713
2714         }// end loop over all event tracks
2715         return  nTrackWithTPCrefitMultiplicity;
2716 }
2717
2718
2719
2720
2721
2722
2723
2724 //________________________________________________________________________
2725 void AliAnalysisTaskCheckPerformanceCascade::Terminate(Option_t *) 
2726 {
2727   // Draw result to the screen
2728   // Called once at the end of the query
2729         
2730   TList *cRetrievedList = 0x0;
2731   cRetrievedList = (TList*)GetOutputData(1);
2732   if(!cRetrievedList){
2733         Printf("ERROR - AliAnalysisTaskCheckPerformanceCascade : ouput data container list not available\n");
2734         return;
2735   }     
2736         
2737   fHistMCTrackMultiplicity = dynamic_cast<TH1F*> (  cRetrievedList->FindObject("fHistMCTrackMultiplicity")  );
2738   if (!fHistMCTrackMultiplicity) {
2739     Printf("ERROR - AliAnalysisTaskCheckPerformanceCascade : fHistMCTrackMultiplicity not available");
2740     return;
2741   }
2742   
2743    
2744   TCanvas *canCheckPerformanceCascade = new TCanvas("AliAnalysisTaskCheckPerformanceCascade","Multiplicity",10,10,510,510);
2745   canCheckPerformanceCascade->cd(1)->SetLogy();
2746
2747   fHistMCTrackMultiplicity->SetMarkerStyle(22);
2748   fHistMCTrackMultiplicity->DrawCopy("E");
2749
2750 }