d3e1c274c389d0003705478dad3e370d34e569f1
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Correlations / AliAnalysisTaskLambdaOverK0sJets.cxx
1 /************************************************************************* 
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * 
3  *                                                                        * 
4  * Author: X. Sanchez Castro                                              * 
5  * Contributors are mentioned in the code where appropriate.              * 
6  *                                                                        * 
7  * Permission to use, copy, modify and distribute this software and its   * 
8  * documentation strictly for non-commercial purposes is hereby granted   * 
9  * without fee, provided that the above copyright notice appears in all   * 
10  * copies and that both the copyright notice and this permission notice   * 
11  * appear in the supporting documentation. The authors make no claims     * 
12  * about the suitability of this software for any purpose. It is          * 
13  * provided "as is" without express or implied warranty.                  * 
14  **************************************************************************/
15
16 //git test
17
18 #include <TCanvas.h>
19 #include <TTree.h>
20 #include <TFile.h>
21 #include <TH1F.h>
22 #include <TH2F.h>
23 #include <THnSparse.h>
24 #include <TH3F.h>
25 #include <TPDGCode.h>
26 #include <TDatabasePDG.h>
27 #include <TClonesArray.h>
28 #include <TROOT.h>
29
30 #include "AliOADBContainer.h"
31
32 #include "AliAODMCHeader.h"
33 #include "AliAODMCParticle.h"
34 #include "AliGenHijingEventHeader.h"
35
36 #include "AliAODEvent.h"
37 #include "AliAODv0.h"
38 #include "AliAODcascade.h"
39
40 #include "AliCFContainer.h"
41 #include "AliCentrality.h"
42
43 #include "AliPID.h"
44 #include "AliPIDResponse.h"
45 #include "AliAODPid.h"
46
47 #include "AliInputEventHandler.h"
48 #include "AliAnalysisManager.h"
49
50 #include "AliAnalysisTaskLambdaOverK0sJets.h"
51
52 //extern TROOT *gROOT;
53
54
55 ClassImp(AliAnalysisTaskLambdaOverK0sJets)
56 ClassImp(AliMiniParticle)
57
58 // Global variables:
59 static Int_t    nbins = 100;                 // Number of bins for l, pt, mass for V0
60 static Int_t    nbinsPhi = 120;              // Number of bins for Phi
61 static Int_t    nbinsdPhi = 20;              // Number of bins for dPhi
62 static Int_t    nbinsdEta = 30;              // Number of bins for dEta
63 static Int_t    nbinPtLP = 200;
64 static Int_t    nbinsVtx = 20;
65
66 static Float_t pMin = 0.0;                  // Lower cut for transverse momentum
67 static Float_t pMax = 10.;                  // Max cut for transverse momentum for V0
68 static Float_t ptMaxLP = 50.;               // Max cut for transverse momentum LP
69
70 static Float_t lMin = 0.0;                  // Limits in the histo for fidutial volume
71 static Float_t lMax = 100.;                 // Limits in the fidutial volume
72
73 static Int_t   nMaxEvMix = 250;
74
75 //
76 //  
77 //
78
79 AliAnalysisTaskLambdaOverK0sJets::AliAnalysisTaskLambdaOverK0sJets(const char *name) :
80   AliAnalysisTaskSE(name),
81
82   fAOD(0),  fCollision("PbPb2010"), fIsMC(kFALSE), fUsePID(kFALSE), fCentMin(0.), fCentMax(90.), fDoQA(kFALSE), fDoMixEvt(kFALSE), fTrigPtMin(5.), fTrigPtMax(10.), fTrigPtMCMin(5.), fTrigPtMCMax(10000.), fTrigEtaMax(0.8), fCheckIDTrig(kFALSE), fSeparateInjPart(kTRUE), fEndOfHijingEvent(-1),  fPIDResponse(0),
83
84   fMinPtDaughter(0.160), fMaxEtaDaughter(0.8), fMaxDCADaughter(1.0), fUseEtaCut(kFALSE), fYMax(0.7), fDCAToPrimVtx(0.1), fMinCPA(0.998), fNSigma(3.0), fDaugNClsTPC(70.), fMinCtau(0.), fMaxCtau(3.), fIdTrigger(-1), fIsV0LP(0), fPtV0LP(0.), fIsSndCheck(0),
85
86   fOutput(0), fOutputQA(0), fOutputME(0), fMEList(0x0), fTriggerParticles(0x0), fTriggerPartMC(0x0), fAssocParticles(0x0), fAssocPartMC(0x0), fEvents(0), fCentrality(0),  fCentrality2(0), fCentralityTrig(0), fPrimaryVertexX(0), fPrimaryVertexY(0), fPrimaryVertexZ(0),
87
88  fTriggerEventPlane(0),  fTriggerMCPtCent(0), fTriggerMCResPt(0), fTriggerMCResEta(0), fTriggerMCResPhi(0), fTriggerPtCent(0),  fTriggerPtCentCh(0), fNTrigPerEvt(0), fTriggerWiSPDHit(0), fTriggerEtaPhi(0), fCheckTriggerFromV0Daug(0), fTriggerComingFromDaug(0), fTriggerIsV0(0), fCheckIDTrigPtK0s(0), fCheckIDTrigPhiK0s(0), fCheckIDTrigEtaK0s(0), fCheckIDTrigNclsK0s(0), fCheckIDTrigPtLambda(0), fCheckIDTrigPhiLambda(0), fCheckIDTrigEtaLambda(0),  fCheckIDTrigNclsLambda(0), fCheckIDTrigPtAntiLambda(0), fCheckIDTrigPhiAntiLambda(0), fCheckIDTrigEtaAntiLambda(0), fCheckIDTrigNclsAntiLambda(0), 
89
90 fInjectedParticles(0),
91
92 fK0sMCPt(0), fK0sMCPtRap(0), fK0sMCPtRap2(0),  fK0sMCPtRapEmbeded(0), fK0sAssocPt(0), fK0sAssocPtArm(0),  fK0sAssocPtRap(0), fK0sAssocPtRapEmbeded(0), fK0sMCResEta(0), fK0sMCResPhi(0), fLambdaMCPt(0), fLambdaMCPtRap(0), fLambdaMCPtRap2(0),  fLambdaMCPtRapEmbeded(0),  fLambdaMCFromXi(0), fLambdaAssocPt(0), fLambdaAssocPtRap(0), fLambdaAssocFromXi(0), fLambdaMCResEta(0), fLambdaMCResPhi(0), fAntiLambdaMCPt(0), fAntiLambdaMCPtRap(0), fAntiLambdaMCPtRap2(0), fAntiLambdaMCPtRapEmbeded(0), fAntiLambdaMCFromXi(0), fAntiLambdaAssocPt(0), fAntiLambdaAssocPtRap(0), fAntiLambdaAssocFromXi(0), fAntiLambdaMCResEta(0), fAntiLambdaMCResPhi(0),
93
94   fHistArmenterosPodolanski(0), fHistArmPodBckg(0),
95   
96   fK0sMass(0), fK0sMassEmbeded(0), fK0sMassPtEta(0), fK0sMassPtPhi(0), fK0sDaughtersPt(0), fK0sDCADaugToPrimVtx(0), fK0sSpatialRes(0), fK0sBckgDecLength(0), fK0sBckgDCADaugToPrimVtx(0), fK0sBckgEtaPhi(0), fK0sBckgPhiRadio(0), fK0sBckgDCANegDaugToPrimVtx(0), fK0sBckgDCAPosDaugToPrimVtx(0), fV0MassCascade(0),
97   
98   fLambdaMass(0), fLambdaMassEmbeded(0), fLambdaMass2(0), fLambdaMass2Embeded(0), fLambdaMassPtEta(0), fLambdaMassPtPhi(0), fLambdaDaughtersPt(0), fLambdaDCADaugToPrimVtx(0), fLambdaSpatialRes(0), fLambdaBckgDecLength(0), fLambdaBckgDCADaugToPrimVtx(0), fLambdaBckgEtaPhi(0), fLambdaBckgPhiRadio(0), fLambdaBckgDCANegDaugToPrimVtx(0), fLambdaBckgDCAPosDaugToPrimVtx(0), 
99
100   fAntiLambdaMass(0), fAntiLambdaMassEmbeded(0), fAntiLambdaMass2(0), fAntiLambdaMass2Embeded(0), fAntiLambdaMassPtEta(0), fAntiLambdaMassPtPhi(0), fAntiLambdaDaughtersPt(0), fAntiLambdaDCADaugToPrimVtx(0), fAntiLambdaSpatialRes(0), fAntiLambdaBckgDecLength(0), fAntiLambdaBckgDCADaugToPrimVtx(0), fAntiLambdaBckgEtaPhi(0), fAntiLambdaBckgPhiRadio(0), fAntiLambdaBckgDCANegDaugToPrimVtx(0), fAntiLambdaBckgDCAPosDaugToPrimVtx(0), 
101
102   fK0sPtPosDaug(0), fK0sPtNegDaug(0), fK0sBckgPtPosDaug(0), fK0sBckgPtNegDaug(0), fK0sPhiEtaPosDaug(0), fK0sPhiEtaNegDaug(0), fK0sBckgPhiEtaPosDaug(0), fK0sBckgPhiEtaNegDaug(0), fK0sDCAPosDaug(0), fK0sDCANegDaug(0), fK0sBckgDCAPosDaug(0), fK0sBckgDCANegDaug(0), fK0sDecayPos(0), fK0sBckgDecayPos(0), fK0sDecayVertex(0), fK0sBckgDecayVertex(0), fK0sCPA(0), fK0sBckgCPA(0), fK0sDCAV0Daug(0), fK0sBckgDCAV0Daug(0), fK0sNClustersTPC(0), fK0sBckgNClustersTPC(0), fK0sNClustersITSPos(0), fK0sNClustersITSNeg(0), fK0sBckgNClustersITSPos(0), fK0sBckgNClustersITSNeg(0),   
103
104   fLambdaPtPosDaug(0), fLambdaPtNegDaug(0), fLambdaBckgPtPosDaug(0), fLambdaBckgPtNegDaug(0), fLambdaPhiEtaPosDaug(0),fLambdaPhiEtaNegDaug(0), fLambdaBckgPhiEtaPosDaug(0),fLambdaBckgPhiEtaNegDaug(0), fLambdaDCAPosDaug(0),fLambdaDCANegDaug(0), fLambdaBckgDCAPosDaug(0), fLambdaBckgDCANegDaug(0), fLambdaDecayPos(0), fLambdaBckgDecayPos(0), fLambdaDecayVertex(0), fLambdaBckgDecayVertex(0), fLambdaCPA(0), fLambdaBckgCPA(0), fLambdaDCAV0Daug(0), fLambdaBckgDCAV0Daug(0), fLambdaNClustersTPC(0), fLambdaBckgNClustersTPC(0), fLambdaNClustersITSPos(0), fLambdaNClustersITSNeg(0), fLambdaBckgNClustersITSPos(0),  fLambdaBckgNClustersITSNeg(0),
105
106   fAntiLambdaPtPosDaug(0), fAntiLambdaPtNegDaug(0), fAntiLambdaBckgPtPosDaug(0), fAntiLambdaBckgPtNegDaug(0), fAntiLambdaPhiEtaPosDaug(0),fAntiLambdaPhiEtaNegDaug(0), fAntiLambdaBckgPhiEtaPosDaug(0),fAntiLambdaBckgPhiEtaNegDaug(0), fAntiLambdaDCAPosDaug(0),fAntiLambdaDCANegDaug(0), fAntiLambdaBckgDCAPosDaug(0), fAntiLambdaBckgDCANegDaug(0), fAntiLambdaDecayPos(0), fAntiLambdaBckgDecayPos(0), fAntiLambdaDecayVertex(0), fAntiLambdaBckgDecayVertex(0), fAntiLambdaCPA(0), fAntiLambdaBckgCPA(0), fAntiLambdaDCAV0Daug(0), fAntiLambdaBckgDCAV0Daug(0), fAntiLambdaNClustersTPC(0), fAntiLambdaBckgNClustersTPC(0), fAntiLambdaNClustersITSPos(0), fAntiLambdaNClustersITSNeg(0), fAntiLambdaBckgNClustersITSPos(0),  fAntiLambdaBckgNClustersITSNeg(0)
107   
108 {
109   // Dummy Constructor
110
111   // Particles properties in MC
112   for (Int_t i=0; i<kNCent; i++){ 
113     
114     // K0s
115     fK0sMCPtRapVtx[i] = 0;
116     fK0sMCPtRapVtxEmbeded[i] = 0;
117     fK0sMCPtPhiEta[i] = 0;
118     fK0sAssocPtPhiEta[i] = 0;
119     // -- Natural particles
120     fK0sAssocPtMassArm[i] = 0;
121     fK0sAssocMassPtVtx[i] = 0;
122     fK0sAssocMassPtDCADaug[i] = 0;
123     fK0sAssocMassPtCPA[i] = 0;
124     fK0sAssocMassPtDCAPV[i] = 0;
125     fK0sAssocMassPtDaugNClsTPC[i] = 0;
126     // -- Embeded particles
127     fK0sAssocPtMassArmEmbeded[i] = 0;
128     fK0sAssocMassPtVtxEmbeded[i] = 0;
129     fK0sAssocMassPtDCADaug[i] = 0;
130     fK0sAssocMassPtCPAEmbeded[i] = 0;
131     fK0sAssocMassPtDCAPVEmbeded[i] = 0;
132     fK0sAssocMassPtDaugNClsTPCEmbeded[i] = 0;
133     // -- Mass vs rapidity vs pt vs centrlaity
134     fK0sMassPtRap[i] = 0;
135
136     // Lambda
137     fLambdaMCPtRapVtx[i] = 0;
138     fLambdaMCPtRapVtxEmbeded[i] = 0;
139     fLambdaMCPtPhiEta[i] = 0;
140     fLambdaAssocPtPhiEta[i] = 0;
141     // -- Natural particles
142     fLambdaAssocMassPtRap[i] = 0;
143     fLambdaAssocMassPtRap2[i] = 0;
144     fLambdaAssocMassPtVtx[i] = 0;
145     fLambdaAssocMassPtDCADaug[i] = 0;
146     fLambdaAssocMassPtCPA[i] = 0;
147     fLambdaAssocMassPtDCAPV[i] = 0;
148     fLambdaAssocMassPtDaugNClsTPC[i] = 0;
149     // -- Embeded particles
150     fLambdaAssocMassPtRapEmbeded[i] = 0;
151     fLambdaAssocMassPtRapEmbeded2[i] = 0;
152     fLambdaAssocMassPtVtxEmbeded[i] = 0;
153     fLambdaAssocMassPtDCADaug[i] = 0;
154     fLambdaAssocMassPtCPAEmbeded[i] = 0;
155     fLambdaAssocMassPtDCAPVEmbeded[i] = 0;
156     fLambdaAssocMassPtDaugNClsTPCEmbeded[i] = 0;
157     // -- Mass vs rapidity vs pt vs centrlaity
158     fLambdaMassPtRap[i] = 0;
159
160     // AntiLambda
161     fAntiLambdaMCPtRapVtx[i] = 0;
162     fAntiLambdaMCPtRapVtxEmbeded[i] = 0;
163     fAntiLambdaMCPtPhiEta[i] = 0;
164     fAntiLambdaAssocPtPhiEta[i] = 0;
165     // -- Natural particles
166     fAntiLambdaAssocMassPtRap[i] = 0;
167     fAntiLambdaAssocMassPtRap2[i] = 0;
168     fAntiLambdaAssocMassPtVtx[i] = 0;
169     fAntiLambdaAssocMassPtDCADaug[i] = 0;
170     fAntiLambdaAssocMassPtCPA[i] = 0;
171     fAntiLambdaAssocMassPtDCAPV[i] = 0;
172     fAntiLambdaAssocMassPtDaugNClsTPC[i] = 0;
173     // -- Embeded particles
174     fAntiLambdaAssocMassPtRapEmbeded[i] = 0;
175     fAntiLambdaAssocMassPtRapEmbeded2[i] = 0;
176     fAntiLambdaAssocMassPtVtxEmbeded[i] = 0;
177     fAntiLambdaAssocMassPtDCADaug[i] = 0;
178     fAntiLambdaAssocMassPtCPAEmbeded[i] = 0;
179     fAntiLambdaAssocMassPtDCAPVEmbeded[i] = 0;
180     fAntiLambdaAssocMassPtDaugNClsTPCEmbeded[i] = 0;
181     // -- Mass vs rapidity vs pt vs centrlaity
182     fAntiLambdaMassPtRap[i] = 0;
183   }
184
185   // Correlations in MC
186   for (Int_t i=0; i<kNCent*kN1; i++){     
187     // K0s
188     fK0sdPhidEtaMC[i] = 0;
189     // Lambda
190     fLambdadPhidEtaMC[i] = 0;
191     // AntiLambda
192     fAntiLambdadPhidEtaMC[i] = 0;
193   }
194
195   // Correlations
196   for (Int_t i=0; i<(kNCent*kN1*kNVtxZ); i++){     
197     // K0s
198     fK0sdPhidEtaPtL[i] = 0;
199     // Lambda
200     fLambdadPhidEtaPtL[i] = 0;
201     // AntiLambda
202     fAntiLambdadPhidEtaPtL[i] = 0;  
203   }
204
205   // Mixed events distributions
206   for (Int_t i=0; i<(kN1*kNVtxZ*kNCent); i++){ 
207     fK0sdPhidEtaME[i] = 0;
208     fLambdadPhidEtaME[i] = 0;
209     fAntiLambdadPhidEtaME[i] = 0;
210   }
211  
212   // Constructor. Initialization of pointers
213   DefineOutput(1, TList::Class());
214   DefineOutput(2, TList::Class());
215   DefineOutput(3, TList::Class());
216  
217
218 }
219
220 //___________________________________________________________________________________________
221
222 AliAnalysisTaskLambdaOverK0sJets::~AliAnalysisTaskLambdaOverK0sJets() 
223 {
224
225   // Destructor
226   if(fMEList){
227     
228     for(Int_t icent=0; icent<kNCent; icent++){
229       for(Int_t iz=0; iz<kNVtxZ; iz++){
230         fMEList[icent*kNVtxZ+iz]->Delete();  delete fMEList[icent*kNVtxZ+iz];
231       }
232     }
233     delete[] fMEList; fMEList=0x0;
234   }
235   
236   if(fTriggerParticles) {
237     delete fTriggerParticles;
238     fTriggerParticles=0x0;
239   }
240
241   if(fTriggerPartMC) {
242     delete fTriggerPartMC;
243     fTriggerPartMC=0x0;
244   }
245
246   if(fAssocParticles) {
247     delete fAssocParticles;
248     fAssocParticles=0x0;
249   }
250
251   if(fAssocPartMC) {
252     delete fAssocPartMC;
253     fAssocPartMC=0x0;
254   }
255  
256     
257 }
258
259 //___________________________________________________________________________________________
260
261 void AliAnalysisTaskLambdaOverK0sJets::UserCreateOutputObjects()
262
263   // Creating the histograms that are needed for the output 
264   
265   fOutput = new TList(); 
266   fOutput->SetOwner();
267
268   fOutputQA = new TList(); 
269   fOutputQA->SetOwner();
270
271   fOutputME = new TList(); 
272   fOutputME->SetOwner();
273
274   fMEList = new TList*[kNCent*kNVtxZ];
275   for(Int_t icent=0; icent<kNCent; icent++){
276     for(Int_t iz=0; iz<kNVtxZ; iz++){
277       fMEList[icent*kNVtxZ+iz] = new TList();
278       fMEList[icent*kNVtxZ+iz]->SetOwner(kFALSE);
279     }
280   }
281
282   char hNameHist[100];
283
284   // ====== General characteristics of the event and tracks ====== //
285
286   // Counter for the number of events in each step:
287   fEvents=new TH1F("fEvents","Number of events",14,-0.5,13.5);
288   fEvents->GetXaxis()->SetBinLabel(1,"calls to UserExec()");
289   fEvents->GetXaxis()->SetBinLabel(2,"AOD available");
290   fEvents->GetXaxis()->SetBinLabel(3,"CINT1B");
291   fEvents->GetXaxis()->SetBinLabel(4,"V0M Cent");
292   fEvents->GetXaxis()->SetBinLabel(5,"Vtx > 3 part");
293   fEvents->GetXaxis()->SetBinLabel(6,"|VtxZ| < 10 cm");
294   fEvents->GetXaxis()->SetBinLabel(7,"Mult && Cent");
295   fEvents->GetXaxis()->SetBinLabel(8,"Bad ID Trigger");
296   fEvents->GetXaxis()->SetBinLabel(9,"V0 is LP");
297   fEvents->GetXaxis()->SetBinLabel(10,"Trigger is V0 daug");
298   fEvents->GetXaxis()->SetBinLabel(11,"Trigger is V0 daug && 2nd check");
299   fEvents->GetXaxis()->SetBinLabel(12,"Triggered");
300   fEvents->GetXaxis()->SetBinLabel(13,"NOT Triggered");
301   fEvents->GetXaxis()->SetBinLabel(14,"V0 is LP in MC");
302   fEvents->GetYaxis()->SetTitle("Counts"); 
303   fOutput->Add(fEvents);
304
305   // Centrality:
306   fCentrality = new TH1F("fCentrality","Centrality;Centrality (%);Events",100,0.,100.);
307   fOutput->Add(fCentrality);
308
309   fCentrality2 = new TH1F("fCentrality2","Centrality in events with |VtxZ|<10 cm;Centrality (%);Events",100,0.,100.);
310   fOutput->Add(fCentrality2);
311
312   fCentralityTrig = new TH2F("fCentralityTrig","Centrality in events per trigger selection;Centrality (%);Triger Selection",100,0.,100.,3,0.5,3.5);
313   fCentralityTrig->GetYaxis()->SetBinLabel(1,"kCentral");
314   fCentralityTrig->GetYaxis()->SetBinLabel(2,"kSemiCentral");
315   fCentralityTrig->GetYaxis()->SetBinLabel(3,"kMB");
316   fOutput->Add(fCentralityTrig);
317
318   // Primary Vertex:
319   fPrimaryVertexX = new TH1F("fPrimaryVertexX", "Primary Vertex Position X;Primary Vertex Position X (cm);Events",100,-0.5,0.5);
320   fOutput->Add(fPrimaryVertexX);
321   
322   fPrimaryVertexY = new TH1F("fPrimaryVertexY", "Primary Vertex Position Y;Primary Vertex Position Y (cm);Events",100,-0.5,0.5);
323   fOutput->Add(fPrimaryVertexY);
324   
325   fPrimaryVertexZ = new TH1F("fPrimaryVertexZ", "Primary Vertex Position Z;Primary Vertex Position Z (cm);Events",200,-20,20);
326   fOutput->Add(fPrimaryVertexZ);
327   
328
329   // ====== Trigger Particle characteristics ====== //
330   
331   // Difference between Event plane and the Trigger particles:
332   fTriggerEventPlane = new TH1F("fTriggerEventPlane", ";#varphi_{EP}-#varphi_{Trig};Events",50,0.,TMath::Pi());
333   fOutput->Add(fTriggerEventPlane);
334
335   // MC: Pt Trigger particle vs centrality:
336   if(fIsMC){
337     fTriggerMCPtCent = new TH2F("fTriggerMCPtCent","Trigger particle MC;#it{p}_{T} (GeV/#it{c});centrality (%)",2*nbinPtLP,pMin,2*ptMaxLP,100,0.,100.);
338     fOutput->Add(fTriggerMCPtCent);
339
340     fTriggerMCResPt = new TH3F("fTriggerMCResPt","Trigger particle MC: p_{t} resolution;(p_{t,MC}-p_{t,Rec})/p_{t,Rec};p_{t} (GeV/#it{c});centrality",60,-0.3,0.3,2*nbinPtLP,pMin,ptMaxLP,100,0.,100.);
341     fOutput->Add(fTriggerMCResPt);
342
343     fTriggerMCResEta = new TH3F("fTriggerMCResEta","Trigger particle MC: #eta resolution; #eta_{MC}-#eta_{Rec};p_{t} (GeV/#it{c}); centrality",40,-0.1,0.1,2*nbinPtLP,pMin,ptMaxLP,100,0.,100.);
344     fOutput->Add(fTriggerMCResEta);
345
346     fTriggerMCResPhi = new TH3F("fTriggerMCResPhi","Trigger particle MC: #varphi resolution; #varphi_{MC}-#varphi_{Rec};p_{t} (GeV/#it{c}); centrality",40,-0.1,0.1,2*nbinPtLP,pMin,ptMaxLP,100,0.,100.);
347     fOutput->Add(fTriggerMCResPhi);
348   }
349
350   // Pt Trigger particle vs centrality:
351   fTriggerPtCent = new TH3F("fTriggerPtCent","Trigger particle;#it{p}_{T} (GeV/#it{c});centrality (%);Vertex Z (cm)",nbinPtLP,pMin,ptMaxLP,100,0.,100.,nbinsVtx,-10.,10.);
352   fOutput->Add(fTriggerPtCent);
353
354   fTriggerPtCentCh = new TH3F("fTriggerPtCentCh","Trigger particle;#it{p}_{T} (GeV/#it{c});centrality (%);Vertex Z (cm)",nbinPtLP,pMin,ptMaxLP,100,0.,100.,nbinsVtx,-10.,10.);
355   fOutput->Add(fTriggerPtCentCh);
356
357   fNTrigPerEvt = new TH2F("fNTrigPerEvt","Number of Trigger Particles Per Event;Counts;Centrality",51,-0.5,50.5,100,0.,100);
358   fOutput->Add(fNTrigPerEvt);
359
360   fTriggerWiSPDHit = new TH1F("fTriggerWiSPDHit","Number of Trigger Particles wi SPD Hits",3,0.,3.);
361   fOutput->Add(fTriggerWiSPDHit);
362
363   // Phi vs pseudorapidity:
364   fTriggerEtaPhi = new TH2F("fTriggerEtaPhi","Trigger particle;#varphi (rad);#eta",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.);
365   fOutput->Add(fTriggerEtaPhi);
366   
367   // Check if Trigger particle comes from a V0 daughter:
368   fCheckTriggerFromV0Daug = 
369     new TH1F("fCheckTriggerFromV0Daug","Trigger particle from a V0 daughter;;Counts",4,-0.5,3.5);
370   fCheckTriggerFromV0Daug->GetXaxis()->SetTitle("Flag"); 
371   fCheckTriggerFromV0Daug->GetXaxis()->SetBinLabel(1,"NOT V0 daug");
372   fCheckTriggerFromV0Daug->GetXaxis()->SetBinLabel(2,"V0 daug");
373   fCheckTriggerFromV0Daug->GetXaxis()->SetBinLabel(3,"V0 daug & V0 LP");
374   fOutput->Add(fCheckTriggerFromV0Daug);
375   
376   fTriggerComingFromDaug = new TH1F("fTriggerComingFromDaug","Trigger particle from a V0 daughter;#it{p}_{T} (GeV/#it{c});Counts",240, 0, 12);
377   fOutput->Add(fTriggerComingFromDaug);
378
379   fTriggerIsV0 = new TH1F("fTriggerIsV0","V0 candidate is a LP;#it{p}_{T} (GeV/#it{c});Counts",nbinPtLP,pMin,ptMaxLP);
380   fOutput->Add(fTriggerIsV0);
381
382   // ------------------- > Comaring properties of this trigger with the daughters
383   //   K0s
384   fCheckIDTrigPtK0s = new TH3F("fCheckIDTrigPtK0s","K^{0}_{S};#deltap/p_{tri};;p_{V0}",40,-0.2,0.2,7,-0.5,6.5,100,1.,11.);
385   fCheckIDTrigPtK0s->GetYaxis()->SetBinLabel(1,"Pos Daug X");
386   fCheckIDTrigPtK0s->GetYaxis()->SetBinLabel(2,"Pos Daug Y");
387   fCheckIDTrigPtK0s->GetYaxis()->SetBinLabel(3,"Pos Daug Z");
388   fCheckIDTrigPtK0s->GetYaxis()->SetBinLabel(4,"Neg Daug X");
389   fCheckIDTrigPtK0s->GetYaxis()->SetBinLabel(5,"Neg Daug Y");
390   fCheckIDTrigPtK0s->GetYaxis()->SetBinLabel(6,"Neg Daug Z");
391   fOutput->Add(fCheckIDTrigPtK0s);
392
393   fCheckIDTrigPhiK0s = new TH3F("fCheckIDTrigPhiK0s","K^{0}_{S};#delta#varphi;;p_{V0}",40,-0.1,0.1,3,-0.5,2.5,100,1.,11.);
394   fCheckIDTrigPhiK0s->GetYaxis()->SetBinLabel(1,"Pos Daug");
395   fCheckIDTrigPhiK0s->GetYaxis()->SetBinLabel(2,"Neg Daug");
396   fOutput->Add(fCheckIDTrigPhiK0s);
397
398   fCheckIDTrigEtaK0s = new TH3F("fCheckIDTrigEtaK0s","K^{0}_{S};#delta#eta;;p_{V0}",40,-0.1,0.1,3,-0.5,2.5,100,1.,11.);
399   fCheckIDTrigEtaK0s->GetYaxis()->SetBinLabel(1,"Pos Daug");
400   fCheckIDTrigEtaK0s->GetYaxis()->SetBinLabel(2,"Neg Daug");
401   fOutput->Add(fCheckIDTrigEtaK0s);
402
403   fCheckIDTrigNclsK0s = new TH3F("fCheckIDTrigNclsK0s","K^{0}_{S};NCls TPC;;p_{V0}",181,0.5,180.5,3,-0.5,2.5,100,1.,11.);
404   fCheckIDTrigNclsK0s->GetYaxis()->SetBinLabel(1,"Pos Daug");
405   fCheckIDTrigNclsK0s->GetYaxis()->SetBinLabel(2,"Neg Daug");
406   fOutput->Add(fCheckIDTrigNclsK0s);
407
408   //   Lambda
409   fCheckIDTrigPtLambda = new TH3F("fCheckIDTrigPtLambda","#Lambda",40,-0.1,0.1,7,-0.5,6.5,100,1.,11.);
410   fCheckIDTrigPtLambda->GetYaxis()->SetBinLabel(1,"Pos Daug X");
411   fCheckIDTrigPtLambda->GetYaxis()->SetBinLabel(2,"Pos Daug Y");
412   fCheckIDTrigPtLambda->GetYaxis()->SetBinLabel(3,"Pos Daug Z");
413   fCheckIDTrigPtLambda->GetYaxis()->SetBinLabel(4,"Neg Daug X");
414   fCheckIDTrigPtLambda->GetYaxis()->SetBinLabel(5,"Neg Daug Y");
415   fCheckIDTrigPtLambda->GetYaxis()->SetBinLabel(6,"Neg Daug Z");
416   fOutput->Add(fCheckIDTrigPtLambda);
417
418   fCheckIDTrigPhiLambda  = new TH3F("fCheckIDTrigPhiLambda","#Lambda",40,-0.1,0.1,3,-0.5,2.5,100,1.,11.);
419   fCheckIDTrigPhiLambda->GetYaxis()->SetBinLabel(1,"Pos Daug");
420   fCheckIDTrigPhiLambda->GetYaxis()->SetBinLabel(2,"Neg Daug");
421   fOutput->Add(fCheckIDTrigPhiLambda);
422
423   fCheckIDTrigEtaLambda  = new TH3F("fCheckIDTrigEtaLambda","#Lambda",40,-0.1,0.1,3,-0.5,2.5,100,1.,11.);
424   fCheckIDTrigEtaLambda->GetYaxis()->SetBinLabel(1,"Pos Daug");
425   fCheckIDTrigEtaLambda->GetYaxis()->SetBinLabel(2,"Neg Daug");
426   fOutput->Add(fCheckIDTrigEtaLambda);
427
428   fCheckIDTrigNclsLambda = new TH3F("fCheckIDTrigNclsLambda","#Lambda;NCls TPC;;p_{V0}",181,0.5,180.5,3,-0.5,2.5,100,1.,11.);
429   fCheckIDTrigNclsLambda->GetYaxis()->SetBinLabel(1,"Pos Daug");
430   fCheckIDTrigNclsLambda->GetYaxis()->SetBinLabel(2,"Neg Daug");
431   fOutput->Add(fCheckIDTrigNclsLambda);
432
433   //   AntiLambda
434   fCheckIDTrigPtAntiLambda = new TH3F("fCheckIDTrigPtAntiLambda","#bar{#Lambda}",40,-0.2,0.2,7,-0.5,6.5,100,1.,11.);
435   fCheckIDTrigPtAntiLambda->GetYaxis()->SetBinLabel(1,"Pos Daug X");
436   fCheckIDTrigPtAntiLambda->GetYaxis()->SetBinLabel(2,"Pos Daug Y");
437   fCheckIDTrigPtAntiLambda->GetYaxis()->SetBinLabel(3,"Pos Daug Z");
438   fCheckIDTrigPtAntiLambda->GetYaxis()->SetBinLabel(4,"Neg Daug X");
439   fCheckIDTrigPtAntiLambda->GetYaxis()->SetBinLabel(5,"Neg Daug Y");
440   fCheckIDTrigPtAntiLambda->GetYaxis()->SetBinLabel(6,"Neg Daug Z");
441   fOutput->Add(fCheckIDTrigPtAntiLambda);
442
443   fCheckIDTrigPhiAntiLambda  = new TH3F("fCheckIDTrigPhiAntiLambda","#bar{#Lambda}",40,-0.1,0.1,3,-0.5,2.5,100,1.,11.);
444   fCheckIDTrigPhiAntiLambda->GetYaxis()->SetBinLabel(1,"Pos Daug");
445   fCheckIDTrigPhiAntiLambda->GetYaxis()->SetBinLabel(2,"Neg Daug");
446   fOutput->Add(fCheckIDTrigPhiAntiLambda);
447
448   fCheckIDTrigEtaAntiLambda  = new TH3F("fCheckIDTrigEtaAntiLambda","#bar{#Lambda}",40,-0.1,0.1,3,-0.5,2.5,100,1.,11.);
449   fCheckIDTrigEtaAntiLambda->GetYaxis()->SetBinLabel(1,"Pos Daug");
450   fCheckIDTrigEtaAntiLambda->GetYaxis()->SetBinLabel(2,"Neg Daug");
451   fOutput->Add(fCheckIDTrigEtaAntiLambda);
452
453   fCheckIDTrigNclsAntiLambda = new TH3F("fCheckIDTrigNclsAntiLambda","#bar{#Lambda};NCls TPC;;p_{V0}",181,0.5,180.5,3,-0.5,2.5,100,1.,11.);
454   fCheckIDTrigNclsAntiLambda->GetYaxis()->SetBinLabel(1,"Pos Daug");
455   fCheckIDTrigNclsAntiLambda->GetYaxis()->SetBinLabel(2,"Neg Daug");
456   fOutput->Add(fCheckIDTrigNclsAntiLambda);
457
458   // ====== MC-true and  MC-Association information ====== //
459   if(fIsMC){
460
461     fInjectedParticles = new TH1F("fInjectedParticles","Injected particles;;Counts",2,0.,2.);
462     fInjectedParticles->GetXaxis()->SetBinLabel(1,"Injected");
463     fInjectedParticles->GetXaxis()->SetBinLabel(2,"Natural");
464     fOutput->Add(fInjectedParticles);
465     
466     // K0s MC-true:
467     fK0sMCPt       = new TH1F("fK0sMCPt", "K^{0}_{S} MC;#it{p}_{T} (GeV/#it{c});Counts",nbins,pMin,pMax);
468     fOutput->Add(fK0sMCPt);
469
470     fK0sMCPtRap    = new TH3F("fK0sMCPtRap", "K^{0}_{S} MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
471     fOutput->Add(fK0sMCPtRap);
472
473     fK0sMCPtRap2   = new TH3F("fK0sMCPtRap2", "K^{0}_{S} MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
474     fOutput->Add(fK0sMCPtRap2);
475
476     for(Int_t jj=0;jj<kNCent;jj++){
477       snprintf(hNameHist,100, "fK0sMCPtRapVtx_Cent_%d",jj);
478       fK0sMCPtRapVtx[jj] = new TH3F(hNameHist, "K^{0}_{S} MC  |VtxZ|;#it{p}_{T} (GeV/#it{c});y;VtxZ",nbins,pMin,pMax,20,-1.0,1.0,20,-10.,10.);
479       fOutput->Add(fK0sMCPtRapVtx[jj]);
480     }
481
482     fK0sMCPtRapEmbeded   = new TH3F("fK0sMCPtRapEmbeded", "K^{0}_{S} Embeded MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.,1.,100,0.,100.);
483     fOutput->Add(fK0sMCPtRapEmbeded);
484
485     for(Int_t jj=0;jj<kNCent;jj++){
486       snprintf(hNameHist,100, "fK0sMCPtRapVtxEmbeded_Cent_%d",jj);
487       fK0sMCPtRapVtxEmbeded[jj] = new TH3F(hNameHist, "K^{0}_{S} Embeded MC |VtxZ|;#it{p}_{T} (GeV/#it{c});y;VtxZ",nbins,pMin,pMax,20,-1.0,1.0,20,-10.,10.);
488       fOutput->Add(fK0sMCPtRapVtxEmbeded[jj]);
489     }
490   
491     for(Int_t jj=0;jj<kNCent;jj++){
492       snprintf(hNameHist,100, "fK0sMCPtPhiEta_Cent_%d",jj);
493       fK0sMCPtPhiEta[jj]    = new TH3F(hNameHist, "K^{0}_{S} MC;#varphi (rad);#eta;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),20,-1.,1.,nbins,pMin,pMax);
494       fOutput->Add(fK0sMCPtPhiEta[jj]);
495     }
496   
497     // K0s MC-Association:
498     fK0sAssocPt = 
499       new TH1F("fK0sAssocPt","K^{0}_{S} Assoc: L_{T} vs #it{p}_{T};#it{p}_{T} (GeV/#it{c});Counts",nbins,pMin,pMax);
500     fOutput->Add(fK0sAssocPt);
501
502     fK0sAssocPtArm = 
503       new TH3F("fK0sAssocPtArm","K^{0}_{S} Assoc: #it{p}_{T} vs y vs centrality;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
504     fOutput->Add(fK0sAssocPtArm);
505
506     fK0sAssocPtRap    = new TH3F("fK0sAssocPtRap","K^{0}_{S} Assoc;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
507     fOutput->Add(fK0sAssocPtRap);
508
509     fK0sAssocPtRapEmbeded    = new TH3F("fK0sAssocPtRapEmbeded","K^{0}_{S} Assoc  - Embeded MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
510     fOutput->Add(fK0sAssocPtRapEmbeded);
511   
512     for(Int_t jj=0;jj<kNCent;jj++){
513       snprintf(hNameHist,100, "fK0sAssocPtPhiEta_Cent_%d",jj);
514       fK0sAssocPtPhiEta[jj]    = new TH3F(hNameHist,"K^{0}_{S} Assoc;#varphi;#eta;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),20,-1.0,1.0,nbins,pMin,pMax);
515       fOutput->Add(fK0sAssocPtPhiEta[jj]);
516     }
517
518
519     // Histogramas para estudios sistematicos de la eficiencia
520     Int_t binsEff1[3] = {nbins,nbins,20};          Double_t xminEff1[3] = {0.398,pMin,-1.0};          Double_t xmaxEff1[3] = {0.598,pMax,1.0};             // gral efficiency
521     Int_t binsEff2[4] = {nbins,nbins,20,10};       Double_t xminEff2[4] = {0.398,pMin,-1.0,-10.};     Double_t xmaxEff2[4] = {0.598,pMax,1.0,10.};         // vtx cut
522     Int_t binsEff3[4] = {nbins,nbins,20,60};       Double_t xminEff3[4] = {0.398,pMin,-1.0,0.};       Double_t xmaxEff3[4] = {0.598,pMax,1.0,1.2};         // dca between daughters
523     Int_t binsEff4[4] = {nbins,nbins,20,50};       Double_t xminEff4[4] = {0.398,pMin,-1.0,0.9975};   Double_t xmaxEff4[4] = {0.598,pMax,1.0,1.};          // cpa
524     Int_t binsEff5[5] = {nbins,nbins,20,99,99};    Double_t xminEff5[5] = {0.398,pMin,-1.0,0.,0.};    Double_t xmaxEff5[5] = {0.598,pMax,1.0,3.3,3.3};     // dca to prim. vtx
525     Int_t binsEff6[5] = {nbins,nbins,20,170,170};  Double_t xminEff6[5] = {0.398,pMin,-1.0,0.5,0.5};  Double_t xmaxEff6[5] = {0.598,pMax,1.0,170.5,170};   // No. TPC Cls
526
527     for(Int_t i=0; i<kNCent; i++){
528      
529       /// ------- Natural particles
530       snprintf(hNameHist,100, "fK0sAssocPtMassArm_Cent_%d",i);
531       fK0sAssocPtMassArm[i]    = new THnSparseD(hNameHist,"K^{0}_{S} Assoc;Mass (GeV/c^{2});#it{p}_{T} (GeV/#it{c});rap;",3,binsEff1,xminEff1,xmaxEff1);
532       fOutput->Add(fK0sAssocPtMassArm[i]);
533
534       snprintf(hNameHist,100, "fK0sAssocMassPtVtx_Cent_%d",i);
535       fK0sAssocMassPtVtx[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; VtxZ;",4,binsEff2,xminEff2,xmaxEff2);
536       fOutput->Add(fK0sAssocMassPtVtx[i]);      
537
538       snprintf(hNameHist,100, "fK0sAssocMassPtDCADaug_Cent_%d",i);
539       fK0sAssocMassPtDCADaug[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; DCADaug;",4,binsEff3,xminEff3,xmaxEff3);
540       fOutput->Add(fK0sAssocMassPtDCADaug[i]); 
541
542       snprintf(hNameHist,100, "fK0sAssocMassPtCPA_Cent_%d",i);
543       fK0sAssocMassPtCPA[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; CPA;",4,binsEff4,xminEff4,xmaxEff4);
544       fOutput->Add(fK0sAssocMassPtCPA[i]);  
545       
546       snprintf(hNameHist,100, "fK0sAssocMassPtDCAPV_Cent_%d",i);
547       fK0sAssocMassPtDCAPV[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos DCA to Prim. Vtx; Neg DCA to Prim. Vtx;",5,binsEff5,xminEff5,xmaxEff5);
548       fOutput->Add(fK0sAssocMassPtDCAPV[i]);  
549      
550       snprintf(hNameHist,100, "fK0sAssocMassPtDaugNClsTPC_Cent_%d",i);
551       fK0sAssocMassPtDaugNClsTPC[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos # TPC Cls; Neg # TPC Cls;",5,binsEff6,xminEff6,xmaxEff6);
552       fOutput->Add(fK0sAssocMassPtDaugNClsTPC[i]); 
553
554       /// ----- Embeded particles 
555       snprintf(hNameHist,100, "fK0sAssocPtMassArmEmbeded_Cent_%d",i);
556       fK0sAssocPtMassArmEmbeded[i]    = new THnSparseD(hNameHist,"K^{0}_{S} Assoc Embeded;Mass (GeV/c^{2});#it{p}_{T} (GeV/#it{c});rap;",3,binsEff1,xminEff1,xmaxEff1);
557       fOutput->Add(fK0sAssocPtMassArmEmbeded[i]);
558
559       snprintf(hNameHist,100, "fK0sAssocMassPtVtxEmbeded_Cent_%d",i);
560       fK0sAssocMassPtVtxEmbeded[i]  = new THnSparseD(hNameHist, "K^{0}_{S} Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap; VtxZ;",4,binsEff2,xminEff2,xmaxEff2);
561       fOutput->Add(fK0sAssocMassPtVtxEmbeded[i]);      
562
563       snprintf(hNameHist,100, "fK0sAssocMassPtDCADaugEmbeded_Cent_%d",i);
564       fK0sAssocMassPtDCADaugEmbeded[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; DCADaug;",4,binsEff3,xminEff3,xmaxEff3);
565       fOutput->Add(fK0sAssocMassPtDCADaugEmbeded[i]); 
566
567       snprintf(hNameHist,100, "fK0sAssocMassPtCPAEmbeded_Cent_%d",i);
568       fK0sAssocMassPtCPAEmbeded[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; CPA;",4,binsEff4,xminEff4,xmaxEff4);
569       fOutput->Add(fK0sAssocMassPtCPAEmbeded[i]);  
570
571       snprintf(hNameHist,100, "fK0sAssocMassPtDCAPVEmbeded_Cent_%d",i);
572       fK0sAssocMassPtDCAPVEmbeded[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos DCA to Prim. Vtx; Neg DCA to Prim. Vtx;",5,binsEff5,xminEff5,xmaxEff5);
573       fOutput->Add(fK0sAssocMassPtDCAPVEmbeded[i]);  
574
575       snprintf(hNameHist,100, "fK0sAssocMassPtDaugNClsTPCEmbeded_Cent_%d",i);
576       fK0sAssocMassPtDaugNClsTPCEmbeded[i]  = new THnSparseD(hNameHist, "K^{0}_{S}; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos # TPC Cls; Neg # TPC Cls;",5,binsEff6,xminEff6,xmaxEff6);
577       fOutput->Add(fK0sAssocMassPtDaugNClsTPCEmbeded[i]); 
578
579     }
580     
581     fK0sMCResEta     = new TH3F("fK0sMCResEta","K^{0}_{S} Assoc: #eta resolution; #eta_{MC}-#eta_{Rec};#it{p}_{T} (GeV/#it{c}); centrality",40,-0.1,0.1,nbins,pMin,pMax,100,0.,100.);
582     fOutput->Add(fK0sMCResEta);
583
584     fK0sMCResPhi     = new TH3F("fK0sMCResPhi","K^{0}_{S} Assoc: #varphi resolution; #varphi_{MC}-#varphi_{Rec};#it{p}_{T} (GeV/#it{c}); centrality",40,-0.1,0.1,nbins,pMin,pMax,100,0.,100.);
585     fOutput->Add(fK0sMCResPhi);
586
587     // Lambda MC-true: 
588     fLambdaMCPt = new TH1F("fLambdaMCPt","#Lambda MC;#it{p}_{T} (GeV/#it{c});Counts",nbins,pMin,pMax);
589     fOutput->Add(fLambdaMCPt);
590
591     fLambdaMCPtRap = new TH3F("fLambdaMCPtRap","#Lambda MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
592     fOutput->Add(fLambdaMCPtRap);
593
594     fLambdaMCPtRap2 = new TH3F("fLambdaMCPtRap2","#Lambda MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
595     fOutput->Add(fLambdaMCPtRap2);
596
597     for(Int_t jj=0;jj<kNCent;jj++){
598       snprintf(hNameHist,100, "fLambdaMCPtRapVtx_Cent_%d",jj);
599       fLambdaMCPtRapVtx[jj] = new TH3F(hNameHist,"#Lambda MC  |VtxZ|<3 cm;#it{p}_{T} (GeV/#it{c});y;zv",nbins,pMin,pMax,20,-1.0,1.0,20,-10.,10.);
600       fOutput->Add(fLambdaMCPtRapVtx[jj]);
601     }
602
603     fLambdaMCPtRapEmbeded = new TH3F("fLambdaMCPtRapEmbeded","#Lambda Embeded MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
604     fOutput->Add(fLambdaMCPtRapEmbeded);
605   
606     for(Int_t jj=0;jj<kNCent;jj++){
607       snprintf(hNameHist,100, "fLambdaMCPtRapVtxEmbeded_Cent_%d",jj);
608       fLambdaMCPtRapVtxEmbeded[jj] = new TH3F(hNameHist,"#Lambda Embeded MC |VtxZ|<3 cm;#it{p}_{T} (GeV/#it{c});y;zv",nbins,pMin,pMax,20,-1.0,1.0,20,-10.,10.);
609       fOutput->Add(fLambdaMCPtRapVtxEmbeded[jj]);
610     }
611
612     fLambdaMCFromXi  = new TH2F("fLambdaMCFromXi", "#Lambda from Xi MC;#it{p}_{T} (GeV/#it{c});centrality",nbins,pMin,pMax,100,0.,100.);
613     fOutput->Add(fLambdaMCFromXi);
614
615     for(Int_t jj=0;jj<kNCent;jj++){
616       snprintf(hNameHist,100, "fLambdaMCPtPhiEta_Cent_%d",jj);
617       fLambdaMCPtPhiEta[jj] = new TH3F(hNameHist,"#Lambda MC;#varphi (rad);#eta;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),20,-1.0,1.0,nbins,pMin,pMax);
618       fOutput->Add(fLambdaMCPtPhiEta[jj]);
619     }
620
621     // Lambda MC-Association:
622     fLambdaAssocPt = 
623       new TH1F("fLambdaAssocPt","#Lambda Assoc: L_{T} vs #it{p}_{T};#it{p}_{T} (GeV/#it{c});Counts",nbins,pMin,pMax);
624     fOutput->Add(fLambdaAssocPt);
625
626     fLambdaAssocPtRap = new TH3F("fLambdaAssocPtRap", "#Lambda Assoc;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
627     fOutput->Add(fLambdaAssocPtRap);
628     
629     fLambdaAssocFromXi  = new TH2F("fLambdaAssocFromXi", "#Lambda from Xi Assoc;#it{p}_{T} (GeV/#it{c});centrality",nbins,pMin,pMax,100,0.,100.);
630     fOutput->Add(fLambdaAssocFromXi);
631
632     for(Int_t jj=0;jj<kNCent;jj++){
633       snprintf(hNameHist,100, "fLambdaAssocPtPhiEta_Cent_%d",jj);
634       fLambdaAssocPtPhiEta[jj] = new TH3F(hNameHist, "#Lambda Assoc;#varphi (rad);#eta;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),20,-1.0,1.0,nbins,pMin,pMax);
635       fOutput->Add(fLambdaAssocPtPhiEta[jj]);
636     }
637     
638     // Histogramas para estudios sistematicos de la eficiencia
639     Int_t binsEff7[3] = {nbins,nbins,20};          Double_t xminEff7[3] = {1.065,pMin,-1.0};           Double_t xmaxEff7[3] = {1.165,pMax,1.0};        // gral efficiency
640     Int_t binsEff8[4] = {nbins,nbins,20,10};       Double_t xminEff8[4] = {1.065,pMin,-1.0,-10.};      Double_t xmaxEff8[4] = {1.165,pMax,1.0,10.};    // vtx
641     Int_t binsEff9[4] = {nbins,nbins,20,60};       Double_t xminEff9[4] = {1.065,pMin,-1.0,0.};        Double_t xmaxEff9[4] = {1.165,pMax,1.0,1.2};    // dca between daughters
642     Int_t binsEff10[4] = {nbins,nbins,20,50};      Double_t xminEff10[4] = {1.065,pMin,-1.0,0.9975};   Double_t xmaxEff10[4] = {1.165,pMax,1.0,1.};    // cpa
643     Int_t binsEff11[5] = {nbins,nbins,20,99,99};   Double_t xminEff11[5] = {1.065,pMin,-1.0,0.,0.};    Double_t xmaxEff11[5] = {1.165,pMax,1.0,3.3,3.3};   // dca to prim. vtx
644     Int_t binsEff12[5] = {nbins,nbins,20,170,170}; Double_t xminEff12[5] = {1.065,pMin,-1.0,0.5,0.5};  Double_t xmaxEff12[5] = {1.165,pMax,1.0,170.5,170.5};   // No. TPC Cls
645
646     for(Int_t i=0; i<kNCent; i++){
647
648       // --------- Natural particles
649       snprintf(hNameHist,100, "fLambdaAssocMassPtRap_Cent_%d",i);
650       fLambdaAssocMassPtRap[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff7,xminEff7,xmaxEff7);
651       fOutput->Add(fLambdaAssocMassPtRap[i]);      
652
653       snprintf(hNameHist,100, "fLambdaAssocMassPtRap2_Cent_%d",i);
654       fLambdaAssocMassPtRap2[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff7,xminEff7,xmaxEff7);
655       fOutput->Add(fLambdaAssocMassPtRap2[i]);     
656       
657       snprintf(hNameHist,100, "fLambdaAssocMassPtVtx_Cent_%d",i);
658       fLambdaAssocMassPtVtx[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; VtxZ;",4,binsEff8,xminEff8,xmaxEff8);
659       fOutput->Add(fLambdaAssocMassPtVtx[i]);      
660      
661       snprintf(hNameHist,100, "fLambdaAssocMassPtDCADaug_Cent_%d",i);
662       fLambdaAssocMassPtDCADaug[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; DCADaug;",4,binsEff9,xminEff9,xmaxEff9);
663       fOutput->Add(fLambdaAssocMassPtDCADaug[i]); 
664      
665       snprintf(hNameHist,100, "fLambdaAssocMassPtCPA_Cent_%d",i);
666       fLambdaAssocMassPtCPA[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; CPA;",4,binsEff10,xminEff10,xmaxEff10);
667       fOutput->Add(fLambdaAssocMassPtCPA[i]);  
668     
669       snprintf(hNameHist,100, "fLambdaAssocMassPtDCAPV_Cent_%d",i);
670       fLambdaAssocMassPtDCAPV[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos DCA to Prim. Vtx; Neg DCA to Prim. Vtx;",5,binsEff11,xminEff11,xmaxEff11);
671       fOutput->Add(fLambdaAssocMassPtDCAPV[i]);  
672
673       snprintf(hNameHist,100, "fLambdaAssocMassPtDaugNClsTPC_Cent_%d",i);
674       fLambdaAssocMassPtDaugNClsTPC[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos # TPC Cls; Neg # TPC Cls;",5,binsEff12,xminEff12,xmaxEff12);
675       fOutput->Add(fLambdaAssocMassPtDaugNClsTPC[i]); 
676
677       // ------------ Embeded particles
678       snprintf(hNameHist,100, "fLambdaAssocMassPtRapEmbeded_Cent_%d",i);
679       fLambdaAssocMassPtRapEmbeded[i]  = new THnSparseD(hNameHist, "#Lambda Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff7,xminEff7,xmaxEff7);
680       fOutput->Add(fLambdaAssocMassPtRapEmbeded[i]);  
681
682       snprintf(hNameHist,100, "fLambdaAssocMassPtRapEmbeded2_Cent_%d",i);
683       fLambdaAssocMassPtRapEmbeded2[i]  = new THnSparseD(hNameHist, "#Lambda Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff7,xminEff7,xmaxEff7);
684       fOutput->Add(fLambdaAssocMassPtRapEmbeded2[i]);    
685
686       snprintf(hNameHist,100, "fLambdaAssocMassPtVtxEmbeded_Cent_%d",i);
687       fLambdaAssocMassPtVtxEmbeded[i]  = new THnSparseD(hNameHist, "#Lambda Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap; VtxZ;",4,binsEff8,xminEff8,xmaxEff8);
688       fOutput->Add(fLambdaAssocMassPtVtxEmbeded[i]);      
689
690       snprintf(hNameHist,100, "fLambdaAssocMassPtDCADaugEmbeded_Cent_%d",i);
691       fLambdaAssocMassPtDCADaugEmbeded[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; DCADaug;",4,binsEff9,xminEff9,xmaxEff9);
692       fOutput->Add(fLambdaAssocMassPtDCADaugEmbeded[i]); 
693  
694       snprintf(hNameHist,100, "fLambdaAssocMassPtCPAEmbeded_Cent_%d",i);
695       fLambdaAssocMassPtCPAEmbeded[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; CPA;",4,binsEff10,xminEff10,xmaxEff10);
696       fOutput->Add(fLambdaAssocMassPtCPAEmbeded[i]);  
697
698       snprintf(hNameHist,100, "fLambdaAssocMassPtDCAPVEmbeded_Cent_%d",i);
699       fLambdaAssocMassPtDCAPVEmbeded[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos DCA to Prim. Vtx; Neg DCA to Prim. Vtx;",5,binsEff11,xminEff11,xmaxEff11);
700       fOutput->Add(fLambdaAssocMassPtDCAPVEmbeded[i]);  
701
702       snprintf(hNameHist,100, "fLambdaAssocMassPtDaugNClsTPCEmbeded_Cent_%d",i);
703       fLambdaAssocMassPtDaugNClsTPCEmbeded[i]  = new THnSparseD(hNameHist, "#Lambda; Mass (GeV/c^{2}); #it{p}_{T}; rap;  Pos # TPC Cls; Neg # TPC Cls;",5,binsEff12,xminEff12,xmaxEff12);
704       fOutput->Add(fLambdaAssocMassPtDaugNClsTPCEmbeded[i]);
705     } 
706
707     fLambdaMCResEta     = new TH3F("fLambdaMCResEta","#Lambda Assoc: #eta resolution; #eta_{MC}-#eta_{Rec};#it{p}_{T} (GeV/#it{c}); centrality",40,-0.1,0.1,nbins,pMin,pMax,100,0.,100.);
708     fOutput->Add(fLambdaMCResEta);
709
710     fLambdaMCResPhi     = new TH3F("fLambdaMCResPhi","#Lambda Assoc: #varphi resolution; #varphi_{MC}-#varphi_{Rec};#it{p}_{T} (GeV/#it{c}); centrality",40,-0.1,0.1,nbins,pMin,pMax,100,0.,100.);
711     fOutput->Add(fLambdaMCResPhi);
712
713     // AntiLambda MC-true: 
714     fAntiLambdaMCPt = new TH1F("fAntiLambdaMCPt","#bar{#Lambda} MC;#it{p}_{T} (GeV/#it{c});Counts",nbins,pMin,pMax);
715     fOutput->Add(fAntiLambdaMCPt);
716   
717     fAntiLambdaMCPtRap = new TH3F("fAntiLambdaMCPtRap","#bar{#Lambda} MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
718     fOutput->Add(fAntiLambdaMCPtRap);
719   
720     fAntiLambdaMCPtRap2 = new TH3F("fAntiLambdaMCPtRap2","#bar{#Lambda} MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
721     fOutput->Add(fAntiLambdaMCPtRap2);
722
723     for(Int_t jj=0;jj<kNCent;jj++){
724       snprintf(hNameHist,100, "fAntiLambdaMCPtRapVtx_Cent_%d",jj);
725       fAntiLambdaMCPtRapVtx[jj] = new TH3F(hNameHist,"#bar{#Lambda} MC |VtxZ|;#it{p}_{T} (GeV/#it{c});y;zv",nbins,pMin,pMax,20,-1.0,1.0,20,-10.,10.);
726       fOutput->Add(fAntiLambdaMCPtRapVtx[jj]);  
727     }
728
729     fAntiLambdaMCPtRapEmbeded = new TH3F("fAntiLambdaMCPtRapEmbeded","#bar{#Lambda} Embeded MC;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
730     fOutput->Add(fAntiLambdaMCPtRapEmbeded);
731     
732     for(Int_t jj=0;jj<kNCent;jj++){
733       snprintf(hNameHist,100, "fAntiLambdaMCPtRapVtxEmbeded_Cent_%d",jj);
734       fAntiLambdaMCPtRapVtxEmbeded[jj] = new TH3F(hNameHist,"#bar{#Lambda} Embeded MC |VtxZ|;#it{p}_{T} (GeV/#it{c});y;zv",nbins,pMin,pMax,20,-1.0,1.0,20,-10.,10.);
735       fOutput->Add(fAntiLambdaMCPtRapVtxEmbeded[jj]); 
736     }
737
738     fAntiLambdaMCFromXi  = new TH2F("fAntiLambdaMCFromXi", "#bar{#Lambda} from Xi MC;#it{p}_{T} (GeV/#it{c});centrality",nbins,pMin,pMax,100,0.,100.);
739     fOutput->Add(fAntiLambdaMCFromXi);
740
741     for(Int_t jj=0;jj<kNCent;jj++){
742       snprintf(hNameHist,100, "fAntiLambdaMCPtPhiEta_Cent_%d",jj);
743       fAntiLambdaMCPtPhiEta[jj] = new TH3F(hNameHist,"#bar{#Lambda} MC;#varphi (rad);#eta;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),20,-1.0,1.0,nbins,pMin,pMax);
744       fOutput->Add(fAntiLambdaMCPtPhiEta[jj]);
745     }
746   
747     // AntiLambda MC-Association:
748     fAntiLambdaAssocPt = 
749       new TH1F("fAntiLambdaAssocPt","#bar{#Lambda} Assoc: L_{T} vs #it{p}_{T};#it{p}_{T} (GeV/#it{c})",nbins,pMin,pMax);
750     fOutput->Add(fAntiLambdaAssocPt);
751   
752     fAntiLambdaAssocPtRap = new TH3F("fAntiLambdaAssocPtRap", "#bar{#Lambda} Assoc;#it{p}_{T} (GeV/#it{c});y;centrality",nbins,pMin,pMax,20,-1.0,1.0,100,0.,100.);
753     fOutput->Add(fAntiLambdaAssocPtRap);
754   
755     fAntiLambdaAssocFromXi  = new TH2F("fAntiLambdaAssocFromXi", "#bar{#Lambda} from Xi MC;#it{p}_{T} (GeV/#it{c});centrality",nbins,pMin,pMax,100,0.,100.);
756     fOutput->Add(fAntiLambdaAssocFromXi);
757
758     for(Int_t jj=0;jj<kNCent;jj++){
759       snprintf(hNameHist,100, "fAntiLambdaAssocPtPhiEta_Cent_%d",jj);
760       fAntiLambdaAssocPtPhiEta[jj] = new TH3F(hNameHist, "#Lambda Assoc;#varphi (rad);#eta;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),20,-1.0,1.0,nbins,pMin,pMax);
761       fOutput->Add(fAntiLambdaAssocPtPhiEta[jj]);
762     }
763
764     // Histogramas para estudios sistematicos de la eficiencia
765     Int_t binsEff13[3] = {nbins,nbins,20};          Double_t xminEff13[3] = {1.065,pMin,-1.0};          Double_t xmaxEff13[3] = {1.165,pMax,1.0};              // gral efficiency
766     Int_t binsEff14[4] = {nbins,nbins,20,10};       Double_t xminEff14[4] = {1.065,pMin,-1.0,-10.};     Double_t xmaxEff14[4] = {1.165,pMax,1.0,10.};          // vtx
767     Int_t binsEff15[4] = {nbins,nbins,20,60};       Double_t xminEff15[4] = {1.065,pMin,-1.0,0.};       Double_t xmaxEff15[4] = {1.165,pMax,1.0,1.2};          // dca between daug
768     Int_t binsEff16[4] = {nbins,nbins,20,50};       Double_t xminEff16[4] = {1.065,pMin,-1.0,0.9975};   Double_t xmaxEff16[4] = {1.165,pMax,1.0,1.};           // cpa
769     Int_t binsEff17[5] = {nbins,nbins,20,99,99};    Double_t xminEff17[5] = {1.065,pMin,-1.0,0.,0.};    Double_t xmaxEff17[5] = {1.165,pMax,1.0,3.3,3.3};      // dca to prim. vtx
770     Int_t binsEff18[5] = {nbins,nbins,20,170,170};  Double_t xminEff18[5] = {1.065,pMin,-1.0,0.5,0.5};  Double_t xmaxEff18[5] = {1.165,pMax,1.0,170.5,170.5};  // No. TPC Cls
771
772     for(Int_t i=0; i<kNCent; i++){
773       // --------- Natural particles
774       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtRap_Cent_%d",i);
775       fAntiLambdaAssocMassPtRap[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff13,xminEff13,xmaxEff13);
776       fOutput->Add(fAntiLambdaAssocMassPtRap[i]);      
777   
778       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtRap2_Cent_%d",i);
779       fAntiLambdaAssocMassPtRap2[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff13,xminEff13,xmaxEff13);
780       fOutput->Add(fAntiLambdaAssocMassPtRap2[i]); 
781       
782       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtVtx_Cent_%d",i);
783       fAntiLambdaAssocMassPtVtx[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; VtxZ;",4,binsEff14,xminEff14,xmaxEff14);
784       fOutput->Add(fAntiLambdaAssocMassPtVtx[i]);      
785
786       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtDCADaug_Cent_%d",i);
787       fAntiLambdaAssocMassPtDCADaug[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; DCADaug;",4,binsEff15,xminEff15,xmaxEff15);
788       fOutput->Add(fAntiLambdaAssocMassPtDCADaug[i]); 
789
790       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtCPA_Cent_%d",i);
791       fAntiLambdaAssocMassPtCPA[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; CPA;",4,binsEff16,xminEff16,xmaxEff16);
792       fOutput->Add(fAntiLambdaAssocMassPtCPA[i]);  
793
794       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtDCAPV_Cent_%d",i);
795       fAntiLambdaAssocMassPtDCAPV[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos DCA to Prim. Vtx; Neg DCA to Prim. Vtx;",5,binsEff17,xminEff17,xmaxEff17);
796       fOutput->Add(fAntiLambdaAssocMassPtDCAPV[i]);  
797
798       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtDaugNClsTPC_Cent_%d",i);
799       fAntiLambdaAssocMassPtDaugNClsTPC[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap;  Pos # TPC Cls; Neg # TPC Cls;",5,binsEff18,xminEff18,xmaxEff18);
800       fOutput->Add(fAntiLambdaAssocMassPtDaugNClsTPC[i]); 
801
802       // ------------ Embeded particles
803       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtRapEmbeded_Cent_%d",i);
804       fAntiLambdaAssocMassPtRapEmbeded[i]  = new THnSparseD(hNameHist, "#bar{#Lambda} Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff13,xminEff13,xmaxEff13);
805       fOutput->Add(fAntiLambdaAssocMassPtRapEmbeded[i]);    
806
807       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtRapEmbeded2_Cent_%d",i);
808       fAntiLambdaAssocMassPtRapEmbeded2[i]  = new THnSparseD(hNameHist, "#bar{#Lambda} Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap;",3,binsEff13,xminEff13,xmaxEff13);
809       fOutput->Add(fAntiLambdaAssocMassPtRapEmbeded2[i]);    
810
811       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtVtxEmbeded_Cent_%d",i);
812       fAntiLambdaAssocMassPtVtxEmbeded[i]  = new THnSparseD(hNameHist, "#bar{#Lambda} Embeded; Mass (GeV/c^{2}); #it{p}_{T}; rap; VtxZ;",4,binsEff14,xminEff14,xmaxEff14);
813       fOutput->Add(fAntiLambdaAssocMassPtVtxEmbeded[i]);      
814
815       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtDCADaugEmbeded_Cent_%d",i);
816       fAntiLambdaAssocMassPtDCADaugEmbeded[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; DCADaug;",4,binsEff15,xminEff15,xmaxEff15);
817       fOutput->Add(fAntiLambdaAssocMassPtDCADaugEmbeded[i]); 
818
819       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtCPAEmbeded_Cent_%d",i);
820       fAntiLambdaAssocMassPtCPAEmbeded[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; CPA;",4,binsEff16,xminEff16,xmaxEff16);
821       fOutput->Add(fAntiLambdaAssocMassPtCPAEmbeded[i]);  
822
823       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtDCAPVEmbeded_Cent_%d",i);
824       fAntiLambdaAssocMassPtDCAPVEmbeded[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap; Pos DCA to Prim. Vtx; Neg DCA to Prim. Vtx;",5,binsEff17,xminEff17,xmaxEff17);
825       fOutput->Add(fAntiLambdaAssocMassPtDCAPVEmbeded[i]);  
826
827       snprintf(hNameHist,100, "fAntiLambdaAssocMassPtDaugNClsTPCEmbeded_Cent_%d",i);
828       fAntiLambdaAssocMassPtDaugNClsTPCEmbeded[i]  = new THnSparseD(hNameHist, "#bar{#Lambda}; Mass (GeV/c^{2}); #it{p}_{T}; rap;  Pos # TPC Cls; Neg # TPC Cls;",5,binsEff18,xminEff18,xmaxEff18);
829       fOutput->Add(fAntiLambdaAssocMassPtDaugNClsTPCEmbeded[i]);
830     } 
831
832     fAntiLambdaMCResEta     = new TH3F("fAntiLambdaMCResEta","#bar{#Lambda} Assoc: #eta resolution; #eta_{MC}-#eta_{Rec};#it{p}_{T} (GeV/#it{c}); centrality",40,-0.1,0.1,nbins,pMin,pMax,100,0.,100.);
833     fOutput->Add(fAntiLambdaMCResEta);
834
835     fAntiLambdaMCResPhi     = new TH3F("fAntiLambdaMCResPhi","#bar{#Lambda} Assoc: #varphi resolution; #varphi_{MC}-#varphi_{Rec};#it{p}_{T} (GeV/#it{c}); centrality",40,-0.1,0.1,nbins,pMin,pMax,100,0.,100.);
836     fOutput->Add(fAntiLambdaMCResPhi);
837
838   } //End MC
839
840   // ======================================================== //
841   // ========== Reconstruction information in AOD =========== //
842   fHistArmenterosPodolanski  =
843     new TH3F("fHistArmenterosPodolanski","Armenteros-Podolanski phase space;#alpha;p_{t} arm",
844              100,-1.0,1.0,50,0,0.5,7,-0.5,6.5);
845   fHistArmenterosPodolanski->GetZaxis()->SetBinLabel(1,"K^{0}_{S} Inv. Mass Peak");
846   fHistArmenterosPodolanski->GetZaxis()->SetBinLabel(2,"K^{0}_{S} Bckg");
847   fHistArmenterosPodolanski->GetZaxis()->SetBinLabel(3,"#Lambda Inv. Mass Peak");
848   fHistArmenterosPodolanski->GetZaxis()->SetBinLabel(4,"#Lambda Bckg");
849   fHistArmenterosPodolanski->GetZaxis()->SetBinLabel(5,"#bar{#Lambda} Inv. Mass Peak");
850   fHistArmenterosPodolanski->GetZaxis()->SetBinLabel(6,"#bar{#Lambda} Bckg");
851   fOutput->Add(fHistArmenterosPodolanski);
852  
853   fHistArmPodBckg =
854     new TH3F("fHistArmPodBckg","Background: Armenteros-Podolanski phase space;#alpha;p_{t} arm",
855              100,-1.0,1.0,50,0,0.5,4,-0.5,3.5);
856   fHistArmPodBckg->GetZaxis()->SetBinLabel(1,"K^{0}_{S}: Trig events");
857   fHistArmPodBckg->GetZaxis()->SetBinLabel(2,"#Lambda: Trig events");
858   fHistArmPodBckg->GetZaxis()->SetBinLabel(3,"#bar{#Lambda}: Trig events");
859   fOutput->Add(fHistArmPodBckg);
860  
861   // ****** K0s ******
862   fK0sMass =
863     new TH3F("fK0sMass", "K^{0}_{s}: mass vs #it{p}_{T};Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});centrality",nbins,0.398,0.598,nbins,pMin,pMax,100,0.,100.);
864   fOutput->Add(fK0sMass);
865  
866   fK0sMassEmbeded =
867     new TH3F("fK0sMassEmbeded", "K^{0}_{s} Embeded: mass vs #it{p}_{T}",nbins,0.398,0.598,nbins,pMin,pMax,100,0.,100.);
868   fK0sMassEmbeded->GetXaxis()->SetTitle("Mass (GeV/c^2)");
869   fK0sMassEmbeded->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
870   fK0sMassEmbeded->GetZaxis()->SetTitle("centrality");
871   fOutput->Add(fK0sMassEmbeded);
872
873   fK0sMassPtEta =
874     new TH3F("fK0sMassPtEta","K^{0}_{s}: Mass vs #it{p}_{T} vs #eta;Mass (GeV/C^{2});#it{p}_{T} (GeV/#it{c});#eta",
875              nbins,0.398,0.598,nbins,pMin,pMax,20,-1.0,1.0);
876   fOutput->Add(fK0sMassPtEta);
877  
878   for(Int_t i=0; i<kNCent; i++){
879     fK0sMassPtRap[i] =
880       new TH3F(Form("fK0sMassPtRap_cent_%.0lf_%.0lf",kBinCent[i],kBinCent[i+1]),"K^{0}_{s}: mass vs #it{p}_{T} vs y;Mass (GeV/C^{2});#it{p}_{T} (GeV/#it{c});y",
881                nbins,0.398,0.598,nbins,pMin,pMax,20,-1.0,1.0);
882     fOutput->Add(fK0sMassPtRap[i]);
883   } 
884  
885   fK0sMassPtPhi  =
886     new TH3F("fK0sMassPtPhi","K^{0}_{s}: mass vs #it{p}_{T} vs #varphi;Mass (GeV/c^2);#it{p}_{T} (GeV/#it{c});#varphi (rad)",
887              nbins,0.398,0.598,nbins,pMin,pMax,nbinsPhi,0.,2.*TMath::Pi());
888   fOutput->Add(fK0sMassPtPhi);
889   
890   // Correlations:
891   fK0sDCADaugToPrimVtx  
892     = new TH3F("fK0sDCADaugToPrimVtx","K^{0}_{S} Bckg: dca daughter vs. p_{T,l};DCA Pos daug (cm);DCA Neg daug (cm);p_{T,l} (GeV/#it{c})",
893                90,0.,3.3,90,0.,3.3,nbinPtLP,pMin,ptMaxLP);
894   fOutput->Add(fK0sDCADaugToPrimVtx);
895
896   //    Spatial Resoltuion between trigger- and asosciated- particles
897   fK0sSpatialRes = new TH3F("fK0sSpatialRes","K^{0}_{S}: Spatial resolution;#Delta#varphi (rad);trig-assoc. resolution (cm);dec. length (cm)",
898                             20,-0.1,0.1,100,0.,10,2*nbins,lMin,lMax);
899   fOutput->Add(fK0sSpatialRes);
900
901   for(Int_t jj=0;jj<kNCent;jj++){
902     for(Int_t k=0;k<kN1;k++){
903
904       // Monte-Carlo level:
905       if(fIsMC){
906         snprintf(hNameHist,100, "fK0sdPhidEtaMC_%.2f_%.2f_Cent_%.0f_%.0f",kPtBinV0[k],kPtBinV0[k+1],kBinCent[jj],kBinCent[jj+1]); 
907         fK0sdPhidEtaMC[jj*kN1+k] = new TH3F(hNameHist,"K^{0}_{S} MC: #Delta#varphi vs #Delta#eta vs p_{T,l}",
908                                             nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
909                                             nbinsdEta,-1.5,1.5,
910                                             nbinsVtx,-10.,10.);
911         fK0sdPhidEtaMC[jj*kN1+k]->GetXaxis()->SetTitle("#Delta#varphi (rad)"); 
912         fK0sdPhidEtaMC[jj*kN1+k]->GetYaxis()->SetTitle("#Delta#eta"); 
913         fK0sdPhidEtaMC[jj*kN1+k]->GetZaxis()->SetTitle("Vertex Z (cm)"); 
914         fOutput->Add(fK0sdPhidEtaMC[jj*kN1+k]);
915       }
916   
917       // Reconstruction level:
918       for(Int_t ll=0;ll<kNVtxZ;ll++){
919         snprintf(hNameHist,100, "fK0sdPhidEtaPtL_%.2f_%.2f_Cent_%.0f_%.0f_%d",kPtBinV0[k],kPtBinV0[k+1],kBinCent[jj],kBinCent[jj+1],ll); 
920         fK0sdPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll] = new TH3F(hNameHist,"K^{0}_{S}: #Delta#varphi vs #Delta#eta vs Inv. Mass",
921                                              nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
922                                              nbinsdEta,-1.5,1.5,
923                                              nbins,0.398,0.598);
924         fK0sdPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetXaxis()->SetTitle("#Delta#varphi (rad)"); 
925         fK0sdPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetYaxis()->SetTitle("#Delta#eta"); 
926         fK0sdPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetZaxis()->SetTitle("Inv. Mass"); 
927         fOutput->Add(fK0sdPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]);
928       }
929     }
930   }
931
932   // Correlations (side-band):
933   fK0sBckgDecLength
934     = new TH2F("fK0sBckgDecLength","K^{0}_{S} Bckg: c#tau vs. p_{T,l}",
935                100,0.,15.,nbinPtLP,pMin,ptMaxLP);
936   fK0sBckgDecLength->GetXaxis()->SetTitle("c#tau (cm)"); 
937   fK0sBckgDecLength->GetYaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
938   fOutput->Add(fK0sBckgDecLength);
939
940   fK0sBckgDCADaugToPrimVtx  
941     = new TH3F("fK0sBckgDCADaugToPrimVtx","K^{0}_{S} Bckg: dca daughter vs. p_{T,l}",
942                90,0.,3.3,90,0.,3.3,nbinPtLP,pMin,ptMaxLP);
943   fK0sBckgDCADaugToPrimVtx->GetXaxis()->SetTitle("DCA Pos daug (cm)"); 
944   fK0sBckgDCADaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg daug (cm)"); 
945   fK0sBckgDCADaugToPrimVtx->GetZaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
946   fOutput->Add(fK0sBckgDCADaugToPrimVtx);
947   
948   fK0sBckgEtaPhi = 
949     new TH2F("fK0sBckgEtaPhi","K^{0}_{s} Bckg: #varphi vs #eta",
950              nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.);
951   fK0sBckgEtaPhi->GetXaxis()->SetTitle("#varphi (rad)"); 
952   fK0sBckgEtaPhi->GetYaxis()->SetTitle("#eta"); 
953   fOutput->Add(fK0sBckgEtaPhi);
954
955   fK0sBckgPhiRadio
956     = new TH2F("fK0sBckgPhiRadio","K^{0}_{S} Bckg: #varphi vs l_{T}",
957                nbinsPhi,0.,2.*TMath::Pi(),2*nbins,lMin,lMax);
958   fK0sBckgPhiRadio->GetXaxis()->SetTitle("#varphi (rad)"); 
959   fK0sBckgPhiRadio->GetYaxis()->SetTitle("l_{T} (cm)"); 
960   fOutput->Add(fK0sBckgPhiRadio);
961  
962   fK0sBckgDCANegDaugToPrimVtx  
963     = new TH2F("fK0sBckgDCANegDaugToPrimVtx","K^{0}_{S} Bckg: dca NegDaughter",
964                7,-0.5,6.5,90,0.,3.3);
965   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetTitle("MC Production"); 
966   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(1,"Rec");
967   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(2,"Primary");
968   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(3,"V0's");
969   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(4,"Cascades");
970   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(5,"Gamma conv.");
971   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(6,"Unidentified mother");
972   fK0sBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(7,"Other");
973   fK0sBckgDCANegDaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg Daug (cm)"); 
974   fOutput->Add(fK0sBckgDCANegDaugToPrimVtx);
975
976   fK0sBckgDCAPosDaugToPrimVtx  
977     = new TH2F("fK0sBckgDCAPosDaugToPrimVtx","K^{0}_{S} Bckg: dca PosDaughter",
978                7,-0.5,6.5,90,0.,3.3);
979   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetTitle("MC Production"); 
980   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(1,"Rec");
981   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(2,"Primary");
982   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(3,"V0's");
983   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(4,"Cascades");
984   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(5,"Gamma conv.");
985   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(6,"Unidentified mother");
986   fK0sBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(7,"Other");
987   fK0sBckgDCAPosDaugToPrimVtx->GetYaxis()->SetTitle("DCA Pos Daug (cm)"); 
988   fOutput->Add(fK0sBckgDCAPosDaugToPrimVtx);
989         
990   fV0MassCascade
991     = new TH2F("fV0MassCascade","Cascade Reconstruction wi V0's candiates;Invariant Mass (GeV/c^{2});Cascade type",650, 1.2, 2.5,12,0.5,12.5);
992   fOutput->Add(fV0MassCascade);
993
994
995   // ****** Lambda ******
996   fLambdaMass = 
997     new TH3F("fLambdaMass","Mass vs #it{p}_{T} for \\Lambda",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
998   fLambdaMass->GetXaxis()->SetTitle("Mass (GeV/c^2)");
999   fLambdaMass->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); 
1000   fLambdaMass->GetZaxis()->SetTitle("centrality"); 
1001   fOutput->Add(fLambdaMass);
1002   
1003   fLambdaMassEmbeded =
1004     new TH3F("fLambdaMassEmbeded","Mass vs #it{p}_{T} for \\Lambda Embeded",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1005   fLambdaMassEmbeded->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1006   fLambdaMassEmbeded->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
1007   fLambdaMassEmbeded->GetZaxis()->SetTitle("centrality");
1008   fOutput->Add(fLambdaMassEmbeded);
1009
1010   fLambdaMass2 =
1011     new TH3F("fLambdaMass2","Mass vs #it{p}_{T} for \\Lambda",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1012   fLambdaMass2->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1013   fLambdaMass2->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
1014   fLambdaMass2->GetZaxis()->SetTitle("centrality");
1015   fOutput->Add(fLambdaMass2);
1016
1017   fLambdaMass2Embeded =
1018     new TH3F("fLambdaMass2Embeded","Mass vs #it{p}_{T} for \\Lambda Embeded",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1019   fLambdaMass2Embeded->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1020   fLambdaMass2Embeded->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
1021   fLambdaMass2Embeded->GetZaxis()->SetTitle("centrality");
1022   fOutput->Add(fLambdaMass2Embeded);
1023
1024   fLambdaMassPtEta =
1025     new TH3F("fLambdaMassPtEta","\\Lambda: mass vs #it{p}_{T} vs #eta;Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});#eta",
1026              nbins,1.065,1.165,nbins,pMin,pMax,20,-1.0,1.0);
1027   fOutput->Add(fLambdaMassPtEta);
1028
1029   for(Int_t i=0; i<kNCent; i++){
1030     fLambdaMassPtRap[i] =
1031       new TH3F(Form("fLambdaMassPtRap_cent_%.0lf_%.0lf",kBinCent[i],kBinCent[i+1]),"\\Lambda: mass vs #it{p}_{T} vs y;Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});y",
1032                nbins,1.065,1.165,nbins,pMin,pMax,20,-1.0,1.0);
1033     fOutput->Add(fLambdaMassPtRap[i]);
1034   }
1035
1036   fLambdaMassPtPhi  = 
1037     new TH3F("fLambdaMassPtPhi","#Lambda: mass vs #it{p}_{T} vs #varphi;Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});#varphi (rad)",
1038              nbins,1.065,1.165,nbins,pMin,pMax,nbinsPhi,0.,2.*TMath::Pi());
1039   fOutput->Add(fLambdaMassPtPhi);
1040
1041   // Correlations:
1042   fLambdaDCADaugToPrimVtx  
1043     = new TH3F("fLambdaDCADaugToPrimVtx","#Lambda Bckg: dca daughter vs. p_{T,l}",
1044                90,0.,3.3,90,0.,3.3,nbinPtLP,pMin,ptMaxLP);
1045   fLambdaDCADaugToPrimVtx->GetXaxis()->SetTitle("DCA Pos daug (cm)"); 
1046   fLambdaDCADaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg daug (cm)"); 
1047   fLambdaDCADaugToPrimVtx->GetZaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
1048   fOutput->Add(fLambdaDCADaugToPrimVtx);
1049
1050   //    Spatial Resoltuion between trigger- and asosciated- particles
1051   fLambdaSpatialRes = new TH3F("fLambdaSpatialRes","#Lambda: Spatial resolution;#Delta#varphi (rad);trig-assoc. resolution (cm);dec. length (cm)",
1052                                20,-0.1,0.1,100,0.,10,2*nbins,lMin,lMax);
1053   fOutput->Add(fLambdaSpatialRes);
1054
1055
1056   for(Int_t jj=0;jj<kNCent;jj++){
1057     for(Int_t k=0;k<kN1;k++){
1058
1059       // Monte-Carlo level:
1060       if(fIsMC){
1061         snprintf(hNameHist,100, "fLambdadPhidEtaMC_%.2f_%.2f_Cent_%.0f_%.0f",kPtBinV0[k],kPtBinV0[k+1],kBinCent[jj],kBinCent[jj+1]); 
1062         fLambdadPhidEtaMC[jj*kN1+k] = new TH3F(hNameHist,"#Lambda MC: #Delta#varphi vs #Delta#eta vs p_{T,l}",
1063                                                nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1064                                                nbinsdEta,-1.5,1.5,
1065                                                nbinsVtx,-10.,10.);
1066         fLambdadPhidEtaMC[jj*kN1+k]->GetXaxis()->SetTitle("#Delta#varphi (rad)"); 
1067         fLambdadPhidEtaMC[jj*kN1+k]->GetYaxis()->SetTitle("#Delta#eta"); 
1068         fLambdadPhidEtaMC[jj*kN1+k]->GetZaxis()->SetTitle("Vertex Z (cm)"); 
1069         fOutput->Add(fLambdadPhidEtaMC[jj*kN1+k]);
1070       }
1071
1072       // Reconstruction level:
1073       for(Int_t ll=0;ll<kNVtxZ;ll++){
1074         snprintf(hNameHist,100, "fLambdadPhidEtaPtL_%.2f_%.2f_Cent_%.0f_%.0f_%d",kPtBinV0[k],kPtBinV0[k+1],kBinCent[jj],kBinCent[jj+1],ll); 
1075         fLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll] = new TH3F(hNameHist,"#Lambda: #Delta#varphi vs #Delta#eta vs p_{T,l}",
1076                                                                       nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1077                                                                       nbinsdEta,-1.5,1.5,
1078                                                                       nbins,1.065,1.165);
1079         fLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetXaxis()->SetTitle("#Delta#varphi (rad)"); 
1080         fLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetYaxis()->SetTitle("#Delta#eta"); 
1081         fLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetZaxis()->SetTitle("Inv. Mass");
1082         fOutput->Add(fLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]);
1083       }
1084     }
1085   }
1086
1087   // Correlations (side-band):
1088   fLambdaBckgDecLength
1089     = new TH2F("fLambdaBckgDecLength","#Lambda Bckg: c#tau vs. p_{T,l}",
1090                100,0.,25.,nbinPtLP,pMin,ptMaxLP);
1091   fLambdaBckgDecLength->GetXaxis()->SetTitle("c#tau (cm)"); 
1092   fLambdaBckgDecLength->GetYaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
1093   fOutput->Add(fLambdaBckgDecLength);
1094   
1095   fLambdaBckgDCADaugToPrimVtx  
1096     = new TH3F("fLambdaBckgDCADaugToPrimVtx","#Lambda Bckg: dca daughter vs. p_{T,l}",
1097                90,0.,3.3,90,0.,3.3,nbinPtLP,pMin,ptMaxLP);
1098   fLambdaBckgDCADaugToPrimVtx->GetXaxis()->SetTitle("DCA Pos daug (cm)"); 
1099   fLambdaBckgDCADaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg daug (cm)"); 
1100   fLambdaBckgDCADaugToPrimVtx->GetZaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
1101   fOutput->Add(fLambdaBckgDCADaugToPrimVtx);
1102   
1103   fLambdaBckgEtaPhi = 
1104     new TH2F("fLambdaBckgEtaPhi","#Lambda Bckg: #varphi vs #eta",
1105              nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.);
1106   fLambdaBckgEtaPhi->GetXaxis()->SetTitle("#varphi (rad)"); 
1107   fLambdaBckgEtaPhi->GetYaxis()->SetTitle("#eta"); 
1108   fOutput->Add(fLambdaBckgEtaPhi);
1109     
1110   fLambdaBckgPhiRadio
1111     = new TH2F("fLambdaBckgPhiRadio","#Lambda Bckg: #varphi vs l_{T}",
1112                nbinsPhi,0.,2.*TMath::Pi(),2*nbins,lMin,lMax);
1113   fLambdaBckgPhiRadio->GetXaxis()->SetTitle("#varphi (rad)"); 
1114   fLambdaBckgPhiRadio->GetYaxis()->SetTitle("l_{T} (cm)"); 
1115   fOutput->Add(fLambdaBckgPhiRadio);
1116
1117
1118   fLambdaBckgDCANegDaugToPrimVtx  
1119     = new TH2F("fLambdaBckgDCANegDaugToPrimVtx","#Lambda Bckg: dca NegDaughter",
1120                7,-0.5,6.5,90,0.,3.3);
1121   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetTitle("MC Production"); 
1122   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(1,"Rec");
1123   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(2,"Primary");
1124   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(3,"V0's");
1125   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(4,"Cascades");
1126   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(5,"Gamma conv.");
1127   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(6,"Unidentified mother");
1128   fLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(7,"Other");
1129   fLambdaBckgDCANegDaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg Daug (cm)"); 
1130   fOutput->Add(fLambdaBckgDCANegDaugToPrimVtx);
1131
1132
1133   fLambdaBckgDCAPosDaugToPrimVtx  
1134     = new TH2F("fLambdaBckgDCAPosDaugToPrimVtx","#Lambda Bckg: dca PosDaughter",
1135                7,-0.5,6.5,90,0.,3.3);
1136   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetTitle("MC Production"); 
1137   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(1,"Rec");
1138   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(2,"Primary");
1139   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(3,"V0's");
1140   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(4,"Cascades");
1141   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(5,"Gamma conv.");
1142   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(6,"Unidentified mother");
1143   fLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(7,"Other");
1144   fLambdaBckgDCAPosDaugToPrimVtx->GetYaxis()->SetTitle("DCA Pos Daug (cm)"); 
1145   fOutput->Add(fLambdaBckgDCAPosDaugToPrimVtx);
1146
1147
1148   // ****** AntiLambda ******
1149   fAntiLambdaMass = 
1150     new TH3F("fAntiLambdaMass","Mass vs #it{p}_{T} for #bar{#Lambda}",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1151   fAntiLambdaMass->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1152   fAntiLambdaMass->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); 
1153   fAntiLambdaMass->GetZaxis()->SetTitle("centrality"); 
1154   fOutput->Add(fAntiLambdaMass);
1155   
1156   fAntiLambdaMassEmbeded =
1157     new TH3F("fAntiLambdaMassEmbeded","Mass vs #it{p}_{T} for #bar{#Lambda} Embeded",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1158   fAntiLambdaMassEmbeded->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1159   fAntiLambdaMassEmbeded->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
1160   fAntiLambdaMassEmbeded->GetZaxis()->SetTitle("centrality");
1161   fOutput->Add(fAntiLambdaMassEmbeded);
1162
1163   fAntiLambdaMass2 =
1164     new TH3F("fAntiLambdaMass2","Mass vs #it{p}_{T} for #bar{#Lambda}",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1165   fAntiLambdaMass2->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1166   fAntiLambdaMass2->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
1167   fAntiLambdaMass2->GetZaxis()->SetTitle("centrality");
1168   fOutput->Add(fAntiLambdaMass2);  
1169
1170   fAntiLambdaMass2Embeded =
1171     new TH3F("fAntiLambdaMass2Embeded","Mass vs #it{p}_{T} for #bar{#Lambda} Embeded",nbins,1.065,1.165,nbins,pMin,pMax,100,0.,100.);
1172   fAntiLambdaMass2Embeded->GetXaxis()->SetTitle("Mass (GeV/c^2)");
1173   fAntiLambdaMass2Embeded->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
1174   fAntiLambdaMass2Embeded->GetZaxis()->SetTitle("centrality");
1175   fOutput->Add(fAntiLambdaMass2Embeded);  
1176
1177   fAntiLambdaMassPtEta =
1178     new TH3F("fAntiLambdaMassPtEta","#bar{#Lambda}: mass vs #it{p}_{T} vs #eta;Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});#eta",nbins,1.065,1.165,nbins,pMin,pMax,20,-1.0,1.0);
1179   fOutput->Add(fAntiLambdaMassPtEta);
1180
1181   for(Int_t i=0; i<kNCent; i++){
1182     fAntiLambdaMassPtRap[i] =
1183       new TH3F(Form("fAntiLambdaMassPtRap_cent_%.0lf_%.0lf",kBinCent[i],kBinCent[i+1]),"#bar{#Lambda}: mass vs #it{p}_{T} vs y;Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});y",nbins,1.065,1.165,nbins,pMin,pMax,20,-1.0,1.0);
1184     fOutput->Add(fAntiLambdaMassPtRap[i]);
1185   }
1186
1187   fAntiLambdaMassPtPhi  = 
1188     new TH3F("fAntiLambdaMassPtPhi","#bar{#Lambda}: mass vs #it{p}_{T} vs #varphi;Mass (GeV/#it{c}^2);#it{p}_{T} (GeV/#it{c});#varphi (rad)",
1189              nbins,1.065,1.165,nbins,pMin,pMax,nbinsPhi,0.,2.*TMath::Pi());
1190   fOutput->Add(fAntiLambdaMassPtPhi);
1191
1192
1193   // Correlations:
1194   fAntiLambdaDCADaugToPrimVtx  
1195     = new TH3F("fAntiLambdaDCADaugToPrimVtx","#bar{#Lambda} Bckg: dca daughter vs. p_{T,l}",
1196                90,0.,3.3,90,0.,3.3,nbinPtLP,pMin,ptMaxLP);
1197   fAntiLambdaDCADaugToPrimVtx->GetXaxis()->SetTitle("DCA Pos daug (cm)"); 
1198   fAntiLambdaDCADaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg daug (cm)"); 
1199   fAntiLambdaDCADaugToPrimVtx->GetZaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
1200   fOutput->Add(fAntiLambdaDCADaugToPrimVtx);
1201
1202   //    Spatial Resoltuion between trigger- and asosciated- particles
1203   fAntiLambdaSpatialRes = new TH3F("fAntiLambdaSpatialRes","#bar{#Lambda}: Spatial resolution;#Delta#varphi (rad);trig-assoc. resolution (cm);dec. length (cm)",
1204                                    20,-0.1,0.1,100,0.,10,2*nbins,lMin,lMax);
1205   fOutput->Add(fAntiLambdaSpatialRes);
1206
1207   for(Int_t jj=0;jj<kNCent;jj++){
1208     for(Int_t k=0;k<kN1;k++){
1209
1210       // Monte-Carlo level:
1211       if(fIsMC){
1212         snprintf(hNameHist,100, "fAntiLambdadPhidEtaMC_%.2f_%.2f_Cent_%.0f_%.0f",kPtBinV0[k],kPtBinV0[k+1],kBinCent[jj],kBinCent[jj+1]); 
1213         fAntiLambdadPhidEtaMC[jj*kN1+k] = new TH3F(hNameHist,"#bar{#Lambda} MC: #Delta#varphi vs #Delta#eta vs p_{T,l}",
1214                                                    nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1215                                                    nbinsdEta,-1.5,1.5,
1216                                                    nbinsVtx,-10.,10.);
1217         fAntiLambdadPhidEtaMC[jj*kN1+k]->GetXaxis()->SetTitle("#Delta#varphi (rad)"); 
1218         fAntiLambdadPhidEtaMC[jj*kN1+k]->GetYaxis()->SetTitle("#Delta#eta"); 
1219         fAntiLambdadPhidEtaMC[jj*kN1+k]->GetZaxis()->SetTitle("Vertex Z (cm)"); 
1220         fOutput->Add(fAntiLambdadPhidEtaMC[jj*kN1+k]);
1221       }
1222
1223       // Reconstruction level:
1224       for(Int_t ll=0;ll<kNVtxZ;ll++){
1225         snprintf(hNameHist,100, "fAntiLambdadPhidEtaPtL_%.2f_%.2f_Cent_%.0f_%.0f_%d",kPtBinV0[k],kPtBinV0[k+1],kBinCent[jj],kBinCent[jj+1],ll); 
1226         fAntiLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll] = new TH3F(hNameHist,"#bar{#Lambda}: #Delta#varphi vs #Delta#eta vs p_{T,l}",
1227                                                                           nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1228                                                                           nbinsdEta,-1.5,1.5,
1229                                                                           nbins,1.065,1.165);
1230         fAntiLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetXaxis()->SetTitle("#Delta#varphi (rad)"); 
1231         fAntiLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetYaxis()->SetTitle("#Delta#eta"); 
1232         fAntiLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]->GetZaxis()->SetTitle("Inv. Mass");
1233         fOutput->Add(fAntiLambdadPhidEtaPtL[jj*kN1*kNVtxZ  + k*kNVtxZ + ll]);
1234       }
1235     }
1236   }
1237
1238   // Correlations (side-band):
1239   fAntiLambdaBckgDecLength
1240     = new TH2F("fAntiLambdaBckgDecLength","#bar{#Lambda} Bckg: c#tau vs. p_{T,l}",
1241                100,0.,25.,nbinPtLP,pMin,ptMaxLP);
1242   fAntiLambdaBckgDecLength->GetXaxis()->SetTitle("c#tau (cm)"); 
1243   fAntiLambdaBckgDecLength->GetYaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
1244   fOutput->Add(fAntiLambdaBckgDecLength);
1245   
1246   fAntiLambdaBckgDCADaugToPrimVtx  
1247     = new TH3F("fAntiLambdaBckgDCADaugToPrimVtx","#bar{#Lambda} Bckg: dca daughter vs. p_{T,l}",
1248                90,0.,3.3,90,0.,3.3,nbinPtLP,pMin,ptMaxLP);
1249   fAntiLambdaBckgDCADaugToPrimVtx->GetXaxis()->SetTitle("DCA Pos daug (cm)"); 
1250   fAntiLambdaBckgDCADaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg daug (cm)"); 
1251   fAntiLambdaBckgDCADaugToPrimVtx->GetZaxis()->SetTitle("p_{T,l} (GeV/#it{c})"); 
1252   fOutput->Add(fAntiLambdaBckgDCADaugToPrimVtx);
1253   
1254   fAntiLambdaBckgEtaPhi = 
1255     new TH2F("fAntiLambdaBckgEtaPhi","#bar{#Lambda} Bckg: #varphi vs #eta;#varphi (rad);l_{T} (cm)",
1256              nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.);
1257   fOutput->Add(fAntiLambdaBckgEtaPhi);
1258     
1259   fAntiLambdaBckgPhiRadio
1260     = new TH2F("fAntiLambdaBckgPhiRadio","#bar{#Lambda} Bckg: #varphi vs l_{T};#varphi (rad);l_{T} (cm)",
1261                nbinsPhi,0.,2.*TMath::Pi(),2*nbins,lMin,lMax);
1262   fOutput->Add(fAntiLambdaBckgPhiRadio);
1263
1264
1265   fAntiLambdaBckgDCANegDaugToPrimVtx  
1266     = new TH2F("fAntiLambdaBckgDCANegDaugToPrimVtx","#bar{#Lambda} Bckg: dca NegDaughter",
1267                7,-0.5,6.5,90,0.,3.3);
1268   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetTitle("MC Production"); 
1269   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(1,"Rec");
1270   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(2,"Primary");
1271   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(3,"V0's");
1272   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(4,"Cascades");
1273   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(5,"Gamma conv.");
1274   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(6,"Unidentified mother");
1275   fAntiLambdaBckgDCANegDaugToPrimVtx->GetXaxis()->SetBinLabel(7,"Other");
1276   fAntiLambdaBckgDCANegDaugToPrimVtx->GetYaxis()->SetTitle("DCA Neg Daug (cm)"); 
1277   fOutput->Add(fAntiLambdaBckgDCANegDaugToPrimVtx);
1278
1279
1280   fAntiLambdaBckgDCAPosDaugToPrimVtx  
1281     = new TH2F("fAntiLambdaBckgDCAPosDaugToPrimVtx","#bar{#Lambda} Bckg: dca PosDaughter",
1282                7,-0.5,6.5,90,0.,3.3);
1283   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetTitle("MC Production"); 
1284   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(1,"Rec");
1285   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(2,"Primary");
1286   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(3,"V0's");
1287   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(4,"Cascades");
1288   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(5,"Gamma conv.");
1289   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(6,"Unidentified mother");
1290   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetXaxis()->SetBinLabel(7,"Other");
1291   fAntiLambdaBckgDCAPosDaugToPrimVtx->GetYaxis()->SetTitle("DCA Pos Daug (cm)"); 
1292   fOutput->Add(fAntiLambdaBckgDCAPosDaugToPrimVtx);
1293
1294
1295   // ============================================================= //
1296
1297   // K0s in ME:  
1298   for(Int_t ll=0;ll<kNCent;ll++){
1299     for(Int_t k=0;k<kN1;k++){
1300       for(Int_t j=0;j<kNVtxZ;j++){
1301       
1302         snprintf(hNameHist,100,"fK0sdPhidEtaME_%.2f_%.2f_%.0f_%.0f_%d",kPtBinV0[k],kPtBinV0[k+1],kBinCent[ll],kBinCent[ll+1],j);                  
1303         fK0sdPhidEtaME[ll*kN1*kNVtxZ + k*kNVtxZ + j] = new TH2F(hNameHist,"K^{0}_{S}: #Delta#varphi vs #Delta#eta in ME;#Delta#varphi (rad);#Delta#eta",
1304                                                                 nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1305                                                                 nbinsdEta,-1.5,1.5);
1306         fOutputME->Add(fK0sdPhidEtaME[ll*kN1*kNVtxZ + k*kNVtxZ + j]);
1307       }
1308     }
1309   }
1310
1311   // Lambda in ME:  
1312   for(Int_t ll=0;ll<kNCent;ll++){
1313     for(Int_t k=0;k<kN1;k++){
1314       for(Int_t j=0;j<kNVtxZ;j++){
1315
1316         snprintf(hNameHist,100,"fLambdadPhidEtaME_%.2f_%.2f_%.0lf_%.0lf_%d",kPtBinV0[k],kPtBinV0[k+1],kBinCent[ll],kBinCent[ll+1],j);
1317         fLambdadPhidEtaME[ll*kN1*kNVtxZ + k*kNVtxZ + j] = new TH2F(hNameHist,"#Lambda: #Delta#varphi vs #Delta#eta in ME;#Delta#varphi (rad);#Delta#eta",
1318                                                                    nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1319                                                                    nbinsdEta,-1.5,1.5);
1320         fOutputME->Add(fLambdadPhidEtaME[ll*kN1*kNVtxZ + k*kNVtxZ + j]);
1321       }
1322     }
1323   }
1324
1325   // AntiLambda in ME:
1326   for(Int_t ll=0;ll<kNCent;ll++){
1327     for(Int_t k=0;k<kN1;k++){
1328       for(Int_t j=0;j<kNVtxZ;j++){
1329
1330         snprintf(hNameHist,100,"fAntiLambdadPhidEtaME_%.2f_%.2f_%.0lf_%.0lf_%d",kPtBinV0[k],kPtBinV0[k+1],kBinCent[ll],kBinCent[ll+1],j);
1331         fAntiLambdadPhidEtaME[ll*kN1*kNVtxZ + k*kNVtxZ + j] = new TH2F(hNameHist,"#bar{#Lambda}: #Delta#varphi vs #Delta#eta in ME;#Delta#varphi (rad);#Delta#eta",
1332                                                                        nbinsdPhi,-TMath::PiOver2(),3*TMath::PiOver2(),
1333                                                                        nbinsdEta,-1.5,1.5);
1334         fOutputME->Add(fAntiLambdadPhidEtaME[ll*kN1*kNVtxZ + k*kNVtxZ + j]);
1335       }
1336     }
1337   }
1338
1339   
1340   // ============================================================= //
1341
1342   if(fDoQA){
1343
1344     // ----------------------------
1345     // Quality Assurance K0s:
1346
1347     // Transverse momentum:
1348     //     --- signal ---
1349     fK0sPtPosDaug =
1350       new TH2F("fK0sPtPosDaug","K^{0}_{S}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1351     fOutputQA->Add(fK0sPtPosDaug);
1352
1353     fK0sPtNegDaug =
1354       new TH2F("fK0sPtNegDaug","K^{0}_{S}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1355     fOutputQA->Add(fK0sPtNegDaug);
1356
1357     //     --- background ---
1358     fK0sBckgPtPosDaug =
1359       new TH2F("fK0sBckgPtPosDaug","K^{0}_{S}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1360     fOutputQA->Add(fK0sBckgPtPosDaug);
1361
1362     fK0sBckgPtNegDaug =
1363       new TH2F("fK0sBckgPtNegDaug","K^{0}_{S}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1364     fOutputQA->Add(fK0sBckgPtNegDaug);
1365
1366     // Phi Eta
1367     //     --- signal ---
1368     fK0sPhiEtaPosDaug = 
1369       new TH3F("fK0sPhiEtaPosDaug","K^{0}_{S}: #varphi vs #eta Pos. Daug.;#varphi;#eta;#it{p}_{T} V0",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1370     fOutputQA->Add(fK0sPhiEtaPosDaug);
1371
1372     fK0sPhiEtaNegDaug  = 
1373       new TH3F("fK0sPhiEtaNegDaug","K^{0}_{S}: #varphi vs #eta Neg. Daug.;#varphi;#eta;#it{p}_{T} V0",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1374     fOutputQA->Add(fK0sPhiEtaNegDaug);
1375
1376     //     --- background ---
1377     fK0sBckgPhiEtaPosDaug = 
1378       new TH3F("fK0sBckgPhiEtaPosDaug","K^{0}_{S} Bckg: #varphi vs #eta Pos. Daug.;#varphi;#eta;#it{p}_{T} V0",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1379     fOutputQA->Add(fK0sBckgPhiEtaPosDaug);
1380
1381     fK0sBckgPhiEtaNegDaug  = 
1382       new TH3F("fK0sBckgPhiEtaNegDaug","K^{0}_{S} Bckg: #varphi vs #eta Neg. Daug.;#varphi;#eta;#it{p}_{T} V0",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1383     fOutputQA->Add(fK0sBckgPhiEtaNegDaug);
1384
1385     // Distance of closest approach:
1386     //     --- signal ---
1387     fK0sDCAPosDaug = 
1388       new TH2F("fK0sDCAPosDaug","K^{0}_{S}: dca Pos;dca;#it{p}_{T} V0",66,0.,3.3,nbins,pMin,pMax);
1389     fOutputQA->Add(fK0sDCAPosDaug);
1390
1391     fK0sDCANegDaug =  
1392       new TH2F("fK0sDCANegDaug","K^{0}_{S}: dca Neg;dca;#it{p}_{T} V0",66,0.,3.3,nbins,pMin,pMax);
1393     fOutputQA->Add(fK0sDCANegDaug);
1394     
1395     //     --- background ---
1396     fK0sBckgDCAPosDaug = 
1397       new TH2F("fK0sBckgDCAPosDaug","K^{0}_{S} Bckg: dca Pos;dca;#it{p}_{T} V0",66,0.,3.3,nbins,pMin,pMax);
1398     fOutputQA->Add(fK0sBckgDCAPosDaug);
1399
1400     fK0sBckgDCANegDaug =  
1401       new TH2F("fK0sBckgDCANegDaug","K^{0}_{S} Bckg: dca Neg;dca;#it{p}_{T} V0",66,0.,3.3,nbins,pMin,pMax);
1402     fOutputQA->Add(fK0sBckgDCANegDaug);
1403
1404     // Decay vertex reconstruction:
1405     //     --- signal ---
1406     fK0sDecayPos  =  
1407       new TH3F("fK0sDecayPos","K^{0}_{S}: Position of Dec. Vtx",200,-100.,100.,200,-100.,100.,nbins,pMin,pMax);
1408     fK0sDecayPos->GetXaxis()->SetTitle("Pos. X"); 
1409     fK0sDecayPos->GetYaxis()->SetTitle("Pos. Y"); 
1410     fK0sDecayPos->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1411     fOutputQA->Add(fK0sDecayPos);
1412
1413     fK0sDecayVertex  =  
1414       new TH2F("fK0sDecayVertex","K^{0}_{S}: decay length",100,0.,100.,nbins,pMin,pMax);
1415     fK0sDecayVertex->GetXaxis()->SetTitle("l_{T}"); 
1416     fK0sDecayVertex->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1417     fOutputQA->Add(fK0sDecayVertex);
1418
1419     //     --- background ---
1420     fK0sBckgDecayPos  =  
1421       new TH3F("fK0sBckgDecayPos","K^{0}_{S}: Position of Dec. Vtx",200,-100.,100.,200,-100.,100.,nbins,pMin,pMax);
1422     fK0sBckgDecayPos->GetXaxis()->SetTitle("Pos. X"); 
1423     fK0sBckgDecayPos->GetYaxis()->SetTitle("Pos. Y"); 
1424     fK0sBckgDecayPos->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1425     fOutputQA->Add(fK0sBckgDecayPos);
1426
1427     fK0sBckgDecayVertex  =  
1428       new TH2F("fK0sBckgDecayVertex","K^{0}_{S} Bckg: decay vertex",100,0.,100.,nbins,pMin,pMax);
1429     fK0sBckgDecayVertex->GetXaxis()->SetTitle("l_{T}"); 
1430     fK0sBckgDecayVertex->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1431     fOutputQA->Add(fK0sBckgDecayVertex);
1432
1433     // Cosine of the Pointing Angle:
1434     //     --- signal ---
1435     fK0sCPA  =  
1436       new TH2F("fK0sCPA","K^{0}_{S}: cosine of the pointing angle",100,0.98,1.,nbins,pMin,pMax);
1437     fK0sCPA->GetXaxis()->SetTitle("cpa"); 
1438     fK0sCPA->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1439     fOutputQA->Add(fK0sCPA);
1440     //     --- background ---
1441     fK0sBckgCPA  =  
1442       new TH2F("fK0sBckgCPA","K^{0}_{S} Bckg: cosine of the pointing angle",100,0.98,1.,nbins,pMin,pMax);
1443     fK0sBckgCPA->GetXaxis()->SetTitle("cpa"); 
1444     fK0sBckgCPA->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1445     fOutputQA->Add(fK0sBckgCPA);
1446
1447     // DCA between daughters:
1448     //     --- signal ---
1449     fK0sDCAV0Daug  =  
1450       new TH2F("fK0sDCAV0Daug","K^{0}_{S}: DCA daughters",60,0,1.2,nbins,pMin,pMax);
1451     fK0sDCAV0Daug->GetXaxis()->SetTitle("dca between daughters"); 
1452     fK0sDCAV0Daug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1453     fOutputQA->Add(fK0sDCAV0Daug);
1454     //     --- background ---
1455     fK0sBckgDCAV0Daug  =  
1456       new TH2F("fK0sBckgDCAV0Daug","K^{0}_{S} Bckg: DCA daughters",60,0,1.2,nbins,pMin,pMax);
1457     fK0sBckgDCAV0Daug->GetXaxis()->SetTitle("dca between daughters"); 
1458     fK0sBckgDCAV0Daug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1459     fOutputQA->Add(fK0sBckgDCAV0Daug);
1460
1461     // Number of TPC clusters:
1462     //     --- signal ---
1463     fK0sNClustersTPC =  // Positive momentum to positive daugther - Negative momentum to negative daugther 
1464       new TH3F("fK0sNClustersTPC","K^{0}_{S};#varphi;Num. TPC Clusters; #it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),181,0.5,180.5,nbins,-pMax,pMax); 
1465     fOutputQA->Add(fK0sNClustersTPC);
1466     //     --- background ---
1467     fK0sBckgNClustersTPC =  // Positive momentum to positive daugther - Negative momentum to negative daugther 
1468       new TH3F("fK0sBckgNClustersTPC","K^{0}_{S} Bckg;#varphi;Num. TPC Clusters; #it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),181,0.5,180.5,nbins,-pMax,pMax); 
1469     fOutputQA->Add(fK0sBckgNClustersTPC);
1470  
1471     // Number of ITS clusters:
1472     //     --- signal ---
1473     fK0sNClustersITSPos = 
1474       new TH3F("fK0sNClustersITSPos","K^{0}_{S}: Pos. Daug;#varphi;Num. ITS Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1475     fOutputQA->Add(fK0sNClustersITSPos);
1476
1477     fK0sNClustersITSNeg = 
1478       new TH3F("fK0sNClustersITSNeg","K^{0}_{S}: Neg. Daug;#varphi;Num. ITS Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1479     fOutputQA->Add(fK0sNClustersITSNeg);
1480     //     --- background ---
1481     fK0sBckgNClustersITSPos = 
1482       new TH3F("fK0sBckgNClustersITSPos","K^{0}_{S} Bckg: Pos. Daug;#varphi;Num. ITS Clusters;;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1483     fOutputQA->Add(fK0sBckgNClustersITSPos);
1484
1485     fK0sBckgNClustersITSNeg = 
1486       new TH3F("fK0sBckgNClustersITSNeg","K^{0}_{S} Bckg: Neg. Daug;#varphi;Num. ITS Clusters;;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1487     fOutputQA->Add(fK0sBckgNClustersITSNeg);
1488   
1489     // ----------------------------
1490     // Quality Assurance Lambda:
1491
1492     // Transverse momentum:
1493     //     --- signal ---
1494     fLambdaPtPosDaug =
1495       new TH2F("fLambdaPtPosDaug","#Lambda: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1496     fOutputQA->Add(fLambdaPtPosDaug);
1497
1498     fLambdaPtNegDaug =
1499       new TH2F("fLambdaPtNegDaug","#Lambda: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1500     fOutputQA->Add(fLambdaPtNegDaug);
1501
1502     //     --- background ---
1503     fLambdaBckgPtPosDaug =
1504       new TH2F("fLambdaBckgPtPosDaug","#Lambda: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1505     fOutputQA->Add(fLambdaBckgPtPosDaug);
1506
1507     fLambdaBckgPtNegDaug =
1508       new TH2F("fLambdaBckgPtNegDaug","#Lambda: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1509     fOutputQA->Add(fLambdaBckgPtNegDaug);
1510
1511     // Phi Eta
1512     //     --- signal ---
1513     fLambdaPhiEtaPosDaug = 
1514       new TH3F("fLambdaPhiEtaPosDaug","#Lambda: #varphi vs #eta Pos. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1515     fLambdaPhiEtaPosDaug->GetXaxis()->SetTitle("#varphi"); 
1516     fLambdaPhiEtaPosDaug->GetYaxis()->SetTitle("#eta"); 
1517     fLambdaPhiEtaPosDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1518     fOutputQA->Add(fLambdaPhiEtaPosDaug);
1519
1520     fLambdaPhiEtaNegDaug  = 
1521       new TH3F("fLambdaPhiEtaNegDaug","#Lambda: #varphi vs #eta Neg. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1522     fLambdaPhiEtaNegDaug->GetXaxis()->SetTitle("#varphi"); 
1523     fLambdaPhiEtaNegDaug->GetYaxis()->SetTitle("#eta"); 
1524     fLambdaPhiEtaNegDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1525     fOutputQA->Add(fLambdaPhiEtaNegDaug);
1526
1527     //     --- background ---
1528     fLambdaBckgPhiEtaPosDaug = 
1529       new TH3F("fLambdaBckgPhiEtaPosDaug","#Lambda: #varphi vs #eta Pos. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1530     fLambdaBckgPhiEtaPosDaug->GetXaxis()->SetTitle("#varphi"); 
1531     fLambdaBckgPhiEtaPosDaug->GetYaxis()->SetTitle("#eta"); 
1532     fLambdaBckgPhiEtaPosDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1533     fOutputQA->Add(fLambdaBckgPhiEtaPosDaug);
1534
1535     fLambdaBckgPhiEtaNegDaug  = 
1536       new TH3F("fLambdaBckgPhiEtaNegDaug","#Lambda: #varphi vs #eta Neg. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1537     fLambdaBckgPhiEtaNegDaug->GetXaxis()->SetTitle("#varphi"); 
1538     fLambdaBckgPhiEtaNegDaug->GetYaxis()->SetTitle("#eta"); 
1539     fLambdaBckgPhiEtaNegDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1540     fOutputQA->Add(fLambdaBckgPhiEtaNegDaug);
1541
1542     // Distance of closest approach
1543     //     --- signal ---
1544     fLambdaDCAPosDaug = 
1545       new TH2F("fLambdaDCAPosDaug","#Lambda: dca Pos",66,0.,3.3,nbins,pMin,pMax);
1546     fLambdaDCAPosDaug->GetXaxis()->SetTitle("dca"); 
1547     fLambdaDCAPosDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1548     fOutputQA->Add(fLambdaDCAPosDaug);
1549
1550     fLambdaDCANegDaug =  
1551       new TH2F("fLambdaDCANegDaug","#Lambda: dca Neg",66,0.,3.3,nbins,pMin,pMax);
1552     fLambdaDCANegDaug->GetXaxis()->SetTitle("dca"); 
1553     fLambdaDCANegDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1554     fOutputQA->Add(fLambdaDCANegDaug);
1555     
1556     //     --- background ---
1557     fLambdaBckgDCAPosDaug = 
1558       new TH2F("fLambdaBckgDCAPosDaug","#Lambda Bckg: dca Pos",66,0.,3.3,nbins,pMin,pMax);
1559     fLambdaBckgDCAPosDaug->GetXaxis()->SetTitle("dca"); 
1560     fLambdaBckgDCAPosDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1561     fOutputQA->Add(fLambdaBckgDCAPosDaug);
1562
1563     fLambdaBckgDCANegDaug =  
1564       new TH2F("fLambdaBckgDCANegDaug","#Lambda Bckg: dca Neg",66,0.,3.3,nbins,pMin,pMax);
1565     fLambdaBckgDCANegDaug->GetXaxis()->SetTitle("dca"); 
1566     fLambdaBckgDCANegDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1567     fOutputQA->Add(fLambdaBckgDCANegDaug);
1568
1569
1570     // Decay vertex reconstruction
1571     //     --- signal ---
1572     fLambdaDecayPos  =  
1573       new TH3F("fLambdaDecayPos","#Lambda: Position of Dec. Vtx",200,-100.,100.,200,-100.,100.,nbins,pMin,pMax);
1574     fLambdaDecayPos->GetXaxis()->SetTitle("Pos. X"); 
1575     fLambdaDecayPos->GetYaxis()->SetTitle("Pos. Y"); 
1576     fLambdaDecayPos->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1577     fOutputQA->Add(fLambdaDecayPos);
1578
1579     fLambdaDecayVertex  =  
1580       new TH2F("fLambdaDecayVertex","#Lambda: decay length",100,0.,100.,nbins,pMin,pMax);
1581     fLambdaDecayVertex->GetXaxis()->SetTitle("l_{T}"); 
1582     fLambdaDecayVertex->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1583     fOutputQA->Add(fLambdaDecayVertex);
1584
1585     //     --- background ---
1586     fLambdaBckgDecayPos  =  
1587       new TH3F("fLambdaBckgDecayPos","#Lambda Bckg: Position of Dec. Vtx",200,-100.,100.,200,-100.,100.,nbins,pMin,pMax);
1588     fLambdaBckgDecayPos->GetXaxis()->SetTitle("Pos. X"); 
1589     fLambdaBckgDecayPos->GetYaxis()->SetTitle("Pos. Y"); 
1590     fLambdaBckgDecayPos->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1591     fOutputQA->Add(fLambdaBckgDecayPos);
1592
1593     fLambdaBckgDecayVertex  =  
1594       new TH2F("fLambdaBckgDecayVertex","#Lambda Bckg: decay length",100,0.,100.,nbins,pMin,pMax);
1595     fLambdaBckgDecayVertex->GetXaxis()->SetTitle("l_{T}"); 
1596     fLambdaBckgDecayVertex->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1597     fOutputQA->Add(fLambdaBckgDecayVertex);
1598
1599     // Cosine of the Pointing Angle
1600     //     --- signal ---
1601     fLambdaCPA  =  
1602       new TH2F("fLambdaCPA","#Lambda: cosine of the pointing angle",100,0.98,1.,nbins,pMin,pMax);
1603     fLambdaCPA->GetXaxis()->SetTitle("cpa"); 
1604     fLambdaCPA->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1605     fOutputQA->Add(fLambdaCPA);
1606     //     --- background ---
1607     fLambdaBckgCPA  =  
1608       new TH2F("fLambdaBckgCPA","#Lambda Bckg: cosine of the pointing angle",100,0.98,1.,nbins,pMin,pMax);
1609     fLambdaBckgCPA->GetXaxis()->SetTitle("cpa"); 
1610     fLambdaBckgCPA->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1611     fOutputQA->Add(fLambdaBckgCPA);
1612
1613     // DCA between daughters
1614     //     --- signal ---
1615     fLambdaDCAV0Daug  =  
1616       new TH2F("fLambdaDCAV0Daug","#Lambda: DCA daughters",60,0,1.2,nbins,pMin,pMax);
1617     fLambdaDCAV0Daug->GetXaxis()->SetTitle("dca between daughters"); 
1618     fLambdaDCAV0Daug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1619     fOutputQA->Add(fLambdaDCAV0Daug);
1620     //     --- background ---
1621     fLambdaBckgDCAV0Daug  =  
1622       new TH2F("fLambdaBckgDCAV0Daug","#Lambda Bckg: DCA daughters",60,0,1.2,nbins,pMin,pMax);
1623     fLambdaBckgDCAV0Daug->GetXaxis()->SetTitle("dca between daughters"); 
1624     fLambdaBckgDCAV0Daug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1625     fOutputQA->Add(fLambdaBckgDCAV0Daug);
1626   
1627     // Number of TPC clusters:
1628     //     --- signal ---
1629     fLambdaNClustersTPC = 
1630       new TH3F("fLambdaNClustersTPC","#Lambda;#varphi;Num. TPC Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),181,0.5,180.5,nbins,-pMax,pMax); 
1631     fOutputQA->Add(fLambdaNClustersTPC);
1632     //     --- background ---
1633     fLambdaBckgNClustersTPC = 
1634       new TH3F("fLambdaBckgNClustersTPC","#Lambda Bckg;#varphi;Num. TPC Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),181,0.5,180.5,nbins,-pMax,pMax); 
1635     fOutputQA->Add(fLambdaBckgNClustersTPC);
1636  
1637     // Number of ITS clusters:
1638     //     --- signal ---
1639     fLambdaNClustersITSPos = 
1640       new TH3F("fLambdaNClustersITSPos","#Lambda: Pos. Daug;#varphi;Num. ITS Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1641     fOutputQA->Add(fLambdaNClustersITSPos);
1642
1643     fLambdaNClustersITSNeg = 
1644       new TH3F("fLambdaNClustersITSNeg","#Lambda: Neg. Daug;#varphi;Num. ITS Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1645     fOutputQA->Add(fLambdaNClustersITSNeg);
1646     //     --- background ---
1647     fLambdaBckgNClustersITSPos = 
1648       new TH3F("fLambdaBckgNClustersITSPos","#Lambda Bckg: Pos. Daug;#varphi;Num. ITS Clusters;;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1649     fOutputQA->Add(fLambdaBckgNClustersITSPos);
1650
1651     fLambdaBckgNClustersITSNeg = 
1652       new TH3F("fLambdaBckgNClustersITSNeg","#Lambda Bckg: Neg. Daug;#varphi;Num. ITS Clusters;;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1653     fOutputQA->Add(fLambdaBckgNClustersITSNeg);
1654
1655
1656     // ----------------------------
1657     // Quality Assurance AntiLambda:
1658     // Transverse momentum:
1659     //     --- signal ---
1660     fAntiLambdaPtPosDaug =
1661       new TH2F("fAntiLambdaPtPosDaug","#bar{#Lambda}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1662     fOutputQA->Add(fAntiLambdaPtPosDaug);
1663
1664     fAntiLambdaPtNegDaug =
1665       new TH2F("fAntiLambdaPtNegDaug","#bar{#Lambda}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1666     fOutputQA->Add(fAntiLambdaPtNegDaug);
1667
1668     //     --- background ---
1669     fAntiLambdaBckgPtPosDaug =
1670       new TH2F("fAntiLambdaBckgPtPosDaug","#bar{#Lambda}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1671     fOutputQA->Add(fAntiLambdaBckgPtPosDaug);
1672
1673     fAntiLambdaBckgPtNegDaug =
1674       new TH2F("fAntiLambdaBckgPtNegDaug","#bar{#Lambda}: #it{p}_{T};#it{p}_{T};#it{p}_{T} V0",nbins,pMin,pMax,nbins,pMin,pMax);
1675     fOutputQA->Add(fAntiLambdaBckgPtNegDaug);
1676
1677     // Phi Eta
1678     //     --- signal ---
1679     fAntiLambdaPhiEtaPosDaug = 
1680       new TH3F("fAntiLambdaPhiEtaPosDaug","#bar{#Lambda}: #varphi vs #eta Pos. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1681     fAntiLambdaPhiEtaPosDaug->GetXaxis()->SetTitle("#varphi"); 
1682     fAntiLambdaPhiEtaPosDaug->GetYaxis()->SetTitle("#eta"); 
1683     fAntiLambdaPhiEtaPosDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1684     fOutputQA->Add(fAntiLambdaPhiEtaPosDaug);
1685
1686     fAntiLambdaPhiEtaNegDaug  = 
1687       new TH3F("fAntiLambdaPhiEtaNegDaug","#bar{#Lambda}: #varphi vs #eta Neg. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1688     fAntiLambdaPhiEtaNegDaug->GetXaxis()->SetTitle("#varphi"); 
1689     fAntiLambdaPhiEtaNegDaug->GetYaxis()->SetTitle("#eta"); 
1690     fAntiLambdaPhiEtaNegDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1691     fOutputQA->Add(fAntiLambdaPhiEtaNegDaug);
1692
1693     //     --- background ---
1694     fAntiLambdaBckgPhiEtaPosDaug = 
1695       new TH3F("fAntiLambdaBckgPhiEtaPosDaug","#bar{#Lambda}: #varphi vs #eta Pos. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1696     fAntiLambdaBckgPhiEtaPosDaug->GetXaxis()->SetTitle("#varphi"); 
1697     fAntiLambdaBckgPhiEtaPosDaug->GetYaxis()->SetTitle("#eta"); 
1698     fAntiLambdaBckgPhiEtaPosDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1699     fOutputQA->Add(fAntiLambdaBckgPhiEtaPosDaug);
1700
1701     fAntiLambdaBckgPhiEtaNegDaug  = 
1702       new TH3F("fAntiLambdaBckgPhiEtaNegDaug","#bar{#Lambda}: #varphi vs #eta Neg. Daug.",nbinsPhi,0.,2.*TMath::Pi(),100,-1.,1.,nbins,pMin,pMax);
1703     fAntiLambdaBckgPhiEtaNegDaug->GetXaxis()->SetTitle("#varphi"); 
1704     fAntiLambdaBckgPhiEtaNegDaug->GetYaxis()->SetTitle("#eta"); 
1705     fAntiLambdaBckgPhiEtaNegDaug->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1706     fOutputQA->Add(fAntiLambdaBckgPhiEtaNegDaug);
1707
1708     // Distance of closest approach
1709     //     --- signal ---
1710     fAntiLambdaDCAPosDaug = 
1711       new TH2F("fAntiLambdaDCAPosDaug","#bar{#Lambda}: dca Pos",66,0.,3.3,nbins,pMin,pMax);
1712     fAntiLambdaDCAPosDaug->GetXaxis()->SetTitle("dca"); 
1713     fAntiLambdaDCAPosDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1714     fOutputQA->Add(fAntiLambdaDCAPosDaug);
1715
1716     fAntiLambdaDCANegDaug =  
1717       new TH2F("fAntiLambdaDCANegDaug","#bar{#Lambda}: dca Neg",66,0.,3.3,nbins,pMin,pMax);
1718     fAntiLambdaDCANegDaug->GetXaxis()->SetTitle("dca"); 
1719     fAntiLambdaDCANegDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1720     fOutputQA->Add(fAntiLambdaDCANegDaug);
1721     
1722     //     --- background ---
1723     fAntiLambdaBckgDCAPosDaug = 
1724       new TH2F("fAntiLambdaBckgDCAPosDaug","#bar{#Lambda} Bckg: dca Pos",66,0.,3.3,nbins,pMin,pMax);
1725     fAntiLambdaBckgDCAPosDaug->GetXaxis()->SetTitle("dca"); 
1726     fAntiLambdaBckgDCAPosDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1727     fOutputQA->Add(fAntiLambdaBckgDCAPosDaug);
1728
1729     fAntiLambdaBckgDCANegDaug =  
1730       new TH2F("fAntiLambdaBckgDCANegDaug","#bar{#Lambda} Bckg: dca Neg",66,0.,3.3,nbins,pMin,pMax);
1731     fAntiLambdaBckgDCANegDaug->GetXaxis()->SetTitle("dca"); 
1732     fAntiLambdaBckgDCANegDaug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1733     fOutputQA->Add(fAntiLambdaBckgDCANegDaug);
1734
1735     // Decay vertex reconstruction
1736     //     --- signal ---
1737     fAntiLambdaDecayPos  =  
1738       new TH3F("fAntiLambdaDecayPos","#bar{#Lambda}: Position of Dec. Vtx",200,-100.,100.,200,-100.,100.,nbins,pMin,pMax);
1739     fAntiLambdaDecayPos->GetXaxis()->SetTitle("Pos. X"); 
1740     fAntiLambdaDecayPos->GetYaxis()->SetTitle("Pos. Y"); 
1741     fAntiLambdaDecayPos->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1742     fOutputQA->Add(fAntiLambdaDecayPos);
1743
1744     fAntiLambdaDecayVertex  =  
1745       new TH2F("fAntiLambdaDecayVertex","#bar{#Lambda}: decay length",100,0.,100.,nbins,pMin,pMax);
1746     fAntiLambdaDecayVertex->GetXaxis()->SetTitle("l_{T}"); 
1747     fAntiLambdaDecayVertex->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1748     fOutputQA->Add(fAntiLambdaDecayVertex);
1749
1750     //     --- background ---
1751     fAntiLambdaBckgDecayPos  =  
1752       new TH3F("fAntiLambdaBckgDecayPos","#bar{#Lambda} Bckg: Position of Dec. Vtx",200,-100.,100.,200,-100.,100.,nbins,pMin,pMax);
1753     fAntiLambdaBckgDecayPos->GetXaxis()->SetTitle("Pos. X"); 
1754     fAntiLambdaBckgDecayPos->GetYaxis()->SetTitle("Pos. Y"); 
1755     fAntiLambdaBckgDecayPos->GetZaxis()->SetTitle("#it{p}_{T} V0"); 
1756     fOutputQA->Add(fAntiLambdaBckgDecayPos);
1757
1758     fAntiLambdaBckgDecayVertex  =  
1759       new TH2F("fAntiLambdaBckgDecayVertex","#bar{#Lambda} Bckg: decay length",100,0.,100.,nbins,pMin,pMax);
1760     fAntiLambdaBckgDecayVertex->GetXaxis()->SetTitle("l_{T}"); 
1761     fAntiLambdaBckgDecayVertex->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1762     fOutputQA->Add(fAntiLambdaBckgDecayVertex);
1763
1764     // Cosine of the Pointing Angle
1765     //     --- signal ---
1766     fAntiLambdaCPA  =  
1767       new TH2F("fAntiLambdaCPA","#bar{#Lambda}: cosine of the pointing angle",100,0.98,1.,nbins,pMin,pMax);
1768     fAntiLambdaCPA->GetXaxis()->SetTitle("cpa"); 
1769     fAntiLambdaCPA->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1770     fOutputQA->Add(fAntiLambdaCPA);
1771     //     --- background ---
1772     fAntiLambdaBckgCPA  =  
1773       new TH2F("fAntiLambdaBckgCPA","#bar{#Lambda} Bckg: cosine of the pointing angle",100,0.98,1.,nbins,pMin,pMax);
1774     fAntiLambdaBckgCPA->GetXaxis()->SetTitle("cpa"); 
1775     fAntiLambdaBckgCPA->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1776     fOutputQA->Add(fAntiLambdaBckgCPA);
1777
1778     // DCA between daughters
1779     //     --- signal ---
1780     fAntiLambdaDCAV0Daug  =  
1781       new TH2F("fAntiLambdaDCAV0Daug","#bar{#Lambda}: DCA daughters",60,0,1.2,nbins,pMin,pMax);
1782     fAntiLambdaDCAV0Daug->GetXaxis()->SetTitle("dca between daughters"); 
1783     fAntiLambdaDCAV0Daug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1784     fOutputQA->Add(fAntiLambdaDCAV0Daug);
1785     //     --- background ---
1786     fAntiLambdaBckgDCAV0Daug  =  
1787       new TH2F("fAntiLambdaBckgDCAV0Daug","#bar{#Lambda} Bckg: DCA daughters",60,0,1.2,nbins,pMin,pMax);
1788     fAntiLambdaBckgDCAV0Daug->GetXaxis()->SetTitle("dca between daughters"); 
1789     fAntiLambdaBckgDCAV0Daug->GetYaxis()->SetTitle("#it{p}_{T} V0"); 
1790     fOutputQA->Add(fAntiLambdaBckgDCAV0Daug);
1791
1792     // Number of TPC clusters:
1793     //     --- signal ---
1794     fAntiLambdaNClustersTPC = 
1795       new TH3F("fAntiLambdaNClustersTPC","#bar{#Lambda};#varphi;Num. TPC Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),181,0.5,180.5,nbins,-pMax,pMax); 
1796     fOutputQA->Add(fAntiLambdaNClustersTPC);
1797     //     --- background ---
1798     fAntiLambdaBckgNClustersTPC = 
1799       new TH3F("fAntiLambdaBckgNClustersTPC","#bar{#Lambda} Bckg;#varphi;Num. TPC Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),181,0.5,180.5,nbins,-pMax,pMax); 
1800     fOutputQA->Add(fAntiLambdaBckgNClustersTPC);
1801  
1802     // Number of ITS clusters:
1803     //     --- signal ---
1804     fAntiLambdaNClustersITSPos = 
1805       new TH3F("fAntiLambdaNClustersITSPos","#bar{#Lambda}: Pos. Daug;#varphi;Num. ITS Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1806     fOutputQA->Add(fAntiLambdaNClustersITSPos);
1807
1808     fAntiLambdaNClustersITSNeg = 
1809       new TH3F("fAntiLambdaNClustersITSNeg","#bar{#Lambda}: Neg. Daug;#varphi;Num. ITS Clusters;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1810     fOutputQA->Add(fAntiLambdaNClustersITSNeg);
1811     //     --- background ---
1812     fAntiLambdaBckgNClustersITSPos = 
1813       new TH3F("fAntiLambdaBckgNClustersITSPos","#bar{#Lambda} Bckg: Pos. Daug;#varphi;Num. ITS Clusters;;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1814     fOutputQA->Add(fAntiLambdaBckgNClustersITSPos);
1815
1816     fAntiLambdaBckgNClustersITSNeg = 
1817       new TH3F("fAntiLambdaBckgNClustersITSNeg","#bar{#Lambda} Bckg: Neg. Daug;#varphi;Num. ITS Clusters;;#it{p}_{T} (GeV/#it{c})",nbinsPhi,0.,2.*TMath::Pi(),7,-0.5,6.5,nbins,pMin,pMax); 
1818     fOutputQA->Add(fAntiLambdaBckgNClustersITSNeg);
1819
1820   }
1821
1822   // ============================================================= //
1823   
1824   PostData(1, fOutput);
1825   PostData(2, fOutputME);
1826   PostData(3, fOutputQA);
1827   
1828 }
1829
1830 //___________________________________________________________________________________________
1831
1832 static Int_t VtxBin(Double_t vtx)
1833 {
1834   // Bin in vertez position Z
1835   Int_t bin = -1;
1836   for(Int_t i=0;i<kNVtxZ;i++)
1837     if ( (vtx>=kBinVtxZ[i]) && (vtx<kBinVtxZ[i+1]) )
1838       bin = i;
1839
1840   return bin;
1841
1842 }
1843
1844 //___________________________________________________________________________________________
1845
1846 static Int_t PtBin(Double_t pt)
1847 {
1848   // Bin in pt
1849   Int_t bin = -1;
1850   for(Int_t i=0;i<kN1;i++)
1851     if ( (pt>=kPtBinV0[i]) && (pt<kPtBinV0[i+1]) )
1852       bin = i;
1853
1854   return bin;
1855
1856 }
1857
1858 //___________________________________________________________________________________________
1859
1860 static Int_t CentBin(Double_t cent)
1861 {
1862   // Bin in pt
1863   Int_t bin = -1;
1864   for(Int_t i=0;i<kNCent;i++)
1865     if ( (cent>=kBinCent[i]) && (cent<kBinCent[i+1]) )
1866       bin = i;
1867
1868   return bin;
1869
1870 }
1871
1872 //___________________________________________________________________________________________
1873
1874 Bool_t AliAnalysisTaskLambdaOverK0sJets::AcceptTrack(AliAODTrack *t) 
1875 {
1876   // Track criteria for primaries particles 
1877   
1878   // TPC only tracks
1879   if (TMath::Abs(t->Eta())>0.8 )  return kFALSE; 
1880   if (!(t->TestFilterMask(1<<7))) return kFALSE; 
1881
1882   Float_t nCrossedRowsTPC = t->GetTPCClusterInfo(2,1); 
1883   if (nCrossedRowsTPC < 70) return kFALSE;  
1884   
1885
1886   // Hybrid tracks
1887   //if( !(t->TestFilterBit(272)) )  return kFALSE;
1888   //if(!t->IsHybridGlobalConstrainedGlobal()) return kFALSE;
1889
1890   // Point in the SPD
1891   Int_t SPDHits = t->HasPointOnITSLayer(0) + t->HasPointOnITSLayer(1);
1892   if( SPDHits )
1893     fTriggerWiSPDHit->Fill(1.5);
1894   
1895   return kTRUE;   
1896 }
1897
1898 //___________________________________________________________________________________________
1899
1900 Bool_t AliAnalysisTaskLambdaOverK0sJets::AcceptTrackV0(const AliAODTrack *t) 
1901
1902   // Track criteria for daughter particles of V0 candidate 
1903   if (!t->IsOn(AliAODTrack::kTPCrefit)) return kFALSE;
1904   Float_t nCrossedRowsTPC = t->GetTPCClusterInfo(2,1); 
1905   if (nCrossedRowsTPC<fDaugNClsTPC) return kFALSE;
1906
1907   return kTRUE;   
1908 }
1909
1910 //___________________________________________________________________________________________
1911
1912 Bool_t AliAnalysisTaskLambdaOverK0sJets::AcceptV0(AliAODVertex *vtx, const AliAODv0 *v1) 
1913
1914   // Selection for accepting V0 candidates 
1915
1916   if (v1->GetOnFlyStatus()) return kFALSE;
1917   
1918   //if (v1->Pt() < pMin) return kFALSE; ***
1919   
1920   const AliAODTrack *ntrack1=(AliAODTrack *)v1->GetDaughter(1);
1921   const AliAODTrack *ptrack1=(AliAODTrack *)v1->GetDaughter(0);
1922     
1923   if( !ntrack1 || !ptrack1 ) return kFALSE;
1924   if( !AcceptTrackV0(ntrack1) ) return kFALSE;
1925   if( !AcceptTrackV0(ptrack1) ) return kFALSE;
1926   
1927   if( ntrack1->Charge() == ptrack1->Charge()) 
1928     return kFALSE;
1929
1930   // Daughters: pseudo-rapidity cut
1931   if ( TMath::Abs(ntrack1->Eta()) > fMaxEtaDaughter  ||
1932        TMath::Abs(ptrack1->Eta()) > fMaxEtaDaughter  )
1933     return kFALSE;
1934
1935   // Daughters: transverse momentum cut
1936   if ( ( ntrack1->Pt() < fMinPtDaughter ) || 
1937        ( ptrack1->Pt() < fMinPtDaughter )  ) 
1938     return kFALSE;
1939   
1940   // Daughters: Impact parameter of daughter to prim vtx
1941   Float_t xy = v1->DcaNegToPrimVertex();
1942   if (TMath::Abs(xy)<fDCAToPrimVtx) return kFALSE;
1943   xy = v1->DcaPosToPrimVertex();
1944   if (TMath::Abs(xy)<fDCAToPrimVtx) return kFALSE;
1945
1946   // Daughters: DCA
1947   Float_t dca = v1->DcaV0Daughters();
1948   if (dca>fMaxDCADaughter) return kFALSE;
1949
1950   // V0: Cosine of the pointing angle
1951   Float_t cpa=v1->CosPointingAngle(vtx);
1952   if (cpa<fMinCPA) return kFALSE;
1953
1954   // V0: Fiducial volume
1955   Double_t xyz[3]; v1->GetSecondaryVtx(xyz);
1956   Float_t r2=xyz[0]*xyz[0] + xyz[1]*xyz[1];
1957   if (r2<5.*5.) return kFALSE;
1958   if (r2>lMax*lMax) return kFALSE;
1959
1960   return kTRUE;
1961 }
1962
1963 //___________________________________________________________________________________________
1964
1965 static Float_t dPHI(Float_t phi1, Float_t phi2) 
1966
1967   // Calculate the phi difference between two tracks  
1968   Float_t deltaPhi = phi1 - phi2;
1969   
1970   if (deltaPhi<-TMath::PiOver2())    deltaPhi = deltaPhi + 2*(TMath::Pi());
1971   if (deltaPhi>(3*TMath::PiOver2()))  deltaPhi = deltaPhi - 2*(TMath::Pi());
1972   return deltaPhi;
1973 }
1974
1975 //___________________________________________________________________________________________
1976
1977 static Float_t MyRapidity(Float_t rE, Float_t rPz)
1978
1979   // Local method for rapidity
1980   return 0.5*TMath::Log((rE+rPz)/(rE-rPz+1.e-13));
1981
1982
1983 //___________________________________________________________________________________________
1984
1985 static Int_t SameTrack(AliAODTrack *trk, const AliAODTrack *daugTrk)
1986
1987   // Local method to compaire the momentum between two tracks
1988
1989   //double const kEpsilon = 0.01;
1990   Int_t    isSamePt = 0;
1991
1992   /*
1993     Float_t p[3];     trk->GetPxPyPz(p);
1994     Float_t pNegTrk[3]; nTrk->GetPxPyPz(pNegTrk);
1995     Float_t pPosTrk[3]; pTrk->GetPxPyPz(pPosTrk);
1996   
1997     if( (  fabs(p[0]-pNegTrk[0])<kEpsilon && 
1998     fabs(p[1]-pNegTrk[1])<kEpsilon && 
1999     fabs(p[2]-pNegTrk[2])<kEpsilon ) 
2000     isSamePt = 1;
2001   */
2002     
2003   if(  (TMath::Abs(daugTrk->GetID())+1)==(TMath::Abs(trk->GetID()))  )
2004     isSamePt = 1;
2005   
2006
2007   return isSamePt;
2008
2009 }
2010
2011 //___________________________________________________________________________________________
2012
2013 static Float_t SpatialResolution(Float_t p1x,Float_t p1y,Float_t p2x,Float_t p2y,Float_t dist)
2014 {
2015   // Obtains the spacial resolution between trigger and V0
2016   // within a distance in (deltaPhi,deltaEta) < 0.1
2017
2018   Float_t res = -100.;
2019
2020   res = TMath::Sqrt( p1x*p1x + p1y*p1y )*TMath::Sqrt( p2x*p2x + p2y*p2y );
2021   res = (p1x*p2x + p1y*p2y)/res;
2022
2023   res = TMath::ACos(res);
2024   
2025   return res = TMath::Sin(res)*dist;
2026  
2027 }
2028
2029 //___________________________________________________________________________________________
2030
2031 void AliAnalysisTaskLambdaOverK0sJets::RecCascade(AliAODTrack *trk1,const AliAODTrack *trk2,const AliAODTrack *trkBch,TString histo)
2032 {
2033   // Local method to reconstruct cascades candidates from the combinations of three tracks
2034   // The input tracks correspond to the trigger particle and the daughter tracks of the V0 candidate (correlation step)
2035   // The trigger particle track will be always consider as a possible daughter of the V0 which coming from the Cascade decay.
2036   // The daughters of the V0 candidates are switched to be the bachelor track for the Cascade reconstruction.
2037
2038   Float_t lMassBach=0., lPtot2Bach=0., lEBach=0.;
2039   Float_t lMassLambda=0., lPtot2Lambda=0., lELambda = 0.; 
2040   Float_t pLambda[3] = {0.,0.,0.};
2041   Float_t pCascade[3] = {0.,0.,0.};
2042   Float_t lMassCascade = 0., lPtot2Cascade=0.;
2043
2044   // Two loops are done to consider the posibility to reconstruct a Xi or an Omega
2045   for(Int_t i=0;i<2;i++){
2046
2047     // 0. Check the charge for both tracks: trk1 & trk2. 
2048     //    Usefull in the Lambda step.
2049     if( trk1->Charge() == trk2->Charge() ) 
2050       continue;
2051    
2052     // 1. Bachelor: Allocation for the track
2053     if(i==0) // Xi 
2054       lMassBach = TDatabasePDG::Instance()->GetParticle(kPiMinus)->Mass();
2055     else if(i==1) //Omega
2056       lMassBach = TDatabasePDG::Instance()->GetParticle(kKMinus)->Mass();
2057
2058     lPtot2Bach = TMath::Power(trkBch->P(),2);
2059
2060     lEBach = TMath::Sqrt(lPtot2Bach + lMassBach*lMassBach);
2061
2062     // 2. Lambda: Kinematical properties
2063     lMassLambda = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();
2064       
2065     pLambda[0] = trk1->Px() + trk2->Px();
2066     pLambda[1] = trk1->Py() + trk2->Py();
2067     pLambda[2] = trk1->Pz() + trk2->Pz();
2068
2069     lPtot2Lambda = pLambda[0]*pLambda[0] +  pLambda[1]*pLambda[1] +  pLambda[2]*pLambda[2];
2070
2071     lELambda = TMath::Sqrt(lPtot2Lambda + lMassLambda*lMassLambda);
2072
2073     // 3. Cascade: Reconstruction
2074     pCascade[0] = pLambda[0] + trkBch->Px();
2075     pCascade[1] = pLambda[1] + trkBch->Py();
2076     pCascade[2] = pLambda[2] + trkBch->Pz();
2077
2078     lPtot2Cascade = pCascade[0]*pCascade[0] + pCascade[1]*pCascade[1] + pCascade[2]*pCascade[2];
2079
2080     lMassCascade = TMath::Sqrt( TMath::Power(lEBach+lELambda,2) - lPtot2Cascade );
2081    
2082     // 4. Filling histograms
2083     if( histo.Contains("K0s") ) {
2084       if(i==0) // Xi 
2085         fV0MassCascade->Fill(lMassCascade,1);
2086       else if(i==1) //Omega
2087         fV0MassCascade->Fill(lMassCascade,3);
2088     }
2089     else if( histo.Contains("AntiLambda") ) {
2090       if(i==0) // Xi 
2091         fV0MassCascade->Fill(lMassCascade,9);
2092       else if(i==1) //Omega
2093         fV0MassCascade->Fill(lMassCascade,11);
2094     }
2095     else if( histo.Contains("Lambda") ) {
2096       if(i==0) // Xi 
2097         fV0MassCascade->Fill(lMassCascade,5);
2098       else if(i==1) //Omega
2099         fV0MassCascade->Fill(lMassCascade,7);
2100     }
2101
2102   }
2103   
2104 }
2105
2106 //___________________________________________________________________________________________
2107  
2108 void AliAnalysisTaskLambdaOverK0sJets::V0Loop(V0LoopStep_t step, Bool_t isTriggered, Int_t iArray, Int_t idTrig) 
2109
2110   // Three options for the 'step' variable:
2111   // 1) TriggerCheck
2112   // 2) Reconstruction
2113
2114   AliAODTrack *trkTrig = 0x0;
2115   Float_t  ptTrig  = -100.;
2116   Float_t  phiTrig = -100.;
2117   Float_t  etaTrig = -100.; 
2118   Double_t pTrig[3]; 
2119
2120   if( (step==kTriggerCheck || isTriggered) && idTrig>=0 ){
2121     trkTrig = (AliAODTrack*)fAOD->GetTrack(idTrig); 
2122     ptTrig  = trkTrig->Pt();
2123     phiTrig = trkTrig->Phi();
2124     etaTrig = trkTrig->Eta();
2125     trkTrig->GetPxPyPz(pTrig); 
2126   }
2127   
2128   // *************************************************
2129   // Centrality selection
2130   AliCentrality *cent = fAOD->GetCentrality();
2131   Float_t centrality = cent->GetCentralityPercentile("V0M");
2132   Int_t curCentBin = CentBin(centrality);
2133
2134   // *************************************************
2135   // MC Event
2136   TClonesArray *stackMC = 0x0;
2137   Float_t mcXv=0., mcYv=0., mcZv=0.;
2138    
2139   if(fIsMC){
2140     TList *lst = fAOD->GetList();
2141     stackMC = (TClonesArray*)lst->FindObject(AliAODMCParticle::StdBranchName());
2142     if (!stackMC) {
2143       Printf("ERROR: stack not available");
2144     }
2145
2146     AliAODMCHeader *mcHdr = 
2147       (AliAODMCHeader*)lst->FindObject(AliAODMCHeader::StdBranchName());
2148     
2149     mcXv=mcHdr->GetVtxX(); mcYv=mcHdr->GetVtxY(); mcZv=mcHdr->GetVtxZ();
2150   }
2151   
2152   // *************************************************
2153   // V0 loop - AOD
2154   const AliAODVertex *vtx=fAOD->GetPrimaryVertex();
2155   Float_t xv=vtx->GetX(), yv=vtx->GetY(), zv=vtx->GetZ();
2156   Int_t nV0sTot = fAOD->GetNumberOfV0s();
2157
2158   for (Int_t iV0 = 0; iV0 < nV0sTot; iV0++) {
2159     
2160     AliAODv0 *v0=fAOD->GetV0(iV0);
2161     if (!v0) continue;
2162     if (!AcceptV0(fAOD->GetPrimaryVertex(),v0)) continue;
2163     
2164     const AliAODTrack *ntrack=(AliAODTrack *)v0->GetDaughter(1);
2165     const AliAODTrack *ptrack=(AliAODTrack *)v0->GetDaughter(0);
2166
2167     // Decay vertex
2168     Double_t xyz[3]; v0->GetSecondaryVtx(xyz);
2169     Float_t dx=xyz[0]-xv, dy=xyz[1]-yv;//, dz=xyz[2]-zv;
2170    
2171     // Momentum: 2D & 3D
2172     Float_t pt=TMath::Sqrt(v0->Pt2V0());
2173     //Float_t p=v0->P();
2174
2175     // Decay length: 2D & 3D 
2176     Float_t lt=TMath::Sqrt(dx*dx + dy*dy); 
2177     //Float_t dl=TMath::Sqrt(dx*dx + dy*dy + dz*dz);  
2178     
2179     Float_t dlK = 0.4977*lt/pt;
2180     Float_t dlL = 1.1157*lt/pt; 
2181     /*
2182       Float_t dlK  = v0->MassK0Short()*dl/p;
2183       Float_t dlL  = v0->MassLambda()*dl/p;
2184       Float_t dlAL = v0->MassAntiLambda()*dl/p;
2185     */
2186
2187     // ctau
2188     Bool_t ctK=kTRUE;  if (dlK > fMaxCtau*2.68 || dlK < fMinCtau*2.68) ctK=kFALSE; 
2189     Bool_t ctL=kTRUE;  if (dlL > fMaxCtau*7.89 || dlL < fMinCtau*7.89) ctL=kFALSE; 
2190     Bool_t ctAL=kTRUE; if (dlL > fMaxCtau*7.89 || dlL < fMinCtau*7.89) ctAL=kFALSE;    
2191
2192     //  ---- Daughter tracks properties:
2193     // Pt
2194     Float_t lPtNeg = ntrack->Pt();
2195     Float_t lPtPos = ptrack->Pt();  
2196     // Momentum
2197     Double_t pNegDaug[3];  ntrack->GetPxPyPz(pNegDaug);                  
2198     Double_t pPosDaug[3];  ptrack->GetPxPyPz(pPosDaug);
2199     // Phi
2200     Float_t phiNeg = ntrack->Phi();
2201     Float_t phiPos = ptrack->Phi();
2202     // Eta
2203     Float_t etaNeg = ntrack->Eta();
2204     Float_t etaPos = ptrack->Eta();
2205     //  Number of TPC Clusters 
2206     Float_t nClsTPCPos = ptrack->GetTPCClusterInfo(2,1);
2207     Float_t nClsTPCNeg = ntrack->GetTPCClusterInfo(2,1); 
2208     // Number of clusters of ITS
2209     Double_t posITSNcls = ptrack->GetITSNcls();   
2210     Double_t negITSNcls = ntrack->GetITSNcls();
2211
2212     //  ---- V0 candidate properties:
2213     // Armenteros variables:
2214     Float_t lAlphaV0      =  v0->AlphaV0();
2215     Float_t lPtArmV0      =  v0->PtArmV0();
2216     // dca to primary vertex
2217     Float_t dcaNeg = v0->DcaNegToPrimVertex();
2218     Float_t dcaPos = v0->DcaPosToPrimVertex();
2219     // dca between daughters
2220     Float_t dca   = v0->DcaV0Daughters();
2221     // cpa
2222     Float_t cpa   = v0->CosPointingAngle(fAOD->GetPrimaryVertex());
2223     // eta
2224     Float_t lEta  = v0->PseudoRapV0();
2225     // phi
2226     Float_t lPhi  = v0->Phi();
2227     //lPhi  = ( (lPhi < 0) ? lPhi + 2*TMath::Pi() : lPhi );    
2228
2229     // rapidity
2230     Float_t rapK0s = v0->RapK0Short();
2231     Float_t rapLambda = v0->RapLambda();
2232
2233     if(fUseEtaCut){
2234       rapK0s = lEta;
2235       rapLambda = lEta;
2236     }
2237    
2238     // **********************************
2239     // PID - tracks  
2240     Float_t pPos = -100.;
2241     Float_t pNeg = -100.;
2242     
2243     //Float_t dedxPos = -1000.;
2244     //Float_t dedxNeg = -1000.;
2245     //Float_t nsigPosPion   = 0.;
2246     //Float_t nsigNegPion   = 0.;
2247     Float_t nsigPosProton = 0.;
2248     Float_t nsigNegProton = 0.;
2249
2250     if(fUsePID && !fIsMC) {     
2251       const AliAODPid *pidNeg = ntrack->GetDetPid();
2252       const AliAODPid *pidPos = ptrack->GetDetPid();
2253       
2254       if (pidNeg && pidPos) {
2255         pPos = pidPos->GetTPCmomentum();
2256         pNeg = pidNeg->GetTPCmomentum();
2257         //dedxPos = pidPos->GetTPCsignal()/47.; 
2258         //dedxNeg = pidNeg->GetTPCsignal()/47.; 
2259         
2260         
2261         if(pPos<1.){
2262           //nsigPosPion   = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(ptrack,AliPID::kPion));
2263           nsigPosProton = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(ptrack,AliPID::kProton));
2264         }
2265         if(pNeg<1.){
2266           //nsigNegPion   = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(ntrack,AliPID::kPion));
2267           nsigNegProton = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(ntrack,AliPID::kProton));
2268         }
2269         
2270       }
2271       
2272     }
2273
2274     // **********************************
2275     // Disentangle the V0 candidate
2276     Float_t massK0s = 0., mK0s = 0., sK0s = 0.;
2277     Float_t massLambda = 0., mLambda = 0., sL = 0.;
2278     Float_t massAntiLambda = 0., sAL = 0.;
2279
2280     Bool_t isCandidate2K0s = kFALSE;
2281     massK0s = v0->MassK0Short();
2282     mK0s = TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass();
2283     if( fCollision.Contains("PbPb2010") )
2284       sK0s = kCteK0s2010[curCentBin] + kLinearK0s2010[curCentBin]*pt;
2285     else if( fCollision.Contains("PbPb2011") ) 
2286       sK0s = kCteK0s2011[curCentBin] + kLinearK0s2011[curCentBin]*pt;
2287     if ( TMath::Abs(mK0s-massK0s) < 3*sK0s )  isCandidate2K0s = kTRUE;     
2288     
2289     Bool_t isCandidate2Lambda = kFALSE;
2290     massLambda = v0->MassLambda();
2291     mLambda = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();
2292     if( fCollision.Contains("PbPb2010") )
2293       sL = kCteLambda2010[curCentBin] + kLinearLambda2010[curCentBin]*pt;
2294     else if( fCollision.Contains("PbPb2011") ) 
2295       sL = kCteLambda2011[curCentBin] + kLinearLambda2011[curCentBin]*pt;
2296     if (TMath::Abs(mLambda-massLambda) < 3*sL)  isCandidate2Lambda = kTRUE;  
2297     
2298     Bool_t isCandidate2LambdaBar = kFALSE;
2299     massAntiLambda = v0->MassAntiLambda();
2300     if( fCollision.Contains("PbPb2010") )
2301       sAL = kCteAntiLambda2010[curCentBin] + kLinearAntiLambda2010[curCentBin]*pt;
2302     else if( fCollision.Contains("PbPb2011") ) 
2303       sAL = kCteAntiLambda2011[curCentBin] + kLinearAntiLambda2011[curCentBin]*pt;
2304     if (TMath::Abs(mLambda-massAntiLambda) < 3*sAL)  isCandidate2LambdaBar = kTRUE; 
2305
2306     // **********************************
2307     // MC Association:
2308     Bool_t lComeFromSigma     = kTRUE; 
2309     Bool_t lCheckMcK0Short    = kTRUE;
2310     Bool_t lCheckMcLambda     = kTRUE;
2311     Bool_t lCheckMcAntiLambda = kTRUE;
2312     Bool_t lComeFromXi        = kTRUE; 
2313         
2314     Int_t lMCAssocNegDaug = -100;
2315     Int_t lMCAssocPosDaug = -100;  
2316     
2317     // ********* MC - Association *********
2318     // In case of injected-MC, the correlations might be done with only natural particles 
2319     Bool_t isNaturalPart = kTRUE;
2320     if(step==kReconstruction){
2321       
2322       if(fIsMC){        
2323         if(!stackMC) goto noas;
2324
2325         isNaturalPart = kFALSE;
2326
2327         lComeFromSigma     = kFALSE; 
2328         lCheckMcK0Short    = kFALSE;
2329         lCheckMcLambda     = kFALSE;
2330         lCheckMcAntiLambda = kFALSE;
2331         lComeFromXi        = kFALSE;
2332
2333         Int_t ntrkMC=stackMC->GetEntriesFast();
2334         
2335         Int_t nlab = TMath::Abs(ntrack->GetLabel());//** UInt_t
2336         Int_t plab = TMath::Abs(ptrack->GetLabel());
2337   
2338         // To avoid futher problems 
2339         if ( (nlab<0 || plab<0) ||
2340              (nlab>=ntrkMC || plab>=ntrkMC) )
2341           goto noas;      
2342
2343         AliAODMCParticle *nPart=(AliAODMCParticle*)stackMC->UncheckedAt(nlab);
2344         AliAODMCParticle *pPart=(AliAODMCParticle*)stackMC->UncheckedAt(plab);
2345
2346         if(!nPart || !pPart)   goto noas;
2347
2348         // MC origin of daughters: Primaries?
2349         if( nPart->IsPhysicalPrimary() ) lMCAssocNegDaug = 1;
2350         if( pPart->IsPhysicalPrimary() ) lMCAssocPosDaug = 1;
2351         
2352         /*
2353         if ( TMath::Abs(nPart->Eta()) > fMaxEtaDaughter ||
2354              TMath::Abs(pPart->Eta()) > fMaxEtaDaughter )
2355           goto noas;
2356         */
2357         /*
2358         // Daughter momentum cut
2359         if ( ( nPart->Pt() < fMinPtDaughter ) || 
2360         ( pPart->Pt() < fMinPtDaughter )  ) 
2361         goto noas;
2362         */
2363
2364         // ----------------------------------------
2365         
2366         Int_t lPDGCodeNegDaughter = nPart->GetPdgCode();
2367         Int_t lPDGCodePosDaughter = pPart->GetPdgCode();
2368         
2369         Int_t ipMother = pPart->GetMother();
2370         Int_t inMother = nPart->GetMother();
2371         
2372         if(inMother<0 || inMother>=ntrkMC) lMCAssocNegDaug = 6;
2373         if(ipMother<0 || ipMother>=ntrkMC) lMCAssocPosDaug = 6;
2374
2375         if(inMother<0 || inMother>=ntrkMC) {  goto noas;}
2376         if(inMother != ipMother) { // did the negative daughter decay ?
2377           AliAODMCParticle *negMotherOfMotherPart = (AliAODMCParticle*)stackMC->UncheckedAt(inMother);
2378           if (negMotherOfMotherPart->GetMother() != ipMother) 
2379             goto noas;
2380         }
2381         
2382         if (ipMother<0 || ipMother>=ntrkMC)
2383           goto noas;     
2384         
2385         AliAODMCParticle *p0=(AliAODMCParticle*)stackMC->UncheckedAt(ipMother);
2386         if(!p0) 
2387           goto noas; 
2388
2389         // ----------------------------------------
2390         
2391         if ( (ipMother>=fEndOfHijingEvent) && 
2392              (fEndOfHijingEvent!=-1)     && 
2393              (p0->GetMother()<0) ) 
2394           isNaturalPart = kFALSE; 
2395         else  isNaturalPart = kTRUE; 
2396
2397         // ----------------------------------------
2398         
2399         if(fSeparateInjPart && !isNaturalPart) goto noas;     
2400         
2401         Int_t lPDGCodeV0 = p0->GetPdgCode();
2402         
2403         // MC origin of daughters:
2404         //Decay from Weak Decay?
2405         if( (TMath::Abs(lPDGCodeV0) == kK0Short) || (TMath::Abs(lPDGCodeV0) == kLambda0) || 
2406             (TMath::Abs(lPDGCodeV0) == kSigmaMinus) || (TMath::Abs(lPDGCodeV0) == kSigmaPlus) ||
2407             (TMath::Abs(lPDGCodeV0) == kSigma0) )
2408           { lMCAssocNegDaug = 2;          lMCAssocPosDaug = 2; }
2409         // Cascade Gamma conversion
2410         if( (TMath::Abs(lPDGCodeV0) == kXiMinus) ||
2411             (TMath::Abs(lPDGCodeV0) == kOmegaMinus) )
2412           { lMCAssocNegDaug = 3;          lMCAssocPosDaug = 3; }
2413         // Gamma conversion
2414         else if( TMath::Abs(lPDGCodeV0) == kGamma )
2415           { lMCAssocNegDaug = 4;          lMCAssocPosDaug = 4; }
2416         // Unidentied mother:
2417         else 
2418           { lMCAssocNegDaug = 5;          lMCAssocPosDaug = 5; }
2419
2420
2421         Int_t lIndexMotherOfMother   = p0->GetMother();
2422         Int_t lPdgcodeMotherOfMother = 0;
2423         if (lIndexMotherOfMother != -1) {
2424           AliAODMCParticle *lMCAODMotherOfMother=(AliAODMCParticle*)stackMC->UncheckedAt(lIndexMotherOfMother);
2425           if (lMCAODMotherOfMother) {lPdgcodeMotherOfMother = lMCAODMotherOfMother->GetPdgCode();}
2426         }
2427         
2428         /*
2429         // Daughter momentum cut: ! FIX it in case of AOD ! //MC or REc
2430         if ( (nPart->Pt()  < fMinPtDaughter ) ||
2431         (pPart->Pt()  < fMinPtDaughter ) )
2432         goto noas;
2433         */
2434
2435         if( (lPDGCodeV0 != kK0Short) &&
2436             (lPDGCodeV0 != kLambda0) &&
2437             (lPDGCodeV0 != kLambda0Bar) ) 
2438           goto noas;
2439         
2440              
2441         // ----------------------------------------
2442       
2443         // K0s
2444         if( (lPDGCodePosDaughter==+211) && (lPDGCodeNegDaughter==-211) &&
2445             (inMother==ipMother) && (lPDGCodeV0==310) ) {
2446           
2447           if ( ((AliAODMCParticle*)stackMC->UncheckedAt(ipMother))->IsPrimary()  )
2448             lCheckMcK0Short  = kTRUE;
2449         
2450         }
2451         // Lambda
2452         else if( (lPDGCodePosDaughter==+2212) && (lPDGCodeNegDaughter==-211)  &&
2453                  (inMother==ipMother) && (lPDGCodeV0==3122)  ){
2454           
2455           if ( ( TMath::Abs(lPdgcodeMotherOfMother) == 3212) /*||
2456                ( TMath::Abs(lPdgcodeMotherOfMother) == 3224) ||
2457                ( TMath::Abs(lPdgcodeMotherOfMother) == 3214) ||
2458                ( TMath::Abs(lPdgcodeMotherOfMother) == 3114)*/
2459                ) lComeFromSigma = kTRUE;
2460           else lComeFromSigma = kFALSE; 
2461           
2462           if ( ((AliAODMCParticle*)stackMC->UncheckedAt(ipMother))->IsPrimary() || 
2463                ( !(((AliAODMCParticle*)stackMC->UncheckedAt(ipMother))->IsPrimary() ) 
2464                  && (lComeFromSigma==kTRUE) )
2465                ) lCheckMcLambda  = kTRUE; 
2466           
2467           
2468           if ( TMath::Abs(lPdgcodeMotherOfMother) == 3312) 
2469             lComeFromXi = kTRUE;
2470           
2471         }
2472         // AntiLambda
2473         else if( (lPDGCodePosDaughter==211) && (lPDGCodeNegDaughter==-2212) &&
2474                  (inMother==ipMother) && (lPDGCodeV0==-3122) ) {
2475           
2476           
2477           if ( ( TMath::Abs(lPdgcodeMotherOfMother) == 3212) /*||
2478                ( TMath::Abs(lPdgcodeMotherOfMother) == 3224) ||
2479                ( TMath::Abs(lPdgcodeMotherOfMother) == 3214) ||
2480                ( TMath::Abs(lPdgcodeMotherOfMother) == 3114)*/
2481                ) lComeFromSigma = kTRUE;
2482           else lComeFromSigma = kFALSE;  
2483           
2484           if ( ((AliAODMCParticle*)stackMC->UncheckedAt(ipMother))->IsPrimary() || 
2485                ( (!((AliAODMCParticle*)stackMC->UncheckedAt(ipMother))->IsPrimary()) 
2486                  && (lComeFromSigma==kTRUE) )
2487                ) lCheckMcAntiLambda  = kTRUE;
2488           
2489           if ( TMath::Abs(lPdgcodeMotherOfMother) == 3312 || TMath::Abs(lPdgcodeMotherOfMother) == 3322 ) 
2490             lComeFromXi = kTRUE;
2491           
2492         }
2493         
2494         //  ----------------------------------------
2495         
2496         if ((p0->Pt())<pMin) goto noas;
2497         if (TMath::Abs(p0->Y())>fYMax ) goto noas;
2498         
2499         Float_t dxAs = mcXv - p0->Xv(),  dyAs = mcYv - p0->Yv(),  dzAs = mcZv - p0->Zv();
2500         Float_t l = TMath::Sqrt(dxAs*dxAs + dyAs*dyAs + dzAs*dzAs);
2501         
2502         dxAs = mcXv - pPart->Xv(); dyAs = mcYv - pPart->Yv();
2503         //Float_t ltAs = TMath::Sqrt(dxAs*dxAs + dyAs*dyAs);
2504         Float_t ptAs = p0->Pt();
2505         Float_t rapAs = p0->Y();
2506         Float_t etaAs = p0->Eta();
2507
2508         if(fUseEtaCut){
2509           rapAs = etaAs;
2510         }
2511
2512         // phi resolution for V0-reconstruction
2513         Float_t resEta = p0->Eta() - v0->Eta(); 
2514         Float_t resPhi = p0->Phi() - v0->Phi(); 
2515         
2516         if ( (l < 0.01)  &&  (ptAs<10.) ) { // Primary V0
2517           
2518           // K0s:
2519           if(ctK && lCheckMcK0Short){ 
2520             
2521             // Natural particles
2522             if(isNaturalPart){
2523
2524               if( (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2525
2526                 fK0sAssocPt->Fill(ptAs);
2527                 fK0sAssocPtRap->Fill(ptAs,rapAs,centrality);
2528                 fK0sAssocPtPhiEta[curCentBin]->Fill(p0->Phi(),etaAs,ptAs);
2529               
2530                 // Armenteros Pod.  and rapidity cut
2531                 if( (lPtArmV0 > TMath::Abs(0.2*lAlphaV0) ) && TMath::Abs(rapAs)<fYMax ){ 
2532                                 
2533                   Double_t effK0sArm[3] = {v0->MassK0Short(),ptAs,rapAs};
2534                   Double_t effK0sVtx[4] = {v0->MassK0Short(),ptAs,rapAs,zv};
2535                   Double_t effK0sDCA[4] = {v0->MassK0Short(),ptAs,rapAs,dca};
2536                   Double_t effK0sCPA[4] = {v0->MassK0Short(),ptAs,rapAs,cpa};
2537                   
2538                   // Distributions for the efficiency (systematics chechks)
2539                   fK0sAssocPtMassArm[curCentBin]->Fill(effK0sArm);
2540                   fK0sAssocMassPtVtx[curCentBin]->Fill(effK0sVtx);
2541                   fK0sAssocMassPtDCADaug[curCentBin]->Fill(effK0sDCA);
2542                   fK0sAssocMassPtCPA[curCentBin]->Fill(effK0sCPA);
2543                 }
2544               
2545                 fK0sMCResEta->Fill(resEta,pt,centrality);
2546                 fK0sMCResPhi->Fill(resPhi,pt,centrality);
2547               
2548               } // End selection in the dca to prim. vtx and the number of clusters
2549
2550               // Distributions for the efficiency (Systematic checks)
2551               if( (lPtArmV0 > TMath::Abs(0.2*lAlphaV0) ) && TMath::Abs(rapAs)<fYMax ){ 
2552               
2553                 //  Cut in the DCA ToPrim Vtx
2554                 if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2555
2556                   Double_t effK0sdcaPV[5] = {v0->MassK0Short(),ptAs,rapAs,dcaPos,dcaNeg};
2557                   fK0sAssocMassPtDCAPV[curCentBin]->Fill(effK0sdcaPV);
2558                 }                 
2559
2560                 // cut in the number of tpc clusters
2561                 if( (dcaPos>0.1) && (dcaNeg>0.1) && TMath::Abs(rapAs)<fYMax ){
2562                   
2563                   Double_t effK0sTPCcls[5]  = {v0->MassK0Short(),ptAs,rapAs,nClsTPCPos,nClsTPCNeg};
2564                   fK0sAssocMassPtDaugNClsTPC[curCentBin]->Fill(effK0sTPCcls);
2565                   
2566                 }
2567
2568               } // End selection for systematics
2569
2570             } // End natural particle selection
2571             // Embeded particles
2572             if(!isNaturalPart){ 
2573
2574               if( (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2575
2576                 fK0sAssocPtRapEmbeded->Fill(ptAs,rapAs,centrality);
2577
2578                 if( (lPtArmV0 > TMath::Abs(0.2*lAlphaV0)) && TMath::Abs(rapAs)<fYMax ){
2579                   
2580                   Double_t effK0sArm[3] = {v0->MassK0Short(),ptAs,rapAs};
2581                   Double_t effK0sVtx[4] = {v0->MassK0Short(),ptAs,rapAs,zv};
2582                   Double_t effK0sDCA[4] = {v0->MassK0Short(),ptAs,rapAs,dca};
2583                   Double_t effK0sCPA[4] = {v0->MassK0Short(),ptAs,rapAs,cpa};
2584                 
2585                   // Distributions for the efficiency (systematics chechks)
2586                   fK0sAssocPtMassArmEmbeded[curCentBin]->Fill(effK0sArm);       
2587                   fK0sAssocMassPtVtxEmbeded[curCentBin]->Fill(effK0sVtx);
2588                   fK0sAssocMassPtDCADaugEmbeded[curCentBin]->Fill(effK0sDCA);
2589                   fK0sAssocMassPtCPAEmbeded[curCentBin]->Fill(effK0sCPA);
2590                 }
2591
2592               } // End selection in the dca to prim. vtx and the number of clusters
2593
2594               // Distributions for the efficiency (Systematic checks)
2595               if( (lPtArmV0 > TMath::Abs(0.2*lAlphaV0) ) && TMath::Abs(rapAs)<fYMax ){ 
2596
2597                 //  Cut in the DCA ToPrim Vtx
2598                 if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2599
2600                   Double_t effK0sdcaPV[5] = {v0->MassK0Short(),ptAs,rapAs,dcaPos,dcaNeg};
2601                   fK0sAssocMassPtDCAPVEmbeded[curCentBin]->Fill(effK0sdcaPV);
2602                 }                 
2603
2604                 // cut in the number of tpc clusters
2605                 if( (dcaPos>0.1) && (dcaNeg>0.1) && TMath::Abs(rapAs)<fYMax ){
2606
2607                   Double_t effK0sTPCcls[5]  = {v0->MassK0Short(),ptAs,rapAs,nClsTPCPos,nClsTPCNeg};
2608                   fK0sAssocMassPtDaugNClsTPCEmbeded[curCentBin]->Fill(effK0sTPCcls);
2609                 }
2610
2611               } // End selection for systematics
2612
2613             } // End embeded particle selection
2614
2615           }  // End K0s selection
2616           
2617           // Lambda:
2618           if(ctL && lCheckMcLambda && (TMath::Abs(nsigPosProton)<fNSigma) ) {  
2619             
2620             // Natural particles
2621             if(isNaturalPart){
2622
2623               if( (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2624
2625                 fLambdaAssocPt->Fill(ptAs);
2626                 fLambdaAssocPtRap->Fill(ptAs,rapAs,centrality);
2627                 fLambdaAssocPtPhiEta[curCentBin]->Fill(p0->Phi(),etaAs,ptAs);
2628
2629                 // Rapidity cut
2630                 if(TMath::Abs(rapAs)<fYMax)  {
2631
2632                   Double_t effLambda[3] = {v0->MassLambda(),ptAs,rapAs};
2633                   Double_t effLambdaVtx[4] = {v0->MassLambda(),ptAs,rapAs,zv};
2634                   Double_t effLambdaDCA[4] = {v0->MassLambda(),ptAs,rapAs,dca};
2635                   Double_t effLambdaCPA[4] = {v0->MassLambda(),ptAs,rapAs,cpa};
2636
2637                   // Distributions for the efficiency (systematics chechks)
2638                   fLambdaAssocMassPtRap[curCentBin]->Fill(effLambda);
2639                   fLambdaAssocMassPtVtx[curCentBin]->Fill(effLambdaVtx);
2640                   fLambdaAssocMassPtDCADaug[curCentBin]->Fill(effLambdaDCA);
2641                   fLambdaAssocMassPtCPA[curCentBin]->Fill(effLambdaCPA);
2642
2643                   if( !isCandidate2K0s && !isCandidate2LambdaBar)
2644                     fLambdaAssocMassPtRap2[curCentBin]->Fill(effLambda);
2645
2646                 }
2647
2648                 fLambdaMCResEta->Fill(resEta,pt,centrality);
2649                 fLambdaMCResPhi->Fill(resPhi,pt,centrality);
2650
2651               } // End selection in the dca to prim. vtx and the number of clusters
2652               
2653               // Distributions for the efficiency (Systematic checks)
2654               if( TMath::Abs(rapAs)<fYMax ){ 
2655                 
2656                 //  Cut in the DCA ToPrim Vtx
2657                 if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2658
2659                   Double_t effLambdadcaPV[5] = {v0->MassLambda(),ptAs,rapAs,dcaPos,dcaNeg};
2660                   fLambdaAssocMassPtDCAPV[curCentBin]->Fill(effLambdadcaPV);
2661                 }                 
2662
2663                 // cut in the number of tpc clusters
2664                 if( (dcaPos>0.1) && (dcaNeg>0.1) && TMath::Abs(rapAs)<fYMax){
2665                  
2666                   Double_t effLambdaTPCcls[5]  = {v0->MassLambda(),ptAs,rapAs,nClsTPCPos,nClsTPCNeg};
2667                   fLambdaAssocMassPtDaugNClsTPC[curCentBin]->Fill(effLambdaTPCcls);
2668                 }
2669
2670               } // End selection for systematics
2671
2672             } // End natural particle selection
2673             // Embeded particles
2674             if(!isNaturalPart){
2675
2676               if( (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2677               
2678                 if( TMath::Abs(rapAs)<fYMax ){
2679
2680                   Double_t effLambda[3] = {v0->MassLambda(),ptAs,rapAs};
2681                   Double_t effLambdaVtx[4] = {v0->MassLambda(),ptAs,rapAs,zv};
2682                   Double_t effLambdaDCA[4] = {v0->MassLambda(),ptAs,rapAs,dca};
2683                   Double_t effLambdaCPA[4] = {v0->MassLambda(),ptAs,rapAs,cpa};
2684
2685                   // Distributions for the efficiency (systematics chechks)
2686                   fLambdaAssocMassPtRapEmbeded[curCentBin]->Fill(effLambda);
2687                   fLambdaAssocMassPtVtxEmbeded[curCentBin]->Fill(effLambdaVtx);
2688                   fLambdaAssocMassPtDCADaugEmbeded[curCentBin]->Fill(effLambdaDCA);
2689                   fLambdaAssocMassPtCPAEmbeded[curCentBin]->Fill(effLambdaCPA);
2690
2691                   if( !isCandidate2K0s && !isCandidate2LambdaBar)
2692                     fLambdaAssocMassPtRapEmbeded2[curCentBin]->Fill(effLambda);
2693                 }
2694
2695               } // End selection in the dca to prim. vtx and the number of clusters
2696
2697               // Distributions for the efficiency (Systematic checks)
2698               if( TMath::Abs(rapAs)<fYMax ){ 
2699
2700                 //  Cut in the DCA ToPrim Vtx
2701                 if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2702                   Double_t effLambdadcaPV[5] = {v0->MassLambda(),ptAs,rapAs,dcaPos,dcaNeg};
2703                   fLambdaAssocMassPtDCAPVEmbeded[curCentBin]->Fill(effLambdadcaPV);
2704                 }                 
2705
2706                 // cut in the number of tpc clusters
2707                 if( (dcaPos>0.1) && (dcaNeg>0.1) ){
2708                   Double_t effLambdaTPCcls[5]  = {v0->MassLambda(),ptAs,rapAs,nClsTPCPos,nClsTPCNeg};
2709                   fLambdaAssocMassPtDaugNClsTPCEmbeded[curCentBin]->Fill(effLambdaTPCcls);
2710                 }
2711
2712               } // End selection for systematics
2713
2714             }  // End embeded particle selection
2715             
2716           } // End Lambda selection
2717           
2718           // AntiLambda:
2719           if (ctAL && lCheckMcAntiLambda  && (TMath::Abs(nsigNegProton)<fNSigma) ){
2720             
2721             if(isNaturalPart){
2722
2723               if( (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2724
2725                 fAntiLambdaAssocPt->Fill(ptAs);
2726                 fAntiLambdaAssocPtRap->Fill(ptAs,rapAs,centrality);
2727                 fAntiLambdaAssocPtPhiEta[curCentBin]->Fill(p0->Phi(),etaAs,ptAs);
2728   
2729                 // Rapidity cut
2730                 if(TMath::Abs(rapAs)<fYMax)  {
2731   
2732                   Double_t effAntiLambda[3] = {v0->MassAntiLambda(),ptAs,rapAs};
2733                   Double_t effAntiLambdaVtx[4] = {v0->MassAntiLambda(),ptAs,rapAs,zv};
2734                   Double_t effAntiLambdaDCA[4] = {v0->MassAntiLambda(),ptAs,rapAs,dca};
2735                   Double_t effAntiLambdaCPA[4] = {v0->MassAntiLambda(),ptAs,rapAs,cpa};
2736
2737                   // Distributions for the efficiency (systematics chechks)
2738                   fAntiLambdaAssocMassPtRap[curCentBin]->Fill(effAntiLambda);
2739                   fAntiLambdaAssocMassPtVtx[curCentBin]->Fill(effAntiLambdaVtx);
2740                   fAntiLambdaAssocMassPtDCADaug[curCentBin]->Fill(effAntiLambdaDCA);
2741                   fAntiLambdaAssocMassPtCPA[curCentBin]->Fill(effAntiLambdaCPA);
2742
2743                   if( !isCandidate2K0s && !isCandidate2Lambda )
2744                     fAntiLambdaAssocMassPtRap2[curCentBin]->Fill(effAntiLambda);
2745                 }
2746
2747                 fAntiLambdaMCResEta->Fill(resEta,pt,centrality);
2748                 fAntiLambdaMCResPhi->Fill(resPhi,pt,centrality);
2749
2750               } // End selection in the dca to prim. vtx and the number of clusters
2751
2752               // Distributions for the efficiency (Systematic checks)
2753               if( TMath::Abs(rapAs)<fYMax ){ 
2754                 
2755                 //  Cut in the DCA ToPrim Vtx
2756                 if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2757                   
2758                   Double_t effAntiLambdadcaPV[5] = {v0->MassAntiLambda(),ptAs,rapAs,dcaPos,dcaNeg};
2759                   fAntiLambdaAssocMassPtDCAPV[curCentBin]->Fill(effAntiLambdadcaPV);
2760                 }                 
2761
2762                 // cut in the number of tpc clusters
2763                 if( (dcaPos>0.1) && (dcaNeg>0.1) && TMath::Abs(rapAs)<fYMax){
2764                   Double_t effAntiLambdaTPCcls[5]  = {v0->MassAntiLambda(),ptAs,rapAs,nClsTPCPos,nClsTPCNeg};
2765                   fAntiLambdaAssocMassPtDaugNClsTPC[curCentBin]->Fill(effAntiLambdaTPCcls);
2766                 }
2767
2768               } // End selection for systematics
2769
2770             }  // End natural particle selection
2771             // Embeded particles
2772             if(!isNaturalPart){
2773
2774               if( (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2775
2776                 if( TMath::Abs(rapAs)<fYMax ){
2777
2778                   Double_t effAntiLambda[3] = {v0->MassAntiLambda(),ptAs,rapAs};
2779                   Double_t effAntiLambdaVtx[4] = {v0->MassAntiLambda(),ptAs,rapAs,zv};
2780                   Double_t effAntiLambdaDCA[4] = {v0->MassAntiLambda(),ptAs,rapAs,dca};
2781                   Double_t effAntiLambdaCPA[4] = {v0->MassAntiLambda(),ptAs,rapAs,cpa};
2782
2783                   // Distributions for the efficiency (systematics chechks)
2784                   fAntiLambdaAssocMassPtRapEmbeded[curCentBin]->Fill(effAntiLambda);
2785                   fAntiLambdaAssocMassPtVtxEmbeded[curCentBin]->Fill(effAntiLambdaVtx);
2786                   fAntiLambdaAssocMassPtDCADaugEmbeded[curCentBin]->Fill(effAntiLambdaDCA);
2787                   fAntiLambdaAssocMassPtCPAEmbeded[curCentBin]->Fill(effAntiLambdaCPA);
2788
2789                   if( !isCandidate2K0s && !isCandidate2Lambda )
2790                     fAntiLambdaAssocMassPtRapEmbeded2[curCentBin]->Fill(effAntiLambda);
2791                 }
2792
2793               } // End selection in the dca to prim. vtx and the number of clusters
2794
2795
2796               // Distributions for the efficiency (Systematic checks)
2797               if( TMath::Abs(rapAs)<fYMax ){ 
2798
2799                 //  Cut in the DCA ToPrim Vtx
2800                 if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2801
2802                   Double_t effAntiLambdadcaPV[5] = {v0->MassAntiLambda(),ptAs,rapAs,dcaPos,dcaNeg};
2803                   fAntiLambdaAssocMassPtDCAPVEmbeded[curCentBin]->Fill(effAntiLambdadcaPV);
2804                 }                 
2805
2806                 // cut in the number of tpc ckusters
2807                 if( (dcaPos>0.1) && (dcaNeg>0.1) ){
2808
2809                   Double_t effAntiLambdaTPCcls[5]  = {v0->MassAntiLambda(),ptAs,rapAs,nClsTPCPos,nClsTPCNeg};
2810                   fAntiLambdaAssocMassPtDaugNClsTPCEmbeded[curCentBin]->Fill(effAntiLambdaTPCcls);
2811                 }
2812
2813               } // End selection for systematics
2814
2815             }  // End embeded particle selection
2816           
2817             } // End AntiLambda
2818           // Xi decay:
2819           if( lComeFromXi && isNaturalPart ){
2820             if(lPDGCodeV0==3122) { fLambdaAssocFromXi->Fill(ptAs,centrality); }
2821             else if(lPDGCodeV0==-3122) { fAntiLambdaAssocFromXi->Fill(ptAs,centrality); }
2822           }
2823
2824         } // End Primary V0 selection
2825        
2826         // After the kinematical selection of K0s and Lambdas
2827         // it might be that the daugthers are not identified through MC Association
2828         if(lMCAssocNegDaug==0)
2829           lMCAssocNegDaug = 6;
2830         if(lMCAssocPosDaug==0)
2831           lMCAssocPosDaug = 6;
2832                 
2833       } // End MC-Association 
2834       
2835     }// End Correlation Step
2836    
2837     // ************************************
2838   
2839   noas:
2840
2841     // Comparing the pt of the trigger particle wrt the v0-candidate's daughter:
2842     // It is used as well for the side-band subtraction
2843     Int_t isSameTrkPosDaug = -1;
2844     Int_t isSameTrkNegDaug = -1;
2845     if( step==kTriggerCheck ){
2846       isSameTrkPosDaug = SameTrack(trkTrig,ptrack);
2847       isSameTrkNegDaug = SameTrack(trkTrig,ntrack);
2848     }
2849
2850     // *******************
2851     //   K0s selection
2852     // *******************
2853     if (ctK && (TMath::Abs(rapK0s)<fYMax) && ( lPtArmV0 > TMath::Abs(0.2*lAlphaV0) ) && ( massK0s > 0.3979 && massK0s < 0.5981 ) ) {
2854       
2855       switch(step) {
2856       case kTriggerCheck: 
2857
2858         if (isCandidate2K0s && (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2859
2860           if(pt>ptTrig){
2861             fIsV0LP = 1; 
2862             fPtV0LP = pt;
2863           }       
2864           
2865           if( isSameTrkPosDaug==1 || isSameTrkNegDaug==1){
2866             Printf("  The LP has the same momentum in X and Y as one of the K0s daughters *** iV0 %d",iV0); 
2867             
2868             if(fCheckIDTrig){  // Compare properties of daughters nad 
2869               Float_t difNegP[3];
2870               difNegP[0] = (pTrig[0]-pNegDaug[0])/pTrig[0];  difNegP[1] = (pTrig[1]-pNegDaug[1])/pTrig[1]; difNegP[2] = (pTrig[2]-pNegDaug[2])/pTrig[2];
2871               Float_t difPosP[3]; 
2872               difPosP[0] = (pTrig[0]-pPosDaug[0])/pTrig[0];  difPosP[1] = (pTrig[1]-pPosDaug[1])/pTrig[1]; difPosP[2] = (pTrig[2]-pPosDaug[2])/pTrig[2];
2873               Float_t posDeltaPhi =  phiTrig - phiPos, negDeltaPhi =  phiTrig - phiNeg;
2874               Float_t posDeltaEta =  etaTrig - etaPos, negDeltaEta =  etaTrig - etaNeg;
2875               
2876               /*
2877                 Printf("  The LP has the same momentum in X and Y as one of the K0s daughters *** iV0 %d \n\t\t %d %d %d \n\t\t %lf %lf %lf \n\t\t %lf %lf %lf \n\t\t %lf %lf \n\t\t %lf %lf ",
2878                 iV0, TMath::Abs( trkTrig->GetID() ), ntrack->GetID() ,  ptrack->GetID() ,
2879                 TMath::Abs( difNegP[1] ), TMath::Abs( difNegP[2] ), TMath::Abs( difNegP[0] ),
2880                 TMath::Abs( difPosP[1] ), TMath::Abs( difPosP[2] ), TMath::Abs( difPosP[0] ),
2881                 TMath::Abs( negDeltaPhi ), TMath::Abs( negDeltaEta ),
2882                 TMath::Abs( posDeltaPhi ), TMath::Abs( posDeltaEta )
2883                 );
2884               */
2885               
2886               // Positive daughter
2887               if( isSameTrkPosDaug==1 ){
2888                 for(Int_t i=0;i<3;i++)
2889                   fCheckIDTrigPtK0s->Fill(difPosP[i],i,pt); 
2890                 fCheckIDTrigPhiK0s->Fill(posDeltaPhi,0.,pt);
2891                 fCheckIDTrigEtaK0s->Fill(posDeltaEta,0.,pt);
2892                 fCheckIDTrigNclsK0s->Fill(nClsTPCPos,0.,pt);
2893               }
2894               // Negative daughter
2895               if( isSameTrkNegDaug==1 ){ 
2896                 for(Int_t i=0;i<3;i++)
2897                   fCheckIDTrigPtK0s->Fill(difNegP[i],i+3,pt); 
2898                 fCheckIDTrigPhiK0s->Fill(negDeltaPhi,2.,pt);
2899                 fCheckIDTrigEtaK0s->Fill(negDeltaEta,2.,pt);
2900                 fCheckIDTrigNclsK0s->Fill(nClsTPCNeg,2.,pt);
2901               }
2902               
2903             } // End check ID
2904             
2905             
2906             fTriggerParticles->RemoveAt(iArray);
2907             fTriggerParticles->AddAt( new AliMiniParticle(centrality, zv, idTrig, ptTrig, phiTrig, etaTrig, 0, 0, 0), iArray);
2908             
2909
2910           } // Close isTrigFromV0daug
2911           
2912         }// End K0s Mass cut
2913         
2914         break; // End K0s selection for TriggerCheck
2915       case kReconstruction:
2916         
2917         if( (dcaPos > 0.1) && (dcaNeg > 0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) && (pt<10.) ){
2918           
2919           if(isNaturalPart) fK0sMass->Fill(massK0s,pt,centrality);
2920           else fK0sMassEmbeded->Fill(massK0s,pt,centrality);
2921           
2922           fK0sMassPtEta->Fill(massK0s,pt,lEta);
2923           fK0sMassPtRap[curCentBin]->Fill(massK0s,pt,rapK0s);
2924           fK0sMassPtPhi->Fill(massK0s,pt,lPhi);
2925
2926           
2927           if( (pt>kPtBinV0[0]) && (pt<kPtBinV0[kN1]) && isNaturalPart )
2928             fAssocParticles->Add( new AliMiniParticle(centrality, zv, iV0, pt, lPhi, lEta, lMCAssocNegDaug, lMCAssocPosDaug, 3) );
2929           
2930
2931         }
2932
2933         if( fDoQA && lCheckMcK0Short && isNaturalPart && (pt<10.) ){ // Quality Assurance
2934
2935           // Invariant Mass cut
2936           if (TMath::Abs(mK0s-massK0s) < 3*sK0s) {
2937
2938             if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2939               fK0sDCAPosDaug->Fill(dcaPos,pt);
2940               fK0sDCANegDaug->Fill(dcaNeg,pt);
2941             }
2942
2943             if( (dcaPos > 0.1) && (dcaNeg > 0.1) ){
2944
2945               if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC ) ){
2946                 fK0sPtPosDaug->Fill(pt,lPtPos);
2947                 fK0sPtNegDaug->Fill(pt,lPtNeg);
2948
2949                 fK0sPhiEtaPosDaug->Fill(phiPos,etaPos,pt);
2950                 fK0sPhiEtaNegDaug->Fill(phiNeg,etaNeg,pt);
2951             
2952                 fK0sDecayPos->Fill(dx,dy,pt);
2953                 fK0sDecayVertex->Fill(lt,pt);
2954             
2955                 fK0sCPA->Fill(cpa,pt); 
2956                 fK0sDCAV0Daug->Fill(dca,pt); 
2957
2958                 fK0sNClustersITSPos->Fill(phiPos,posITSNcls,pt);
2959                 fK0sNClustersITSNeg->Fill(phiNeg,negITSNcls,pt);
2960               }
2961
2962               fK0sNClustersTPC->Fill(phiPos,nClsTPCPos,pt);
2963               fK0sNClustersTPC->Fill(phiNeg,nClsTPCNeg,-pt);
2964             }
2965
2966           } // End selection in mass
2967
2968           if( TMath::Abs(mK0s-massK0s + 6.5*sK0s) < 1.5*sK0s ||
2969               TMath::Abs(mK0s-massK0s - 6.5*sK0s) < 1.5*sK0s  ) {
2970
2971             if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2972               fK0sBckgDCAPosDaug->Fill(dcaPos,pt);
2973               fK0sBckgDCANegDaug->Fill(dcaNeg,pt);
2974             }
2975             
2976             if( (dcaPos > 0.1) && (dcaNeg > 0.1) ){
2977
2978               if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
2979                 fK0sBckgPtPosDaug->Fill(pt,lPtPos);
2980                 fK0sBckgPtNegDaug->Fill(pt,lPtNeg);
2981               
2982                 fK0sBckgPhiEtaPosDaug->Fill(phiPos,etaPos,pt);
2983                 fK0sBckgPhiEtaNegDaug->Fill(phiNeg,etaNeg,pt);
2984               
2985                 fK0sBckgDecayPos->Fill(dx,dy,pt);
2986                 fK0sBckgDecayVertex->Fill(lt,pt);
2987               
2988                 fK0sBckgCPA->Fill(cpa,pt); 
2989                 fK0sBckgDCAV0Daug->Fill(dca,pt); 
2990               
2991                 fK0sBckgNClustersITSPos->Fill(phiPos,posITSNcls,pt);
2992                 fK0sBckgNClustersITSNeg->Fill(phiNeg,negITSNcls,pt);
2993               }
2994
2995               fK0sBckgNClustersTPC->Fill(phiPos,nClsTPCPos,pt);
2996               fK0sBckgNClustersTPC->Fill(phiNeg,nClsTPCNeg,-pt);
2997
2998             }
2999
3000           }// End selection in outside the mass cut
3001
3002         } // End QA
3003         
3004         break; // End K0s selection for Corrleation
3005       default:
3006         Printf( " Selection of 'step' is not set properly");
3007         break;
3008         
3009       }// End switch
3010
3011     } // End K0s selection
3012
3013     // *******************
3014     // Lambda selection
3015     // *******************
3016     if ( ctL && (TMath::Abs(rapLambda)<fYMax) && (massLambda > 1.0649 && massLambda < 1.1651 ) && (TMath::Abs(nsigPosProton)<fNSigma) ){
3017
3018       switch(step) {
3019       case kTriggerCheck: 
3020         
3021         if (isCandidate2Lambda && (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) && !isCandidate2K0s && !isCandidate2LambdaBar ){
3022
3023           if(pt>ptTrig) {
3024             fIsV0LP = 1;
3025             fPtV0LP = pt;
3026           }
3027
3028           if( isSameTrkPosDaug==1 || isSameTrkNegDaug==1 ){
3029             Printf("  The LP has the same momentum in X and Y as one of the Lambda daughters *** iV0 %d",iV0); 
3030
3031             if(fCheckIDTrig){  // Compare properties of daughters nad 
3032               Float_t difNegP[3];
3033               difNegP[0] = (pTrig[0]-pNegDaug[0])/pTrig[0];  difNegP[1] = (pTrig[1]-pNegDaug[1])/pTrig[1]; difNegP[2] = (pTrig[2]-pNegDaug[2])/pTrig[2];
3034               Float_t difPosP[3]; 
3035               difPosP[0] = (pTrig[0]-pPosDaug[0])/pTrig[0];  difPosP[1] = (pTrig[1]-pPosDaug[1])/pTrig[1]; difPosP[2] = (pTrig[2]-pPosDaug[2])/pTrig[2];
3036               Float_t posDeltaPhi =  phiTrig - phiPos, negDeltaPhi =  phiTrig - phiNeg;
3037               Float_t posDeltaEta =  etaTrig - etaPos, negDeltaEta =  etaTrig - etaNeg;
3038     
3039               /*
3040                 Printf("  The LP has the same momentum in X and Y as one of the Lambda daughters *** iV0 %d \n\t\t %d %d %d \n\t\t %lf %lf %lf \n\t\t %lf %lf %lf \n\t\t %lf %lf \n\t\t %lf %lf ",
3041                 iV0, TMath::Abs( trkTrig->GetID() ), ntrack->GetID() ,  ptrack->GetID() ,
3042                 TMath::Abs( difNegP[1] ), TMath::Abs( difNegP[2] ), TMath::Abs( difNegP[0] ),
3043                 TMath::Abs( difPosP[1] ), TMath::Abs( difPosP[2] ), TMath::Abs( difPosP[0] ),
3044                 TMath::Abs( negDeltaPhi ), TMath::Abs( negDeltaEta ),
3045                 TMath::Abs( posDeltaPhi ), TMath::Abs( posDeltaEta )
3046                 );
3047               */
3048
3049               // Positive daughter
3050               if( isSameTrkPosDaug==1 ){
3051                 for(Int_t i=0;i<3;i++)
3052                   fCheckIDTrigPtLambda->Fill(difPosP[i],i,pt); 
3053                 fCheckIDTrigPhiLambda->Fill(posDeltaPhi,0.,pt);
3054                 fCheckIDTrigEtaLambda->Fill(posDeltaEta,0.,pt);
3055                 fCheckIDTrigNclsLambda->Fill(nClsTPCPos,0.,pt);
3056               }
3057               // Negative daughter
3058               if( isSameTrkNegDaug==1 ){ 
3059                 for(Int_t i=0;i<3;i++)
3060                   fCheckIDTrigPtLambda->Fill(difNegP[i],i+3,pt); 
3061                 fCheckIDTrigPhiLambda->Fill(negDeltaPhi,2.,pt);
3062                 fCheckIDTrigEtaLambda->Fill(negDeltaEta,2.,pt);
3063                 fCheckIDTrigNclsLambda->Fill(nClsTPCNeg,2.,pt);
3064               }
3065
3066             } // End check ID
3067
3068             fTriggerParticles->RemoveAt(iArray);
3069             fTriggerParticles->AddAt( new AliMiniParticle(centrality, zv, idTrig, ptTrig, phiTrig, etaTrig, 0, 0, 0), iArray);
3070
3071           } // Close isTrigFromV0daug
3072
3073         } // End Lambda Mass cut        
3074         break; // End Lambda selection for TriggerCheck
3075       case kReconstruction:
3076         
3077         if( (dcaPos > 0.1) && (dcaNeg > 0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) && (pt<10.) ){
3078
3079           if(isNaturalPart) fLambdaMass->Fill(massLambda,pt,centrality);
3080           else  fLambdaMassEmbeded->Fill(massLambda,pt,centrality);
3081
3082           if( !isCandidate2K0s && !isCandidate2LambdaBar){
3083             if(isNaturalPart) fLambdaMass2->Fill(massLambda,pt,centrality);
3084             else fLambdaMass2Embeded->Fill(massLambda,pt,centrality);
3085           }
3086
3087           fLambdaMassPtEta->Fill(massLambda,pt,lEta);
3088           fLambdaMassPtRap[curCentBin]->Fill(massLambda,pt,rapLambda);  
3089           fLambdaMassPtPhi->Fill(massLambda,pt,lPhi);
3090
3091           
3092           if( (pt>kPtBinV0[0]) && (pt<kPtBinV0[kN1]) && isNaturalPart )
3093             fAssocParticles->Add( new AliMiniParticle(centrality, zv, iV0, pt, lPhi, lEta, lMCAssocNegDaug, lMCAssocPosDaug, 4) );
3094           
3095           
3096         }
3097         
3098         // Invariant Mass cut
3099         if(fDoQA && lCheckMcLambda && isNaturalPart && (pt<10.)){ // Quality Assurance
3100           
3101           // Invariant Mass cut
3102           if (TMath::Abs(mLambda-massLambda) < 3*sL) {
3103
3104             if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
3105               fLambdaDCAPosDaug->Fill(dcaPos,pt);
3106               fLambdaDCANegDaug->Fill(dcaNeg,pt);
3107             }
3108
3109             if( (dcaPos > 0.1) && (dcaNeg > 0.1) ){
3110
3111               if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
3112                 fLambdaPtPosDaug->Fill(pt,lPtPos);
3113                 fLambdaPtNegDaug->Fill(pt,lPtNeg);
3114
3115                 fLambdaPhiEtaPosDaug->Fill(phiPos,etaPos,pt);
3116                 fLambdaPhiEtaNegDaug->Fill(phiNeg,etaNeg,pt);
3117
3118                 fLambdaDecayPos->Fill(dx,dy,pt);
3119                 fLambdaDecayVertex->Fill(lt,pt);
3120
3121                 fLambdaCPA->Fill(cpa,pt); 
3122                 fLambdaDCAV0Daug->Fill(dca,pt); 
3123
3124                 fLambdaNClustersITSPos->Fill(phiPos,posITSNcls,pt);
3125                 fLambdaNClustersITSNeg->Fill(phiNeg,negITSNcls,pt);
3126               }
3127
3128               fLambdaNClustersTPC->Fill(phiPos,nClsTPCPos,pt);
3129               fLambdaNClustersTPC->Fill(phiNeg,nClsTPCNeg,-pt);
3130
3131             }
3132
3133           } // End selection in mass
3134         
3135           if( (TMath::Abs(mLambda-massLambda + 6.5*sL) < 1.5*sL) ||
3136               (TMath::Abs(mLambda-massLambda - 6.5*sL) < 1.5*sL) ){
3137
3138             if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
3139               fLambdaBckgDCAPosDaug->Fill(dcaPos,pt);
3140               fLambdaBckgDCANegDaug->Fill(dcaNeg,pt);
3141             }       
3142
3143             if( (dcaPos > 0.1) && (dcaNeg > 0.1) ){
3144
3145               if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
3146                 fLambdaBckgPtPosDaug->Fill(pt,lPtPos);
3147                 fLambdaBckgPtNegDaug->Fill(pt,lPtNeg);
3148
3149                 fLambdaBckgPhiEtaPosDaug->Fill(phiPos,etaPos,pt);
3150                 fLambdaBckgPhiEtaNegDaug->Fill(phiNeg,etaNeg,pt);
3151               
3152                 fLambdaBckgDecayPos->Fill(dx,dy,pt);
3153                 fLambdaBckgDecayVertex->Fill(lt,pt);
3154               
3155                 fLambdaBckgCPA->Fill(cpa,pt); 
3156                 fLambdaBckgDCAV0Daug->Fill(dca,pt); 
3157
3158                 fLambdaBckgNClustersITSPos->Fill(phiPos,posITSNcls,pt);
3159                 fLambdaBckgNClustersITSNeg->Fill(phiNeg,negITSNcls,pt);
3160               }
3161               
3162               fLambdaBckgNClustersTPC->Fill(phiPos,nClsTPCPos,pt);
3163               fLambdaBckgNClustersTPC->Fill(phiNeg,nClsTPCNeg,-pt);
3164             }
3165
3166           }// End selection in outside the mass cut  
3167           
3168         } // End QA
3169
3170         break; // End Lambda selection for Correlation
3171       default:
3172         Printf(" Selection of 'step' is not set properly");
3173         break;
3174         
3175       }// End switch
3176       
3177     } // End Lambda selection
3178
3179     // *******************
3180     // AntiLambda selection
3181     // *******************
3182     if ( ctAL && (TMath::Abs(rapLambda)<fYMax)  && (massAntiLambda > 1.0649 && massAntiLambda < 1.1651 ) && (TMath::Abs(nsigNegProton)<fNSigma) ) {
3183       
3184       switch(step) {
3185       case kTriggerCheck: 
3186         
3187         if (isCandidate2LambdaBar && (dcaPos>0.1) && (dcaNeg>0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) &&  !isCandidate2K0s && !isCandidate2Lambda ){
3188
3189           if(pt>ptTrig) {
3190             fIsV0LP = 1;
3191             fPtV0LP = pt;
3192           }
3193           
3194           if( isSameTrkPosDaug==1 || isSameTrkNegDaug==1 ){
3195             Printf("  The LP has the same momentum in X and Y as one of the AntiLambda daughters *** iV0 %d",iV0); 
3196
3197             if(fCheckIDTrig){  // Compare properties of daughters nad 
3198               Float_t difNegP[3];
3199               difNegP[0] = (pTrig[0]-pNegDaug[0])/pTrig[0];  difNegP[1] = (pTrig[1]-pNegDaug[1])/pTrig[1]; difNegP[2] = (pTrig[2]-pNegDaug[2])/pTrig[2];
3200               Float_t difPosP[3]; 
3201               difPosP[0] = (pTrig[0]-pPosDaug[0])/pTrig[0];  difPosP[1] = (pTrig[1]-pPosDaug[1])/pTrig[1]; difPosP[2] = (pTrig[2]-pPosDaug[2])/pTrig[2];
3202               Float_t posDeltaPhi =  phiTrig - phiPos, negDeltaPhi =  phiTrig - phiNeg;
3203               Float_t posDeltaEta =  etaTrig - etaPos, negDeltaEta =  etaTrig - etaNeg;
3204
3205               /*
3206                 Printf("  The LP has the same momentum in X and Y as one of the AntiLambda daughters *** iV0 %d \n\t\t %d %d %d \n\t\t %lf %lf %lf \n\t\t %lf %lf %lf \n\t\t %lf %lf \n\t\t %lf %lf ",
3207                 iV0, TMath::Abs( trkTrig->GetID() ), ntrack->GetID() ,  ptrack->GetID() ,
3208                 TMath::Abs( difNegP[1] ), TMath::Abs( difNegP[2] ), TMath::Abs( difNegP[0] ),
3209                 TMath::Abs( difPosP[1] ), TMath::Abs( difPosP[2] ), TMath::Abs( difPosP[0] ),
3210                 TMath::Abs( negDeltaPhi ), TMath::Abs( negDeltaEta ),
3211                 TMath::Abs( posDeltaPhi ), TMath::Abs( posDeltaEta )
3212                 );
3213               */
3214
3215               // Positive daughter
3216               if( isSameTrkPosDaug==1 ){
3217                 for(Int_t i=0;i<3;i++)
3218                   fCheckIDTrigPtAntiLambda->Fill(difPosP[i],i,pt); 
3219                 fCheckIDTrigPhiAntiLambda->Fill(posDeltaPhi,0.,pt);
3220                 fCheckIDTrigEtaAntiLambda->Fill(posDeltaEta,0.,pt);
3221                 fCheckIDTrigNclsAntiLambda->Fill(nClsTPCPos,0.,pt);
3222               }
3223               // Negative daughter
3224               if( isSameTrkNegDaug==1 ){ 
3225                 for(Int_t i=0;i<3;i++)
3226                   fCheckIDTrigPtAntiLambda->Fill(difNegP[i],i+3,pt); 
3227                 fCheckIDTrigPhiAntiLambda->Fill(negDeltaPhi,2.,pt);
3228                 fCheckIDTrigEtaAntiLambda->Fill(negDeltaEta,2.,pt);
3229                 fCheckIDTrigNclsAntiLambda->Fill(nClsTPCNeg,2.,pt);
3230               }
3231
3232             } // End check ID  
3233
3234
3235             fTriggerParticles->RemoveAt(iArray);
3236             fTriggerParticles->AddAt( new AliMiniParticle(centrality, zv, idTrig, ptTrig, phiTrig, etaTrig, 0, 0, 0), iArray);
3237
3238           }// Close isTrigFromV0daug
3239           
3240         }// End AntiLambda Mass cut
3241         break; // End AntiLambda selection for CheckTrigger
3242       case kReconstruction: 
3243         
3244         if( (dcaPos > 0.1) && (dcaNeg > 0.1) && (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) && (pt<10.) ) {
3245
3246           if(isNaturalPart)  fAntiLambdaMass->Fill(massAntiLambda,pt,centrality);
3247           else fAntiLambdaMassEmbeded->Fill(massAntiLambda,pt,centrality);
3248
3249           if( !isCandidate2K0s && !isCandidate2Lambda) {
3250             if(isNaturalPart) fAntiLambdaMass2->Fill(massAntiLambda,pt,centrality);
3251             else fAntiLambdaMass2Embeded->Fill(massAntiLambda,pt,centrality);
3252           }
3253
3254           fAntiLambdaMassPtEta->Fill(massAntiLambda,pt,lEta);
3255           fAntiLambdaMassPtRap[curCentBin]->Fill(massAntiLambda,pt,rapLambda);    
3256           fAntiLambdaMassPtPhi->Fill(massAntiLambda,pt,lPhi);
3257         
3258           
3259           if( (pt>kPtBinV0[0]) && (pt<kPtBinV0[kN1]) && isNaturalPart )
3260             fAssocParticles->Add( new AliMiniParticle(centrality, zv, iV0, pt, lPhi, lEta, lMCAssocNegDaug, lMCAssocPosDaug, 5) );
3261           
3262
3263         }
3264  
3265         if( fDoQA && lCheckMcAntiLambda && isNaturalPart && (pt<10.) ){ // Quality Assurance
3266
3267           // Invariant Mass cut
3268           if (TMath::Abs(mLambda-massAntiLambda) < 3*sAL) {
3269
3270             if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
3271               fAntiLambdaDCAPosDaug->Fill(dcaPos,pt);
3272               fAntiLambdaDCANegDaug->Fill(dcaNeg,pt);
3273             }
3274
3275             if( (dcaPos>0.1) && (dcaNeg>0.1) ){
3276               
3277               if( (nClsTPCPos>fDaugNClsTPC) && (nClsTPCNeg>fDaugNClsTPC) ){
3278                   fAntiLambdaPtPosDaug->Fill(pt,lPtPos);