Added THn for eta-phi debbuging
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / AliAnalysisTaskV0ForRAA.cxx
1 /**************************************************************************
2  * Authors : Simone Schuchmann                                            *
3  * Contributors are mentioned in the code where appropriate.              *
4  *                                                                        *
5  * Permission to use, copy, modify and distribute this software and its   *
6  * documentation strictly for non-commercial purposes is hereby granted   *
7  * without fee, provided that the above copyright notice appears in all   *
8  * copies and that both the copyright notice and this permission notice   *
9  * appear in the supporting documentation. The authors make no claims     *
10  * about the suitability of this software for any purpose. It is          *
11  * provided "as is" without express or implied warranty.                  *
12  **************************************************************************/
13
14 //-----------------------------------------------------------------
15 // AliAnalysisTaskV0ForRAA class
16 // This task is for analysing Lambda and K0s pt spectra in PbPb and
17 // pp as well as with MC. The flag for pp and MC  must be set
18 // accordingly, default is PbPb data.
19 // It works with ESD files only.
20 //-----------------------------------------------------------------
21
22
23 #define AliAnalysisTaskV0ForRAA_cxx
24
25
26 #include "AliAnalysisTaskV0ForRAA.h"
27
28 #include "Riostream.h"
29 //#include "THn.h"
30 #include "TROOT.h"
31 #include "TH1.h"
32 #include "TH2.h"
33 //#include "TH3.h"//xxx
34 #include "TLorentzVector.h"
35
36 #include "AliAnalysisTaskSE.h"
37 #include "AliAnalysisManager.h"
38 #include "AliESDInputHandler.h"
39 #include "AliMCEventHandler.h"
40
41 #include "AliESDVZERO.h"
42 #include "AliMultiplicity.h"
43 #include "AliCentrality.h"
44
45 #include "AliKFParticle.h"
46 #include "AliKFVertex.h"
47 #include "AliESDtrackCuts.h"
48 #include "AliESDpid.h"
49 #include "AliESDv0.h"
50 #include "AliESDEvent.h"
51 #include "AliMCEvent.h"
52 #include "AliStack.h"
53 #include "AliGenEventHeader.h"
54
55
56 ClassImp(AliAnalysisTaskV0ForRAA)
57
58 //________________________________________________________________________
59 AliAnalysisTaskV0ForRAA::AliAnalysisTaskV0ForRAA()
60 :AliAnalysisTaskSE("default_AliAnalysisTaskV0ForRAA"),
61   fESD(0),
62   fMCev(0),
63 //other objects
64   fESDpid(0),
65   fESDTrackCuts(0),
66   fESDTrackCutsCharged(0),
67   fESDTrackCutsLowPt(0),
68   fOutputContainer(0),
69 //thnf
70   fTHnFK0s(0),
71   fTHnFL(0),
72   fTHnFAL(0),
73   fTHnFK0sDauEta(0),
74   fTHnFLDauEta(0),
75   fTHnFALDauEta(0),
76   fTHnFK0sDauPhi(0),
77   fTHnFLDauPhi(0),
78   fTHnFALDauPhi(0),
79 //event histos
80   fHistITSLayerHits(0),
81   fHistOneHitWithSDD(0),
82   fHistNEvents(0),
83   fHistPrimVtxZESDVSNContributors(0),
84   fHistPrimVtxZESDTPCVSNContributors(0),
85   fHistPrimVtxZESDSPDVSNContributors(0),
86   fHistPrimVtxZESD(0),
87   fHistPrimVtxZESDTPC(0),
88   fHistPrimVtxZESDSPD(0),
89   fHistESDVertexZ(0),
90   fHistMuliplicity(0),
91   fHistMuliplicityRaw(0),
92   fHistCentBinRaw(0),
93   fHistCentBin(0),
94   fHistMultiplicityPrimary(0),
95   fHistNPrim(0),
96   fHistPiPiK0sVsLambdaMass(0),
97   fHistPiPiK0sVsALambdaMass(0),
98   fHistPiPK0sVsLambdaMass(0),
99   fHistPiAPK0sVsALambdaMass(0),
100   fHistPiPALambdaVsLambdaMass(0),
101   fHistPiAPLambdaVsALambdaMass(0),
102 //-----------K0 histos -------------------//
103   fHistPiPiMass(0),
104   fHistPiPiMassVSPt(0),
105   fHistPiPiMassVSPtMCTruth(0),
106   fHistPiPiMassVSY(0),
107   fHistPiPiPtVSY(0),
108 // fHistPiPiMassVSAlpha(0),
109   fHistPiPiRadiusXY(0),
110   fHistPiPiCosPointAng(0),
111   fHistPiPiDCADaughterPosToPrimVtxVSMass(0),  
112   fHistPiPiDecayLengthVsPt(0),
113   fHistPiPiDecayLengthVsMass(0),
114   fHistPiPiDecayLengthVsCtau(0),
115   fHistPiPiDCADaughters(0), 
116 //  fHistPiPiPtDaughters(0),
117   fHistPiPiDCAVSMass(0),
118 //fHistPiPiDCAZPos(0),
119 //fHistPiPiDCAZNeg(0),
120   fHistPiPiTrackLengthPosVsMass(0),
121   fHistPiPiTrackLengthNegVsMass(0),  
122   fHistPiPiMonitorCuts(0),
123   fHistPiPiMonitorMCCuts(0),
124   fHistPiPiDecayLengthResolution(0),
125   fHistNclsITSPosK0(0),
126   fHistNclsITSNegK0(0),
127   fHistNclsTPCPosK0(0),
128   fHistNclsTPCNegK0(0),
129   fHistChi2PerNclsITSPosK0(0),
130   fHistChi2PerNclsITSNegK0(0),
131   fHistNCRowsTPCPosK0(0),
132   fHistNCRowsTPCNegK0(0),
133   fHistRatioFoundOverFinableTPCK0Pos(0),
134   fHistRatioFoundOverFinableTPCK0Neg(0),
135 //------------MC only histos-----------
136   fHistPrimVtxZESDVSNContributorsMC(0),
137   fHistPrimVtxZESDTPCVSNContributorsMC(0),
138   fHistPrimVtxZESDSPDVSNContributorsMC(0),
139   fHistMCVertexZ(0),
140   fHistPiPiPDGCode(0),
141   fHistPiPPDGCode(0),
142   fHistPiAPPDGCode(0),
143
144 //-- BG of K0s
145 // fHistPiPiGA(0),
146 // fHistPiPiKch(0),
147 // fHistPiPiPhi(0),
148 // fHistPiPiL(0),
149 // fHistPiPiPi0(0),
150 // fHistPiPiPich(0),
151 // fHistPiPiRoh(0),
152 // fHistPiPiOmega(0),
153 // fHistPiPiKStar(0),
154 // fHistPiPiNoMother(0),
155 // fHistPiPiK0s(0),
156 // fHistPiPiK0L(0),
157 // fHistPiPiN(0),
158 // fHistPiPiSigma(0),
159 // fHistPiPiXi(0),
160 // fHistPiPiDelta(0),
161 // fHistPiPiB(0),
162 // fHistPiPiD(0),
163 // fHistPiPiEta(0),
164 // //-- BG of Lambda
165 // fHistPiPGA(0),
166 // fHistPiPKch(0),
167 // fHistPiPK0s(0),
168 // fHistPiPPi0(0),
169 // fHistPiPPich(0),
170 // fHistPiPKStar(0),
171 // fHistPiPN(0),
172 // fHistPiPNoMother(0),
173 // fHistPiPL(0),
174
175 //cosine of pointing angle of Xi vs pt histos
176   fHistPiPCosPointAngXiVsPt(0),
177   fHistPiAPCosPointAngXiVsPt(0),
178   fHistPiPMassVSPtSecXiMCTruth(0),
179   fHistPiPMassVSPtSecOmegaMCTruth(0),
180   fHistPiAPMassVSPtSecXiMCTruth(0),
181   fHistPiAPMassVSPtSecOmegaMCTruth(0),
182 // fHistUserPtShift(0),
183 // fHistPiPiPhiPosVsPtPosVsMass(0),//xxx
184 // fHistPiPPhiPosVsPtPosVsMass(0),//xxx
185 // fHistPiAPPhiPosVsPtPosVsMass(0),//xxx
186 //selection booleans and values
187   fMCMode(0),
188   fMCTruthMode(0),
189   fSelectInjected(0),
190   fSelectMBMotherMC(0),
191   fCheckNegLabelReco(0),
192   fOnlyFoundRecoV0(0),
193   fUseCentrality(0),
194   fUseCentralityBin(0),
195   fUseCentralityRange(0),
196   fAnapp(0),
197   fRejectPileUpSPD(0),
198   fSelSDD(0),
199   fSelNoSDD(0),
200   fOntheFly(0),
201   fVertexZCut(0),
202   fVtxStatus(0),
203   fNcr(0),              
204   fChi2cls(0),      
205   fTPCrefit(0),      
206   fNcrCh(0),      
207   fChi2clsCh(0),         
208   fTPCrefitCh(0),   
209   fNcrLpt(0),            
210   fChi2clsLpt(0),     
211   fTPCrefitLpt(0),
212   fUsePID(0),
213   fUsePIDPion(0),
214   fNSigma(0),
215   fNSigma2(0),
216   fPPIDcut(0),
217   fPtTPCCut(0),
218   fMoreNclsThanRows(0),
219   fMoreNclsThanFindable(0),
220   fMoreNclsThanFindableMax(0),
221   fRatioFoundOverFindable(0),
222   fRatioMaxCRowsOverFindable(0),
223   fChi2PerClusterITS(0),
224   fDistanceTPCInner(0),
225   fMinNCLSITSPos(0),
226   fMinNCLSITSNeg(0),
227   fMaxNCLSITSPos(0),
228   fMaxNCLSITSNeg(0),
229   fSwitchCaseITSCls(0),
230   fCutMITrackLength(0),
231   fCutMICrossedR(0),
232   fCutMITPCncls(0),
233   fCutMITrackLengthLengthF(0),
234   fCutMICrossedRLengthF(0),
235   fRapCutV0(0),
236   fRap(0),
237   fEtaCutMCDaughters(0),
238   fEtaCutMCDaughtersVal(0),
239   fMinPt(0),
240   fAlfaCut(0),
241   fQtCut(0),
242   fQtCutPt(0),
243   fQtCutPtLow(0),
244   fArmCutK0(0),      
245   fArmCutL(0),
246   fArmQtSlope(0),
247   fExcludeLambdaFromK0s(0),
248   fExcludeK0sFromLambda(0),
249   fExcludePhotonsFromK0s(0),
250   fExcludePhotonsFromLambda(0),
251   fDCAToVertexK0(0),
252   fDCAToVertexL(0),
253   fDCAXK(0),
254   fDCAYK(0),
255   fDCAXL(0),
256   fDCAYL(0),
257   fDCAZ(0),
258   fDCADaughtersL(0),
259   fDCADaughtersAL(0),
260   fDCADaughtersK0(0),
261   fDCADaughtersToVtxLarge(0),
262   fDCADaughtersToVtxSmall(0),
263   fDecayRadXYMin(0),
264   fDecayRadXYMax(0),
265   fPtDecRadMin(0),
266   fCosPointAngL(0),
267   fCosPointAngK(0),
268   fCPAPtCutK0(0),
269   fCPAPtCutL(0),
270   fOpengAngleDaughters(0),
271   fOpAngPtCut(0),
272   fDecayLengthMax(0),
273   fDecayLengthMin(0),
274   fDecRadCutITSMin(0),
275   fDecRadCutITSMax(0),
276   fCtauK0s(0),
277   fCtauL(0),
278   fCtauPtCutK0(0),
279   fCtauPtCutL(0),
280   fChiCutKf(0),                 
281   fK0sLowMassCut(0),
282   fK0sHighMassCut(0),
283   fLLowMassCut(0),
284   fLHighMassCut(0),
285   fSetFillDetAL(0),
286   fSetPtDepHist(0),
287   fStopLoop(0)
288   //  fShift(0),
289   // fDeltaInvP(0)
290 {  // Constructor.
291
292   DefineOutput(1,TList::Class());
293   // define defaults for globals
294   /*
295     fShift = kFALSE;                       // shift in charge/pt yes/no
296     fDeltaInvP = 0.00;                     // shift value
297   */
298    
299   fMCMode = kFALSE;
300   fMCTruthMode = kFALSE;
301
302   fUseCentrality = 0;
303   fUseCentralityBin = 0;
304   fUseCentralityRange =0;
305
306   fAnapp = kFALSE;
307   fRejectPileUpSPD = kFALSE;
308   fSelSDD = kFALSE;
309   fSelNoSDD= kFALSE;
310    
311   fSelectInjected = kFALSE;
312   fSelectMBMotherMC = kFALSE;
313   fCheckNegLabelReco = kFALSE;
314   fOnlyFoundRecoV0= kFALSE;
315
316   fVertexZCut = 100000.0;
317   fVtxStatus = kFALSE;
318
319   fOntheFly = kTRUE;
320
321   //----- define defaults for V0 and track cuts ----//
322   fNcr = 70;              
323   fChi2cls = 4;      
324   fTPCrefit = kTRUE;      
325   fNcrCh = 70;      
326   fChi2clsCh =4;         
327   fTPCrefitCh = kTRUE;   
328   fNcrLpt = 70;            
329   fChi2clsLpt = 4;     
330   fTPCrefitLpt = kTRUE; 
331
332   fUsePID = kFALSE;
333   fUsePIDPion = kFALSE;
334   fMoreNclsThanRows = kFALSE;
335   fMoreNclsThanFindable = kFALSE;
336   fMoreNclsThanFindableMax = kFALSE;
337   fRatioFoundOverFindable = -1.0;
338   fRatioMaxCRowsOverFindable = 1000.0;
339
340
341   fChi2PerClusterITS = 100000.0;
342   fDistanceTPCInner = -1.0;
343   fMinNCLSITSPos = -1;
344   fMaxNCLSITSPos = 1000;
345   fMinNCLSITSNeg = -1;
346   fMaxNCLSITSNeg = 1000;
347   fSwitchCaseITSCls = kFALSE;
348
349   fCutMITrackLength = kFALSE;
350   fCutMICrossedR    = kFALSE;
351   fCutMITPCncls     = kFALSE;
352   fCutMITrackLengthLengthF = 1.0;
353   fCutMICrossedRLengthF = 0.85;
354
355   fNSigma   = 100000.0;
356   fNSigma2  = 100000.0;
357   fPPIDcut  = 100.0;
358   fPtTPCCut = -1.0;
359
360
361   fRapCutV0=kFALSE;
362   fRap=1000.0;
363   fRap=1000.0;
364
365   fAlfaCut= -100.0;
366   fQtCut = -1.0;
367   fQtCutPt = 100.0;
368   fQtCutPtLow = -1.0;
369   fArmCutK0=kFALSE;     
370   fArmCutL=kFALSE;  
371   fArmQtSlope =0.2;
372   fExcludeLambdaFromK0s = -1.0;
373   fExcludeK0sFromLambda = -1.0;
374   fExcludePhotonsFromK0s = -1.0;
375   fExcludePhotonsFromLambda = -1.0;
376
377   fEtaCutMCDaughters = kFALSE;
378   fEtaCutMCDaughtersVal = 50.0;
379
380   fMinPt= -1.0;
381
382   fDCAToVertexK0 = 10000.0;
383   fDCAToVertexL = 10000.0;
384   fDCAXK=10000.0;
385   fDCAYK=10000.0;
386   fDCAXL=10000.0;
387   fDCAYL=10000.0;
388   fDCAZ=10000.0;
389    
390   fDCADaughtersL=10000.0;
391   fDCADaughtersAL=10000.0;
392   fDCADaughtersK0=10000.0;
393
394   fDCADaughtersToVtxLarge=-1.0;
395   fDCADaughtersToVtxSmall=-1.0;
396
397   fDecayRadXYMin = -100000.0;
398   fDecayRadXYMax = 1000000.0;
399   fPtDecRadMin = 1000000.0;
400   fDecayLengthMax = 100000.0;
401   fDecayLengthMin = -1000000.0;
402    
403   fDecRadCutITSMin = 0.0000;
404   fDecRadCutITSMax = 10000.0;
405
406   fCosPointAngL=-1.0;
407   fCosPointAngK=-1.0;
408   fCPAPtCutK0 = 1000.0;
409   fCPAPtCutL = -1000.0;//xxx
410   fOpengAngleDaughters = -1.0;
411   fOpAngPtCut = -1.0;
412       
413   fCtauK0s=10e6;
414   fCtauL=10e6;
415   fCtauPtCutK0=10e6;
416   fCtauPtCutL=10e6;
417
418   fChiCutKf=1000000.0;
419
420   fK0sLowMassCut  = 0.25;
421   fK0sHighMassCut = 0.75;
422
423   fLLowMassCut  = 1.05;
424   fLHighMassCut = 1.25;
425
426
427   fSetFillDetAL = kFALSE;
428
429   fSetPtDepHist=kFALSE;
430
431   fStopLoop = kFALSE;
432
433   //---- histograms ----//
434   for(Int_t j=0;j<2;j++){
435     fHistArmenteros[j]=NULL;
436     fHistV0RadiusZ[j] =NULL;
437     fHistV0RadiusZVSPt[j] =NULL;
438     fHistV0RadiusXY[j] =NULL;
439     fHistV0RadiusXYVSY[j] =NULL;
440          
441     //Lambda
442     fHistPiPMass[j]=NULL;
443     fHistPiPMassVSPt[j]=NULL;
444     fHistPiPMassVSY[j] = NULL;
445     fHistPiPMassVSPtMCTruth[j]=NULL;
446     fHistPiPRadiusXY[j]=NULL;
447     fHistPiPCosPointAng[j]=NULL;
448     fHistPiPDecayLengthVsPt[j]=NULL;
449     fHistPiPDecayLengthVsMass[j]=NULL;
450     fHistPiPDecayLengthVsCtau[j]=NULL;
451     fHistPiPDCADaughterPosToPrimVtxVSMass[j]=NULL;
452     fHistPiPDCADaughterNegToPrimVtxVSMass[j]=NULL;
453     fHistPiPMassVSPtSecSigma[j]=NULL;
454     fHistPiPMassVSPtSecXi[j]=NULL;
455     fHistPiPMassVSPtSecOmega[j]=NULL;
456     fHistPiPMassVSYSecXi[j]=NULL;
457     fHistPiPXi0PtVSLambdaPt[j]=NULL;
458     fHistPiPXiMinusPtVSLambdaPt[j]=NULL;
459     fHistPiPOmegaPtVSLambdaPt[j]=NULL;
460     fHistPiPDCADaughters[j]=NULL;
461     //  fHistPiPPtDaughters[j]=NULL;
462     fHistPiPPtVSY[j]=NULL;
463     fHistPiPDCAVSMass[j]=NULL;
464     fHistPiPMonitorCuts[j] =NULL;
465     fHistPiPMonitorMCCuts[j] =NULL;
466     fHistPiPDecayLengthResolution[j] =NULL;
467     //    fHistPiPDCAZPos[j] =NULL;
468     //fHistPiPDCAZNeg[j] =NULL;
469     fHistPiPTrackLengthPosVsMass[j] = NULL;
470     fHistPiPTrackLengthNegVsMass[j] = NULL;
471
472     //ALambda
473     fHistPiAPMass[j]=NULL;
474     fHistPiAPMassVSPt[j]=NULL;
475     fHistPiAPMassVSY[j] = NULL;
476     fHistPiAPMassVSPtMCTruth[j]=NULL;
477     fHistPiAPRadiusXY[j]=NULL;
478     fHistPiAPCosPointAng[j]=NULL;
479     fHistPiAPDecayLengthVsPt[j]=NULL;
480     fHistPiAPDecayLengthVsMass[j]=NULL;
481     fHistPiAPDecayLengthVsCtau[j]=NULL;
482     fHistPiAPDCADaughterPosToPrimVtxVSMass[j]=NULL;
483     fHistPiAPDCADaughterNegToPrimVtxVSMass[j]=NULL;
484     fHistPiAPMassVSPtSecSigma[j]=NULL;
485     fHistPiAPMassVSPtSecXi[j]=NULL;
486     fHistPiAPMassVSPtSecOmega[j]=NULL;
487     fHistPiAPMassVSYSecXi[j]=NULL;
488     fHistPiAPXi0PtVSLambdaPt[j]=NULL;
489     fHistPiAPXiMinusPtVSLambdaPt[j]=NULL;
490     fHistPiAPOmegaPtVSLambdaPt[j] =NULL;
491     fHistPiAPDCADaughters[j]=NULL;
492     // fHistPiAPPtDaughters[j]=NULL;
493     fHistPiAPPtVSY[j]=NULL;
494     fHistPiAPDCAVSMass[j]=NULL;
495     fHistPiAPMonitorCuts[j] =NULL;
496     fHistPiAPMonitorMCCuts[j] =NULL;
497     fHistPiAPDecayLengthResolution[j] =NULL;
498     //    fHistPiAPDCAZPos[j] =NULL;
499     //fHistPiAPDCAZNeg[j] =NULL;
500     fHistPiAPTrackLengthPosVsMass[j] = NULL;
501     fHistPiAPTrackLengthNegVsMass[j] = NULL;
502
503     //other 
504     fHistDedxSecProt[j]=NULL;
505     fHistDedxSecAProt[j]=NULL;
506     fHistDedxSecPiMinus[j]=NULL;
507     fHistDedxSecPiPlus[j]=NULL;
508     fHistDedxProt[j]=NULL;
509     fHistDedxAProt[j]=NULL;
510     fHistDedxPiMinus[j]=NULL;
511     fHistDedxPiPlus[j]=NULL;
512     fHistNclsITS[j]=NULL;
513     fHistNclsTPC[j]=NULL;
514     fHistNclsITSPosL[j]=NULL;
515     fHistNclsITSNegL[j]=NULL;
516     fHistNclsTPCPosL[j]=NULL;
517     fHistNclsTPCNegL[j]=NULL;
518     fHistChi2PerNclsITSPosL[j]=NULL;
519     fHistChi2PerNclsITSNegL[j]=NULL;
520     fHistNCRowsTPCPosL[j]=NULL;
521     fHistNCRowsTPCNegL[j]=NULL;
522     fHistRatioFoundOverFinableTPCLPos[j]=NULL;
523     fHistRatioFoundOverFinableTPCLNeg[j]=NULL;
524     fHistPiPiEtaDMC[j] = NULL;
525     fHistPiPiEtaDReco[j] = NULL;
526     fHistPiPEtaDMC[j] = NULL;
527     fHistPiPEtaDReco[j] = NULL;
528   }
529    
530 }
531 //________________________________________________________________________
532 AliAnalysisTaskV0ForRAA::AliAnalysisTaskV0ForRAA(const char *name)
533  :AliAnalysisTaskSE(name),
534   fESD(0),
535   fMCev(0),
536   //other objects
537   fESDpid(0),
538   fESDTrackCuts(0),
539   fESDTrackCutsCharged(0),
540   fESDTrackCutsLowPt(0),
541   fOutputContainer(0),
542   //thnf
543   fTHnFK0s(0),
544   fTHnFL(0),
545   fTHnFAL(0),
546   fTHnFK0sDauEta(0),
547   fTHnFLDauEta(0),
548   fTHnFALDauEta(0),
549   fTHnFK0sDauPhi(0),
550   fTHnFLDauPhi(0),
551   fTHnFALDauPhi(0),
552   //event histos
553   fHistITSLayerHits(0),
554   fHistOneHitWithSDD(0),
555   fHistNEvents(0),
556   fHistPrimVtxZESDVSNContributors(0),
557   fHistPrimVtxZESDTPCVSNContributors(0),
558   fHistPrimVtxZESDSPDVSNContributors(0),
559   fHistPrimVtxZESD(0),
560   fHistPrimVtxZESDTPC(0),
561   fHistPrimVtxZESDSPD(0),
562   fHistESDVertexZ(0),
563   fHistMuliplicity(0),
564   fHistMuliplicityRaw(0),
565   fHistCentBinRaw(0),
566   fHistCentBin(0),
567   fHistMultiplicityPrimary(0),
568   fHistNPrim(0),
569   fHistPiPiK0sVsLambdaMass(0),
570   fHistPiPiK0sVsALambdaMass(0),
571   fHistPiPK0sVsLambdaMass(0),
572   fHistPiAPK0sVsALambdaMass(0),
573   fHistPiPALambdaVsLambdaMass(0),
574   fHistPiAPLambdaVsALambdaMass(0),
575   //-----------K0 histos -------------------//
576   fHistPiPiMass(0),
577   fHistPiPiMassVSPt(0),
578   fHistPiPiMassVSPtMCTruth(0),
579   fHistPiPiMassVSY(0),
580   fHistPiPiPtVSY(0),
581  
582   // fHistPiPiMassVSAlpha(0),
583   fHistPiPiRadiusXY(0),
584   fHistPiPiCosPointAng(0),
585   fHistPiPiDCADaughterPosToPrimVtxVSMass(0),  
586   fHistPiPiDecayLengthVsPt(0),
587   fHistPiPiDecayLengthVsMass(0),
588   fHistPiPiDecayLengthVsCtau(0),
589   fHistPiPiDCADaughters(0), 
590   //    fHistPiPiPtDaughters(0),
591   fHistPiPiDCAVSMass(0),
592   //  fHistPiPiDCAZPos(0),
593   //fHistPiPiDCAZNeg(0),
594   fHistPiPiTrackLengthPosVsMass(0),
595   fHistPiPiTrackLengthNegVsMass(0),  
596   fHistPiPiMonitorCuts(0),
597   fHistPiPiMonitorMCCuts(0),
598   fHistPiPiDecayLengthResolution(0),
599   fHistNclsITSPosK0(0),
600   fHistNclsITSNegK0(0),
601   fHistNclsTPCPosK0(0),
602   fHistNclsTPCNegK0(0),
603   fHistChi2PerNclsITSPosK0(0),
604   fHistChi2PerNclsITSNegK0(0),
605   fHistNCRowsTPCPosK0(0),
606   fHistNCRowsTPCNegK0(0),
607   fHistRatioFoundOverFinableTPCK0Pos(0),
608   fHistRatioFoundOverFinableTPCK0Neg(0),
609   //------------MC only histos-----------
610   fHistPrimVtxZESDVSNContributorsMC(0),
611   fHistPrimVtxZESDTPCVSNContributorsMC(0),
612   fHistPrimVtxZESDSPDVSNContributorsMC(0),
613   fHistMCVertexZ(0),
614   fHistPiPiPDGCode(0),
615   fHistPiPPDGCode(0),
616   fHistPiAPPDGCode(0),
617   
618   // //-- BG of K0s
619   // fHistPiPiGA(0),
620   // fHistPiPiKch(0),
621   // fHistPiPiPhi(0),
622   // fHistPiPiL(0),
623   // fHistPiPiPi0(0),
624   // fHistPiPiPich(0),
625   // fHistPiPiRoh(0),
626   // fHistPiPiOmega(0),
627   // fHistPiPiKStar(0),
628   // fHistPiPiNoMother(0),
629   // fHistPiPiK0s(0),
630   // fHistPiPiK0L(0),
631   // fHistPiPiN(0),
632   // fHistPiPiSigma(0),
633   // fHistPiPiXi(0),
634   // fHistPiPiDelta(0),
635   // fHistPiPiB(0),
636   // fHistPiPiD(0),
637   // fHistPiPiEta(0),
638   // //-- BG of Lambda
639   // fHistPiPGA(0),
640   // fHistPiPKch(0),
641   // fHistPiPK0s(0),
642   // fHistPiPPi0(0),
643   // fHistPiPPich(0),
644   // fHistPiPKStar(0),
645   // fHistPiPN(0),
646   // fHistPiPNoMother(0),
647   // fHistPiPL(0),
648  
649   //cosine of pointing angle of Xi vs pt histos
650   fHistPiPCosPointAngXiVsPt(0),
651   fHistPiAPCosPointAngXiVsPt(0),
652   fHistPiPMassVSPtSecXiMCTruth(0),
653   fHistPiPMassVSPtSecOmegaMCTruth(0),
654   fHistPiAPMassVSPtSecXiMCTruth(0),
655   fHistPiAPMassVSPtSecOmegaMCTruth(0),
656   // fHistUserPtShift(0),
657   //fHistPiPiPhiPosVsPtPosVsMass(0),//xxx
658   //fHistPiPPhiPosVsPtPosVsMass(0),//xxx
659   //fHistPiAPPhiPosVsPtPosVsMass(0),//xxx
660   //selection booleans and values
661   fMCMode(0),
662   fMCTruthMode(0),
663   fSelectInjected(0),
664   fSelectMBMotherMC(0),
665   fCheckNegLabelReco(0),
666   fOnlyFoundRecoV0(0),
667   fUseCentrality(0),
668   fUseCentralityBin(0),
669   fUseCentralityRange(0),
670   fAnapp(0),
671   fRejectPileUpSPD(0),
672   fSelSDD(0),
673   fSelNoSDD(0),
674   fOntheFly(0),
675   fVertexZCut(0),
676   fVtxStatus(0),
677   fNcr(0),              
678   fChi2cls(0),      
679   fTPCrefit(0),      
680   fNcrCh(0),      
681   fChi2clsCh(0),         
682   fTPCrefitCh(0),   
683   fNcrLpt(0),            
684   fChi2clsLpt(0),     
685   fTPCrefitLpt(0),
686   fUsePID(0),
687   fUsePIDPion(0),
688   fNSigma(0),
689   fNSigma2(0),
690   fPPIDcut(0),
691   fPtTPCCut(0),
692   fMoreNclsThanRows(0),
693   fMoreNclsThanFindable(0),
694   fMoreNclsThanFindableMax(0),
695   fRatioFoundOverFindable(0),
696   fRatioMaxCRowsOverFindable(0),
697   fChi2PerClusterITS(0),
698   fDistanceTPCInner(0),
699   fMinNCLSITSPos(0),
700   fMinNCLSITSNeg(0),
701   fMaxNCLSITSPos(0),
702   fMaxNCLSITSNeg(0),
703   fSwitchCaseITSCls(0),
704   fCutMITrackLength(0),
705   fCutMICrossedR(0),
706   fCutMITPCncls(0),
707   fCutMITrackLengthLengthF(0),
708   fCutMICrossedRLengthF(0),
709   fRapCutV0(0),
710   fRap(0),
711   fEtaCutMCDaughters(0),
712   fEtaCutMCDaughtersVal(0),
713   fMinPt(0),
714   fAlfaCut(0),
715   fQtCut(0),
716   fQtCutPt(0),
717   fQtCutPtLow(0),
718   fArmCutK0(0),      
719   fArmCutL(0),
720   fArmQtSlope(0),
721   fExcludeLambdaFromK0s(0),
722   fExcludeK0sFromLambda(0),
723   fExcludePhotonsFromK0s(0),
724   fExcludePhotonsFromLambda(0),
725   fDCAToVertexK0(0),
726   fDCAToVertexL(0),
727   fDCAXK(0),
728   fDCAYK(0),
729   fDCAXL(0),
730   fDCAYL(0),
731   fDCAZ(0),
732   fDCADaughtersL(0),
733   fDCADaughtersAL(0),
734   fDCADaughtersK0(0),
735   fDCADaughtersToVtxLarge(0),
736   fDCADaughtersToVtxSmall(0),
737   fDecayRadXYMin(0),
738   fDecayRadXYMax(0),
739   fPtDecRadMin(0),
740   fCosPointAngL(0),
741   fCosPointAngK(0),
742   fCPAPtCutK0(0),
743   fCPAPtCutL(0),
744   fOpengAngleDaughters(0),
745   fOpAngPtCut(0),
746   fDecayLengthMax(0),
747   fDecayLengthMin(0),
748   fDecRadCutITSMin(0),
749   fDecRadCutITSMax(0),
750   fCtauK0s(0),
751   fCtauL(0),
752   fCtauPtCutK0(0),
753   fCtauPtCutL(0),
754   fChiCutKf(0),                 
755   fK0sLowMassCut(0),
756   fK0sHighMassCut(0),
757   fLLowMassCut(0),
758   fLHighMassCut(0),
759   fSetFillDetAL(0),
760   fSetPtDepHist(0),
761   fStopLoop(0)
762   //  fShift(0),
763   // fDeltaInvP(0)
764 {// Constructor.
765
766   DefineOutput(1,TList::Class());
767   // define defaults for globals
768   /*
769     fShift = kFALSE;                       // shift in charge/pt yes/no
770     fDeltaInvP = 0.00;                     // shift value
771   */
772    
773   fMCMode = kFALSE;
774   fMCTruthMode = kFALSE;
775
776   fUseCentrality = 0;
777   fUseCentralityBin = 0;
778   fUseCentralityRange =0;
779
780   fAnapp = kFALSE;
781   fRejectPileUpSPD = kFALSE;
782   fSelSDD = kFALSE;
783   fSelNoSDD= kFALSE;
784    
785   fSelectInjected = kFALSE;
786   fSelectMBMotherMC = kFALSE;
787   fCheckNegLabelReco = kFALSE;
788   fOnlyFoundRecoV0= kFALSE;
789
790   fVertexZCut = 100000.0;
791   fVtxStatus = kFALSE;
792    
793   fOntheFly = kTRUE;
794
795   //----- define defaults for V0 and track cuts ----//
796   fNcr = 70;              
797   fChi2cls = 4;      
798   fTPCrefit = kTRUE;      
799   fNcrCh = 70;      
800   fChi2clsCh =4;         
801   fTPCrefitCh = kTRUE;   
802   fNcrLpt = 70;            
803   fChi2clsLpt = 4;     
804   fTPCrefitLpt = kTRUE;
805
806   fUsePID = kFALSE;
807   fUsePIDPion = kFALSE;
808   fMoreNclsThanRows = kFALSE;
809   fMoreNclsThanFindable = kFALSE;
810   fMoreNclsThanFindableMax = kFALSE;
811   fRatioFoundOverFindable = -1.0;
812   fRatioMaxCRowsOverFindable = 1000.0;
813
814
815   fChi2PerClusterITS = 100000.0;
816   fDistanceTPCInner = -1.0;
817   fMinNCLSITSPos = -1;
818   fMaxNCLSITSPos = 1000;
819   fMinNCLSITSNeg = -1;
820   fMaxNCLSITSNeg = 1000;
821   fSwitchCaseITSCls = kFALSE;
822
823   fCutMITrackLength = kFALSE;
824   fCutMICrossedR    = kFALSE;
825   fCutMITPCncls     = kFALSE;
826   fCutMITrackLengthLengthF = 1.0;
827   fCutMICrossedRLengthF = 0.85;
828
829   fNSigma   = 100000.0;
830   fNSigma2  = 100000.0;
831   fPPIDcut  = 100.0;
832   fPtTPCCut = -1.0;
833
834
835   fRapCutV0=kFALSE;
836   fRap=1000.0;
837   fRap=1000.0;
838
839   fAlfaCut= -100.0;
840   fQtCut = -1.0;
841   fQtCutPt = 100.0;
842   fQtCutPtLow = -1.0;
843   fArmCutK0=kFALSE;     
844   fArmCutL=kFALSE;  
845   fArmQtSlope =0.2;
846   fExcludeLambdaFromK0s = -1.0;
847   fExcludeK0sFromLambda = -1.0;
848   fExcludePhotonsFromK0s = -1.0;
849   fExcludePhotonsFromLambda = -1.0;
850
851   fEtaCutMCDaughters = kFALSE;
852   fEtaCutMCDaughtersVal = 50.0;
853
854   fMinPt= -1.0;
855
856   fDCAToVertexK0 = 10000.0;
857   fDCAToVertexL = 10000.0;
858   fDCAXK=10000.0;
859   fDCAYK=10000.0;
860   fDCAXL=10000.0;
861   fDCAYL=10000.0;
862   fDCAZ=10000.0;
863    
864   fDCADaughtersL=10000.0;
865   fDCADaughtersAL=10000.0;
866   fDCADaughtersK0=10000.0;
867
868   fDCADaughtersToVtxLarge=-1.0;
869   fDCADaughtersToVtxSmall=-1.0;
870
871   fDecayRadXYMin = -100000.0;
872   fDecayRadXYMax = 1000000.0;
873   fPtDecRadMin = 1000000.0;
874   fDecayLengthMax = 100000.0;
875   fDecayLengthMin = -1000000.0;
876    
877   fDecRadCutITSMin = 0.0000;
878   fDecRadCutITSMax = 10000.0;
879
880   fCosPointAngL=-1.0;
881   fCosPointAngK=-1.0;
882   fCPAPtCutK0 = 1000.0;
883   fCPAPtCutL = -1000.0;//xxx
884   fOpengAngleDaughters = -1.0;
885   fOpAngPtCut = -1.0;
886       
887   fCtauK0s=10e6;
888   fCtauL=10e6;
889   fCtauPtCutK0=10e6;
890   fCtauPtCutL=10e6;
891
892   fChiCutKf=1000000.0;
893
894   fK0sLowMassCut  = 0.25;
895   fK0sHighMassCut = 0.75;
896
897   fLLowMassCut  = 1.05;
898   fLHighMassCut = 1.25;
899
900
901   fSetFillDetAL = kFALSE;
902
903   fSetPtDepHist=kFALSE;
904
905   fStopLoop = kFALSE;
906
907   //---- histograms ----//
908   for(Int_t j=0;j<2;j++){
909     fHistArmenteros[j]=NULL;
910     fHistV0RadiusZ[j] =NULL;
911     fHistV0RadiusZVSPt[j] =NULL;
912     fHistV0RadiusXY[j] =NULL;
913     fHistV0RadiusXYVSY[j] =NULL;
914          
915     //Lambda
916     fHistPiPMass[j]=NULL;
917     fHistPiPMassVSPt[j]=NULL;
918     fHistPiPMassVSY[j] = NULL;
919     fHistPiPMassVSPtMCTruth[j]=NULL;
920     fHistPiPRadiusXY[j]=NULL;
921     fHistPiPCosPointAng[j]=NULL;
922     fHistPiPDecayLengthVsPt[j]=NULL;
923     fHistPiPDecayLengthVsMass[j]=NULL;
924     fHistPiPDecayLengthVsCtau[j]=NULL;
925     fHistPiPDCADaughterPosToPrimVtxVSMass[j]=NULL;
926     fHistPiPDCADaughterNegToPrimVtxVSMass[j]=NULL;
927     fHistPiPMassVSPtSecSigma[j]=NULL;
928     fHistPiPMassVSPtSecXi[j]=NULL;
929     fHistPiPMassVSPtSecOmega[j]=NULL;
930     fHistPiPMassVSYSecXi[j]=NULL;
931     fHistPiPXi0PtVSLambdaPt[j]=NULL;
932     fHistPiPXiMinusPtVSLambdaPt[j]=NULL;
933     fHistPiPOmegaPtVSLambdaPt[j]=NULL;
934     fHistPiPDCADaughters[j]=NULL;
935     //  fHistPiPPtDaughters[j]=NULL;
936     fHistPiPPtVSY[j]=NULL;
937     fHistPiPDCAVSMass[j]=NULL;
938     fHistPiPMonitorCuts[j] =NULL;
939     fHistPiPMonitorMCCuts[j] =NULL;
940     fHistPiPDecayLengthResolution[j] =NULL;
941     //    fHistPiPDCAZPos[j] =NULL;
942     //fHistPiPDCAZNeg[j] =NULL;
943     fHistPiPTrackLengthPosVsMass[j] = NULL;
944     fHistPiPTrackLengthNegVsMass[j] = NULL;
945
946     //ALambda
947     fHistPiAPMass[j]=NULL;
948     fHistPiAPMassVSPt[j]=NULL;
949     fHistPiAPMassVSY[j] = NULL;
950     fHistPiAPMassVSPtMCTruth[j]=NULL;
951     fHistPiAPRadiusXY[j]=NULL;
952     fHistPiAPCosPointAng[j]=NULL;
953     fHistPiAPDecayLengthVsPt[j]=NULL;
954     fHistPiAPDecayLengthVsMass[j]=NULL;
955     fHistPiAPDecayLengthVsCtau[j]=NULL;
956     fHistPiAPDCADaughterPosToPrimVtxVSMass[j]=NULL;
957     fHistPiAPDCADaughterNegToPrimVtxVSMass[j]=NULL;
958     fHistPiAPMassVSPtSecSigma[j]=NULL;
959     fHistPiAPMassVSPtSecXi[j]=NULL;
960     fHistPiAPMassVSPtSecOmega[j]=NULL;
961     fHistPiAPMassVSYSecXi[j]=NULL;
962     fHistPiAPXi0PtVSLambdaPt[j]=NULL;
963     fHistPiAPXiMinusPtVSLambdaPt[j]=NULL;
964     fHistPiAPOmegaPtVSLambdaPt[j] =NULL;
965     fHistPiAPDCADaughters[j]=NULL;
966     // fHistPiAPPtDaughters[j]=NULL;
967     fHistPiAPPtVSY[j]=NULL;
968     fHistPiAPDCAVSMass[j]=NULL;
969     fHistPiAPMonitorCuts[j] =NULL;
970     fHistPiAPMonitorMCCuts[j] =NULL;
971     fHistPiAPDecayLengthResolution[j] =NULL;
972     //    fHistPiAPDCAZPos[j] =NULL;
973     //fHistPiAPDCAZNeg[j] =NULL;
974     fHistPiAPTrackLengthPosVsMass[j] = NULL;
975     fHistPiAPTrackLengthNegVsMass[j] = NULL;
976
977     //other 
978     fHistDedxSecProt[j]=NULL;
979     fHistDedxSecAProt[j]=NULL;
980     fHistDedxSecPiMinus[j]=NULL;
981     fHistDedxSecPiPlus[j]=NULL;
982     fHistDedxProt[j]=NULL;
983     fHistDedxAProt[j]=NULL;
984     fHistDedxPiMinus[j]=NULL;
985     fHistDedxPiPlus[j]=NULL;
986     fHistNclsITS[j]=NULL;
987     fHistNclsTPC[j]=NULL;
988     fHistNclsITSPosL[j]=NULL;
989     fHistNclsITSNegL[j]=NULL;
990     fHistNclsTPCPosL[j]=NULL;
991     fHistNclsTPCNegL[j]=NULL;
992     fHistChi2PerNclsITSPosL[j]=NULL;
993     fHistChi2PerNclsITSNegL[j]=NULL;
994     fHistNCRowsTPCPosL[j]=NULL;
995     fHistNCRowsTPCNegL[j]=NULL;
996     fHistRatioFoundOverFinableTPCLPos[j]=NULL;
997     fHistRatioFoundOverFinableTPCLNeg[j]=NULL;
998     fHistPiPiEtaDMC[j] = NULL;
999     fHistPiPiEtaDReco[j] = NULL;
1000     fHistPiPEtaDMC[j] = NULL;
1001     fHistPiPEtaDReco[j] = NULL;
1002   }
1003    
1004 }
1005 //_____________________________________________________
1006 AliAnalysisTaskV0ForRAA::~AliAnalysisTaskV0ForRAA()
1007 {
1008   //---- Remove all pointers ----//
1009   if(fOutputContainer) delete fOutputContainer;fOutputContainer=0;
1010   if(fESDTrackCuts) delete fESDTrackCuts;fESDTrackCuts=0;
1011   if(fESDTrackCutsCharged) delete fESDTrackCutsCharged;fESDTrackCutsCharged=0;
1012   if(fESDTrackCutsLowPt) delete fESDTrackCutsLowPt; fESDTrackCutsLowPt=0;
1013 }
1014 //________________________________________________________________________
1015 void AliAnalysisTaskV0ForRAA::UserCreateOutputObjects(){
1016
1017   //--- esd track cuts V0 daughters ---//
1018   TString cutsname = "esdtrackcuts";
1019   // esd track cuts for pions high pt
1020   fESDTrackCuts = new AliESDtrackCuts(cutsname);
1021   fESDTrackCuts->SetMaxChi2PerClusterTPC(fChi2cls);
1022   fESDTrackCuts->SetMinNCrossedRowsTPC(fNcr);
1023   fESDTrackCuts->SetAcceptKinkDaughters(kFALSE);
1024   fESDTrackCuts->SetRequireTPCRefit(fTPCrefit);
1025   fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
1026
1027   // esd track cuts for protons high pt
1028   TString cutsnameCh = cutsname;
1029   cutsnameCh +="_charged";
1030   fESDTrackCutsCharged = new AliESDtrackCuts(cutsnameCh);
1031   fESDTrackCutsCharged->SetMaxChi2PerClusterTPC(fChi2clsCh);
1032   fESDTrackCutsCharged->SetMinNCrossedRowsTPC(fNcrCh);
1033   fESDTrackCutsCharged->SetAcceptKinkDaughters(kFALSE);
1034   fESDTrackCutsCharged->SetRequireTPCRefit(fTPCrefitCh);
1035   fESDTrackCutsCharged->SetRequireSigmaToVertex(kFALSE);
1036
1037   // esd track cuts for all low pt
1038   TString cutsnameLowPt  = cutsname;
1039   cutsnameLowPt +="_lowpt";
1040   fESDTrackCutsLowPt = new AliESDtrackCuts(cutsnameLowPt);
1041   fESDTrackCutsLowPt->SetMaxChi2PerClusterTPC(fChi2clsLpt);
1042   fESDTrackCutsLowPt->SetMinNCrossedRowsTPC(fNcrLpt);
1043   fESDTrackCutsLowPt->SetAcceptKinkDaughters(kFALSE);
1044   fESDTrackCutsLowPt->SetRequireTPCRefit(fTPCrefitLpt);
1045   fESDTrackCutsLowPt->SetRequireSigmaToVertex(kFALSE);  
1046
1047
1048
1049   //create output objects
1050   Int_t nbMass=500;
1051   
1052   //-----------------  create output container -----------------//
1053
1054   fOutputContainer = new TList() ;
1055   fOutputContainer->SetName(GetName()) ;
1056   fOutputContainer->SetOwner();
1057   
1058   TH1::SetDefaultSumw2();
1059   TH2::SetDefaultSumw2();
1060
1061   Int_t mchist = 1;// for Data
1062   if((fMCMode && fMCTruthMode) || fMCTruthMode) mchist = 2;//for MC to create sec. Lambda histos        
1063
1064   //------------ create allways -----------------------//
1065   fHistNEvents = new TH1F("fHistNEvents","no of events before cuts =0, after cuts=1, after process =2",5,0.0,5.0);
1066   fOutputContainer->Add(fHistNEvents);
1067       
1068   fHistMuliplicity =  new TH1F("fHistMuliplicity","V0 multiplicity",3000,0.0,30000);
1069   fOutputContainer->Add(fHistMuliplicity);
1070       
1071   fHistMuliplicityRaw =  new TH1F("fHistMuliplicityRaw","V0 multiplicity before process",3000,0.0,30000);      
1072   fOutputContainer->Add(fHistMuliplicityRaw);
1073       
1074   fHistMultiplicityPrimary = new TH1F("fHistMultiplicityPrimary","number of charged tracks",5000,0.0,20000);
1075   fOutputContainer->Add(fHistMultiplicityPrimary);
1076       
1077   fHistESDVertexZ= new TH1F("fHistESDVertexZ"," z vertex distr in cm",500,-50,50);
1078   fOutputContainer->Add(fHistESDVertexZ);
1079    
1080   fHistPrimVtxZESD = new TH1F("fHistPrimVtxZESD","z vertex pos ESD",250,-50,50);
1081   fOutputContainer->Add(fHistPrimVtxZESD);
1082       
1083   fHistPrimVtxZESDVSNContributors = new TH2F("fHistPrimVtxZESDVSNContributors","prim vtx pos z ESD vs no. of contributers TPC",250,-50,50,500,0.0,500.0);
1084   fOutputContainer->Add(fHistPrimVtxZESDVSNContributors);
1085       
1086   fHistNPrim = new TH1F("fHistNPrim","Number of contributers to vertex",2500,0.0,5000);
1087   fOutputContainer->Add(fHistNPrim);
1088  
1089   //------------------------ pp analysis only -------------------------//
1090   if(fAnapp){
1091     fHistITSLayerHits = new TH1F("fHistITSLayerHits","SDD layer -1=0,1=1,2=2 ... 5=5,0=nothing",7,-1.5,5.5);
1092     fOutputContainer->Add(fHistITSLayerHits);
1093     fHistOneHitWithSDD = new TH1F("fHistOneHitWithSDD","min one hit in SDD",2,-0.5,1.5);
1094     fOutputContainer->Add(fHistOneHitWithSDD);
1095     fHistPrimVtxZESDTPC = new TH1F("fHistPrimVtxZESDTPC","z vertex pos TPC",250,-50,50);
1096     fOutputContainer->Add(fHistPrimVtxZESDTPC);
1097     fHistPrimVtxZESDSPD = new TH1F("fHistPrimVtxZESDSPD","z vertex pos SPD",250,-50,50);
1098     fOutputContainer->Add(fHistPrimVtxZESDSPD);  
1099     fHistPrimVtxZESDTPCVSNContributors = new TH2F("fHistPrimVtxZESDTPCVSNContributors","prim vtx pos z TPC vs no. of contributers TPC",250,-50,50,500,0.0,500.0);
1100     fOutputContainer->Add(fHistPrimVtxZESDTPCVSNContributors);
1101     fHistPrimVtxZESDSPDVSNContributors = new TH2F("fHistPrimVtxZESDSPDVSNContributors","prim vtx pos z SPD vs no. of contributers TPC",250,-50,50,500,0.0,500.0);
1102     fOutputContainer->Add(fHistPrimVtxZESDSPDVSNContributors);
1103
1104   }
1105   else {
1106     Double_t binsCent[12]={0.0,5.0,10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0,100.0};
1107     fHistCentBinRaw = new TH1F("fHistCentBinRaw","centrality bin before cent selection",11,binsCent);
1108     fOutputContainer->Add(fHistCentBinRaw);
1109     fHistCentBin = new TH1F("fHistCentBin","centrality bin",11,binsCent);
1110     fOutputContainer->Add(fHistCentBin);
1111       
1112   }
1113    
1114   // ------------------- add always ---------------------------//
1115   //THnF
1116   Double_t piForAx = TMath::Pi();
1117   Int_t binsTHnV0K0s[4] = {150,100,50,18};
1118   Int_t binsTHnV0L[4] = {100,100,50,18};
1119
1120   Int_t binsTHnV0DauEtaK0s[4] = {150,100,50,50};
1121   Int_t binsTHnV0DauEtaL[4] = {100,100,50,50};
1122
1123   Int_t binsTHnV0DauPhiK0s[5] = {150, 18,18, 7,7};
1124   Int_t binsTHnV0DauPhiL[5] = {100, 18,18, 7,7};
1125
1126   Double_t minK0s[4] = {0.35,0.0,-1.0,0.0};
1127   Double_t maxK0s[4] = {0.65,50.0,1.0,piForAx};
1128   Double_t minK0sDauEta[4] = {0.35, 0.0,-1.0,-1.0};
1129   Double_t maxK0sDauEta[4] = {0.65,50.0, 1.0, 1.0};
1130   Double_t minK0sDauPhi[5] = {0.35,0.0,0.0,-0.5,-0.5};
1131   Double_t maxK0sDauPhi[5] = {0.65,piForAx,piForAx,6.5,6.5};
1132
1133   Double_t minL[4] = {1.07, 0.0,-1.0,0.0};
1134   Double_t maxL[4] = {1.17,50.0, 1.0,piForAx};
1135   Double_t minLDauEta[4] = {1.07, 0.0,-1.0,-1.0};
1136   Double_t maxLDauEta[4] = {1.17,50.0, 1.0, 1.0};
1137   Double_t minLDauPhi[5] = {1.07,0.0,0.0,-0.5,-0.5};
1138   Double_t maxLDauPhi[5] = {1.17,piForAx,piForAx,6.5, 6.5};
1139   
1140   
1141   char histTitK0s[255];
1142   snprintf(histTitK0s,255,"fTHnFK0s");
1143   char histTitL[255];
1144   snprintf(histTitL,255,"fTHnFL");
1145   char histTitAL[255];
1146   snprintf(histTitAL,255,"fTHnFAL");
1147
1148
1149   char histTitK0sDauEta[255];
1150   snprintf(histTitK0sDauEta,255,"fTHnFK0sDauEta");
1151   char histTitLDauEta[255];
1152   snprintf(histTitLDauEta,255,"fTHnFLDauEta");
1153   char histTitALDauEta[255];
1154   snprintf(histTitALDauEta,255,"fTHnFALDauEta");
1155
1156
1157   char histTitK0sDauPhi[255];
1158   snprintf(histTitK0sDauPhi,255,"fTHnFK0sDauPhi");
1159   char histTitLDauPhi[255];
1160   snprintf(histTitLDauPhi,255,"fTHnFLDauPhi");
1161   char histTitALDauPhi[255];
1162   snprintf(histTitALDauPhi,255,"fTHnFALDauPhi");
1163  
1164   char axTitK0s[255];
1165   snprintf(axTitK0s,255,"K^{0}_{s};m_{inv} (GeV/c^{2});p_{T} (GeV/c);#eta(V0);#phi(V0)");
1166   char axTitL[255];
1167   snprintf(axTitL,255,"#Lambda;m_{inv} (GeV/c^{2});p_{T} (GeV/c);#eta(V0);#phi(V0)");
1168   char axTitAL[255];
1169   snprintf(axTitAL,255,"#bar{#Lambda};m_{inv} (GeV/c^{2});p_{T} (GeV/c);#eta(V0);#phi(V0)");
1170
1171
1172   char axTitK0sDauEta[255];
1173   snprintf(axTitK0sDauEta,255,"K^{0}_{s} daughter;m_{inv} (GeV/c^{2});p_{T} (Gev/c);#eta_{pos};#eta_{neg}");
1174   char axTitLDauEta[255];
1175   snprintf(axTitLDauEta,255,"#Lambda daughter;m_{inv} (GeV/c^{2});p_{T} (GeV/c);#eta_{pos};#eta_{neg}");
1176   char axTitALDauEta[255];
1177   snprintf(axTitALDauEta,255,"#bar{#Lambda} daughter;m_{inv} (GeV/c^{2});p_{T} (GeV/c);#eta_{pos};#eta_{neg}");
1178
1179
1180   char axTitK0sDauPhi[255];
1181   snprintf(axTitK0sDauPhi,255,"K^{0}_{s} daughter;m_{inv} (GeV/c^{2});#phi_{pos};#phi_{neg};ITS hits (pos);ITS hits (neg)");
1182   char axTitLDauPhi[255];
1183   snprintf(axTitLDauPhi,255,"#Lambda daughter;m_{inv} (GeV/c^{2});#phi_{pos};#phi_{neg};ITS hits (pos);ITS hits (neg)");
1184   char axTitALDauPhi[255];
1185   snprintf(axTitALDauPhi,255,"#bar{#Lambda} daughter;m_{inv} (GeV/c^{2});#phi_{pos};#phi_{neg};ITS hits (pos);ITS hits (neg)");
1186
1187
1188   fTHnFK0s = new        THnF(histTitK0s,axTitK0s,4,binsTHnV0K0s,minK0s,maxK0s);
1189   // fTHnFK0s->Sumw2();
1190   fTHnFL   = new        THnF(histTitL  ,axTitL  ,4,binsTHnV0L,minL  ,maxL);
1191   // fTHnFL->Sumw2();
1192   fTHnFAL  = new        THnF(histTitAL ,axTitAL ,4,binsTHnV0L,minL  ,maxL);
1193   //  fTHnFAL->Sumw2();
1194
1195
1196   fTHnFK0sDauEta = new  THnF(histTitK0sDauEta,axTitK0sDauEta,4,binsTHnV0DauEtaK0s,minK0sDauEta,maxK0sDauEta);
1197   //  fTHnFK0sDauEta->Sumw2();
1198   fTHnFLDauEta   = new  THnF(histTitLDauEta  ,axTitLDauEta  ,4,binsTHnV0DauEtaL,minLDauEta  ,maxLDauEta);
1199   //  fTHnFLDauEta->Sumw2();
1200   fTHnFALDauEta  = new  THnF(histTitALDauEta ,axTitALDauEta ,4,binsTHnV0DauEtaL,minLDauEta  ,maxLDauEta);
1201   // fTHnFALDauEta->Sumw2();
1202
1203   fTHnFK0sDauPhi = new  THnF(histTitK0sDauPhi,axTitK0sDauPhi,5,binsTHnV0DauPhiK0s,minK0sDauPhi,maxK0sDauPhi);
1204   // fTHnFK0sDauPhi->Sumw2();
1205   fTHnFLDauPhi   = new  THnF(histTitLDauPhi  ,axTitLDauPhi  ,5,binsTHnV0DauPhiL,minLDauPhi  ,maxLDauPhi);
1206   // fTHnFLDauPhi->Sumw2();
1207   fTHnFALDauPhi  = new  THnF(histTitALDauPhi ,axTitALDauPhi ,5,binsTHnV0DauPhiL,minLDauPhi  ,maxLDauPhi); 
1208   //fTHnFALDauPhi->Sumw2();
1209
1210  
1211   fHistV0RadiusZ[0]  = new TH2F("fHistV0RadiusZ","z of decay radius vs 2D radius",100,0.0,100.0,250,-125.0,125.0);
1212   fHistV0RadiusZVSPt[0]  = new TH2F("fHistV0RadiusZVSPt","z of decay radius vs pt radius",500,0.0,50.0,125,0.0,125.0);
1213   fHistV0RadiusXY[0]  = new TH2F("fHistV0RadiusXY","y vs x decay radius",250,-125.0,125.0,250,-125.0,125.0);
1214   fHistV0RadiusXYVSY[0]  = new TH2F("fHistV0RadiusXYVSY","2D decay radius vs rap",100,-1,1,100,0.0,100.0);
1215   fHistArmenteros[0] = new TH2F("fHistArmenteros"," pi+pi- armenteros",nbMass,-1.,1.,500,0.,0.5);
1216
1217
1218   fHistPiPiK0sVsLambdaMass  = new TH2F("fHistPiPiK0sVsLambdaMass","K0s mass vs Lambda mass for all pt for K0s",250,1.05,1.25,250,0.25,0.75);
1219   fHistPiPiK0sVsALambdaMass = new TH2F("fHistPiPiK0sVsALambdaMass","K0s mass vs ALambda mass for all pt for K0s",250,1.05,1.25,250,0.25,0.75);
1220
1221   fHistPiPK0sVsLambdaMass   = new TH2F("fHistPiPK0sVsLambdaMass","K0s mass vs Lambda mass for all pt for Lambda",250,1.05,1.25,250,0.25,0.75);
1222
1223   fHistPiAPK0sVsALambdaMass = new TH2F("fHistPiAPK0sVsALambdaMass","K0s mass vs ALambda mass for all pt for ALambda",250,1.05,1.25,250,0.25,0.75);
1224
1225   fHistPiPALambdaVsLambdaMass  = new TH2F("fHistPiPALambdaVsLambdaMass","ALambda mass vs Lambda mass for Lambda",250,1.05,1.25,250,1.05,1.25);
1226   fHistPiAPLambdaVsALambdaMass = new TH2F("fHistPiAPLambdaVsALambdaMass","Lambda mass vs ALambda mass for ALambda",250,1.05,1.25,250,1.05,1.25);
1227
1228   //-----K0s---------//
1229   fHistPiPiMass = new TH1F("fHistPiPiMass"," pi+pi- InvMass distribution",2*nbMass,0.,2.);
1230   fHistPiPiMassVSPt = new TH2F("fHistPiPiMassVSPt","pi+pi- InvMass distribution",nbMass,0.25,0.75,500,0.0,50.0);
1231   fHistPiPiMassVSPtMCTruth = new TH2F("fHistPiPiMassVSPtMCTruth","pi+pi- InvMass distribution vs pt MCTruth",nbMass,0.25,0.75,500,0.0,50.0);
1232   fHistPiPiMassVSY = new TH2F("fHistPiPiMassVSY","pi+pi- InvMass distribution vs rapidity",nbMass,0.25,0.75,200,-1.0,1.0);
1233   fHistPiPiPtVSY = new TH2F("fHistPiPiPtVSY","phi vs mass",100,-1,1,100,0.0,20);
1234   fHistPiPiDecayLengthVsPt = new TH2F("fHistPiPiDecayLengthVsPt","K0 decay length vs pt",500,0.0,50.0,220,0.0,110.0);
1235   fHistPiPiDecayLengthVsMass = new TH2F("fHistPiPiDecayLengthVsMass","K0s decay length vs mass",nbMass,0.25,0.75,220,0.0,110.0);  
1236   //  fHistPiPiPhiPosVsPtPosVsMass = new TH3F("fHistPiPiPhiPosVsPtPosVsMass","ctau K0s vs pt vs mass",250,0.25,0.75,120,0.0,60.0,200,0.0,20.0);//4.0);//xxx      
1237   if(!fSetPtDepHist){
1238     fHistPiPiDecayLengthVsCtau = new TH2F("fHistPiPiDecayLengthVsCtau","K0s ctau vs mass",nbMass,0.25,0.75,250,0.0,50.0);
1239   }
1240   else{
1241     fHistPiPiDecayLengthVsCtau = new TH2F("fHistPiPiDecayLengthVsCtau","K0s ctau vs pt",200,0,20.0,250,0.0,50.0);
1242   } 
1243   
1244   fHistPiPiMonitorCuts = new TH1F("fHistPiPiMonitorCuts","K0 cut monitor",35,0.5,35.5);
1245   fHistPiPiMonitorMCCuts = new TH1F("fHistPiPiMonitorMCCuts","K0 cut monitor mc",35,0.5,35.5);
1246   
1247   //---------------Lambda--------------//
1248   fHistPiPMass[0] = new TH1F("fHistPiPMass"," p+pi- InvMass distribution",2*nbMass,0.,2.);
1249   fHistPiPMassVSPt[0] = new TH2F("fHistPiPMassVSPt","p+pi- InvMass distribution",nbMass,1.05,1.25,500,0.0,50.0);
1250   fHistPiPMassVSPtMCTruth[0] = new TH2F("fHistPiPMassVSPtMCTruth","p+pi- InvMass distribution vs pt MCTruth",nbMass,1.05,1.25,500,0.0,50.0);
1251   fHistPiPMassVSY[0] = new TH2F("fHistPiPMassVSY","p+pi- InvMass distribution vs rapidity",nbMass,1.05,1.25,200,-1.0,1.0);
1252   fHistPiPPtVSY[0] = new TH2F("fHistPiPPtVSY","p{t} vs y",100,-1,1,100,0.0,20);
1253   fHistPiPDecayLengthVsPt[0] = new TH2F("fHistPiPDecayLengthVsPt","#Lambda decay length vs pt",500,0.0,50.0,220,0.0,110.0);
1254   fHistPiPDecayLengthVsMass[0] = new TH2F("fHistPiPDecayLengthVsMass","#Lambda decay length vs mass",nbMass,1.05,1.25,220,0.0,110.0);
1255   //  fHistPiPPhiPosVsPtPosVsMass  = new TH3F("fHistPiPPhiPosVsPtPosVsMass","ctau L vs pt vs mass",200,1.05,1.25,120,0.0,60.0,200,0.0,20.0);//4.0);//xxx        
1256   if(!fSetPtDepHist){
1257     fHistPiPDecayLengthVsCtau[0] = new TH2F("fHistPiPDecayLengthVsCtau","L ctau vs mass",nbMass,1.05,1.25,250,0.0,50.0);
1258   }
1259   else{
1260     fHistPiPDecayLengthVsCtau[0] = new TH2F("fHistPiPDecayLengthVsCtau","L ctau vs pt",500,0.0,50.0,250,0.0,50.0);
1261   }
1262   
1263   fHistPiPMonitorCuts[0] = new TH1F("fHistPiPMonitorCuts","#Lambda cut monitor",35,0.5,35.5);
1264   fHistPiPMonitorMCCuts[0] = new TH1F("fHistPiPMonitorMCCuts","#Lambda cut monitor mc ",35,0.5,35.5);
1265   
1266   //-------------ALamda-------------//
1267   fHistPiAPMass[0] = new TH1F("fHistPiAPMass"," ap-pi+ InvMass distribution",2*nbMass,0.,2.);
1268   fHistPiAPMassVSPt[0] = new TH2F("fHistPiAPMassVSPt","p-pi+ InvMass distribution",nbMass,1.05,1.25,500,0.0,50.0);
1269   fHistPiAPMassVSPtMCTruth[0] = new TH2F("fHistPiAPMassVSPtMCTruth","p-pi+ InvMass distribution vs pt MCTruth",nbMass,1.05,1.25,500,0.0,50.0);
1270   fHistPiAPMassVSY[0] = new TH2F("fHistPiAPMassVSY","p-pi+ InvMass distribution vs rapidity",nbMass,1.05,1.25,200,-1.0,1.0);
1271   fHistPiAPPtVSY[0] = new TH2F("fHistPiAPPtVSY","p{t} vs y",100,-1,1,100,0.0,20);
1272   fHistPiAPDecayLengthVsPt[0] = new TH2F("fHistPiAPDecayLengthVsPt","#bar{#Lambda} decay length vs pt",500,0.0,50.0,220,0.0,110.0);
1273   fHistPiAPDecayLengthVsMass[0] = new TH2F("fHistPiAPDecayLengthVsMass","#bar{#Lambda} decay length vs mass",nbMass,1.05,1.25,220,0.0,110.0);
1274   //  if(fMCTruthMode) fHistPiAPPhiPosVsPtPosVsMass  = new TH3F("fHistPiAPPhiPosVsPtPosVsMass","ctau AL vs pt vs mass",200,1.05,1.25,120,0.0,60.0,200,0.0,20.0);//4.0);//xxx   
1275   if(!fSetPtDepHist){
1276     fHistPiAPDecayLengthVsCtau[0] = new TH2F("fHistPiAPDecayLengthVsCtau","AL ctau vs mass",nbMass,1.05,1.25,250,0.0,50.0);
1277   }
1278   else{
1279     fHistPiAPDecayLengthVsCtau[0] = new TH2F("fHistPiAPDecayLengthVsCtau","AL ctau vs pt",500,0.0,50.0,250,0.0,50.0);
1280   }
1281   
1282   fHistPiAPMonitorCuts[0] = new TH1F("fHistPiAPMonitorCuts","#bar{#Lambda} cut monitor",35,0.5,35.5);
1283   fHistPiAPMonitorMCCuts[0] = new TH1F("fHistPiAPMonitorMCCuts","#bar{#Lambda} cut monitor mc",35,0.5,35.5);   
1284
1285   // ---------------------------------------------for MC reco secondaries -----------------------------------------//
1286   if(mchist==2){
1287     fHistV0RadiusZ[1]  = new TH2F("fHistV0RadiusZSec","z of decay radius vs 2D radius",100,0.0,100.0,250,-125.0,125.0);
1288     fHistV0RadiusZVSPt[1]  = new TH2F("fHistV0RadiusZVSPtSec","z of decay radius vs pt radius",500,0.0,50.0,125,0.0,125.0);
1289     fHistV0RadiusXY[1]  = new TH2F("fHistV0RadiusXYSec","y vs x decay radius",250,-125.0,125.0,250,-125.0,125.0);
1290     fHistV0RadiusXYVSY[1]  = new TH2F("fHistV0RadiusXYVSYSec","2D decay radius vs rap",100,-1,1,100,0.0,100.0);
1291     fHistArmenteros[1] = new TH2F("fHistArmenterosSec"," pi+pi- armenteros",nbMass,-1.,1.,500,0.,0.5);
1292
1293     //-----------------K0s------------//
1294     //--------------- Lambda----------//
1295     fHistPiPMass[1] = new TH1F("fHistPiPMassSec"," p+pi- InvMass distribution",2*nbMass,0.,2.);
1296     fHistPiPMassVSPt[1] = new TH2F("fHistPiPMassVSPtSec","p+pi- InvMass distribution",nbMass,1.05,1.25,500,0.0,50.0);
1297     fHistPiPMassVSPtMCTruth[1] = new TH2F("fHistPiPMassVSPtMCTruthSec","p+pi- InvMass distribution vs pt MCTruth",nbMass,1.05,1.25,500,0.0,50.0);
1298     fHistPiPMassVSY[1] = new TH2F("fHistPiPMassVSYSec","p+pi- InvMass distribution vs rapidity",nbMass,1.05,1.25,200,-1.0,1.0);   
1299     fHistPiPPtVSY[1] = new TH2F("fHistPiPPtVSYSec","p{t} vs y",100,-1,1,100,0.0,20);
1300     fHistPiPDecayLengthVsPt[1] = new TH2F("fHistPiPDecayLengthVsPtSec","#Lambda decay length vs pt",500,0.0,50.0,220,0.0,110.0);
1301     fHistPiPDecayLengthVsMass[1] = new TH2F("fHistPiPDecayLengthVsMassSec","#Lambda decay length vs mass",nbMass,1.05,1.25,220,0.0,110.0);
1302     if(!fSetPtDepHist){
1303       fHistPiPDecayLengthVsCtau[1] = new TH2F("fHistPiPDecayLengthVsCtauSec","L ctau vs mass",nbMass,1.05,1.25,250,0.0,50.0);
1304     }
1305     else{
1306       fHistPiPDecayLengthVsCtau[1] = new TH2F("fHistPiPDecayLengthVsCtauSec","L ctau vs pt",500,0.0,50.0,250,0.0,50.0);
1307     }
1308     
1309     fHistPiPMonitorCuts[1] = new TH1F("fHistPiPMonitorCutsSec","#Lambda cut monitor",35,0.5,35.5);
1310     fHistPiPMonitorMCCuts[1] = new TH1F("fHistPiPMonitorMCCutsSec","#Lambda cut monitor mc",35,0.5,35.5);
1311
1312     //----------------ALambda---------//
1313     fHistPiAPMass[1] = new TH1F("fHistPiAPMassSec"," ap-pi+ InvMass distribution",2*nbMass,0.,2.);
1314     fHistPiAPMassVSPt[1] = new TH2F("fHistPiAPMassVSPtSec","p-pi+ InvMass distribution",nbMass,1.05,1.25,500,0.0,50.0);
1315     fHistPiAPMassVSPtMCTruth[1] = new TH2F("fHistPiAPMassVSPtMCTruthSec","p-pi+ InvMass distribution vs pt MCTruth",nbMass,1.05,1.25,500,0.0,50.0);
1316     fHistPiAPMassVSY[1] = new TH2F("fHistPiAPMassVSYSec","p-pi+ InvMass distribution vs rapidity",nbMass,1.05,1.25,200,-1.0,1.0);
1317     fHistPiAPPtVSY[1] = new TH2F("fHistPiAPPtVSYSec","p{t} vs y",100,-1,1,100,0.0,20);
1318     fHistPiAPDecayLengthVsPt[1] = new TH2F("fHistPiAPDecayLengthVsPtSec","#bar{#Lambda} decay length vs pt",500,0.0,50.0,220,0.0,110.0);
1319     fHistPiAPDecayLengthVsMass[1] = new TH2F("fHistPiAPDecayLengthVsMassSec","#bar{#Lambda} decay length vs mass",nbMass,1.05,1.25,220,0.0,110.0);
1320     if(!fSetPtDepHist){
1321       fHistPiAPDecayLengthVsCtau[1] = new TH2F("fHistPiAPDecayLengthVsCtauSec","AL ctau vs mass",nbMass,1.05,1.25,250,0.0,50.0);
1322     }
1323     else{
1324       fHistPiAPDecayLengthVsCtau[1] = new TH2F("fHistPiAPDecayLengthVsCtauSec","AL ctau vs pt",500,0.0,50.0,250,0.0,50.0);
1325     }
1326
1327     fHistPiAPMonitorCuts[1] = new TH1F("fHistPiAPMonitorCutsSec","#bar{#Lambda} cut monitor",35,0.5,35.5);
1328     fHistPiAPMonitorMCCuts[1] = new TH1F("fHistPiAPMonitorMCCutsSec","#bar{#Lambda} cut monitor mc",35,0.5,35.5);
1329   }
1330
1331   //add to output container
1332   //------------ K0s ------------------//
1333   fOutputContainer->Add(fHistPiPiMass);  
1334   fOutputContainer->Add(fHistPiPiMassVSPt);
1335   fOutputContainer->Add(fHistPiPiMassVSPtMCTruth);
1336   fOutputContainer->Add(fHistPiPiMassVSY);
1337   fOutputContainer->Add(fHistPiPiPtVSY);
1338   fOutputContainer->Add(fHistPiPiDecayLengthVsPt);
1339   fOutputContainer->Add(fHistPiPiDecayLengthVsCtau);
1340   fOutputContainer->Add(fHistPiPiDecayLengthVsMass);  
1341   fOutputContainer->Add(fHistPiPiMonitorCuts);
1342   fOutputContainer->Add(fHistPiPiMonitorMCCuts);
1343   fOutputContainer->Add(fHistPiPiK0sVsLambdaMass);
1344   fOutputContainer->Add(fHistPiPiK0sVsALambdaMass);
1345   fOutputContainer->Add(fTHnFK0s);
1346   fOutputContainer->Add(fTHnFK0sDauEta);
1347   fOutputContainer->Add(fTHnFK0sDauPhi);
1348   //fOutputContainer->Add(fHistPiPiPhiPosVsPtPosVsMass);//xxx      
1349
1350   // --------------- Lambda ---------------//
1351   fOutputContainer->Add(fHistPiPK0sVsLambdaMass);
1352   fOutputContainer->Add(fHistPiPALambdaVsLambdaMass);
1353   //  fOutputContainer->Add(fHistPiPPhiPosVsPtPosVsMass);//xxx
1354   fOutputContainer->Add(fTHnFL);
1355   fOutputContainer->Add(fTHnFLDauEta);
1356   fOutputContainer->Add(fTHnFLDauPhi);
1357
1358   // --------------- ALambda ---------------//
1359   fOutputContainer->Add(fHistPiAPK0sVsALambdaMass);
1360   fOutputContainer->Add(fHistPiAPLambdaVsALambdaMass);
1361   //  if(fMCTruthMode)  fOutputContainer->Add(fHistPiAPPhiPosVsPtPosVsMass);//xxx
1362   fOutputContainer->Add(fTHnFAL);
1363   fOutputContainer->Add(fTHnFALDauEta);
1364   fOutputContainer->Add(fTHnFALDauPhi);
1365
1366   
1367   for(Int_t j=0;j<mchist;j++){
1368     fOutputContainer->Add(fHistArmenteros[j]);
1369     fOutputContainer->Add(fHistV0RadiusZ[j]);
1370     fOutputContainer->Add(fHistV0RadiusZVSPt[j]);
1371     fOutputContainer->Add(fHistV0RadiusXY[j]);
1372     fOutputContainer->Add(fHistV0RadiusXYVSY[j]);
1373     fOutputContainer->Add(fHistPiPMass[j]);
1374     fOutputContainer->Add(fHistPiAPMass[j]);
1375     fOutputContainer->Add(fHistPiPMassVSPt[j]);
1376     fOutputContainer->Add(fHistPiAPMassVSPt[j]);
1377     fOutputContainer->Add(fHistPiPMassVSPtMCTruth[j]);
1378     fOutputContainer->Add(fHistPiAPMassVSPtMCTruth[j]);
1379     fOutputContainer->Add(fHistPiPMassVSY[j]);
1380     fOutputContainer->Add(fHistPiAPMassVSY[j]);      
1381     fOutputContainer->Add(fHistPiPPtVSY[j]);
1382     fOutputContainer->Add(fHistPiAPPtVSY[j]);
1383     fOutputContainer->Add(fHistPiPDecayLengthVsPt[j]);
1384     fOutputContainer->Add(fHistPiAPDecayLengthVsPt[j]);
1385     fOutputContainer->Add(fHistPiPDecayLengthVsCtau[j]);
1386     fOutputContainer->Add(fHistPiAPDecayLengthVsCtau[j]);
1387     fOutputContainer->Add(fHistPiPDecayLengthVsMass[j]);
1388     fOutputContainer->Add(fHistPiAPDecayLengthVsMass[j]);
1389     fOutputContainer->Add(fHistPiPMonitorCuts[j]);
1390     fOutputContainer->Add(fHistPiAPMonitorCuts[j]);
1391     fOutputContainer->Add(fHistPiPMonitorMCCuts[j]);
1392     fOutputContainer->Add(fHistPiAPMonitorMCCuts[j]);
1393   }
1394   
1395   //----------------- for reco or data or mc data like MC reco only -----------------//
1396   if((fMCMode) || (!fMCTruthMode && !fMCMode)){
1397     
1398     fHistPiPiEtaDReco[0] = new TH2F("fHistPiPiEtaDRecoRaw","K0s daughters eta raw",300,-6,6,100,0,20);
1399     fOutputContainer->Add(fHistPiPiEtaDReco[0]);
1400     fHistPiPiEtaDReco[1] = new TH2F("fHistPiPiEtaDReco","K0s daughters eta after rap V0 cut pos",300,-3,3,300,-3.00,3.0);
1401     fOutputContainer->Add(fHistPiPiEtaDReco[1]);         
1402     fHistPiPEtaDReco[0] = new TH2F("fHistPiPEtaDRecoRaw","#Lambda daughters eta raw",300,-6,6,100,0,20);
1403     fOutputContainer->Add(fHistPiPEtaDReco[0]);
1404     fHistPiPEtaDReco[1] = new TH2F("fHistPiPEtaDReco","#Lambda daughters eta after rap V0 cut neg",300,-3,3,300,-3.00,3.0);
1405     fOutputContainer->Add(fHistPiPEtaDReco[1]);
1406         
1407     //-------------K0---------------//
1408     // fHistPiPiMassVSAlpha = new TH2F("fHistPiPiMassVSAlpha"," alpha armenteros vs pi+pi- InvMass distribution",nbMass,0.25,0.75,500,-1.,1.);
1409     if(!fSetPtDepHist){
1410       fHistPiPiDCADaughters = new TH2F("fHistPiPiDCADaughters","dca of K0 daughters",nbMass,0.25,0.75,250,0.0,2);
1411       fHistPiPiDCADaughterPosToPrimVtxVSMass = new TH2F("fHistPiPiDCADaughterPosToPrimVtxVSMass","pi+ DCA daughter to prim vtx vsinvmass",nbMass,0.25,0.75,250,0.0,10.0);
1412       fHistPiPiDCAVSMass = new TH2F("fHistPiPiDCAVSMass","pi+pi- dca  vs pt",nbMass,0.25,0.75,250,0.0,5.0);
1413       fHistPiPiCosPointAng  = new TH2F("fHistPiPiCosPointAng","K0 cosine of pointing angle vs mass ",nbMass,0.25,0.75,200,0.99,1.00);
1414       fHistPiPiRadiusXY = new TH2F("fHistPiPiRadiusXY","pi+pi- phi dist vs mass",nbMass,0.25,0.75,200,0.0,4.0);
1415       // fHistPiPiPtDaughters = new TH2F("fHistPiPiPtDaughters","p_{t} pos vs p_{t} neg of daughters",400,0.0,20.0,400,0,20.0);
1416       // fHistPiPiDCAZPos = new TH2F("fHistPiPiDCAZPos","dca z  of K0 pos daughters",nbMass,0.25,0.75,200,-20.0,20.0);
1417       //fHistPiPiDCAZNeg = new TH2F("fHistPiPiDCAZNeg","dca z  of K0 neg daughters",nbMass,0.25,0.75,200,-20.0,20.0);
1418       fHistPiPiTrackLengthPosVsMass = new TH2F("fHistPiPiTrackLengthPosVsMass","track lenght of pos K0s daughter in TPC",nbMass,0.25,0.75,250,0.0,250.0);
1419       fHistPiPiTrackLengthNegVsMass = new TH2F("fHistPiPiTrackLengthNegVsMass","track lenght of neg K0s daughter in TPC",nbMass,0.25,0.75,250,0.0,250.0);
1420     }
1421     else{//pt dependence
1422       fHistPiPiDCADaughters = new TH2F("fHistPiPiDCADaughters","dca of K0 daughters",500,0.0,50.0,250,0.0,2);
1423       fHistPiPiDCADaughterPosToPrimVtxVSMass = new TH2F("fHistPiPiDCADaughterPosToPrimVtxVSMass","pi+ DCA daughter to prim vtx vsinvmass",500,0.0,50.0,250,0.0,10.0);
1424       fHistPiPiDCAVSMass = new TH2F("fHistPiPiDCAVSMass","pi+pi- dca  vs pt",500,0.0,50.0,250,0.0,5.0);
1425       fHistPiPiCosPointAng  = new TH2F("fHistPiPiCosPointAng","K0 cosine of pointing angle vs mass ",500,0.0,50.0,200,0.99,1.00);
1426       fHistPiPiRadiusXY = new TH2F("fHistPiPiRadiusXY","pi+pi- phi dist vs mass",500,0.0,50.0,200,0.0,4.0);
1427       // fHistPiPiDCAZPos = new TH2F("fHistPiPiDCAZPos","dca z  of K0 pos daughters",500,0.0,50.0,200,-20.0,20.0);
1428       // fHistPiPiDCAZNeg = new TH2F("fHistPiPiDCAZNeg","dca z  of K0 neg daughters",500,0.0,50.0,200,-20.0,20.0);
1429       fHistPiPiTrackLengthPosVsMass = new TH2F("fHistPiPiTrackLengthPosVsMass","track lenght of pos K0s daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1430       fHistPiPiTrackLengthNegVsMass = new TH2F("fHistPiPiTrackLengthNegVsMass","track lenght of neg K0s daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1431     }
1432
1433     //---------------Lambda-------------//
1434     if(!fSetPtDepHist){
1435       fHistPiPDCADaughters[0] = new TH2F("fHistPiPDCADaughters","dca of #Lambda daughters",nbMass,1.05,1.25,250,0.0,2.0);
1436       fHistPiPDCADaughterPosToPrimVtxVSMass[0] = new TH2F("fHistPiPDCADaughterPosToPrimVtxVSMass","pos DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1437       fHistPiPDCADaughterNegToPrimVtxVSMass[0] = new TH2F("fHistPiPDCADaughterNegToPrimVtxVSMass","neg DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1438       fHistPiPDCAVSMass[0] = new TH2F("fHistPiPDCAVSMass","ppi- dca  vs pt",nbMass,1.05,1.25,250,0.0,5.0);
1439       fHistPiPCosPointAng[0]  = new TH2F("fHistPiPCosPointAng","#Lambda cosine of pointing angle vs mass ",nbMass,1.05,1.25,200,0.99,1.00);
1440       fHistPiPRadiusXY[0] = new TH2F("fHistPiPRadiusXY","pi-p+ phi dist vs mass",nbMass,1.05,1.25,200,0.0,4.0);
1441       // fHistPiPPtDaughters[0] = new TH2F("fHistPiPPtDaughters","p_{t} pos vs p_{t} neg of daughters",400,0.0,20.0,400,0,20.0);
1442       //        fHistPiPDCAZPos[0] = new TH2F("fHistPiPDCAZPos","dca z  of Lambda pos daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1443       //fHistPiPDCAZNeg[0] = new TH2F("fHistPiPDCAZNeg","dca z  of Lambda neg daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1444       fHistPiPTrackLengthPosVsMass[0] = new TH2F("fHistPiPTrackLengthPosVsMass","track length of pos Lambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1445       fHistPiPTrackLengthNegVsMass[0] = new TH2F("fHistPiPTrackLengthNegVsMass","track length of neg Lambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1446     }
1447     else{//pt dependence
1448       fHistPiPDCADaughters[0] = new TH2F("fHistPiPDCADaughters","dca of #Lambda daughters",500,0.0,50.0,250,0.0,2.0);
1449       fHistPiPDCADaughterPosToPrimVtxVSMass[0] = new TH2F("fHistPiPDCADaughterPosToPrimVtxVSMass","pos DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1450       fHistPiPDCADaughterNegToPrimVtxVSMass[0] = new TH2F("fHistPiPDCADaughterNegToPrimVtxVSMass","neg DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1451       fHistPiPDCAVSMass[0] = new TH2F("fHistPiPDCAVSMass","ppi- dca  vs pt",500,0.0,50.0,250,0.0,5.0);
1452       fHistPiPCosPointAng[0]  = new TH2F("fHistPiPCosPointAng","#Lambda cosine of pointing angle vs mass ",500,0.0,50.0,200,0.99,1.00);
1453       fHistPiPRadiusXY[0] = new TH2F("fHistPiPRadiusXY","pi-p+ phi dist vs mass",500,0.0,50.0,200,0.0,4.0);
1454       //fHistPiPDCAZPos[0] = new TH2F("fHistPiPDCAZPos","dca z  of Lambda pos daughters",200,0.0,20.0,200,-20.0,20.0);
1455       //fHistPiPDCAZNeg[0] = new TH2F("fHistPiPDCAZNeg","dca z  of Lambda neg daughters",200,0.0,20.0,200,-20.0,20.0);
1456       fHistPiPTrackLengthPosVsMass[0] = new TH2F("fHistPiPTrackLengthPosVsMass","track length of pos Lambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1457       fHistPiPTrackLengthNegVsMass[0] = new TH2F("fHistPiPTrackLengthNegVsMass","track length of neg Lambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1458     }
1459
1460     //-------------------AntiLambda-------------//
1461     if(!fSetPtDepHist){
1462       fHistPiAPDCADaughters[0] = new TH2F("fHistPiAPDCADaughters","dca of #bar{#Lambda} daughters",nbMass,1.05,1.25,250,0.0,2.0);
1463       fHistPiAPDCADaughterPosToPrimVtxVSMass[0] = new TH2F("fHistPiAPDCADaughterPosToPrimVtxVSMass","pos DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1464       fHistPiAPDCADaughterNegToPrimVtxVSMass[0] = new TH2F("fHistPiAPDCADaughterNegToPrimVtxVSMass","neg DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1465       fHistPiAPDCAVSMass[0] = new TH2F("fHistPiAPDCAVSMass","pi+p- dca  vs pt",nbMass,1.05,1.25,250,0.0,5.0);
1466       fHistPiAPCosPointAng[0] = new TH2F("fHistPiAPCosPointAng","#bar{#Lambda} cosine of pointing angle vs mass",nbMass,1.05,1.25,200,0.99,1.00);
1467       fHistPiAPRadiusXY[0] = new TH2F("fHistPiAPRadiusXY","pi+p- phi dist vs mass",nbMass,1.05,1.25,200,0.0,4.0);
1468       // fHistPiAPPtDaughters[0] = new TH2F("fHistPiAPPtDaughters","p_{t} pos vs p_{t} neg of daughters",400,0.0,20.0,400,0,20.0);
1469       //        fHistPiAPDCAZPos[0] = new TH2F("fHistPiAPDCAZPos","dca z  of ALambda pos daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1470       //fHistPiAPDCAZNeg[0] = new TH2F("fHistPiAPDCAZNeg","dca z  of ALambda neg daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1471       fHistPiAPTrackLengthPosVsMass[0] = new TH2F("fHistPiAPTrackLengthPosVsMass","track length of pos ALambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1472       fHistPiAPTrackLengthNegVsMass[0] = new TH2F("fHistPiAPTrackLengthNegVsMass","track length of neg ALambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1473     }
1474     else{//pt dependence
1475       fHistPiAPDCADaughters[0] = new TH2F("fHistPiAPDCADaughters","dca of #bar{#Lambda} daughters",500,0.0,50.0,250,0.0,2.0);
1476       fHistPiAPDCADaughterPosToPrimVtxVSMass[0] = new TH2F("fHistPiAPDCADaughterPosToPrimVtxVSMass","pos DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1477       fHistPiAPDCADaughterNegToPrimVtxVSMass[0] = new TH2F("fHistPiAPDCADaughterNegToPrimVtxVSMass","neg DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1478       fHistPiAPDCAVSMass[0] = new TH2F("fHistPiAPDCAVSMass","pi+p- dca  vs pt",500,0.0,50.0,250,0.0,5.0);
1479       fHistPiAPCosPointAng[0] = new TH2F("fHistPiAPCosPointAng","#bar{#Lambda} cosine of pointing angle vs mass",500,0.0,50.0,200,0.99,1.00);
1480       fHistPiAPRadiusXY[0] = new TH2F("fHistPiAPRadiusXY","pi+p- phi dist vs mass",500,0.0,50.0,200,0.0,4.0);
1481       //        fHistPiAPDCAZPos[0] = new TH2F("fHistPiAPDCAZPos","dca z  of ALambda pos daughters",500,0.0,50.0,200,-20.0,20.0);
1482       //fHistPiAPDCAZNeg[0] = new TH2F("fHistPiAPDCAZNeg","dca z  of ALambda neg daughters",500,0.0,50.0,200,-20.0,20.0);
1483       fHistPiAPTrackLengthPosVsMass[0] = new TH2F("fHistPiAPTrackLengthPosVsMass","track length of pos ALambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1484       fHistPiAPTrackLengthNegVsMass[0] = new TH2F("fHistPiAPTrackLengthNegVsMass","track length of neg ALambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1485     }
1486    
1487     //------dedx--------//
1488     fHistDedxSecProt[0] = new TH2F("fHistDedxSecProt","proton", 250,0.0,5.0, 100, 0, 400);
1489     fHistDedxSecPiPlus[0] = new TH2F("fHistDedxSecPiPlus","pi plus", 250,0.0,5.0, 100, 0, 400);
1490     fHistDedxSecAProt[0] = new TH2F("fHistDedxSecAProt","antiproton", 250,0.0,5.0, 100, 0, 400);
1491     fHistDedxSecPiMinus[0] = new TH2F("fHistDedxSecPiMinus","pi minus", 250,0.0,5.0, 100, 0, 400);
1492     fHistDedxProt[0] = new TH2F("fHistDedxProt","proton", 250,0.0,5.0, 100, 0, 400);
1493     fHistDedxPiPlus[0] = new TH2F("fHistDedxPiPlus","pi plus", 250,0.0,5.0, 100, 0, 400);
1494     fHistDedxAProt[0] = new TH2F("fHistDedxAProt","antiproton", 250,0.0,5.0, 100, 0, 400);
1495     fHistDedxPiMinus[0] = new TH2F("fHistDedxPiMinus","pi minus", 250,0.0,5.0, 100, 0, 400);
1496
1497
1498     // ------------------------------------------ clusters --------------------------------------------------//
1499     fHistNclsITS[0] = new TH2F("fHistNclsITS","fHistNclsITS pos vs neg L",10,-0.5,9.5,10,-0.5,9.5);
1500     fHistNclsTPC[0] = new TH2F("fHistNclsTPC","ncls TPC neg vs crossed rows neg L",200,-0.5,199.5,200,-0.5,199.5);
1501
1502     fHistNclsITS[1] = new TH2F("fHistNclsITSSec","fHistNclsITS pos vs neg K0",10,-0.5,9.5,10,-0.5,9.5);
1503     fHistNclsTPC[1] = new TH2F("fHistNclsTPCSec","ncls TPC neg vs crossed rows neg K0",200,-0.5,199.5,200,-0.5,199.5);
1504
1505     if(!fSetPtDepHist){
1506       //K0s
1507       fHistNclsITSPosK0 = new TH2F("fHistNclsITSPosK0","fHistNclsITSPos  vs pt K0 pos",nbMass,0.25,0.75,7,-0.5,6.5);
1508       fHistNclsITSNegK0 = new TH2F("fHistNclsITSNegK0","fHistNclsITSNeg vs pt K0 neg",nbMass,0.25,0.75,7,-0.5,6.5);
1509           
1510       fHistNclsTPCPosK0 = new TH2F("fHistNclsTPCPosK0","K0 mass vs phi pos",nbMass,0.25,0.75,200,0.0,200.0);
1511       fHistNclsTPCNegK0 = new TH2F("fHistNclsTPCNegK0","K0 mass vs phi neg",nbMass,0.25,0.75,200,0.0,200.0);
1512           
1513       fHistChi2PerNclsITSPosK0 = new TH2F("fHistChi2PerNclsITSPosK0","chi2 per cluster ITS K0 pos",nbMass,0.25,0.75,250,0.0,25.0);
1514       fHistChi2PerNclsITSNegK0 = new TH2F("fHistChi2PerNclsITSNegK0","chi2 per cluster ITS K0 neg",nbMass,0.25,0.75,250,0.0,25.0);
1515           
1516       fHistNCRowsTPCPosK0 = new TH2F("fHistNCRowsTPCPosK0","n crossed rows vs K0 pos",nbMass,0.25,0.75,200,0.0,200.0);
1517       fHistNCRowsTPCNegK0 = new TH2F("fHistNCRowsTPCNegK0","n crossed rows vs K0 neg",nbMass,0.25,0.75,200,0.0,200.0);
1518    
1519       fHistRatioFoundOverFinableTPCK0Pos = new TH2F("fHistRatioFoundOverFinableTPCK0Pos","ncls found over findable K0 pos sec",nbMass,0.25,0.75,200,0.0,2.0);
1520       fHistRatioFoundOverFinableTPCK0Neg = new TH2F("fHistRatioFoundOverFinableTPCK0Neg","ncls found over findable K0 neg sec",nbMass,0.25,0.75,200,0.0,2.0);
1521       //Lambda
1522       fHistNclsITSPosL[0] = new TH2F("fHistNclsITSPosL","fHistNclsITSPos  vs pt L pos",nbMass,1.05,1.25,7,-0.5,6.5);
1523       fHistNclsITSNegL[0] = new TH2F("fHistNclsITSNegL","fHistNclsITSNeg vs pt L neg",nbMass,1.05,1.25,7,-0.5,6.5);
1524           
1525       fHistNclsTPCPosL[0] = new TH2F("fHistNclsTPCPosL","L mass vs phi pos",nbMass,1.05,1.25,200,0.0,200.0);
1526       fHistNclsTPCNegL[0] = new TH2F("fHistNclsTPCNegL","L mass vs phi neg",nbMass,1.05,1.25,200,0.0,200.0);
1527           
1528       fHistChi2PerNclsITSPosL[0] = new TH2F("fHistChi2PerNclsITSPosL","chi2 per cluster ITS L pos",nbMass,1.05,1.25,250,0.0,25.0);
1529       fHistChi2PerNclsITSNegL[0] = new TH2F("fHistChi2PerNclsITSNegL","chi2 per cluster ITS L neg",nbMass,1.05,1.25,250,0.0,25.0);
1530           
1531       fHistNCRowsTPCPosL[0] = new TH2F("fHistNCRowsTPCPosL","n crossed rows vs L pos",nbMass,1.05,1.25,200,0.0,200.0);
1532       fHistNCRowsTPCNegL[0] = new TH2F("fHistNCRowsTPCNegL","n crossed rows vs L neg",nbMass,1.05,1.25,200,0.0,200.0);
1533    
1534       fHistRatioFoundOverFinableTPCLPos[0] = new TH2F("fHistRatioFoundOverFinableTPCLPos","ncls found over findable L pos sec",nbMass,1.05,1.25,200,0.0,2.0);
1535       fHistRatioFoundOverFinableTPCLNeg[0] = new TH2F("fHistRatioFoundOverFinableTPCLNeg","ncls found over findable L neg sec",nbMass,1.05,1.25,200,0.0,2.0);
1536     }
1537     else{//pt dependence
1538       //K0s
1539       fHistNclsITSPosK0 = new TH2F("fHistNclsITSPosK0","fHistNclsITSPos  vs pt L pos",500,0.0,50.0,7,-0.5,6.5);
1540       fHistNclsITSNegK0 = new TH2F("fHistNclsITSNegK0","fHistNclsITSNeg vs pt L neg",500,0.0,50.0,7,-0.5,6.5);
1541           
1542       fHistNclsTPCPosK0 = new TH2F("fHistNclsTPCPosK0","L mass vs phi pos",500,0.0,50.0,200,0.0,200.0);
1543       fHistNclsTPCNegK0 = new TH2F("fHistNclsTPCNegK0","L mass vs phi neg",500,0.0,50.0,200,0.0,200.0);
1544           
1545       fHistChi2PerNclsITSPosK0 = new TH2F("fHistChi2PerNclsITSPosK0","chi2 per cluster ITS L pos",500,0.0,50.0,250,0.0,25.0);
1546       fHistChi2PerNclsITSNegK0 = new TH2F("fHistChi2PerNclsITSNegK0","chi2 per cluster ITS L neg",500,0.0,50.0,250,0.0,25.0);
1547           
1548       fHistNCRowsTPCPosK0 = new TH2F("fHistNCRowsTPCPosK0","n crossed rows vs L pos",500,0.0,50.0,200,0.0,200.0);
1549       fHistNCRowsTPCNegK0 = new TH2F("fHistNCRowsTPCNegK0","n crossed rows vs L neg",500,0.0,50.0,200,0.0,200.0);
1550    
1551       fHistRatioFoundOverFinableTPCK0Pos = new TH2F("fHistRatioFoundOverFinableTPCK0Pos","ncls found over findable L pos sec",500,0.0,50.0,200,0.0,2.0);
1552       fHistRatioFoundOverFinableTPCK0Neg = new TH2F("fHistRatioFoundOverFinableTPCK0Neg","ncls found over findable L neg sec",500,0.0,50.0,200,0.0,2.0);
1553       //Lambda
1554       fHistNclsITSPosL[0] = new TH2F("fHistNclsITSPosL","fHistNclsITSPos  vs pt L pos",500,0.0,50.0,7,-0.5,6.5);
1555       fHistNclsITSNegL[0] = new TH2F("fHistNclsITSNegL","fHistNclsITSNeg vs pt L neg",500,0.0,50.0,7,-0.5,6.5);
1556           
1557       fHistNclsTPCPosL[0] = new TH2F("fHistNclsTPCPosL","L mass vs phi pos",500,0.0,50.0,200,0.0,200.0);
1558       fHistNclsTPCNegL[0] = new TH2F("fHistNclsTPCNegL","L mass vs phi neg",500,0.0,50.0,200,0.0,200.0);
1559           
1560       fHistChi2PerNclsITSPosL[0] = new TH2F("fHistChi2PerNclsITSPosL","chi2 per cluster ITS L pos",500,0.0,50.0,250,0.0,25.0);
1561       fHistChi2PerNclsITSNegL[0] = new TH2F("fHistChi2PerNclsITSNegL","chi2 per cluster ITS L neg",500,0.0,50.0,250,0.0,25.0);
1562           
1563       fHistNCRowsTPCPosL[0] = new TH2F("fHistNCRowsTPCPosL","n crossed rows vs L pos",500,0.0,50.0,200,0.0,200.0);
1564       fHistNCRowsTPCNegL[0] = new TH2F("fHistNCRowsTPCNegL","n crossed rows vs L neg",500,0.0,50.0,200,0.0,200.0);
1565    
1566       fHistRatioFoundOverFinableTPCLPos[0] = new TH2F("fHistRatioFoundOverFinableTPCLPos","ncls found over findable L pos sec",500,0.0,50.0,200,0.0,2.0);
1567       fHistRatioFoundOverFinableTPCLNeg[0] = new TH2F("fHistRatioFoundOverFinableTPCLNeg","ncls found over findable L neg sec",500,0.0,50.0,200,0.0,2.0);
1568     }
1569
1570     // --------------------------------------------- for MC reco secondaries -----------------------------------------//
1571     if(mchist==2){// for MC reco
1572
1573       //-----------------K0s---------------------//
1574       //----------------Lambda-------------------//
1575       if(!fSetPtDepHist){
1576         fHistPiPDCADaughters[1] = new TH2F("fHistPiPDCADaughtersSec","dca of #Lambda daughters",nbMass,1.05,1.25,250,0.0,2.0);
1577         fHistPiPDCADaughterPosToPrimVtxVSMass[1] = new TH2F("fHistPiPDCADaughterPosToPrimVtxVSMassSec","pos sec DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1578         fHistPiPDCADaughterNegToPrimVtxVSMass[1] = new TH2F("fHistPiPDCADaughterNegToPrimVtxVSMassSec","neg sec DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1579         fHistPiPDCAVSMass[1] = new TH2F("fHistPiPDCAVSMassSec","ppi- dca  vs pt",nbMass,1.05,1.25,250,0.0,5.0);
1580         fHistPiPCosPointAng[1]  = new TH2F("fHistPiPCosPointAngSec","#Lambda cosine of pointing angle vs mass",nbMass,1.05,1.25,200,0.99,1.00);
1581         //       fHistPiPDecayLengthVsMass[1] = new TH2F("fHistPiPDecayLengthVsMassSec","#Lambda decay length vs mass",nbMass,1.05,1.25,200,0.0,100.0);
1582         fHistPiPRadiusXY[1] = new TH2F("fHistPiPRadiusXYSec","pi-p+ phi dist vs mass",nbMass,1.05,1.25,200,0.0,4.0);
1583         // fHistPiPPtDaughters[0] = new TH2F("fHistPiPPtDaughters","p_{t} pos vs p_{t} neg of daughters",400,0.0,20.0,400,0,20.0);
1584         //        fHistPiPDCAZPos[1] = new TH2F("fHistPiPDCAZPosSec","dca z  of Lambda sec pos daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1585         //        fHistPiPDCAZNeg[1] = new TH2F("fHistPiPDCAZNegSec","dca z  of Lambda sec neg daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1586         fHistPiPTrackLengthPosVsMass[1] = new TH2F("fHistPiPTrackLengthPosVsMassSec","track length of pos sec Lambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1587         fHistPiPTrackLengthNegVsMass[1] = new TH2F("fHistPiPTrackLengthNegVsMassSec","track length of neg sec Lambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1588       }
1589       else{
1590         fHistPiPDCADaughters[1] = new TH2F("fHistPiPDCADaughtersSec","dca of #Lambda daughters",500,0.0,50.0,250,0.0,2.0);
1591         fHistPiPDCADaughterPosToPrimVtxVSMass[1] = new TH2F("fHistPiPDCADaughterPosToPrimVtxVSMassSec","pos sec DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1592         fHistPiPDCADaughterNegToPrimVtxVSMass[1] = new TH2F("fHistPiPDCADaughterNegToPrimVtxVSMassSec","neg sec DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1593         fHistPiPDCAVSMass[1] = new TH2F("fHistPiPDCAVSMassSec","ppi- dca  vs pt",500,0.0,50.0,250,0.0,5.0);
1594         fHistPiPCosPointAng[1]  = new TH2F("fHistPiPCosPointAngSec","#Lambda cosine of pointing angle vs mass",500,0.0,50.0,200,0.99,1.00);
1595         fHistPiPRadiusXY[1] = new TH2F("fHistPiPRadiusXYSec","pi-p+ phi dist vs mass",500,0.0,50.0,200,0.0,4.0);
1596         //        fHistPiPDCAZPos[1] = new TH2F("fHistPiPDCAZPosSec","dca z  of Lambda sec pos daughters",200,0.0,20.0,200,-20.0,20.0);
1597         //fHistPiPDCAZNeg[1] = new TH2F("fHistPiPDCAZNegSec","dca z  of Lambda sec neg daughters",200,0.0,20.0,200,-20.0,20.0);
1598         fHistPiPTrackLengthPosVsMass[1] = new TH2F("fHistPiPTrackLengthPosVsMassSec","track length of pos sec Lambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1599         fHistPiPTrackLengthNegVsMass[1] = new TH2F("fHistPiPTrackLengthNegVsMassSec","track length of neg sec Lambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1600       }
1601           
1602       //--------------------ALambda--------------//
1603       if(!fSetPtDepHist){
1604         fHistPiAPDCADaughters[1] = new TH2F("fHistPiAPDCADaughtersSec","dca of #bar{#Lambda} daughters",nbMass,1.05,1.25,250,0.0,2.0);
1605         fHistPiAPDCADaughterPosToPrimVtxVSMass[1] = new TH2F("fHistPiAPDCADaughterPosToPrimVtxVSMassSec","pos sec DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1606         fHistPiAPDCADaughterNegToPrimVtxVSMass[1] = new TH2F("fHistPiAPDCADaughterNegToPrimVtxVSMassSec","neg sec DCA daughter to prim vtx vs invmass",nbMass,1.05,1.25,250,0.0,10.0);
1607         fHistPiAPDCAVSMass[1]   = new TH2F("fHistPiAPDCAVSMassSec","pi+p- dca  vs pt",nbMass,1.05,1.25,250,0.0,5.0);
1608         fHistPiAPCosPointAng[1] = new TH2F("fHistPiAPCosPointAngSec","#bar{#Lambda} cosine of pointing angle vs mass",nbMass,1.05,1.25,200,0.99,1.00);
1609         //       fHistPiAPDecayLengthVsMass[1] = new TH2F("fHistPiAPDecayLengthVsMassSec","#bar{#Lambda} decay length vs mass",nbMass,1.05,1.25,200,0.0,100.0);
1610         fHistPiAPRadiusXY[1] = new TH2F("fHistPiAPRadiusXYSec","pi+p- phi dist vs mass",nbMass,1.05,1.25,200,0.0,4.0);
1611         // fHistPiAPPtDaughters[0] = new TH2F("fHistPiAPPtDaughters","p_{t} pos vs p_{t} neg of daughters",400,0.0,20.0,400,0,20.0);
1612         //        fHistPiAPDCAZPos[1] = new TH2F("fHistPiAPDCAZPosSec","dca z  of ALambda sec pos daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1613         //fHistPiAPDCAZNeg[1] = new TH2F("fHistPiAPDCAZNegSec","dca z  of ALambda sec neg daughters",nbMass,1.05,1.25,200,-20.0,20.0);
1614         fHistPiAPTrackLengthPosVsMass[1] = new TH2F("fHistPiAPTrackLengthPosVsMassSec","track length of pos sec ALambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1615         fHistPiAPTrackLengthNegVsMass[1] = new TH2F("fHistPiAPTrackLengthNegVsMassSec","track length of neg sec ALambda daughter in TPC",nbMass,1.05,1.25,250,0.0,250.0);
1616       }
1617       else{
1618         fHistPiAPDCADaughters[1] = new TH2F("fHistPiAPDCADaughtersSec","dca of #bar{#Lambda} daughters",500,0.0,50.0,250,0.0,2.0);
1619         fHistPiAPDCADaughterPosToPrimVtxVSMass[1] = new TH2F("fHistPiAPDCADaughterPosToPrimVtxVSMassSec","pos sec DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1620         fHistPiAPDCADaughterNegToPrimVtxVSMass[1] = new TH2F("fHistPiAPDCADaughterNegToPrimVtxVSMassSec","neg sec DCA daughter to prim vtx vs invmass",500,0.0,50.0,250,0.0,10.0);
1621         fHistPiAPDCAVSMass[1]   = new TH2F("fHistPiAPDCAVSMassSec","pi+p- dca  vs pt",500,0.0,50.0,250,0.0,5.0);
1622         fHistPiAPCosPointAng[1] = new TH2F("fHistPiAPCosPointAngSec","#bar{#Lambda} cosine of pointing angle vs mass",500,0.0,50.0,200,0.99,1.00);
1623         fHistPiAPRadiusXY[1] = new TH2F("fHistPiAPRadiusXYSec","pi+p- phi dist vs mass",500,0.0,50.0,200,0.0,4.0);
1624         //        fHistPiAPDCAZPos[1] = new TH2F("fHistPiAPDCAZPosSec","dca z  of ALambda sec pos daughters",200,0.0,20.0,200,-20.0,20.0);
1625         //fHistPiAPDCAZNeg[1] = new TH2F("fHistPiAPDCAZNegSec","dca z  of ALambda sec neg daughters",200,0.0,20.0,200,-20.0,20.0);
1626         fHistPiAPTrackLengthPosVsMass[1] = new TH2F("fHistPiAPTrackLengthPosVsMassSec","track length of pos sec ALambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1627         fHistPiAPTrackLengthNegVsMass[1] = new TH2F("fHistPiAPTrackLengthNegVsMassSec","track length of neg sec ALambda daughter in TPC",500,0.0,50.0,250,0.0,250.0);
1628       }
1629
1630       //-------------dedx------------//
1631       fHistDedxSecProt[1] = new TH2F("fHistDedxSecProtSec","proton", 250,0.0,5.0, 100, 0, 400);
1632       fHistDedxSecPiPlus[1] = new TH2F("fHistDedxSecPiPlusSec","pi plus", 250,0.0,5.0, 100, 0, 400);
1633       fHistDedxSecAProt[1] = new TH2F("fHistDedxSecAProtSec","antiproton", 250,0.0,5.0, 100, 0, 400);
1634       fHistDedxSecPiMinus[1] = new TH2F("fHistDedxSecPiMinusSec","pi minus", 250,0.0,5.0, 100, 0, 400);
1635       fHistDedxProt[1] = new TH2F("fHistDedxProtSec","proton", 250,0.0,5.0, 100, 0, 400);
1636       fHistDedxPiPlus[1] = new TH2F("fHistDedxPiPlusSec","pi plus", 250,0.0,5.0, 100, 0, 400);
1637       fHistDedxAProt[1] = new TH2F("fHistDedxAProtSec","antiproton", 250,0.0,5.0, 100, 0, 400);
1638       fHistDedxPiMinus[1] = new TH2F("fHistDedxPiMinusSec","pi minus", 250,0.0,5.0, 100, 0, 400);
1639
1640       // ------------------------------------------ clusters --------------------------------------------------//
1641       if(!fSetPtDepHist){
1642         fHistNclsITSPosL[1] = new TH2F("fHistNclsITSPosLSec","fHistNclsITSPos  vs pt L pos",nbMass,1.05,1.25,7,-0.5,6.5);
1643         fHistNclsITSNegL[1] = new TH2F("fHistNclsITSNegLSec","fHistNclsITSNeg vs pt L neg",nbMass,1.05,1.25,7,-0.5,6.5);
1644           
1645         fHistNclsTPCPosL[1] = new TH2F("fHistNclsTPCPosLSec","L mass vs phi pos",nbMass,1.05,1.25,200,0.0,200.0);
1646         fHistNclsTPCNegL[1] = new TH2F("fHistNclsTPCNegLSec","L mass vs phi neg",nbMass,1.05,1.25,200,0.0,200.0);
1647           
1648         fHistChi2PerNclsITSPosL[1] = new TH2F("fHistChi2PerNclsITSPosLSec","chi2 per cluster ITS L pos",nbMass,1.05,1.25,250,0.0,25.0);
1649         fHistChi2PerNclsITSNegL[1] = new TH2F("fHistChi2PerNclsITSNegLSec","chi2 per cluster ITS L neg",nbMass,1.05,1.25,250,0.0,25.0);
1650           
1651         fHistNCRowsTPCPosL[1] = new TH2F("fHistNCRowsTPCPosLSec","n crossed rows vs L pos",nbMass,1.05,1.25,200,0.0,200.0);
1652         fHistNCRowsTPCNegL[1] = new TH2F("fHistNCRowsTPCNegLSec","n crossed rows vs L neg",nbMass,1.05,1.25,200,0.0,200.0);
1653    
1654         fHistRatioFoundOverFinableTPCLPos[1] = new TH2F("fHistRatioFoundOverFinableTPCLPosSec","ncls found over findable L pos sec",nbMass,1.05,1.25,200,0.0,2.0);
1655         fHistRatioFoundOverFinableTPCLNeg[1] = new TH2F("fHistRatioFoundOverFinableTPCLNegSec","ncls found over findable L neg sec",nbMass,1.05,1.25,200,0.0,2.0);
1656       }
1657       else{
1658         fHistNclsITSPosL[1] = new TH2F("fHistNclsITSPosLSec","fHistNclsITSPos  vs pt L pos",500,0.0,50.0,7,-0.5,6.5);
1659         fHistNclsITSNegL[1] = new TH2F("fHistNclsITSNegLSec","fHistNclsITSNeg vs pt L neg",500,0.0,50.0,7,-0.5,6.5);
1660           
1661         fHistNclsTPCPosL[1] = new TH2F("fHistNclsTPCPosLSec","L mass vs phi pos",500,0.0,50.0,200,0.0,200.0);
1662         fHistNclsTPCNegL[1] = new TH2F("fHistNclsTPCNegLSec","L mass vs phi neg",500,0.0,50.0,200,0.0,200.0);
1663           
1664         fHistChi2PerNclsITSPosL[1] = new TH2F("fHistChi2PerNclsITSPosLSec","chi2 per cluster ITS L pos",500,0.0,50.0,250,0.0,25.0);
1665         fHistChi2PerNclsITSNegL[1] = new TH2F("fHistChi2PerNclsITSNegLSec","chi2 per cluster ITS L neg",500,0.0,50.0,250,0.0,25.0);
1666           
1667         fHistNCRowsTPCPosL[1] = new TH2F("fHistNCRowsTPCPosLSec","n crossed rows vs L pos",500,0.0,50.0,200,0.0,200.0);
1668         fHistNCRowsTPCNegL[1] = new TH2F("fHistNCRowsTPCNegLSec","n crossed rows vs L neg",500,0.0,50.0,200,0.0,200.0);
1669    
1670         fHistRatioFoundOverFinableTPCLPos[1] = new TH2F("fHistRatioFoundOverFinableTPCLPosSec","ncls found over findable L pos sec",500,0.0,50.0,200,0.0,2.0);
1671         fHistRatioFoundOverFinableTPCLNeg[1] = new TH2F("fHistRatioFoundOverFinableTPCLNegSec","ncls found over findable L neg sec",500,0.0,50.0,200,0.0,2.0);
1672       }
1673         
1674     }
1675
1676     //------ ITS TPC clusters --------------//
1677     fOutputContainer->Add(fHistNclsITS[0]) ;
1678     fOutputContainer->Add(fHistNclsTPC[0]);
1679     fOutputContainer->Add(fHistNclsITS[1]);
1680     fOutputContainer->Add(fHistNclsTPC[1]);
1681
1682     //-----------K0s ------------------//
1683     //    fOutputContainer->Add(fHistPiPiDCAZNeg);
1684     //fOutputContainer->Add(fHistPiPiDCAZPos);
1685     fOutputContainer->Add(fHistPiPiDCADaughters); 
1686     fOutputContainer->Add(fHistPiPiDCADaughterPosToPrimVtxVSMass);
1687     fOutputContainer->Add(fHistPiPiDCAVSMass);
1688     fOutputContainer->Add(fHistPiPiCosPointAng);
1689     fOutputContainer->Add(fHistPiPiTrackLengthPosVsMass);
1690     fOutputContainer->Add(fHistPiPiTrackLengthNegVsMass);
1691     fOutputContainer->Add(fHistPiPiRadiusXY);
1692     //  fOutputContainer->Add( fHistPiPiPtDaughters);
1693     fOutputContainer->Add(fHistNclsITSPosK0);
1694     fOutputContainer->Add(fHistNclsITSNegK0);
1695     fOutputContainer->Add(fHistNclsTPCPosK0);
1696     fOutputContainer->Add(fHistNclsTPCNegK0);
1697     fOutputContainer->Add(fHistChi2PerNclsITSPosK0);
1698     fOutputContainer->Add(fHistChi2PerNclsITSNegK0);
1699     fOutputContainer->Add(fHistNCRowsTPCPosK0);
1700     fOutputContainer->Add(fHistNCRowsTPCNegK0);
1701     fOutputContainer->Add(fHistRatioFoundOverFinableTPCK0Pos);
1702     fOutputContainer->Add(fHistRatioFoundOverFinableTPCK0Neg);
1703     
1704     //----------- Lambda Antilambda -------------//
1705     for(Int_t j=0;j<mchist;j++){
1706       fOutputContainer->Add(fHistPiPDCADaughters[j]); 
1707       fOutputContainer->Add(fHistPiAPDCADaughters[j]);
1708       fOutputContainer->Add( fHistPiPDCADaughterPosToPrimVtxVSMass[j]);
1709       fOutputContainer->Add( fHistPiPDCADaughterNegToPrimVtxVSMass[j]);
1710       fOutputContainer->Add( fHistPiAPDCADaughterPosToPrimVtxVSMass[j]);
1711       fOutputContainer->Add( fHistPiAPDCADaughterNegToPrimVtxVSMass[j]);
1712       //fOutputContainer->Add( fHistPiPPtDaughters[j]);
1713       //fOutputContainer->Add( fHistPiAPPtDaughters[j]);
1714       fOutputContainer->Add(fHistPiPDCAVSMass[j]);
1715       fOutputContainer->Add(fHistPiAPDCAVSMass[j]);
1716       fOutputContainer->Add(fHistPiPCosPointAng[j]);
1717       fOutputContainer->Add(fHistPiAPCosPointAng[j]);
1718       //fOutputContainer->Add(fHistPiPDCAZNeg[j]);
1719       //fOutputContainer->Add(fHistPiPDCAZPos[j]);
1720       //fOutputContainer->Add(fHistPiAPDCAZNeg[j]);
1721       //fOutputContainer->Add(fHistPiAPDCAZPos[j]);
1722       fOutputContainer->Add(fHistPiPTrackLengthPosVsMass[j]);
1723       fOutputContainer->Add(fHistPiPTrackLengthNegVsMass[j]);
1724       fOutputContainer->Add(fHistPiAPTrackLengthPosVsMass[j]);
1725       fOutputContainer->Add(fHistPiAPTrackLengthNegVsMass[j]);     
1726       fOutputContainer->Add(fHistPiPRadiusXY[j]);
1727       fOutputContainer->Add(fHistPiAPRadiusXY[j]);
1728
1729       //--------- dEdx --------------------------//
1730       fOutputContainer->Add(fHistDedxSecProt[j]);
1731       fOutputContainer->Add(fHistDedxSecAProt[j]);
1732       fOutputContainer->Add(fHistDedxSecPiPlus[j]);
1733       fOutputContainer->Add(fHistDedxSecPiMinus[j]);
1734       fOutputContainer->Add(fHistDedxProt[j]);
1735       fOutputContainer->Add(fHistDedxAProt[j]);
1736       fOutputContainer->Add(fHistDedxPiPlus[j]);
1737       fOutputContainer->Add(fHistDedxPiMinus[j]);
1738
1739       //--------- TPC Lambda-----------------//
1740       fOutputContainer->Add(fHistNclsITSPosL[j]);
1741       fOutputContainer->Add(fHistNclsITSNegL[j]);
1742       fOutputContainer->Add(fHistNclsTPCPosL[j]);
1743       fOutputContainer->Add(fHistNclsTPCNegL[j]);
1744       fOutputContainer->Add(fHistChi2PerNclsITSPosL[j]);
1745       fOutputContainer->Add(fHistChi2PerNclsITSNegL[j]);
1746       fOutputContainer->Add(fHistNCRowsTPCPosL[j]);
1747       fOutputContainer->Add(fHistNCRowsTPCNegL[j]);
1748       fOutputContainer->Add(fHistRatioFoundOverFinableTPCLPos[j]);
1749       fOutputContainer->Add(fHistRatioFoundOverFinableTPCLNeg[j]);
1750     }  
1751   }
1752
1753   //----------------------------- MC reco or MC truth only --------------------------//
1754   if((fMCMode && fMCTruthMode) || fMCTruthMode){//mc reco truth only
1755     if(fAnapp){
1756       fHistPrimVtxZESDVSNContributorsMC = new TH2F("fHistPrimVtxZESDVSNContributorsMC","prim vtx pos z ESD vs no. of contributers MC",250,-50,50,500,0.0,500.0);
1757       fOutputContainer->Add(fHistPrimVtxZESDVSNContributorsMC);
1758       fHistPrimVtxZESDTPCVSNContributorsMC = new TH2F("fHistPrimVtxZESDTPCVSNContributorsMC","prim vtx pos z TPC vs no. of contributers MC",250,-50,50,500,0.0,500.0);
1759       fOutputContainer->Add(fHistPrimVtxZESDTPCVSNContributorsMC);
1760       fHistPrimVtxZESDSPDVSNContributorsMC = new TH2F("fHistPrimVtxZESDSPDVSNContributorsMC","prim vtx pos z SPD vs no. of contributers MC",250,-50,50,500,0.0,500.0);
1761       fOutputContainer->Add(fHistPrimVtxZESDSPDVSNContributorsMC);
1762     }
1763     fHistMCVertexZ= new TH1F("fHistMCVertexZ"," z vertex distr in cm MC",500,-50,50);
1764     fOutputContainer->Add(fHistMCVertexZ);
1765     fHistPiPCosPointAngXiVsPt= new TH2F("fHistPiPCosPointAngXiVsPt","pi-p cos of pointing angle vs pt from xi",500,0.0,50.0,250,0.99,1.00);
1766     fOutputContainer->Add(fHistPiPCosPointAngXiVsPt);
1767     fHistPiAPCosPointAngXiVsPt= new TH2F("fHistPiAPCosPointAngXiVsPt","pi+p- cos of pointing angle vs pt from xi",500,0.0,50.0,250,0.99,1.00);  
1768     fOutputContainer->Add(fHistPiAPCosPointAngXiVsPt);    
1769     fHistPiPiEtaDMC[0] = new TH2F("fHistPiPiEtaDMCRaw","K0s daughters etaMC raw",300,-6,6,100,0,20);//
1770     fOutputContainer->Add(fHistPiPiEtaDMC[0]);
1771     fHistPiPiEtaDMC[1] = new TH2F("fHistPiPiEtaDMC","K0s daughters etaMC after rap V0 cut",300,-6,6,100,0,20);
1772     fOutputContainer->Add(fHistPiPiEtaDMC[1]); 
1773     fHistPiPEtaDMC[0] = new TH2F("fHistPiPEtaDMCRaw","#Lambda daughters etaMC raw",300,-6,6,100,0,20);
1774     fOutputContainer->Add(fHistPiPEtaDMC[0]); 
1775     fHistPiPEtaDMC[1] = new TH2F("fHistPiPEtaDMC","#Lambda daughters etaMC after rap V0 cut",300,-6,6,100,0,20);
1776     fOutputContainer->Add(fHistPiPEtaDMC[1]);
1777
1778     //-------------K0s---------------//
1779    
1780     fHistPiPiDecayLengthResolution = new TH2F("fHistPiPiDecayLengthResolution","K0s decay length resolution MC",220,0.0,110.0,220,0.0,110);
1781          
1782     //-------------Lambda------------//
1783     fHistPiPDecayLengthResolution[0] = new TH2F("fHistPiPDecayLengthResolution","Lambda decay length resolution MC",220,0.0,110.0,220,0.0,110);
1784     fHistPiPDecayLengthResolution[1] = new TH2F("fHistPiPDecayLengthResolutionSec","Lambda sec decay length resolution MC",220,0.0,110.0,220,0.0,110);
1785
1786     fHistPiPMassVSPtSecSigma[0] = new TH2F("fHistPiPMassVSPtSecSigmaMC"," pi-p+ InvMass distribution secondaries from sigma MC",nbMass,1.05,1.25,200,0.,20);
1787     fHistPiPMassVSPtSecSigma[1] = new TH2F("fHistPiPMassVSPtSecSigma"," pi-p+ InvMass distribution secondaries from Sigma reco",nbMass,1.05,1.25,200,0.,20);
1788    
1789     fHistPiPMassVSPtSecXi[0] = new TH2F("fHistPiPMassVSPtSecXiMC"," pi-p+ InvMass distribution secondaries from  xi MC",nbMass,1.05,1.25,200,0.,20);
1790     fHistPiPMassVSPtSecXi[1] = new TH2F("fHistPiPMassVSPtSecXi"," pi-p+ InvMass distribution secondaries from  xi  reco",nbMass,1.05,1.25,200,0.,20);
1791
1792     fHistPiPMassVSPtSecXiMCTruth = new TH2F("fHistPiPMassVSPtSecXiMCTruth","Lambda mass reco vs pt sec Lambda from xi MC truth pt",nbMass,1.05,1.25,500,0.0,50.0);
1793  
1794     fHistPiPMassVSYSecXi[0] = new TH2F("fHistPiPMassVSYSecXiMC"," pi-p+ InvMass distribution secondaries from xi MC",nbMass,1.05,1.25,100,-2.,2);
1795     fHistPiPMassVSYSecXi[1] = new TH2F("fHistPiPMassVSYSecXi"," pi-p+ InvMass distribution secondaries from xi reco",nbMass,1.05,1.25,100,-2.,2);
1796
1797     fHistPiPXi0PtVSLambdaPt[0]= new TH2F("fHistPiPXi0PtVSLambdaPtMC"," pt xi 0 vs pt lambda MC truth",500,0.0,50.0,500,0.0,50.0);
1798     fHistPiPXi0PtVSLambdaPt[1]= new TH2F("fHistPiPXi0PtVSLambdaPt"," pt xi 0 truth vs pt lambda reco",500,0.0,50.0,500,0.0,50.0);
1799
1800     fHistPiPXiMinusPtVSLambdaPt[0]= new TH2F("fHistPiPXiMinusPtVSLambdaPtMC","pt xi- vs pt lambda MC truth",500,0.0,50.0,500,0.0,50.0);
1801     fHistPiPXiMinusPtVSLambdaPt[1]= new TH2F("fHistPiPXiMinusPtVSLambdaPt","pt xi- truth vs pt lambda reco",500,0.0,50.0,500,0.0,50.0);
1802
1803     fHistPiPOmegaPtVSLambdaPt[0] = new TH2F("fHistPiPOmegaPtVSLambdaPtMC","pt omega vs pt lambda MC truth",500,0.0,50.0,500,0.0,50.0);
1804     fHistPiPOmegaPtVSLambdaPt[1] = new TH2F("fHistPiPOmegaPtVSLambdaPt","pt omega vs pt lambda MC reco",500,0.0,50.0,500,0.0,50.0);
1805
1806     fHistPiPMassVSPtSecOmega[0] = new TH2F("fHistPiPMassVSPtSecOmegaMC","Lambda mass vs pt omega MCtruth",nbMass,1.05,1.25,500,0.0,50.0);
1807     fHistPiPMassVSPtSecOmega[1] = new TH2F("fHistPiPMassVSPtSecOmega","Lambda mass vs pt omega MCreco",nbMass,1.05,1.25,500,0.0,50.0);
1808     fHistPiPMassVSPtSecOmegaMCTruth= new TH2F("fHistPiPMassVSPtSecOmegaMCTruth","Lambda mass vs pt sec Lambda from Omega MC truth pt",nbMass,1.05,1.25,500,0.0,50.0);
1809
1810     //--------------ALambda-----------------//
1811     fHistPiAPDecayLengthResolution[0] = new TH2F("fHistPiAPDecayLengthResolution","ALambda decay length resolution MC",220,0.0,110.0,220,0.0,110);
1812     fHistPiAPDecayLengthResolution[1] = new TH2F("fHistPiAPDecayLengthResolutionSec","ALambda sec decay length resolution MC",220,0.0,110.0,220,0.0,110);
1813
1814     fHistPiAPMassVSPtSecSigma[0] = new TH2F("fHistPiAPMassVSPtSecSigmaMC"," pi+p- InvMass distribution secondaries from Sigma MC",nbMass,1.05,1.25,200,0.,20);
1815     fHistPiAPMassVSPtSecSigma[1] = new TH2F("fHistPiAPMassVSPtSecSigma"," pi+p- InvMass distribution secondaries from  Sigma  reco",nbMass,1.05,1.25,200,0.,20);
1816
1817     fHistPiAPMassVSPtSecXi[0] = new TH2F("fHistPiAPMassVSPtSecXiMC"," pi+p- InvMass distribution secondaries from xi MC",nbMass,1.05,1.25,200,0.,20);
1818     fHistPiAPMassVSPtSecXi[1] = new TH2F("fHistPiAPMassVSPtSecXi"," pi+p- InvMass distribution secondaries from  Xi reco",nbMass,1.05,1.25,200,0.,20);
1819
1820     fHistPiAPMassVSPtSecXiMCTruth = new TH2F("fHistPiAPMassVSPtSecXiMCTruth","ALambda mass reco vs pt sec Lambda from xi MC truth pt",nbMass,1.05,1.25,500,0.0,50.0);
1821       
1822     fHistPiAPMassVSYSecXi[0] = new TH2F("fHistPiAPMassVSYSecXiMC"," pi+p- InvMass distribution secondaries from  xi MC",nbMass,1.05,1.25,100,-2,2);
1823     fHistPiAPMassVSYSecXi[1] = new TH2F("fHistPiAPMassVSYSecXi"," pi+p- InvMass distribution secondaries from xi reco",nbMass,1.05,1.25,100,-2.,2);
1824
1825      
1826     fHistPiAPXi0PtVSLambdaPt[0]= new TH2F("fHistPiAPXi0PtVSLambdaPtMC"," pt xi 0 vs pt Alambda MC truth",500,0.0,50.0,500,0.0,50.0);
1827     fHistPiAPXi0PtVSLambdaPt[1]= new TH2F("fHistPiAPXi0PtVSLambdaPt"," pt xi 0 truth vs pt Alambda reco",500,0.0,50.0,500,0.0,50.0);
1828
1829     fHistPiAPXiMinusPtVSLambdaPt[0]= new TH2F("fHistPiAPXiMinusPtVSLambdaPtMC","pt xi- vs pt Alambda MC truth",500,0.0,50.0,500,0.0,50.0);
1830     fHistPiAPXiMinusPtVSLambdaPt[1]= new TH2F("fHistPiAPXiMinusPtVSLambdaPt","pt xi- truth vs pt Alambda reco",500,0.0,50.0,500,0.0,50.0);
1831
1832     fHistPiAPOmegaPtVSLambdaPt[0] = new TH2F("fHistPiAPOmegaPtVSLambdaPtMC","pt omega vs pt alambda MC truth",500,0.0,50.0,500,0.0,50.0);
1833     fHistPiAPOmegaPtVSLambdaPt[1] = new TH2F("fHistPiAPOmegaPtVSLambdaPt","pt omega vs pt alambda MC reco",500,0.0,50.0,500,0.0,50.0);
1834
1835     fHistPiAPMassVSPtSecOmega[0] = new TH2F("fHistPiAPMassVSPtSecOmegaMC","ALambda mass vs pt omega MCtruth",nbMass,1.05,1.25,500,0.0,50.0);
1836     fHistPiAPMassVSPtSecOmega[1] = new TH2F("fHistPiAPMassVSPtSecOmega","ALambda mass vs pt omega MCreco",nbMass,1.05,1.25,500,0.0,50.0);
1837     fHistPiAPMassVSPtSecOmegaMCTruth= new TH2F("fHistPiAPMassVSPtSecOmegaMCTruth","ALambda mass vs pt sec Lambda from Omega MC truth pt",nbMass,1.05,1.25,500,0.0,50.0);
1838    
1839     fOutputContainer->Add(fHistPiPMassVSPtSecXiMCTruth);
1840     fOutputContainer->Add(fHistPiPMassVSPtSecOmegaMCTruth);
1841
1842     fOutputContainer->Add(fHistPiAPMassVSPtSecXiMCTruth);
1843     fOutputContainer->Add(fHistPiAPMassVSPtSecOmegaMCTruth);
1844
1845     fOutputContainer->Add(fHistPiPiDecayLengthResolution);   
1846   
1847   
1848     for(Int_t j=0;j<2;j++){
1849
1850       fOutputContainer->Add(fHistPiPDecayLengthResolution[j]);  
1851       fOutputContainer->Add(fHistPiAPDecayLengthResolution[j]);
1852       fOutputContainer->Add(fHistPiPMassVSPtSecXi[j]);
1853       fOutputContainer->Add(fHistPiAPMassVSPtSecXi[j]);
1854       fOutputContainer->Add(fHistPiPMassVSYSecXi[j]);
1855       fOutputContainer->Add(fHistPiAPMassVSYSecXi[j]);
1856       fOutputContainer->Add(fHistPiPXi0PtVSLambdaPt[j]);
1857       fOutputContainer->Add(fHistPiAPXi0PtVSLambdaPt[j]);
1858       fOutputContainer->Add(fHistPiPXiMinusPtVSLambdaPt[j]);
1859       fOutputContainer->Add(fHistPiAPXiMinusPtVSLambdaPt[j]);
1860       fOutputContainer->Add(fHistPiPMassVSPtSecSigma[j]);
1861       fOutputContainer->Add(fHistPiAPMassVSPtSecSigma[j]);
1862       fOutputContainer->Add(fHistPiPOmegaPtVSLambdaPt[j]);
1863       fOutputContainer->Add(fHistPiAPOmegaPtVSLambdaPt[j]);
1864       fOutputContainer->Add(fHistPiPMassVSPtSecOmega[j]);
1865       fOutputContainer->Add(fHistPiAPMassVSPtSecOmega[j]);
1866     }
1867   }
1868   if(fMCMode ||fMCTruthMode ){
1869     fHistPiPiPDGCode = new TH1F("fHistPiPiPDGCode","PDG code of K0s mothers",3503,-2.5,3500.5);
1870     fOutputContainer->Add(fHistPiPiPDGCode);
1871     fHistPiPPDGCode = new TH1F("fHistPiPPDGCode","PDG code of #Lambda  mothers",3503,-2.5,3500.5);
1872     fOutputContainer->Add(fHistPiPPDGCode);
1873     fHistPiAPPDGCode = new TH1F("fHistPiAPPDGCode","PDG code of #bar{#Lambda} mothers",3503,-2.5,3500.5);
1874     fOutputContainer->Add(fHistPiAPPDGCode);
1875   }
1876   /*
1877     if(fMCMode && !fMCTruthMode){
1878     //K0s
1879     fHistPiPiGA= new TH2F("fHistPiPiGA","photons BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1880     fOutputContainer->Add(fHistPiPiGA);
1881     fHistPiPiKch= new TH2F("fHistPiPiKch","ch kaons BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1882     fOutputContainer->Add(fHistPiPiKch);
1883     fHistPiPiPhi= new TH2F("fHistPiPiPhi","phi BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1884     fOutputContainer->Add(fHistPiPiPhi);
1885     fHistPiPiL= new TH2F("fHistPiPiL","Lambda BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1886     fOutputContainer->Add(fHistPiPiL);
1887     fHistPiPiPi0= new TH2F("fHistPiPiPi0","pi0 BG vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1888     fOutputContainer->Add(fHistPiPiPi0);
1889     fHistPiPiPich= new TH2F("fHistPiPiPich","ch pi BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1890     fOutputContainer->Add(fHistPiPiPich);
1891     fHistPiPiRoh= new TH2F("fHistPiPiRoh","roh BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1892     fOutputContainer->Add(fHistPiPiRoh);
1893     fHistPiPiOmega= new TH2F("fHistPiPiOmega","omega BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1894     fOutputContainer->Add(fHistPiPiOmega);
1895     fHistPiPiKStar= new TH2F("fHistPiPiKStar","Kstar BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1896     fOutputContainer->Add(fHistPiPiKStar);
1897     fHistPiPiNoMother= new TH2F("fHistPiPiNoMother","combi BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1898     fOutputContainer->Add(fHistPiPiNoMother);
1899
1900     fHistPiPiK0s= new TH2F("fHistPiPiK0s","K0s BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1901     fOutputContainer->Add(fHistPiPiK0s);
1902     fHistPiPiK0L= new TH2F("fHistPiPiK0L","K0L BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1903     fOutputContainer->Add(fHistPiPiK0L);
1904     fHistPiPiN= new TH2F("fHistPiPiN","n BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1905     fOutputContainer->Add(fHistPiPiN);
1906     fHistPiPiSigma= new TH2F("fHistPiPiSigma","sigma BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1907     fOutputContainer->Add(fHistPiPiSigma);
1908     fHistPiPiXi= new TH2F("fHistPiPiXi","xi BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1909     fOutputContainer->Add(fHistPiPiXi);
1910     fHistPiPiDelta= new TH2F("fHistPiPiDelta","delta BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1911     fOutputContainer->Add(fHistPiPiDelta);
1912     fHistPiPiB= new TH2F("fHistPiPiB","b BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1913     fOutputContainer->Add(fHistPiPiB);
1914     fHistPiPiD= new TH2F("fHistPiPiD","d BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1915     fOutputContainer->Add(fHistPiPiD);
1916     fHistPiPiEta= new TH2F("fHistPiPiEta","eta BG  vs pt K0 ",nbMass,0.25,0.75,200,0,20.0);
1917     fOutputContainer->Add(fHistPiPiEta);
1918
1919
1920
1921     //Lambda
1922     fHistPiPGA = new TH2F("fHistPiPGA","photons in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1923     fOutputContainer->Add(fHistPiPGA);
1924     fHistPiPKch = new TH2F("fHistPiPKch","ch kaons in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1925     fOutputContainer->Add(fHistPiPKch);
1926     fHistPiPK0s = new TH2F("fHistPiPK0s","K0s in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1927     fOutputContainer->Add(fHistPiPK0s);
1928     fHistPiPPi0 = new TH2F("fHistPiPPi0","pi0 in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1929     fOutputContainer->Add(fHistPiPPi0);
1930     fHistPiPPich = new TH2F("fHistPiPPich","ch pions in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1931     fOutputContainer->Add(fHistPiPPich);
1932     fHistPiPKStar = new TH2F("fHistPiPKStar","Kstar in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1933     fOutputContainer->Add(fHistPiPKStar);
1934     fHistPiPN = new TH2F("fHistPiPN","neutron in L BG",nbMass,1.05,1.25,500,0.0,50.0);
1935     fOutputContainer->Add(fHistPiPN);
1936     fHistPiPNoMother= new TH2F("fHistPiPNoMother","combi BG  vs pt Lambda ",nbMass,1.05,1.25,200,0,20.0);
1937     fOutputContainer->Add(fHistPiPNoMother);
1938     fHistPiPL= new TH2F("fHistPiPL","Lambda BG  vs pt K0 ",nbMass,1.05,1.25,200,0,20.0);
1939     fOutputContainer->Add(fHistPiPL);
1940     }
1941   */
1942
1943   /*    
1944   //shift q/pt
1945   fHistUserPtShift = new TH1F("fHistUserPtShift","user defined shift in 1/pt",100,-0.5,1.5);
1946   */
1947    
1948 }
1949
1950 //________________________________________________________________________
1951 void AliAnalysisTaskV0ForRAA::UserExec(Option_t *) {
1952   //user exec
1953
1954   //-- esd handler --//
1955   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> 
1956     (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
1957   if (!esdH) {
1958     printf("ERROR: Could not get ESDInputHandler");
1959     return;
1960   } 
1961   fESD = esdH->GetEvent();
1962   if(!fESD) {
1963     printf("ERROR: fESD not available \n");
1964     return ;
1965   }
1966
1967   //-- mc handler --//
1968   if(fMCMode || fMCTruthMode){
1969     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*> 
1970       (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
1971     if(!mcH) {
1972       printf("ERROR: Could not get MCInputHandler");
1973       return;
1974     }
1975     fMCev = mcH->MCEvent();
1976     if (!fMCev) {
1977       printf("ERROR: fMCev not available \n");
1978       return ;
1979     }
1980   }
1981     
1982   //--  AliPIDResponse --//
1983   fESDpid = esdH->GetPIDResponse();
1984  
1985   //-- Count events before cuts --//
1986   fHistNEvents->Fill(0);
1987
1988   //-- Check object existence --//
1989   const AliESDVertex *    vtxESD    = fESD->GetPrimaryVertexTracks();
1990   const AliESDVertex *    vtxESDTPC = fESD->GetPrimaryVertexTPC();  
1991   const AliESDVertex *    vtxESDSPD = fESD->GetPrimaryVertexSPD();  
1992   const AliMultiplicity * multESD   = fESD->GetMultiplicity();  
1993
1994   if ( !vtxESD ){
1995     AliError("No Tracks Vertex");
1996     return;
1997   }
1998
1999   if ( !vtxESDTPC ){
2000     AliError("No TPC Vertex");
2001     return ;
2002   }
2003
2004   if ( !vtxESDSPD ){
2005     AliError("No SPD Vertex");
2006     return ;
2007   }
2008
2009   if ( !multESD ){
2010     AliError("No Multiplicity");
2011     return ;
2012   }
2013    
2014
2015   // ----------- MC vertex -----------------------------------//
2016  
2017   Int_t nContr =0;
2018   
2019   if(fMCTruthMode){
2020     Double_t vVertexPrim[3];
2021     fMCev->GetPrimaryVertex()->GetXYZ(vVertexPrim);
2022     fHistMCVertexZ->Fill(vVertexPrim[2]);
2023     
2024     if(fMCMode && fAnapp){
2025       if (vtxESD->GetStatus()){
2026         nContr=vtxESD->GetNContributors();
2027         fHistPrimVtxZESDVSNContributorsMC->Fill(vVertexPrim[2],nContr);
2028         fHistPrimVtxZESDTPCVSNContributorsMC->Fill(vVertexPrim[2],nContr);
2029       }
2030       else {
2031         if(vtxESDSPD->GetStatus()){
2032           nContr=vtxESDSPD->GetNContributors();
2033           fHistPrimVtxZESDTPCVSNContributorsMC->Fill(vVertexPrim[2],nContr);
2034           fHistPrimVtxZESDSPDVSNContributorsMC->Fill(vVertexPrim[2],nContr);
2035         }
2036         else{
2037           fHistPrimVtxZESDVSNContributorsMC->Fill(vVertexPrim[2],nContr);//add for correction ESD and ESDPSD!!!!
2038           fHistPrimVtxZESDTPCVSNContributorsMC->Fill(vVertexPrim[2],nContr);
2039         }
2040       }
2041     }
2042   }
2043   
2044      
2045   
2046   //-- Check fo centrality --//
2047   Bool_t process = kTRUE;
2048   Int_t centBin = -1;
2049   if(fUseCentrality) {
2050     centBin = CalculateCentralityBin();
2051     if(!fUseCentralityRange){
2052       if(centBin!= fUseCentralityBin) process=kFALSE;
2053     }
2054     else if(centBin < fUseCentralityBin || centBin > fUseCentralityBin+fUseCentralityRange)
2055       process = kFALSE;
2056   }
2057
2058   AliESDVZERO* esdV0 = fESD->GetVZEROData();
2059   Float_t multV0 = esdV0->GetMTotV0A() + esdV0->GetMTotV0C();
2060   
2061   if(fAnapp){// pp Analysis
2062   
2063     // SDD test for 2.76TeV pp
2064     // select events with SDD
2065     //   TString trCl = fESD->GetFiredTriggerClasses();
2066     //if(!(trCl.Contains("ALLNOTRD")) && fSelSDD) return;
2067     UInt_t maskSel = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
2068     if(maskSel& AliVEvent::kFastOnly && fSelSDD) return;
2069     if(!(maskSel& AliVEvent::kFastOnly) && fSelNoSDD) return;
2070          
2071
2072     //-- Monitor event cuts --//
2073     fHistNEvents->Fill(1);
2074
2075     //---ask for pileup from SPD---//
2076     Bool_t pileUpSPD = fESD->IsPileupFromSPD();
2077     if(fRejectPileUpSPD && pileUpSPD) return;
2078     
2079     Int_t ntracks = fESD->GetNumberOfTracks();
2080     for(Int_t i=0;i<ntracks;i++){//check sdd event selection
2081       AliESDtrack *tr=   fESD->GetTrack(i);
2082       
2083       Bool_t sdd0 = tr->HasPointOnITSLayer(0);
2084       Bool_t sdd1 = tr->HasPointOnITSLayer(1);
2085       Bool_t sdd2 = tr->HasPointOnITSLayer(2);
2086       Bool_t sdd3 = tr->HasPointOnITSLayer(3);
2087       Bool_t sdd4 = tr->HasPointOnITSLayer(4);
2088       Bool_t sdd5 = tr->HasPointOnITSLayer(5);
2089        
2090       fHistITSLayerHits->Fill(Int_t(sdd0)*(-1),ntracks);
2091       fHistITSLayerHits->Fill(Int_t(sdd1)*1,ntracks);
2092       fHistITSLayerHits->Fill(Int_t(sdd2)*2,ntracks);
2093       fHistITSLayerHits->Fill(Int_t(sdd3)*3,ntracks);
2094       fHistITSLayerHits->Fill(Int_t(sdd4)*4,ntracks);
2095       fHistITSLayerHits->Fill(Int_t(sdd5)*5,ntracks);
2096     }
2097       
2098     //--vertex selection--//
2099     if (vtxESD->GetStatus()){
2100       fHistNEvents->Fill(2);
2101       fHistESDVertexZ->Fill(vtxESD->GetZv());
2102       if(fabs(vtxESD->GetZv()) < fVertexZCut){
2103         fHistMuliplicityRaw->Fill(multV0);
2104         fHistNEvents->Fill(3);
2105         fHistNPrim->Fill(nContr);
2106         
2107         Process();
2108         
2109         fHistMuliplicity->Fill(multV0);
2110         
2111         nContr = vtxESD->GetNContributors();
2112         //  if(nContr<501){
2113         fHistPrimVtxZESDVSNContributors->Fill(vtxESD->GetZv(),nContr);
2114         fHistPrimVtxZESDTPCVSNContributors->Fill(vtxESDTPC->GetZv(),nContr);
2115         //fHistPrimVtxZESDSPDVSNContributorsTPC->Fill(vtxESDSPD->GetZv(),nContr);
2116         //   }
2117         fHistPrimVtxZESD->Fill(vtxESD->GetZv());
2118         fHistPrimVtxZESDTPC->Fill(vtxESDTPC->GetZv());
2119         // fHistPrimVtxZESDSPD->Fill(vtxESDSPD->GetZv());
2120         // -- count events after processing
2121         fHistNEvents->Fill(4);
2122       }
2123     }
2124     else{
2125       if(vtxESDSPD->GetStatus()){
2126         fHistNEvents->Fill(2);
2127         
2128         fHistESDVertexZ->Fill(vtxESDSPD->GetZv());
2129         if(fabs(vtxESDSPD->GetZv()) < fVertexZCut){
2130           
2131           fHistMuliplicityRaw->Fill(multV0);
2132           fHistNEvents->Fill(3);
2133           fHistNPrim->Fill(nContr);
2134           
2135           Process();
2136           
2137           fHistMuliplicity->Fill(multV0);
2138           
2139           nContr = vtxESDSPD->GetNContributors();
2140           //  if(nContr<501){
2141           //fHistPrimVtxZESDVSNContributors->Fill(vtxESD->GetZv(),nContr);
2142           fHistPrimVtxZESDTPCVSNContributors->Fill(vtxESDTPC->GetZv(),nContr);
2143           fHistPrimVtxZESDSPDVSNContributors->Fill(vtxESDSPD->GetZv(),nContr);
2144           // }
2145           // fHistPrimVtxZESD->Fill(vtxESD->GetZv());
2146           fHistPrimVtxZESDTPC->Fill(vtxESDTPC->GetZv());
2147           fHistPrimVtxZESDSPD->Fill(vtxESDSPD->GetZv());
2148           // -- count events after processing
2149           fHistNEvents->Fill(4);
2150         }
2151       }
2152       //else return;
2153     }
2154   }
2155   else{// PbPb analysis
2156     //-- Monitor event cuts --//
2157     fHistNEvents->Fill(1);
2158
2159     if(vtxESD->GetStatus()){
2160       Double_t vtxZ = vtxESD->GetZv();
2161       fHistESDVertexZ->Fill(vtxZ);
2162       if(process){
2163         fHistNEvents->Fill(2);
2164         if(fabs(vtxZ) < fVertexZCut){
2165           nContr = vtxESD->GetNContributors();
2166           fHistMuliplicityRaw->Fill(multV0);
2167           fHistNEvents->Fill(3);
2168           fHistNPrim->Fill(nContr);
2169           Process();
2170           fHistMuliplicity->Fill(multV0);
2171           fHistPrimVtxZESD->Fill(vtxZ);
2172           fHistPrimVtxZESDVSNContributors->Fill(vtxZ,nContr);
2173           // -- count events after processing --//
2174           fHistCentBin->Fill(centBin);
2175           fHistNEvents->Fill(4);
2176         }
2177       }
2178       if(fabs(vtxZ) < fVertexZCut) fHistCentBinRaw->Fill(centBin);
2179     }
2180   }
2181   PostData(1,fOutputContainer);
2182 }
2183
2184 //________________________________________________________________________
2185 void AliAnalysisTaskV0ForRAA::Terminate(Option_t *) {
2186   //terminate
2187 }
2188
2189 //________________________________________________________________________
2190 void AliAnalysisTaskV0ForRAA::Process(){//run the analysis
2191   
2192   Int_t ntracks = fESD->GetNumberOfTracks();
2193   Int_t count = 0;
2194
2195   //-- count number of tracks --//
2196    
2197   if(!(!fMCMode && fMCTruthMode)){
2198     for(Int_t i=0;i<ntracks;i++){
2199       AliESDtrack *track = (AliESDtrack*)fESD->GetTrack(i);
2200       if(!fESDTrackCuts->AcceptTrack(track)) continue;
2201       if( track->Eta() > fEtaCutMCDaughtersVal) continue;
2202       count++;
2203     }
2204     fHistMultiplicityPrimary->Fill(count);
2205   }
2206    
2207   //-- check number of V0s in case of data or mc data like analysis--//
2208   Int_t nV0 = fESD->GetNumberOfV0s();
2209   if(!fMCTruthMode) if(nV0 < 1) return;
2210    
2211   //-- run analysis --//
2212   if(fMCTruthMode)  V0MCTruthLoop();
2213   else  V0RecoLoop(0,0,0,0,0.0,0,0.0,0.0);
2214
2215 }
2216
2217 //________________________________________________________________________
2218 void AliAnalysisTaskV0ForRAA::V0MCTruthLoop(){
2219   //loop over MC truth particles
2220
2221   //-- get MC stack --//
2222   AliStack *stack = fMCev->Stack();
2223
2224   /*
2225   //histo for user defined shift in charge/pt 
2226   if(fShift){
2227   fHistUserPtShift->Fill(fDeltaInvP);
2228   }
2229   */
2230   /*
2231     AliKFVertex primVtxStart(*(fESD->GetPrimaryVertex()));
2232     Int_t nTracksPrim=primVtxStart.GetNContributors();
2233     fHistNPrim->Fill(nTracksPrim);
2234   */
2235   /*
2236   // MC
2237     
2238   Int_t mcPrimaries = stack->GetNprimary();
2239   Int_t mcParticles    = stack->GetNtrack();
2240     
2241   fHistMultiplicityPrimary->Fill(mcPrimaries);
2242   fHistMCMultiplicityTracks->Fill(mcParticles);
2243     
2244   // number of V0
2245   fHistNV0->Fill(nV0);
2246   if(nTracksPrim>0) {
2247   fHistNV0WithVertex->Fill(nV0);
2248   }
2249   */
2250
2251   //-- MC truht loop for V0s --//
2252   for (Int_t iMc = 0; iMc < (stack->GetNtrack()); iMc++){//MC truth loop
2253     Int_t fillMCtruth= int(fMCTruthMode);
2254     if(fMCTruthMode){
2255       fHistPiPiMonitorMCCuts->Fill(1*fillMCtruth);
2256       fHistPiPMonitorMCCuts[0]->Fill(1*fillMCtruth);
2257       fHistPiAPMonitorMCCuts[0]->Fill(1*fillMCtruth);
2258     }
2259     TParticle *p0 = stack->Particle(iMc);
2260     if(!p0) continue;
2261
2262     if(fMCTruthMode){
2263       fHistPiPiMonitorMCCuts->Fill(2*fillMCtruth);
2264       fHistPiPMonitorMCCuts[0]->Fill(2*fillMCtruth);
2265       fHistPiAPMonitorMCCuts[0]->Fill(2*fillMCtruth);
2266     }
2267
2268
2269
2270     Int_t pdgCode = p0->GetPdgCode();
2271
2272     //-------------- only K0s and Lambda ----------//
2273     if( (pdgCode != 310 ) && ( fabs(pdgCode) != 3122 ) ) continue;
2274     Int_t fillFlagK0 = (3122- fabs(pdgCode))/(3122-310)*fillMCtruth;
2275     Int_t fillFlagL = (fabs(pdgCode) - 310)/(3122-310)*(pdgCode+3122)/(2*3122)*fillMCtruth;
2276     Int_t fillFlagAL = (fabs(pdgCode) - 310)/(3122-310)*(pdgCode-3122)/(-2*3122)*fillMCtruth;
2277     
2278     fHistPiPiMonitorMCCuts->Fill(3*fillFlagK0);
2279     fHistPiPMonitorMCCuts[0]->Fill(3*fillFlagL);
2280     fHistPiAPMonitorMCCuts[0]->Fill(3*fillFlagAL);
2281       
2282     if(p0->GetNDaughters() !=2) continue;
2283     fHistPiPiMonitorMCCuts->Fill(4*fillFlagK0);
2284     fHistPiPMonitorMCCuts[0]->Fill(4*fillFlagL);
2285     fHistPiAPMonitorMCCuts[0]->Fill(4*fillFlagAL);
2286       
2287     //-------------- unique ID check-------------- //
2288     Int_t uniqueID =  p0->GetUniqueID();
2289     if(uniqueID==13) continue;
2290       
2291     fHistPiPiMonitorMCCuts->Fill(5*fillFlagK0);
2292     fHistPiPMonitorMCCuts[0]->Fill(5*fillFlagL);
2293     fHistPiAPMonitorMCCuts[0]->Fill(5*fillFlagAL);
2294       
2295     //-------------- daughters --------------------//
2296     Int_t id0  = p0->GetDaughter(0);
2297     Int_t id1  = p0->GetDaughter(1);
2298     if(id0<0 || id1 <0) continue;
2299       
2300     fHistPiPiMonitorMCCuts->Fill(6*fillFlagK0);
2301     fHistPiPMonitorMCCuts[0]->Fill(6*fillFlagL);
2302     fHistPiAPMonitorMCCuts[0]->Fill(6*fillFlagAL);
2303             
2304     Int_t pdgCodeD0 = stack->Particle(id0)->GetPdgCode();
2305     Int_t pdgCodeD1 = stack->Particle(id1)->GetPdgCode();
2306       
2307     if(pdgCodeD0 == pdgCodeD1) continue;
2308     if(pdgCodeD0*pdgCodeD1>0) continue;
2309       
2310     fHistPiPiMonitorMCCuts->Fill(7*fillFlagK0);
2311     fHistPiPMonitorMCCuts[0]->Fill(7*fillFlagL);
2312     fHistPiAPMonitorMCCuts[0]->Fill(7*fillFlagAL);
2313             
2314     if((fabs(pdgCodeD0) != 211 ) && ( fabs(pdgCodeD0) != 2212 )) continue;
2315     if((fabs(pdgCodeD1) != 211 ) && ( fabs(pdgCodeD1) != 2212 )) continue;
2316       
2317     fHistPiPiMonitorMCCuts->Fill(8*fillFlagK0);
2318     fHistPiPMonitorMCCuts[0]->Fill(8*fillFlagL);
2319     fHistPiAPMonitorMCCuts[0]->Fill(8*fillFlagAL);
2320       
2321     TParticle *p00 =stack->Particle(id0);
2322     TParticle *p01 =stack->Particle(id1);
2323     Double_t etaMC00   = p00->Eta();
2324     Double_t etaMC01   = p01->Eta();
2325
2326     //----------- unique ID check daughters-------- //
2327     Int_t uniqueIDdaughter0 = p00->GetUniqueID();
2328     Int_t uniqueIDdaughter1 = p01->GetUniqueID();
2329     if (uniqueIDdaughter0 !=4 || uniqueIDdaughter1 !=4 ) continue;
2330       
2331     fHistPiPiMonitorMCCuts->Fill(9*fillFlagK0);
2332     fHistPiPMonitorMCCuts[0]->Fill(9*fillFlagL);
2333     fHistPiAPMonitorMCCuts[0]->Fill(9*fillFlagAL);
2334
2335     fHistPiPMonitorMCCuts[1]->Fill(9*fillFlagL);
2336     fHistPiAPMonitorMCCuts[1]->Fill(9*fillFlagAL);
2337       
2338     //------------ check label reco -------------------//
2339     if(fCheckNegLabelReco || fOnlyFoundRecoV0){   // check label reco
2340       Bool_t found =kFALSE;
2341       Int_t label0=0,label1=0;      
2342       AliESDv0 * v0MIsMC=NULL;
2343       AliESDtrack *tr0 = NULL;
2344       AliESDtrack *tr1 = NULL;
2345       for(Int_t recL=0;recL < fESD->GetNumberOfV0s();recL++){
2346         v0MIsMC = fESD->GetV0(recL);
2347         if(!v0MIsMC) continue;
2348         tr0 = fESD->GetTrack(v0MIsMC->GetPindex());
2349         tr1 = fESD->GetTrack(v0MIsMC->GetNindex());
2350         if(tr0 && tr1){
2351           label0 = tr0->GetLabel();
2352           label1 = tr1->GetLabel();
2353           if((fabs(label0) == id0 && fabs(label1) == id1) || 
2354              (fabs(label0) == id1 && fabs(label1) == id0)){
2355             found =kTRUE;
2356             break; 
2357           }     
2358         }
2359       }
2360       if(fCheckNegLabelReco && !fOnlyFoundRecoV0) {
2361         if(found && (label0 <0 || label1 < 0)) continue;
2362       }
2363       else{
2364         if(!found) continue;
2365         if(fCheckNegLabelReco && found && (label0 <0 || label1 < 0)) continue;
2366       }
2367       
2368     }
2369     //-----------get geometric properties --------------//
2370     // DCA of mother to prim vertex = production vertex
2371     
2372     //-- primary and secondary vetex --//
2373     Double_t vVertexPrimMC[3];
2374     fMCev->GetPrimaryVertex()->GetXYZ(vVertexPrimMC);
2375     // Double_t x0=p0->Vx(),y0=p0->Vy(),z0=p0->Vz();//mother production vertex
2376     
2377     Double_t x=p00->Vx(),y=p00->Vy(),z=p00->Vz();//daughter vertex =V0 decay vertex
2378     Double_t rx = x - vVertexPrimMC[0];
2379     Double_t ry = y - vVertexPrimMC[1];
2380     Double_t rz = z - vVertexPrimMC[2];
2381     Double_t sdeclength = rx*rx+ry*ry;//+rz*rz;//=p00->Rho();  
2382     Double_t declength =0.0;
2383     if(sdeclength>0) declength = sqrt(sdeclength);
2384     Double_t declength3d = sqrt( rx*rx+ry*ry+rz*rz);
2385     
2386     //-- decay radii --//
2387     Double_t rMC2D  = sqrt(x*x+y*y);
2388     const  Double_t xyzMC[3] = {x,y,z};
2389     // Double_t rMC = p00->R();
2390       
2391     //-- phi --//
2392     Double_t pi = TMath::Pi();
2393     Double_t phi = p0->Phi();
2394     if(phi>pi) phi -=2*pi;
2395
2396     //-------------------- V0 variables ----------------//
2397     Double_t rapidity = p0->Y();
2398     Double_t massV0MC = p0->GetMass();
2399     Double_t ptV0MC =  p0->Pt();
2400     Double_t pV0MC =  p0->P();
2401
2402      
2403     //----------------- mother variables-----------------//
2404     Int_t indexMother1  = p0->GetMother(0);
2405     Int_t isSecd=0;
2406     Int_t pdgMother =0;
2407     // Int_t goodMother=1;
2408     Int_t uniqueIDmother=0;
2409     Double_t ptXiMother=0.0;
2410     Double_t rapXiMother = 0.0;
2411
2412
2413     //------check mother and fill mother histos---------//
2414     Bool_t isPrim= stack->IsPhysicalPrimary(iMc);
2415    
2416     if(!isPrim){//secondary
2417       isSecd=1;// is secondary V0s
2418       if(indexMother1 >-1){// && !isPrim){//secondary V0s
2419         //     isSecd=1;// is secondary V0s
2420         // if(fSelectMBMotherMC && !fMCev->IsFromBGEvent(indexMother1)) continue;//xxx only standard hijing particles for sec. lambdas:not needed
2421         
2422         //-- check for mother --//
2423         TParticle *mother = stack->Particle(indexMother1);
2424         if(!mother) {
2425           Printf("no mother pointer!");continue;
2426         }
2427         pdgMother = mother->GetPdgCode();
2428         fHistPiPMonitorMCCuts[1]->Fill(10*fillFlagL);
2429         fHistPiAPMonitorMCCuts[1]->Fill(10*fillFlagAL);
2430
2431         //-- check for injejcted --//
2432         Bool_t notinjectedMother = kTRUE;
2433         notinjectedMother = fMCev->IsFromBGEvent(indexMother1);
2434         
2435         if(fSelectInjected && !notinjectedMother ) continue;
2436         fHistPiPMonitorMCCuts[1]->Fill(11*fillFlagL);
2437         fHistPiAPMonitorMCCuts[1]->Fill(11*fillFlagAL);
2438
2439         Bool_t isPrimMother= stack->IsPhysicalPrimary(indexMother1);
2440         if(!isPrimMother) continue;
2441         fHistPiPMonitorMCCuts[1]->Fill(12*fillFlagL);
2442         fHistPiAPMonitorMCCuts[1]->Fill(12*fillFlagAL);
2443       
2444         uniqueIDmother =  mother->GetUniqueID();
2445
2446         if(uniqueIDmother==13){
2447           continue;
2448         }
2449         fHistPiPMonitorMCCuts[1]->Fill(13*fillFlagL);
2450         fHistPiAPMonitorMCCuts[1]->Fill(13*fillFlagAL);
2451
2452
2453         //-- fill secondary V0s histos and pdg histos --// 
2454         ptXiMother  = mother->Pt();
2455         rapXiMother = mother->Y();
2456         
2457
2458         //-- K0s --//
2459         if(pdgCode==310){
2460           if(fabs(pdgMother)==311 || fabs(pdgMother)==313 || fabs(pdgMother)==323 ) isSecd=0; // from K0L,  K0 and K* as primary
2461           else fHistPiPiPDGCode->Fill(fabs(pdgMother));
2462         }
2463         
2464         //-- Lambda --//
2465         if(pdgCode==3122){
2466           fHistPiPPDGCode->Fill(fabs(pdgMother));
2467           if (//sigma family
2468               ( TMath::Abs(pdgMother) == 3112) || //sigma minus
2469               ( TMath::Abs(pdgMother) == 3222) || //sigma plus
2470               ( TMath::Abs(pdgMother) == 3224) || //sigma *plus
2471               ( TMath::Abs(pdgMother) == 3114) || //sigma *minus
2472               ( TMath::Abs(pdgMother) == 3214) || //sigma *0 counts as primary????
2473               ( TMath::Abs(pdgMother) == 3212)    //sigma 0 counts as primary
2474               )
2475             {
2476               isSecd=0;
2477             }
2478            
2479           if( pdgMother == 3322) //xi0
2480             {
2481               if(!fRapCutV0 || fabs(rapidity)<fRap){
2482                 if(!fEtaCutMCDaughters  ||  (fabs(etaMC00)<fEtaCutMCDaughtersVal|| fabs(etaMC01)<fEtaCutMCDaughtersVal)){
2483                   fHistPiPMassVSPtSecXi[0]->Fill(massV0MC,ptV0MC);
2484                   fHistPiPMassVSYSecXi[0]->Fill(massV0MC,rapidity);
2485                   if(!fRapCutV0 || fabs(rapXiMother)<fRap) fHistPiPXi0PtVSLambdaPt[0]->Fill(ptV0MC,ptXiMother);
2486                 }
2487               }
2488             }
2489
2490           if(pdgMother == 3312) //xi minus
2491             {
2492               if(!fRapCutV0 || fabs(rapidity)<fRap){
2493                 if(!fEtaCutMCDaughters  ||  (fabs(etaMC00)<fEtaCutMCDaughtersVal|| fabs(etaMC01)<fEtaCutMCDaughtersVal)){
2494                   fHistPiPMassVSPtSecXi[0]->Fill(massV0MC,ptV0MC);
2495                   fHistPiPMassVSYSecXi[0]->Fill(massV0MC,rapidity);
2496                   if(!fRapCutV0 || fabs(rapXiMother)<fRap)  fHistPiPXiMinusPtVSLambdaPt[0]->Fill(ptV0MC,ptXiMother);
2497                 }
2498               }
2499             }
2500           
2501           if(pdgMother == 3334)//omega-
2502             {
2503               //  fHistPiPDCAtoPrimVtxOmega[0]->Fill(p0->GetMass(),dcaV0ToPrimVertex);
2504               if(!fRapCutV0 || fabs(rapXiMother)<fRap) fHistPiPOmegaPtVSLambdaPt[0]->Fill(ptV0MC,ptXiMother);
2505               fHistPiPMassVSPtSecOmega[0]->Fill(massV0MC,ptV0MC);
2506             }
2507         }
2508         
2509         //-- AntiLambda --//
2510         if(pdgCode==-3122 ){
2511           fHistPiAPPDGCode->Fill(fabs(pdgMother));
2512           if (//sigma family
2513               ( TMath::Abs(pdgMother) == 3112) ||//sigma minus
2514               ( TMath::Abs(pdgMother) == 3222) ||//sigma plus
2515               ( TMath::Abs(pdgMother) == 3224) ||//sigma *plus
2516               ( TMath::Abs(pdgMother) == 3114) ||//sigma *minus
2517               ( TMath::Abs(pdgMother) == 3214) || //sigma *0
2518               ( TMath::Abs(pdgMother) == 3212)    //sigma 0 counts as primary
2519               )
2520             {
2521               isSecd=0;
2522             }
2523                    
2524           if( pdgMother == -3322) //xi0
2525             {
2526               if(!fRapCutV0 || fabs(rapidity)<fRap){
2527                 if(!fEtaCutMCDaughters  ||  (fabs(etaMC00)<fEtaCutMCDaughtersVal|| fabs(etaMC01)<fEtaCutMCDaughtersVal)){
2528                   fHistPiAPMassVSPtSecXi[0]->Fill(massV0MC,ptV0MC);
2529                   fHistPiAPMassVSYSecXi[0]->Fill(massV0MC,rapidity);
2530                   if(!fRapCutV0 || fabs(rapXiMother)<fRap) fHistPiAPXi0PtVSLambdaPt[0]->Fill(ptV0MC,ptXiMother);
2531                 }
2532               }
2533             }
2534           
2535           if(pdgMother == -3312) //xi plus
2536             {
2537               if(!fRapCutV0 || fabs(rapidity)<fRap){
2538                 if(!fEtaCutMCDaughters  ||  (fabs(etaMC00)<fEtaCutMCDaughtersVal|| fabs(etaMC01)<fEtaCutMCDaughtersVal)){
2539                   fHistPiAPMassVSPtSecXi[0]->Fill(massV0MC,ptV0MC);
2540                   fHistPiAPMassVSYSecXi[0]->Fill(massV0MC,rapidity);
2541                   if(!fRapCutV0 || fabs(rapXiMother)<fRap) fHistPiAPXiMinusPtVSLambdaPt[0]->Fill(ptV0MC,ptXiMother);
2542                 }
2543               }
2544             }
2545           
2546           if(pdgMother == -3334)//omega+
2547             {
2548               fHistPiAPOmegaPtVSLambdaPt[0]->Fill(ptV0MC,ptXiMother);
2549               if(!fRapCutV0 || fabs(rapXiMother)<fRap) fHistPiAPMassVSPtSecOmega[0]->Fill(massV0MC,ptV0MC);
2550               // fHistPiAPDCAtoPrimVtxOmega[0]->Fill(p0->GetMass(),dcaV0ToPrimVertex);
2551             }
2552         }
2553       } 
2554     }//end secondaries
2555     else{//primaries
2556       //-- check for injejcted --//
2557       Bool_t notinjected = kTRUE;
2558       notinjected = fMCev->IsFromBGEvent(iMc);
2559       
2560       if(fSelectInjected && !notinjected ) continue;
2561       fHistPiPiMonitorMCCuts->Fill(10*fillFlagK0);
2562       fHistPiPMonitorMCCuts[0]->Fill(10*fillFlagL);
2563       fHistPiAPMonitorMCCuts[0]->Fill(10*fillFlagAL);
2564     }
2565     
2566
2567     //-------------- MC truth or reco mode -----------------//
2568     if(fMCTruthMode && !fMCMode){//MC true ana
2569       fHistPiPiMonitorMCCuts->Fill(14*fillFlagK0);
2570       fHistPiPMonitorMCCuts[isSecd]->Fill(14*fillFlagL);
2571       fHistPiAPMonitorMCCuts[isSecd]->Fill(14*fillFlagAL);
2572       
2573       //-- DCA daughters --//
2574       // values of one daugher, should be the same      
2575       /*
2576       //to primary vertex
2577       trackPos->GetImpactParameters(tdcaPosToVertex[0],tdcaPosToVertex[1]);
2578       trackNeg->GetImpactParameters(tdcaNegToVertex[0],tdcaNegToVertex[1]);
2579          
2580       Double_t dcaPosToVertex = TMath::Sqrt(tdcaPosToVertex[0]*tdcaPosToVertex[0]+tdcaPosToVertex[1]*tdcaPosToVertex[1]);
2581       Double_t dcaNegToVertex = TMath::Sqrt(tdcaNegToVertex[0]*tdcaNegToVertex[0]+tdcaNegToVertex[1]*tdcaNegToVertex[1]);
2582       fHistDCADaughtersToPrimVtx[isSecd]->Fill(dcaPosToVertex,dcaNegToVertex);
2583       */
2584          
2585          
2586       //-- armenteros values --//
2587       TVector3 vecPip;
2588       TVector3 vecPin;
2589         
2590       Double_t ptPlus=0, ptMinus=0;
2591       Double_t pt00 = p00->Pt();
2592       Double_t pt01 = p01->Pt();
2593       Double_t  phiMCPos=0.0;
2594       Double_t  phiMCNeg=0.0;
2595       Double_t  etaMCPos =0.0;
2596       Double_t  etaMCNeg =0.0;
2597       if(p00->GetPdgCode()<0)
2598         {
2599           vecPip.SetXYZ(p01->Px(),p01->Py(),p01->Pz());
2600           vecPin.SetXYZ(p00->Px(),p00->Py(),p00->Pz());
2601           ptMinus = pt00;
2602           ptPlus = pt01;
2603           phiMCPos = p01->Phi();
2604           phiMCNeg = p00->Phi();
2605           etaMCPos = etaMC01;
2606           etaMCNeg = etaMC00;
2607         }
2608       else{
2609         vecPin.SetXYZ(p01->Px(),p01->Py(),p01->Pz());
2610         vecPip.SetXYZ(p00->Px(),p00->Py(),p00->Pz());
2611         ptMinus = pt01;
2612         ptPlus = pt00;
2613         phiMCPos = p00->Phi();
2614         phiMCNeg = p01->Phi();
2615         etaMCPos = etaMC00;
2616         etaMCNeg = etaMC01;
2617       }
2618             
2619       TVector3 momTot(p0->Px(),p0->Py(),p0->Pz());
2620       Double_t lQlNeg = fabs(vecPin.Dot(momTot)/momTot.Mag());
2621       Double_t lQlPos = fabs(vecPip.Dot(momTot)/momTot.Mag());
2622       Double_t alfa =0.0;
2623       Double_t den = lQlPos + lQlNeg;
2624       if(den>0) alfa = (lQlPos - lQlNeg)/den;
2625       TVector3 qtvec= vecPin.Cross(momTot);//vecPip.Mag()*sqrt(1-pow(thetapip,2));
2626       Float_t qt = qtvec.Mag()/momTot.Mag();
2627       
2628       //clalc masses for test
2629       Double_t massPi=0.13957018;
2630       Double_t massP=0.93827203;
2631
2632       TLorentzVector pionPTest(vecPip, massPi);
2633       TLorentzVector pionNTest(vecPin, massPi);
2634       TLorentzVector k0sTest = pionPTest+pionNTest;
2635
2636       TLorentzVector protPTest(vecPip, massP);
2637       TLorentzVector lambdaTest = protPTest+pionNTest;
2638
2639       TLorentzVector protNTest(vecPin, massP);
2640       TLorentzVector alambdaTest = protNTest+pionPTest;
2641
2642       Double_t calcK0smass = fabs(k0sTest.M());
2643       Double_t calcLambdamass = fabs(lambdaTest.M());
2644       Double_t calcALambdamass = fabs(alambdaTest.M());
2645
2646       if(pdgCode == 310) {
2647         fHistPiPiEtaDMC[isSecd]->Fill(etaMCPos,ptV0MC);
2648         fHistPiPiEtaDMC[isSecd]->Fill(etaMCNeg,ptV0MC);
2649       }
2650       if(fabs(pdgCode) == 3122) {
2651         fHistPiPEtaDMC[isSecd]->Fill(etaMC00,ptV0MC);
2652         fHistPiPEtaDMC[isSecd]->Fill(etaMC01,ptV0MC);
2653       }
2654
2655       //-- rapidity and eta cut --//      
2656       if(fRapCutV0 && fabs(rapidity)>fRap) continue;
2657       fHistPiPiMonitorMCCuts->Fill(15*fillFlagK0);
2658       fHistPiPMonitorMCCuts[isSecd]->Fill(15*fillFlagL);
2659       fHistPiAPMonitorMCCuts[isSecd]->Fill(15*fillFlagAL);
2660          
2661       if(fEtaCutMCDaughters) { if(fabs(etaMC00)>fEtaCutMCDaughtersVal || fabs(etaMC01)>fEtaCutMCDaughtersVal ) continue; }
2662       fHistPiPiMonitorMCCuts->Fill(16*fillFlagK0);
2663       fHistPiPMonitorMCCuts[isSecd]->Fill(16*fillFlagL);
2664       fHistPiAPMonitorMCCuts[isSecd]->Fill(16*fillFlagAL);
2665
2666     
2667       Double_t phiMC =   p0->Phi(); 
2668       Double_t etaMC =   p0->Eta(); 
2669
2670       Double_t valTHnMC[4] = {massV0MC,ptV0MC,etaMC,phiMC};
2671       Double_t valTHnMCDauEta[4] = {massV0MC,ptV0MC,etaMCPos,etaMCNeg};
2672       Double_t valTHnMCDauPhi[5] = {massV0MC,phiMCPos,phiMCNeg,0.0,0.0};
2673
2674       //-- Fill Particle histos --//
2675       if (pdgCode==310){//K0s
2676         fHistPiPiMonitorMCCuts->Fill(17);
2677
2678         fHistPiPiEtaDMC[1]->Fill(etaMC00,ptV0MC);
2679         fHistPiPiEtaDMC[1]->Fill(etaMC01,ptV0MC);
2680           
2681         fHistPiPiMass->Fill(massV0MC);
2682         fHistPiPiMassVSPt->Fill(massV0MC,ptV0MC);
2683         fHistPiPiMassVSY->Fill(massV0MC,rapidity);
2684         // fHistPiPiPtDaughters->Fill(ptMinus,ptPlus);
2685         fHistPiPiPtVSY->Fill(rapidity,ptV0MC);
2686         Double_t ctTK0s=0.0,ctK0s=0.0;
2687         if(pV0MC>0.0) ctK0s=declength3d*0.497614/pV0MC;
2688         if(ptV0MC>0.0) ctTK0s=declength*0.497614/ptV0MC;
2689         fHistPiPiDecayLengthResolution->Fill(declength3d,declength);
2690         fHistPiPiDecayLengthVsPt->Fill(ptV0MC,declength);//ptV0MC,ctK0s);
2691         fHistPiPiDecayLengthVsCtau->Fill(massV0MC,ctTK0s);
2692         fHistPiPiDecayLengthVsMass->Fill(massV0MC,declength);
2693         //all V0s histo
2694         fHistArmenteros[isSecd]->Fill(alfa,qt);
2695         fHistV0RadiusZ[isSecd]->Fill(rMC2D,xyzMC[2]);
2696         fHistV0RadiusXY[isSecd]->Fill(xyzMC[0],xyzMC[1]);
2697         fHistV0RadiusZVSPt[isSecd]->Fill(ptV0MC,xyzMC[2]);
2698         // fHistPiPiPhiPosVsPtPosVsMass->Fill(massV0MC,ctTK0s,ptV0MC);//,ctK0s);//phiPosMC);//xxx
2699         fHistPiPiK0sVsLambdaMass->Fill(calcLambdamass,calcK0smass);
2700         fHistPiPiK0sVsALambdaMass->Fill(calcALambdamass,calcK0smass); 
2701         fTHnFK0s->Fill(valTHnMC);
2702         fTHnFK0sDauEta->Fill(valTHnMCDauEta);
2703         fTHnFK0sDauPhi->Fill(valTHnMCDauPhi);
2704       }
2705       if (pdgCode==3122){ //Lambda
2706         fHistPiPMonitorMCCuts[isSecd]->Fill(17);
2707         
2708         fHistPiPEtaDMC[1]->Fill(etaMC00,ptV0MC);
2709         fHistPiPEtaDMC[1]->Fill(etaMC01,ptV0MC);
2710
2711         fHistPiPMassVSPt[isSecd]->Fill(massV0MC,ptV0MC);
2712         fHistPiPMass[isSecd]->Fill(massV0MC);  
2713         fHistPiPMassVSY[isSecd]->Fill(massV0MC,rapidity);
2714         //  fHistPiPPtDaughters[isSecd]->Fill(ptMinus,ptPlus);
2715         fHistPiPPtVSY[isSecd]->Fill(rapidity,ptV0MC);
2716           
2717         
2718         Double_t ctTL=0.0, ctL=0.0;
2719         if(pV0MC>0.0) ctL=declength3d*1.115683/pV0MC;
2720         if(ptV0MC>0.0) ctTL=declength*1.115683/ptV0MC;
2721         fHistPiPDecayLengthResolution[0]->Fill(declength3d,declength);
2722         fHistPiPDecayLengthVsPt[isSecd]->Fill(ptV0MC,declength);//(ptV0MC,ctL);
2723         fHistPiPDecayLengthVsCtau[isSecd]->Fill(massV0MC,ctTL);
2724         fHistPiPDecayLengthVsMass[isSecd]->Fill(massV0MC,declength);
2725         //all V0s hito  
2726         fHistArmenteros[isSecd]->Fill(alfa,qt);
2727         fHistV0RadiusZ[isSecd]->Fill(rMC2D,xyzMC[2]);
2728         fHistV0RadiusXY[isSecd]->Fill(xyzMC[0],xyzMC[1]);
2729         fHistV0RadiusZVSPt[isSecd]->Fill(ptV0MC,xyzMC[2]);
2730         
2731         fHistPiPK0sVsLambdaMass->Fill(calcLambdamass,calcK0smass);
2732         fTHnFL->Fill(valTHnMC);
2733         fTHnFLDauEta->Fill(valTHnMCDauEta);
2734         fTHnFLDauPhi->Fill(valTHnMCDauPhi);
2735       }
2736       if (pdgCode==-3122){ //AntiLambda
2737         fHistPiAPMonitorMCCuts[isSecd]->Fill(17);
2738             
2739         fHistPiPEtaDMC[1]->Fill(etaMC00,ptV0MC);
2740         fHistPiPEtaDMC[1]->Fill(etaMC01,ptV0MC);
2741
2742         fHistPiAPMassVSPt[isSecd]->Fill(massV0MC,ptV0MC);
2743         fHistPiAPMass[isSecd]->Fill(massV0MC);
2744         fHistPiPMassVSY[isSecd]->Fill(massV0MC,rapidity);
2745         //  fHistPiAPPtDaughters[isSecd]->Fill(ptMinus,ptPlus);
2746         fHistPiAPPtVSY[isSecd]->Fill(rapidity,ptV0MC);
2747         
2748         Double_t ctTAL=0.0, ctAL=0.0;
2749         if(pV0MC>0.0) ctAL=declength3d*1.115683/pV0MC;
2750         if(ptV0MC>0.0) ctTAL=declength*1.115683/ptV0MC;
2751         fHistPiAPDecayLengthResolution[0]->Fill(declength3d,declength);
2752         fHistPiAPDecayLengthVsPt[isSecd]->Fill(ptV0MC,declength);//(ptV0MC,ctAL);
2753         fHistPiAPDecayLengthVsCtau[isSecd]->Fill(massV0MC,ctAL);
2754         fHistPiAPDecayLengthVsMass[isSecd]->Fill(massV0MC,ctTAL);//declength);
2755         //all V0s histo    
2756         fHistArmenteros[isSecd]->Fill(alfa,qt);
2757         fHistV0RadiusZ[isSecd]->Fill(rMC2D,xyzMC[2]);
2758         fHistV0RadiusXY[isSecd]->Fill(xyzMC[0],xyzMC[1]);
2759         fHistV0RadiusZVSPt[isSecd]->Fill(ptV0MC,xyzMC[2]);
2760         fHistV0RadiusXYVSY[isSecd]->Fill(rapidity,rMC2D);
2761         fHistPiAPK0sVsALambdaMass->Fill(calcALambdamass,calcK0smass);
2762         // if(isSecd <1) fHistPiPPhiPosVsPtPosVsMass->Fill(massV0MC,ctTL,ptV0MC);//,ctK0s);//phiPosMC);//xxx
2763         //else fHistPiAPPhiPosVsPtPosVsMass->Fill(massV0MC,ctTL,ptV0MC);//,ctK0s);//phiPosMC);//xxx       
2764         //fHistPiAPPhiPosVsPtPosVsMass->Fill(massV0MC,ctTL,ptV0MC);//,ctK0s);//phiPosMC);//xxx
2765         fTHnFAL->Fill(valTHnMC);
2766         fTHnFALDauEta->Fill(valTHnMCDauEta);
2767         fTHnFALDauPhi->Fill(valTHnMCDauPhi);
2768       }
2769     }//MC true ana
2770     else{// V0 reco ana
2771       V0RecoLoop(id0,id1,isSecd,pdgCode,ptV0MC,pdgMother,ptXiMother,declength);
2772     }
2773       
2774   }//end MC stack loop
2775
2776 }
2777 //________________________________________________________________________
2778 void AliAnalysisTaskV0ForRAA::V0RecoLoop(Int_t id0,Int_t id1,Int_t isSecd,Int_t what,Double_t ptV0MC, Int_t pdgMother,Double_t ptXiMother,Double_t declengthV0MC){
2779   //loop over reconstructed particles
2780
2781    
2782   //--------------------- define variables -----------------------//
2783   Double_t pp[3];
2784   Double_t pm[3];
2785   Double_t xr[3];
2786    
2787   Double_t massPi=0.13957018;
2788   Double_t massP=0.93827203;
2789   
2790   TLorentzVector positivesMIP;
2791   TLorentzVector negativesMIAP;
2792   TLorentzVector positivesMIPi;
2793   TLorentzVector negativesMIPi;
2794
2795   /*
2796     AliKFParticle::SetField(fESD->GetMagneticField());
2797     AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
2798     AliKFVertex primVtxImproved = primVtx;
2799
2800     AliKFParticle* negPiKF=NULL;
2801     AliKFParticle* posPiKF=NULL;
2802     AliKFParticle* posPKF=NULL;
2803     AliKFParticle* negAPKF=NULL;
2804   */
2805
2806   AliESDtrack* trackPos=NULL;
2807   AliESDtrack* trackNeg=NULL;
2808   AliESDtrack* trackPosTest = NULL;
2809   AliESDtrack* trackNegTest =NULL;
2810
2811   Double_t primaryVtxPosition[3];
2812   primaryVtxPosition[0] = fESD->GetPrimaryVertex()->GetXv();
2813   primaryVtxPosition[1] = fESD->GetPrimaryVertex()->GetYv();
2814   primaryVtxPosition[2] = fESD->GetPrimaryVertex()->GetZv();
2815    
2816   Int_t nV0 = fESD->GetNumberOfV0s();
2817   const Int_t sizenV0 = nV0;
2818   AliESDv0 * v0MIs=NULL;
2819
2820
2821   //    Int_t on =0,off=0;
2822   Bool_t stopLoop = kFALSE;
2823   Int_t trackID[sizenV0][2];
2824   //---------------------- for MC mode only ------------------//
2825   AliStack *stackRec = NULL;
2826   if(fMCMode && !fMCTruthMode) stackRec = fMCev->Stack();
2827     
2828   //------------------------ V0 reco loop --------------------//
2829   for(Int_t iV0MI = 0; iV0MI < nV0; iV0MI++) {//V0 loop
2830       
2831     //-- get V0 info --//
2832     v0MIs = fESD->GetV0(iV0MI);
2833     if(!v0MIs ) continue;
2834
2835     fHistPiPiMonitorCuts->Fill(1);
2836     fHistPiPMonitorCuts[isSecd]->Fill(1);
2837     fHistPiAPMonitorCuts[isSecd]->Fill(1);
2838
2839     if(stopLoop && fStopLoop) break;
2840     //------------ get references of daughters --------------//
2841     //-- esd tracks --//
2842     trackPosTest = fESD->GetTrack(v0MIs->GetPindex());
2843     trackNegTest = fESD->GetTrack(v0MIs->GetNindex());
2844      
2845     if ( trackPosTest->GetSign() == trackNegTest->GetSign()) continue;
2846          
2847     fHistPiPiMonitorCuts->Fill(2);
2848     fHistPiPMonitorCuts[isSecd]->Fill(2);
2849     fHistPiAPMonitorCuts[isSecd]->Fill(2);
2850
2851     //-- onthefly selection --//
2852     Bool_t onthefly = v0MIs->GetOnFlyStatus();
2853     if(fOntheFly!=onthefly) continue;
2854       
2855     fHistPiPiMonitorCuts->Fill(3);
2856     fHistPiPMonitorCuts[isSecd]->Fill(3);
2857     fHistPiAPMonitorCuts[isSecd]->Fill(3);
2858          
2859     //-- for MC mode --//
2860     if(fMCMode){
2861       //check MC labels (and find partners for MC truth V0 daughters for fMCTruthMode=kTRUE)
2862       if(!GetMCTruthPartner(trackPosTest,trackNegTest,id0,id1)) continue;
2863       else stopLoop = kTRUE;
2864     }
2865     else{
2866       //check if V0 was alread found
2867       if(fStopLoop){
2868         if(CheckMultipleV0Candidates(v0MIs,iV0MI,trackID)) continue;
2869       }
2870     }
2871
2872     fHistPiPiMonitorCuts->Fill(4);
2873     fHistPiPMonitorCuts[isSecd]->Fill(4);
2874     fHistPiAPMonitorCuts[isSecd]->Fill(4);
2875       
2876          
2877     //--  get eta from V0 daughters --//
2878     Double_t posDaughterEta=0.0;
2879     Double_t negDaughterEta=0.0;
2880     Double_t posDaughterPhi=0.0;
2881     Double_t negDaughterPhi=0.0;
2882          
2883     Double_t eta00 = trackPosTest->Eta();
2884     Double_t eta01 = trackNegTest->Eta();
2885             
2886
2887     Int_t indexPos = 0,indexNeg=0;
2888     //---------- check sign assignment for daughters --------//
2889     Bool_t switchSign = kFALSE;
2890      
2891     if( trackPosTest->GetSign() >0){//pos
2892       indexPos = v0MIs->GetPindex();
2893       indexNeg = v0MIs->GetNindex();
2894         
2895       v0MIs->GetPPxPyPz(pp[0],pp[1],pp[2]);
2896       v0MIs->GetNPxPyPz(pm[0],pm[1],pm[2]);
2897
2898       posDaughterEta = v0MIs->GetParamP()->Eta();
2899       negDaughterEta = v0MIs->GetParamN()->Eta();
2900       posDaughterPhi = v0MIs->GetParamP()->Phi();
2901       negDaughterPhi = v0MIs->GetParamN()->Phi();
2902       /*      
2903               if (negPiKF) delete negPiKF; negPiKF=NULL;
2904               if (posPiKF) delete posPiKF; posPiKF=NULL;
2905               if (posPKF) delete posPKF; posPKF=NULL;
2906               if (negAPKF) delete negAPKF; negAPKF=NULL;
2907
2908               negPiKF = new AliKFParticle( *(v0MIs->GetParamN()) ,-211);
2909               posPiKF = new AliKFParticle( *(v0MIs->GetParamP()) ,211);
2910               posPKF = new AliKFParticle( *(v0MIs->GetParamP()) ,2212);
2911               negAPKF = new AliKFParticle( *(v0MIs->GetParamN()) ,-2212);
2912       */
2913             
2914     }
2915     if( trackPosTest->GetSign() <0){//neg
2916
2917       indexPos = v0MIs->GetNindex();
2918       indexNeg = v0MIs->GetPindex();
2919         
2920       v0MIs->GetNPxPyPz(pp[0],pp[1],pp[2]);
2921       v0MIs->GetPPxPyPz(pm[0],pm[1],pm[2]);
2922       
2923       posDaughterEta = v0MIs->GetParamN()->Eta();
2924       negDaughterEta = v0MIs->GetParamP()->Eta();
2925       posDaughterPhi = v0MIs->GetParamN()->Phi();
2926       negDaughterPhi = v0MIs->GetParamP()->Phi();
2927       /*
2928         if (negPiKF) delete negPiKF; negPiKF=NULL;
2929         if (posPiKF) delete posPiKF; posPiKF=NULL;
2930         if (posPKF) delete posPKF; posPKF=NULL;
2931         if (negAPKF) delete negAPKF; negAPKF=NULL;
2932
2933
2934         negPiKF = new AliKFParticle( *(v0MIs->GetParamP()) ,-211);
2935         posPiKF = new AliKFParticle( *(v0MIs->GetParamN()) ,211);
2936         posPKF = new AliKFParticle( *(v0MIs->GetParamN()) ,2212);
2937         negAPKF = new AliKFParticle( *(v0MIs->GetParamP()) ,-2212);
2938       */
2939       
2940       switchSign = kTRUE;
2941       eta01 = trackPosTest->Eta();
2942       eta00 = trackNegTest->Eta();
2943
2944     }
2945     
2946     trackPos =fESD->GetTrack(indexPos);
2947     trackNeg =fESD->GetTrack(indexNeg);
2948     
2949     // ------------- calc masses and 4 vectors -------------- //
2950     //K0
2951     positivesMIPi.SetXYZM(pp[0],pp[1],pp[2],massPi);
2952     negativesMIPi.SetXYZM(pm[0],pm[1],pm[2],massPi);
2953     TLorentzVector v0K0=positivesMIPi+negativesMIPi;
2954     
2955     //Lambda
2956     positivesMIP.SetXYZM(pp[0],pp[1],pp[2],massP);
2957     TLorentzVector v0Lambda=positivesMIP+negativesMIPi;
2958      
2959     //Anitlambda
2960     negativesMIAP.SetXYZM(pm[0],pm[1],pm[2],massP);
2961     TLorentzVector v0ALambda=positivesMIPi+negativesMIAP;
2962
2963     //---------------------AliKFParticle ---------------------//
2964     /*  
2965         Double_t chi2K0C=0.0;
2966         Double_t chi2LambdaC=0.0;
2967         Double_t chi2ALambdaC=0.0;
2968
2969      
2970         AliKFParticle v0K0KF;
2971         v0K0KF +=(*negPiKF);
2972         v0K0KF +=(*posPiKF);
2973         //v0K0C.SetVtxGuess(xr[0],xr[1],xr[2]);
2974         v0K0KF.SetProductionVertex(primVtxImproved);
2975           
2976         AliKFParticle v0LambdaKF;
2977         v0LambdaKF +=(*negPiKF);
2978         v0LambdaKF +=(*posPKF);
2979         //v0LambdaC.SetVtxGuess(xr[0],xr[1],xr[2]);
2980         v0LambdaKF.SetProductionVertex(primVtxImproved);
2981           
2982         AliKFParticle v0ALambdaKF;
2983         v0ALambdaKF +=(*negAPKF);
2984         v0ALambdaKF +=(*posPiKF);
2985         //v0ALambdaC.SetVtxGuess(xr[0],xr[1],xr[2]);
2986         v0ALambdaKF.SetProductionVertex(primVtxImproved);
2987         
2988         if( v0K0KF.GetNDF() != 0) {
2989         chi2K0C = v0K0KF.GetChi2()/v0K0KF.GetNDF();
2990         }
2991
2992         Double_t chi2LambdaC=100000.;
2993         if( v0LambdaKF.GetNDF() != 0) {
2994         chi2LambdaC = v0LambdaKF.GetChi2()/v0LambdaKF.GetNDF();
2995         }
2996
2997         Double_t chi2ALambdaC=100000.;
2998         if( v0ALambdaKF.GetNDF() != 0) {
2999         chi2ALambdaC = v0ALambdaKF.GetChi2()/v0ALambdaKF.GetNDF();
3000         }
3001     */
3002       
3003     // ----------------- for MC mode ------------------------ //
3004     Bool_t fillK0sMC = kTRUE;
3005     Bool_t fillLambdaMC = kTRUE;
3006     Bool_t fillALambdaMC = kTRUE;
3007
3008     if(fMCMode && fMCTruthMode) {
3009       if(what == 310) {
3010         fillLambdaMC = kFALSE;
3011         fillALambdaMC = kFALSE;
3012       }
3013       else if(what == 3122){
3014         fillALambdaMC = kFALSE;
3015         fillK0sMC = kFALSE;
3016       }
3017       else if(what == -3122){
3018         fillLambdaMC = kFALSE;
3019         fillK0sMC = kFALSE;
3020       }
3021     }
3022    
3023     //----------------- prepare for V0 ana ------------------//
3024     TVector3 ppTrack(pp);
3025     TVector3 pmTrack(pm);
3026       
3027     //-- momenta --//
3028     Double_t ptK0s = v0K0.Pt();
3029     Double_t ptLambda = v0Lambda.Pt();
3030     Double_t ptALambda = v0ALambda.Pt();
3031       
3032     Double_t pK0s = v0K0.P();
3033     Double_t pLambda = v0Lambda.P();
3034     Double_t pALambda = v0ALambda.P();
3035
3036     Double_t posDaughterP = ppTrack.Mag();
3037     Double_t negDaughterP = pmTrack.Mag();
3038
3039     v0MIs->GetXYZ(xr[0],xr[1],xr[2]);  
3040
3041     //      Double_t posDaughterPt = ppTrack.Pt();
3042     //      Double_t negDaughterPt = pmTrack.Pt();
3043  
3044     /*
3045       Double_t v0sPt=v0MIs->Pt();
3046       if(what == 310 || what ==0){
3047       fHistPiPiEtaDReco[0]->Fill(posDaughterPt,v0sPt);
3048       fHistPiPiEtaDReco[0]->Fill(negDaughterPt,v0sPt);
3049       }
3050       if(fabs(what) == 3122 || what == 0){
3051       fHistPiPEtaDReco[0]->Fill(posDaughterPt,v0sPt);
3052       fHistPiPEtaDReco[0]->Fill(negDaughterPt,v0sPt);
3053       }
3054     */
3055      
3056      
3057
3058     //--------------------------------------------------------- general cuts --------------------------------------------------------------//
3059     //-- track cuts for daughters --//
3060     //-- eta cut --//
3061     if( fabs(posDaughterEta) > fEtaCutMCDaughtersVal || fabs(negDaughterEta) > fEtaCutMCDaughtersVal) continue;
3062     fHistPiPiMonitorCuts->Fill(5);
3063     fHistPiPMonitorCuts[isSecd]->Fill(5);
3064     fHistPiAPMonitorCuts[isSecd]->Fill(5);
3065
3066     //-- esd track cuts --//
3067     //K0s
3068     if( ptK0s > fPtTPCCut){
3069       if(fESDTrackCuts){
3070         if(!fESDTrackCuts->AcceptTrack(trackPosTest) || !fESDTrackCuts->AcceptTrack(trackNegTest)) continue;
3071         else  fHistPiPiMonitorCuts->Fill(6); 
3072       }
3073     }
3074     else{
3075       if(fESDTrackCutsLowPt){
3076         if(!fESDTrackCutsLowPt->AcceptTrack(trackPosTest) || !fESDTrackCutsLowPt->AcceptTrack(trackNegTest))  continue;
3077       }
3078     }
3079     //Lambda
3080     if(ptLambda > fPtTPCCut){
3081       if(fESDTrackCuts && fESDTrackCutsCharged){
3082         if(!fESDTrackCutsCharged->AcceptTrack(trackPosTest) || !fESDTrackCuts->AcceptTrack(trackNegTest)) continue;
3083         else  fHistPiPMonitorCuts[isSecd]->Fill(6); 
3084       }
3085     }
3086     else{
3087       if(fESDTrackCutsLowPt){
3088         if(!fESDTrackCutsLowPt->AcceptTrack(trackPosTest) || !fESDTrackCutsLowPt->AcceptTrack(trackNegTest))  continue;
3089       }
3090     }
3091     //ALambda
3092     if(ptALambda > fPtTPCCut){
3093       if(fESDTrackCuts && fESDTrackCutsCharged){
3094         if(!fESDTrackCuts->AcceptTrack(trackPosTest) || !fESDTrackCutsCharged->AcceptTrack(trackNegTest)) continue;
3095         else  fHistPiAPMonitorCuts[isSecd]->Fill(6); 
3096       }
3097     }
3098     else{
3099       if(fESDTrackCutsLowPt){
3100         if(!fESDTrackCutsLowPt->AcceptTrack(trackPosTest)|| !fESDTrackCutsLowPt->AcceptTrack(trackNegTest))  continue;
3101       }
3102     }
3103
3104       
3105     //------------------------ detector values -------------------------------//
3106     //-- TPC ITS values pos --//
3107     Int_t nclsTPCPos =  trackPos->GetNcls(1