AliPhysics  e59a9ba (e59a9ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSEPicoV0MakerMC.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
17 //
18 // AliAnalysisTaskSE for RecoDecay object (K0 short, Lambda,
19 // D mesons ...) filtering
20 //
21 // Author: X-M. Zhang, xmzhang@lbl.gov
23 
24 #include <iostream>
25 
26 #include <TString.h>
27 #include <TH1D.h>
28 #include <TH2D.h>
29 #include <THnSparse.h>
30 #include <TMath.h>
31 #include <TClonesArray.h>
32 #include <TDatabasePDG.h>
33 #include <TParticle.h>
34 
35 #include "AliAODEvent.h"
36 #include "AliESDEvent.h"
37 #include "AliMCEvent.h"
38 #include "AliStack.h"
39 #include "AliVVertex.h"
40 #include "AliAODv0.h"
41 #include "AliESDv0.h"
42 #include "AliAODTrack.h"
43 #include "AliESDtrack.h"
44 #include "AliStack.h"
45 #include "AliMCParticle.h"
46 #include "AliAODMCParticle.h"
47 #include "AliHeader.h"
48 #include "AliGenDPMjetEventHeader.h"
49 #include "AliV0vertexer.h"
50 #include "AliAnalysisUtils.h"
51 #include "AliInputEventHandler.h"
52 #include "AliCentrality.h"
53 #include "AliPIDResponse.h"
54 
55 #include "AliPicoHeaderCJ.h"
56 #include "AliPicoV0MC.h"
58 
60 //=============================================================================
61 
62 const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassPion = 0.13957;
63 const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassKshort = 0.497614;
64 const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassProton = 0.938272;
65 const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassLambda = 1.11568;
66 
67 //_____________________________________________________________________________
69 AliAnalysisTaskSE(),
70 fEventAOD(0),
71 fEventESD(0),
72 fCentInfo(0),
73 fRespoPID(0),
74 fAnaUtils(0),
75 fEventAcptMask(0),
76 fTriggerMask(0),
77 fCollisionType(0),
78 fCentEst(""),
79 fIsRefitV0sESD(kFALSE),
80 fIsSkipFastOnly(kFALSE),
81 fIsDPMjetMC(kFALSE),
82 fCutMinEventVtxContr(0),
83 fCutMaxEventVzAbs(0.),
84 fCutMinV0Pt(0.),
85 fCutMaxV0Pt(0.),
86 fCutMinV0Rap(0.),
87 fCutMaxV0Rap(0.),
88 fCutMinDauPt(0.),
89 fCutMinDauEta(0.),
90 fCutMaxDauEta(0.),
91 fCutMaxV0Chi2(0.),
92 fCutMinV0Radius(0.),
93 fCutMaxV0Radius(0.),
94 fCutMaxDausDCA(0.),
95 fCutMinDauDCAtoPV(0.),
96 fCutMinDauXrowsTPC(0.),
97 fCutMinDauXrowsOverFindableClusTPC(0.),
98 fCutMaxKshortSigmaTPC(0.),
99 fCutMinKshortCosPA(0.),
100 fCutMaxKshortCtau(0.),
101 fCutMaxKshortArmFrac(0.),
102 fCutMinKshortDeltaM(0.),
103 fCutMaxLambdaSigmaTPC(0.),
104 fCutMinLambdaCosPA(0.),
105 fCutMaxLambdaCtau(0.),
106 fCutMaxLambdaArmFrac(0.),
107 fCutMinLambdaDeletaM(0.),
108 fPicoV0sClArr(0),
109 fListUserOutputs(0)
110 {
111 //
112 // Default constructor
113 //
114 
115  for (Int_t i=3; i--;) fPrimaryVtx[i] = 0.;
116 }
117 
118 //_____________________________________________________________________________
120 AliAnalysisTaskSE(name),
121 fEventAOD(0),
122 fEventESD(0),
123 fCentInfo(0),
124 fRespoPID(0),
125 fAnaUtils(0),
126 fEventAcptMask(0),
127 fTriggerMask(0),
128 fCollisionType(AliPicoHeaderCJ::kPP),
129 fCentEst("V0M"),
130 fIsRefitV0sESD(kFALSE),
131 fIsSkipFastOnly(kFALSE),
132 fIsDPMjetMC(kFALSE),
133 fCutMinEventVtxContr(2),
134 fCutMaxEventVzAbs(10.),
135 fCutMinV0Pt(0.),
136 fCutMaxV0Pt(100.),
137 fCutMinV0Rap(-10.),
138 fCutMaxV0Rap(10.),
139 fCutMinDauPt(0.),
140 fCutMinDauEta(-10.),
141 fCutMaxDauEta(10.),
142 fCutMaxV0Chi2(33.),
143 fCutMinV0Radius(0.5),
144 fCutMaxV0Radius(200.),
145 fCutMaxDausDCA(1.),
146 fCutMinDauDCAtoPV(0.06),
147 fCutMinDauXrowsTPC(70.),
148 fCutMinDauXrowsOverFindableClusTPC(0.8),
149 fCutMaxKshortSigmaTPC(5.),
150 fCutMinKshortCosPA(0.97),
151 fCutMaxKshortCtau(20.),
152 fCutMaxKshortArmFrac(-1.),
153 fCutMinKshortDeltaM(0.005),
154 fCutMaxLambdaSigmaTPC(5.),
155 fCutMinLambdaCosPA(0.995),
156 fCutMaxLambdaCtau(30.),
157 fCutMaxLambdaArmFrac(-1.),
158 fCutMinLambdaDeletaM(0.01),
159 fPicoV0sClArr(0),
160 fListUserOutputs(0)
161 {
162 //
163 // Constructor
164 //
165 
166  for (Int_t i=3; i--;) fPrimaryVtx[i] = 0.;
167 
168  DefineOutput(1, TList::Class());
169 }
170 
171 //_____________________________________________________________________________
173 {
174 //
175 // Default destructor
176 //
177 
178  if (fEventAOD) { delete fEventAOD; fEventAOD = 0; }
179  if (fEventESD) { delete fEventESD; fEventESD = 0; }
180  if (fCentInfo) { delete fCentInfo; fCentInfo = 0; }
181  if (fRespoPID) { delete fRespoPID; fRespoPID = 0; }
182  if (fAnaUtils) { delete fAnaUtils; fAnaUtils = 0; }
183 
184  if (fPicoV0sClArr) { delete fPicoV0sClArr; fPicoV0sClArr = 0; }
186 }
187 
188 //_____________________________________________________________________________
190 {
191 //
192 // AliAnalysisTaskSEPicoV0MakerMC::Init
193 //
194 
195  return;
196 }
197 
198 //_____________________________________________________________________________
200 {
201 //
202 // AliAnalysisTaskSEPicoV0MakerMC::UserCreateOutputObjects
203 //
204 
205  InitAnalysis();
206 //=============================================================================
207 
208  fPicoV0sClArr = new TClonesArray("AliPicoV0MC");
209  fPicoV0sClArr->SetName("PicoV0s");
210 //=============================================================================
211 
212  fListUserOutputs = new TList();
213  fListUserOutputs->SetOwner();
214 
216  PostData(1, fListUserOutputs);
217  return;
218 }
219 
220 //_____________________________________________________________________________
222 {
223 //
224 // AliAnalysisTaskSEPicoV0MakerMC::UserExec
225 //
226 
227  fPicoV0sClArr->Delete();
228  if (IsEventNotAcpt()) return;
229  if (!(InputEvent()->FindListObject("PicoV0s"))) InputEvent()->AddObject(fPicoV0sClArr);
230 //=============================================================================
231 
232  FillHistograms(); if (IsEventNotMBsa()) return;
233 //=============================================================================
234 
235  FillPicoV0s();
236  return;
237 }
238 
239 //_____________________________________________________________________________
241 {
242 //
243 // AliAnalysisTaskSEPicoV0MakerMC::Terminate
244 //
245 
246  return;
247 }
248 
249 //_____________________________________________________________________________
251 {
252 //
253 // AliAnalysisTaskSEPicoV0MakerMC::NotifyRun
254 //
255 
256  return;
257 }
258 
259 //_____________________________________________________________________________
261 {
262 //
263 // AliAnalysisTaskSEPicoV0MakerMC::FillPicoRecoV0s
264 //
265 
266  Int_t nV0s = 0;
267  AliAODv0 *pV0AOD = 0;
268  AliESDv0 *pV0ESD = 0;
269  if (fEventAOD) nV0s = fEventAOD->GetNumberOfV0s();
270  if (fEventESD) nV0s = fEventESD->GetNumberOfV0s();
271  if (nV0s<=0) return;
272 //=============================================================================
273 
274  TH2D *hKshortPtInvM = dynamic_cast<TH2D*>(fListUserOutputs->FindObject("hKshortPtInvM"));
275  TH2D *hLambdaPtInvM = dynamic_cast<TH2D*>(fListUserOutputs->FindObject("hLambdaPtInvM"));
276  TH2D *hAntiLaPtInvM = dynamic_cast<TH2D*>(fListUserOutputs->FindObject("hAntiLaPtInvM"));
277 //=============================================================================
278 
279  AliPicoV0MC *pV0 = 0;
280  Int_t nAt = fPicoV0sClArr->GetEntriesFast();
281 
282  for (Int_t iV0=0; iV0<nV0s; iV0++) {
283 
284  if (fEventAOD) {
285  pV0AOD = fEventAOD->GetV0(iV0); if (!pV0AOD) continue;
286  pV0 = SelectV0Candidate(pV0AOD); if (!pV0) { pV0AOD = 0; continue; }
287  }
288 
289  if (fEventESD) {
290  pV0ESD = fEventESD->GetV0(iV0); if (!pV0ESD) continue;
291  pV0 = SelectV0Candidate(pV0ESD); if (!pV0) { pV0ESD = 0; continue; }
292  }
293 
294  pV0->FillKshortPtInvM(hKshortPtInvM);
295  pV0->FillLambdaPtInvM(hLambdaPtInvM);
296  pV0->FillAntiLaPtInvM(hAntiLaPtInvM);
297  new ((*fPicoV0sClArr)[nAt++]) AliPicoV0MC(*pV0);
298 
299  delete pV0; pV0 = 0;
300  if (pV0AOD) pV0AOD=0;
301  if (pV0ESD) pV0ESD=0;
302  }
303 
304  return;
305 }
306 
307 //_____________________________________________________________________________
309 {
310 //
311 // AliAnalysisTaskSEPicoV0MakerMC::SelectV0Candidate
312 //
313 
314  if (pV0RD->GetOnFlyStatus()) return 0x0;
315  if ((pV0RD->Chi2V0())>fCutMaxV0Chi2) return 0x0;
316 
317  Double_t dV0Pt = pV0RD->Pt(); if ((dV0Pt<fCutMinV0Pt) || (dV0Pt>fCutMaxV0Pt)) return 0x0;
318 //=============================================================================
319 
320  Double_t dV0Vtx[3]; pV0RD->GetXYZ(dV0Vtx);
321  Double_t dV0Radius = TMath::Sqrt(dV0Vtx[0]*dV0Vtx[0] + dV0Vtx[1]*dV0Vtx[1]);
322  if ((dV0Radius<fCutMinV0Radius) || (dV0Radius>fCutMaxV0Radius)) return 0x0;
323 
324  Double_t dDausDCA = pV0RD->DcaV0Daughters(); if (dDausDCA>fCutMaxDausDCA) return 0x0;
325  Double_t dPosDCAtoPV = pV0RD->DcaPosToPrimVertex(); if (dPosDCAtoPV<fCutMinDauDCAtoPV) return 0x0;
326  Double_t dNegDCAtoPV = pV0RD->DcaNegToPrimVertex(); if (dNegDCAtoPV<fCutMinDauDCAtoPV) return 0x0;
327 //=============================================================================
328 
329  AliAODTrack *pDauPosRD = (AliAODTrack*)pV0RD->GetDaughter(0); if (!pDauPosRD) return 0x0;
330  AliAODTrack *pDauNegRD = (AliAODTrack*)pV0RD->GetDaughter(1); if (!pDauNegRD) return 0x0;
331 
332  if (!(pDauPosRD->GetStatus() & AliESDtrack::kTPCrefit)) return 0x0;
333  if (!(pDauNegRD->GetStatus() & AliESDtrack::kTPCrefit)) return 0x0;
334 
335  if ((pDauPosRD->GetProdVertex()->GetType())==((Char_t)AliAODVertex::kKink)) return 0x0;
336  if ((pDauNegRD->GetProdVertex()->GetType())==((Char_t)AliAODVertex::kKink)) return 0x0;
337 
338  Float_t dPosXrowsTPC = pDauPosRD->GetTPCClusterInfo(2,1);
339  Float_t dNegXrowsTPC = pDauNegRD->GetTPCClusterInfo(2,1);
340  Float_t dDauXrowsTPC = dPosXrowsTPC; if (dDauXrowsTPC>dNegXrowsTPC) dDauXrowsTPC = dNegXrowsTPC;
341  if (dDauXrowsTPC<fCutMinDauXrowsTPC) return 0x0;
342 
343  UShort_t wPosTPCNClsF = pDauPosRD->GetTPCNclsF(); if (wPosTPCNClsF<=0) return 0x0;
344  UShort_t wNegTPCNClsF = pDauNegRD->GetTPCNclsF(); if (wNegTPCNClsF<=0) return 0x0;
345  Double_t dPosXrowsOverFindableClusTPC = ((Double_t)dPosXrowsTPC) / ((Double_t)wPosTPCNClsF);
346  Double_t dNegXrowsOverFindableClusTPC = ((Double_t)dNegXrowsTPC) / ((Double_t)wNegTPCNClsF);
347 
348  Double_t dDauXrowsOverFindableClusTPC = dPosXrowsOverFindableClusTPC;
349  if (dDauXrowsOverFindableClusTPC>dNegXrowsOverFindableClusTPC) dDauXrowsOverFindableClusTPC = dNegXrowsOverFindableClusTPC;
350  if (dDauXrowsOverFindableClusTPC<fCutMinDauXrowsOverFindableClusTPC) return 0x0;
351 //=============================================================================
352 
353  Short_t nPosCharge = pDauPosRD->Charge();
354  Short_t nNegCharge = pDauNegRD->Charge();
355  if ((nPosCharge==0) || (nNegCharge==0) || (nPosCharge==nNegCharge)) return 0x0;
356 
357  Double_t dPosPxPyPz[3] = { 0., 0., 0. };
358  Double_t dNegPxPyPz[3] = { 0., 0., 0. };
359  if ((nPosCharge<0) && (nNegCharge>0)) {
360  pDauPosRD = (AliAODTrack*)pV0RD->GetDaughter(1);
361  pDauNegRD = (AliAODTrack*)pV0RD->GetDaughter(0);
362 
363  dPosPxPyPz[0] = pV0RD->MomNegX(); dPosPxPyPz[1] = pV0RD->MomNegY(); dPosPxPyPz[2] = pV0RD->MomNegZ();
364  dNegPxPyPz[0] = pV0RD->MomPosX(); dNegPxPyPz[1] = pV0RD->MomPosY(); dNegPxPyPz[2] = pV0RD->MomPosZ();
365  } else {
366  dPosPxPyPz[0] = pV0RD->MomPosX(); dPosPxPyPz[1] = pV0RD->MomPosY(); dPosPxPyPz[2] = pV0RD->MomPosZ();
367  dNegPxPyPz[0] = pV0RD->MomNegX(); dNegPxPyPz[1] = pV0RD->MomNegY(); dNegPxPyPz[2] = pV0RD->MomNegZ();
368  }
369 
370  TVector3 v3Pos(dPosPxPyPz);
371  TVector3 v3Neg(dNegPxPyPz);
372 
373  if ((v3Pos.Pt()<fCutMinDauPt) || (v3Neg.Pt()<fCutMinDauPt)) return 0x0;
374  Double_t dPosEta = v3Pos.Eta(); if ((dPosEta<fCutMinDauEta) || (dPosEta>fCutMaxDauEta)) return 0x0;
375  Double_t dNegEta = v3Neg.Eta(); if ((dNegEta<fCutMinDauEta) || (dNegEta>fCutMaxDauEta)) return 0x0;
376 //=============================================================================
377 
378  Int_t inp = TMath::Abs(pDauPosRD->GetLabel()); if (inp<0) return 0x0;
379  Int_t inn = TMath::Abs(pDauNegRD->GetLabel()); if (inn<0) return 0x0;
380  AliAODMCParticle *pDauPosMC = (AliAODMCParticle*)MCEvent()->GetTrack(inp); if (!pDauPosMC) return 0x0;
381  AliAODMCParticle *pDauNegMC = (AliAODMCParticle*)MCEvent()->GetTrack(inn); if (!pDauNegMC) return 0x0;
382 
383  Int_t imp = pDauPosMC->GetMother(); if (imp<0) return 0x0;
384  Int_t imn = pDauNegMC->GetMother(); if (imn<0) return 0x0;
385  if (imp != imn) return 0x0;
386 
387  AliAODMCParticle *pV0MC = (AliAODMCParticle*)MCEvent()->GetTrack(imp); if (!pV0MC) return 0x0;
388  if (((pV0MC->Y())<fCutMinV0Rap) || ((pV0MC->Y())>fCutMaxV0Rap)) return 0x0;
389 
390  Int_t idvMC = pV0MC->GetPdgCode();
391  Int_t idp = pDauPosMC->GetPdgCode();
392  Int_t idn = pDauNegMC->GetPdgCode();
393  Bool_t bIsKshort = ((idp==211) && (idn==-211) && (idvMC== 310));
394  Bool_t bIsLambda = ((idp==2212) && (idn==-211) && (idvMC== 3122));
395  Bool_t bIsAntiLa = ((idp==211) && (idn==-2212) && (idvMC==-3122));
396  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
397 //=============================================================================
398 
399  UInt_t wsvMC = 0;
400  if (pV0MC->IsPrimary()) wsvMC |= AliPicoHeaderCJ::kPrimary;
401  if (pV0MC->IsPhysicalPrimary()) wsvMC |= AliPicoHeaderCJ::kPhysicalPrimary;
402  if (pV0MC->IsSecondaryFromWeakDecay()) wsvMC |= AliPicoHeaderCJ::kSecondaryFromWeakDecay;
403  if (pV0MC->IsSecondaryFromMaterial()) wsvMC |= AliPicoHeaderCJ::kSecondaryFromMaterial;
404 
405  Int_t idmMC = 0;
406  UInt_t wsmMC = 0;
407  Double_t dMotherPt = 0.;
408  Double_t dMotherEta = 0.;
409  Double_t dMotherRap = 0.;
410  if (bIsLambda || bIsAntiLa) {
411  Int_t imv = pV0MC->GetMother(); if (imv>=0) {
412  AliAODMCParticle *pMother = (AliAODMCParticle*)MCEvent()->GetTrack(imv);
413 
414  if (pMother) {
415  idmMC = pMother->GetPdgCode();
416  if ((bIsLambda && ((idmMC== 3312) || (idmMC== 3322))) ||
417  (bIsAntiLa && ((idmMC==-3312) || (idmMC==-3322)))) {
418  dMotherPt = pMother->Pt();
419  dMotherEta = pMother->Eta();
420  dMotherRap = pMother->Y();
421 
422  if (pMother->IsPrimary()) wsmMC |= AliPicoHeaderCJ::kPrimary;
423  if (pMother->IsPhysicalPrimary()) wsmMC |= AliPicoHeaderCJ::kPhysicalPrimary;
424  if (pMother->IsSecondaryFromWeakDecay()) wsmMC |= AliPicoHeaderCJ::kSecondaryFromWeakDecay;
425  if (pMother->IsSecondaryFromMaterial()) wsmMC |= AliPicoHeaderCJ::kSecondaryFromMaterial;
426  }
427  }
428  }
429  }
430 //=============================================================================
431 
432  Double_t dV0CosPA = pV0RD->CosPointingAngle(fPrimaryVtx);
433 
434  if (bIsKshort) if (dV0CosPA<fCutMinKshortCosPA) {
435  bIsKshort = kFALSE;
436  }
437 
438  if (bIsLambda || bIsAntiLa) if (dV0CosPA<fCutMinLambdaCosPA) {
439  bIsLambda = kFALSE;
440  bIsAntiLa = kFALSE;
441  }
442 
443  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
444 //=============================================================================
445 
446  Double_t dV0DistToPV = 0.;
447  for (Int_t i=0; i<3; i++) dV0DistToPV += ((dV0Vtx[i]-fPrimaryVtx[i]) * (dV0Vtx[i]-fPrimaryVtx[i]));
448  Double_t dV0DistToPVoverP = TMath::Sqrt(dV0DistToPV) / (pV0RD->P()+1e-10);
449 
450  if (bIsKshort) if ((dV0DistToPVoverP*fgkMassKshort)>fCutMaxKshortCtau) {
451  bIsKshort = kFALSE;
452  }
453 
454  if (bIsLambda || bIsAntiLa) if ((dV0DistToPVoverP*fgkMassLambda)>fCutMaxLambdaCtau) {
455  bIsLambda = kFALSE;
456  bIsAntiLa = kFALSE;
457  }
458 
459  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
460 //=============================================================================
461 
462  Double_t dV0ArmFrac = pV0RD->PtArmV0() / (TMath::Abs(pV0RD->AlphaV0())+1e-12);
463 
464  if (bIsKshort && (fCutMaxKshortArmFrac>0.)) if (dV0ArmFrac>fCutMaxKshortArmFrac) {
465  bIsKshort = kFALSE;
466  }
467 
468  if ((bIsLambda || bIsAntiLa) && fCutMaxLambdaArmFrac>0.) if (dV0ArmFrac>fCutMaxLambdaArmFrac) {
469  bIsLambda = kFALSE;
470  bIsAntiLa = kFALSE;
471  }
472 
473  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
474 //=============================================================================
475 
476  Int_t wMask = 0;
477  if (bIsKshort) {
478  TLorentzVector vPosPion; vPosPion.SetVectM(v3Pos, fgkMassPion);
479  TLorentzVector vNegPion; vNegPion.SetVectM(v3Neg, fgkMassPion);
480  TLorentzVector vKshort = vPosPion + vNegPion;
481 
482  Double_t dKshortInvM = vKshort.M();
483  Double_t dLower = 0.430006 - 0.0110029*dV0Pt;
484  Double_t dUpper = 0.563707 + 0.0114979*dV0Pt;
485  if ((dKshortInvM<dLower) || (dKshortInvM>dUpper)) return 0x0;
486 
487  if (fCutMinKshortDeltaM>0.) {
488  TLorentzVector vPosProton; vPosProton.SetVectM(v3Pos, fgkMassProton);
489  TLorentzVector vNegProton; vNegProton.SetVectM(v3Neg, fgkMassProton);
490 
491  TLorentzVector vLamvda = vPosProton + vNegPion;
492  TLorentzVector vAntiLa = vNegProton + vPosPion;
493 
494  Double_t dLambdaInvM = vLamvda.M();
495  Double_t dAntiLaInvM = vAntiLa.M();
496  if ((TMath::Abs(dLambdaInvM-fgkMassLambda)<fCutMinKshortDeltaM) ||
497  (TMath::Abs(dAntiLaInvM-fgkMassLambda)<fCutMinKshortDeltaM)) return 0x0;
498  }
499 
500  wMask = AliPicoHeaderCJ::kKshort;
501  }
502 
503  if (bIsLambda) {
504  TLorentzVector vPosProton; vPosProton.SetVectM(v3Pos, fgkMassProton);
505  TLorentzVector vNegPion; vNegPion.SetVectM(v3Neg, fgkMassPion);
506  TLorentzVector vLamvda = vPosProton + vNegPion;
507 
508  Double_t dLambdaInvM = vLamvda.M();
509  Double_t dLower = 1.09501 - 0.00523272*dV0Pt - 0.075269*TMath::Exp(-3.46339*dV0Pt);
510  Double_t dUpper = 1.13688 + 0.00527838*dV0Pt + 0.084222*TMath::Exp(-3.80595*dV0Pt);
511  if ((dLambdaInvM<dLower) || (dLambdaInvM>dUpper)) return 0x0;
512 
513  if (fCutMinLambdaDeletaM>0.) {
514  TLorentzVector vPosPion; vPosPion.SetVectM(v3Pos, fgkMassPion);
515  TLorentzVector vKshort = vPosPion + vNegPion;
516 
517  Double_t dKshortInvM = vKshort.M();
518  if ((TMath::Abs(dKshortInvM-fgkMassKshort)<fCutMinLambdaDeletaM)) return 0x0;
519  }
520 
521  wMask = AliPicoHeaderCJ::kLambda;
522  }
523 
524  if (bIsAntiLa) {
525  TLorentzVector vNegProton; vNegProton.SetVectM(v3Neg, fgkMassProton);
526  TLorentzVector vPosPion; vPosPion.SetVectM(v3Pos, fgkMassPion);
527  TLorentzVector vAntiLa = vNegProton + vPosPion;
528 
529  Double_t dAntiLaInvM = vAntiLa.M();
530  Double_t dLower = 1.09501 - 0.00523272*dV0Pt - 0.075269*TMath::Exp(-3.46339*dV0Pt);
531  Double_t dUpper = 1.13688 + 0.00527838*dV0Pt + 0.084222*TMath::Exp(-3.80595*dV0Pt);
532  if ((dAntiLaInvM<dLower) || (dAntiLaInvM>dUpper)) return 0x0;
533 
534  if (fCutMinLambdaDeletaM>0.) {
535  TLorentzVector vNegPion; vNegPion.SetVectM(v3Neg, fgkMassPion);
536  TLorentzVector vKshort = vPosPion + vNegPion;
537 
538  Double_t dKshortInvM = vKshort.M();
539  if ((TMath::Abs(dKshortInvM-fgkMassKshort)<fCutMinLambdaDeletaM)) return 0x0;
540  }
541 
543  }
544 //=============================================================================
545 
546  Bool_t bPosInJC = kFALSE;
547  Bool_t bNegInJC = kFALSE;
548  AliPicoV0MC *pPicoV0 = new AliPicoV0MC(wMask,
549  dV0Radius,
550  dV0CosPA,
551  dV0DistToPVoverP,
552  dDausDCA,
553  dPosDCAtoPV,
554  dNegDCAtoPV,
555  dDauXrowsTPC,
556  dDauXrowsOverFindableClusTPC,
557  v3Pos.Px(), v3Pos.Py(), v3Pos.Pz(),
558  v3Neg.Px(), v3Neg.Py(), v3Neg.Pz(),
559  bPosInJC, bNegInJC,
560  idvMC, wsvMC, pV0MC->Px(), pV0MC->Py(), pV0MC->Pz(), pV0MC->E(),
561  idmMC, wsmMC, dMotherPt, dMotherEta, dMotherRap);
562 
563 
564  return pPicoV0;
565 }
566 
567 //_____________________________________________________________________________
569 {
570 //
571 // AliAnalysisTaskSEPicoV0MakerMC::SelectV0Candidate
572 //
573 
574  AliStack *pStack = MCEvent()->Stack(); if (!pStack) return 0x0;
575  Int_t nPrimary = pStack->GetNprimary();
576 //=============================================================================
577 
578  if (pV0RD->GetOnFlyStatus()) return 0x0;
579  if (pV0RD->GetChi2V0()>fCutMaxV0Chi2) return 0x0;
580 
581  Double_t dV0Pt = pV0RD->Pt(); if ((dV0Pt<fCutMinV0Pt) || (dV0Pt>fCutMaxV0Pt)) return 0x0;
582 //=============================================================================
583 
584  Double_t dV0Vtx[3]; pV0RD->GetXYZ(dV0Vtx[0], dV0Vtx[1], dV0Vtx[2]);
585  Double_t dV0Radius = TMath::Sqrt(dV0Vtx[0]*dV0Vtx[0] + dV0Vtx[1]*dV0Vtx[1]);
586  if ((dV0Radius<fCutMinV0Radius) || (dV0Radius>fCutMaxV0Radius)) return 0x0;
587 
588  Double_t dDausDCA = pV0RD->GetDcaV0Daughters(); if (dDausDCA>fCutMaxDausDCA) return 0x0;
589 //=============================================================================
590 
591  Int_t nPosIndex = TMath::Abs(pV0RD->GetPindex()); if (nPosIndex<0) return 0x0;
592  Int_t nNegIndex = TMath::Abs(pV0RD->GetNindex()); if (nNegIndex<0) return 0x0;
593 
594  AliESDtrack *pDauPosRD = fEventESD->GetTrack(nPosIndex); if (!pDauPosRD) return 0x0;
595  AliESDtrack *pDauNegRD = fEventESD->GetTrack(nNegIndex); if (!pDauNegRD) return 0x0;
596 
597  Double_t dMegField = fEventESD->GetMagneticField();
598  Double_t dPosDCAtoPV = TMath::Abs(pDauPosRD->GetD(fPrimaryVtx[0],fPrimaryVtx[1],dMegField)); if (dPosDCAtoPV<fCutMinDauDCAtoPV) return 0x0;
599  Double_t dNegDCAtoPV = TMath::Abs(pDauNegRD->GetD(fPrimaryVtx[0],fPrimaryVtx[1],dMegField)); if (dNegDCAtoPV<fCutMinDauDCAtoPV) return 0x0;
600 //=============================================================================
601 
602  if (!(pDauPosRD->GetStatus() & AliESDtrack::kTPCrefit)) return 0x0;
603  if (!(pDauNegRD->GetStatus() & AliESDtrack::kTPCrefit)) return 0x0;
604  if ((pDauPosRD->GetKinkIndex(0)>0) || (pDauNegRD->GetKinkIndex(0)>0)) return 0x0;
605 
606  Float_t dPosXrowsTPC = pDauPosRD->GetTPCClusterInfo(2,1);
607  Float_t dNegXrowsTPC = pDauNegRD->GetTPCClusterInfo(2,1);
608  Float_t dDauXrowsTPC = dPosXrowsTPC; if (dDauXrowsTPC>dNegXrowsTPC) dDauXrowsTPC = dNegXrowsTPC;
609  if (dDauXrowsTPC<fCutMinDauXrowsTPC) return 0x0;
610 
611  UShort_t wPosTPCNClsF = pDauPosRD->GetTPCNclsF(); if (wPosTPCNClsF<=0) return 0x0;
612  UShort_t wNegTPCNClsF = pDauNegRD->GetTPCNclsF(); if (wNegTPCNClsF<=0) return 0x0;
613  Double_t dPosXrowsOverFindableClusTPC = ((Double_t)dPosXrowsTPC) / ((Double_t)wPosTPCNClsF);
614  Double_t dNegXrowsOverFindableClusTPC = ((Double_t)dNegXrowsTPC) / ((Double_t)wNegTPCNClsF);
615 
616  Double_t dDauXrowsOverFindableClusTPC = dPosXrowsOverFindableClusTPC;
617  if (dDauXrowsOverFindableClusTPC>dNegXrowsOverFindableClusTPC) dDauXrowsOverFindableClusTPC = dNegXrowsOverFindableClusTPC;
618  if (dDauXrowsOverFindableClusTPC<fCutMinDauXrowsOverFindableClusTPC) return 0x0;
619 //=============================================================================
620 
621  Short_t nPosCharge = pDauPosRD->Charge();
622  Short_t nNegCharge = pDauNegRD->Charge();
623  if ((nPosCharge==0) || (nNegCharge==0) || (nPosCharge==nNegCharge)) return 0x0;
624 
625  Double_t dPosPxPyPz[3] = { 0., 0., 0. };
626  Double_t dNegPxPyPz[3] = { 0., 0., 0. };
627  if ((nPosCharge<0) && (nNegCharge>0)) {
628  pDauPosRD = fEventESD->GetTrack(nNegIndex);
629  pDauNegRD = fEventESD->GetTrack(nPosIndex);
630 
631  pV0RD->GetNPxPyPz(dPosPxPyPz[0], dPosPxPyPz[1], dPosPxPyPz[2]);
632  pV0RD->GetPPxPyPz(dNegPxPyPz[0], dNegPxPyPz[1], dNegPxPyPz[2]);
633  } else {
634  pV0RD->GetPPxPyPz(dPosPxPyPz[0], dPosPxPyPz[1], dPosPxPyPz[2]);
635  pV0RD->GetNPxPyPz(dNegPxPyPz[0], dNegPxPyPz[1], dNegPxPyPz[2]);
636  }
637 
638  TVector3 v3Pos(dPosPxPyPz);
639  TVector3 v3Neg(dNegPxPyPz);
640 
641  if ((v3Pos.Pt()<fCutMinDauPt) || (v3Neg.Pt()<fCutMinDauPt)) return 0x0;
642  Double_t dPosEta = v3Pos.Eta(); if ((dPosEta<fCutMinDauEta) || (dPosEta>fCutMaxDauEta)) return 0x0;
643  Double_t dNegEta = v3Neg.Eta(); if ((dNegEta<fCutMinDauEta) || (dNegEta>fCutMaxDauEta)) return 0x0;
644 //=============================================================================
645 
646  Int_t inp = TMath::Abs(pDauPosRD->GetLabel()); if (inp<0) return 0x0;
647  Int_t inn = TMath::Abs(pDauNegRD->GetLabel()); if (inn<0) return 0x0;
648  TParticle *pDauPosMC = ((AliMCParticle*)MCEvent()->GetTrack(inp))->Particle(); if (!pDauPosMC) return 0x0;
649  TParticle *pDauNegMC = ((AliMCParticle*)MCEvent()->GetTrack(inn))->Particle(); if (!pDauNegMC) return 0x0;
650 
651  Int_t imp = pDauPosMC->GetFirstMother(); if (imp<0) return 0x0;
652  Int_t imn = pDauNegMC->GetFirstMother(); if (imn<0) return 0x0;
653  if (imp != imn) return 0x0;
654 
655  TParticle *pV0MC = ((AliMCParticle*)MCEvent()->GetTrack(imp))->Particle(); if (!pV0MC) return 0x0;
656  if (((pV0MC->Y())<fCutMinV0Rap) || ((pV0MC->Y())>fCutMaxV0Rap)) return 0x0;
657 
658  Int_t idvMC = pV0MC->GetPdgCode();
659  Int_t idp = pDauPosMC->GetPdgCode();
660  Int_t idn = pDauNegMC->GetPdgCode();
661  Bool_t bIsKshort = ((idp==211) && (idn==-211) && (idvMC== 310));
662  Bool_t bIsLambda = ((idp==2212) && (idn==-211) && (idvMC== 3122));
663  Bool_t bIsAntiLa = ((idp==211) && (idn==-2212) && (idvMC==-3122));
664  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
665 //=============================================================================
666 
667  UInt_t wsvMC = 0;
668  if (imp<nPrimary) wsvMC |= AliPicoHeaderCJ::kPrimary;
669  if (pStack->IsPhysicalPrimary(imp)) wsvMC |= AliPicoHeaderCJ::kPhysicalPrimary;
670  if (pStack->IsSecondaryFromWeakDecay(imp)) wsvMC |= AliPicoHeaderCJ::kSecondaryFromWeakDecay;
671  if (pStack->IsSecondaryFromMaterial(imp)) wsvMC |= AliPicoHeaderCJ::kSecondaryFromMaterial;
672 
673  Int_t idmMC = 0;
674  UInt_t wsmMC = 0;
675  Double_t dMotherPt = 0.;
676  Double_t dMotherEta = 0.;
677  Double_t dMotherRap = 0.;
678  if (bIsLambda || bIsAntiLa) {
679  Int_t imv = pV0MC->GetFirstMother(); if (imv>=0) {
680  TParticle *pMother = ((AliMCParticle*)MCEvent()->GetTrack(imv))->Particle();
681 
682  if (pMother) {
683  idmMC = pMother->GetPdgCode();
684  if ((bIsLambda && ((idmMC== 3312) || (idmMC== 3322))) ||
685  (bIsAntiLa && ((idmMC==-3312) || (idmMC==-3322)))) {
686  dMotherPt = pMother->Pt();
687  dMotherEta = pMother->Eta();
688  dMotherRap = pMother->Y();
689 
690  if (imp<nPrimary) wsmMC |= AliPicoHeaderCJ::kPrimary;
691  if (pStack->IsPhysicalPrimary(imv)) wsmMC |= AliPicoHeaderCJ::kPhysicalPrimary;
692  if (pStack->IsSecondaryFromWeakDecay(imv)) wsmMC |= AliPicoHeaderCJ::kSecondaryFromWeakDecay;
693  if (pStack->IsSecondaryFromMaterial(imv)) wsmMC |= AliPicoHeaderCJ::kSecondaryFromMaterial;
694  }
695  }
696  }
697  }
698 //=============================================================================
699 
700  Double_t dV0CosPA = pV0RD->GetV0CosineOfPointingAngle(fPrimaryVtx[0], fPrimaryVtx[1], fPrimaryVtx[2]);
701 
702  if (bIsKshort) if (dV0CosPA<fCutMinKshortCosPA) {
703  bIsKshort = kFALSE;
704  }
705 
706  if (bIsLambda || bIsAntiLa) if (dV0CosPA<fCutMinLambdaCosPA) {
707  bIsLambda = kFALSE;
708  bIsAntiLa = kFALSE;
709  }
710 
711  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
712 //=============================================================================
713 
714  Double_t dV0DistToPV = 0.;
715  for (Int_t i=0; i<3; i++) dV0DistToPV += ((dV0Vtx[i]-fPrimaryVtx[i]) * (dV0Vtx[i]-fPrimaryVtx[i]));
716  Double_t dV0DistToPVoverP = TMath::Sqrt(dV0DistToPV) / (pV0RD->P()+1e-10);
717 
718  if (bIsKshort) if ((dV0DistToPVoverP*fgkMassKshort)>fCutMaxKshortCtau) {
719  bIsKshort = kFALSE;
720  }
721 
722  if (bIsLambda || bIsAntiLa) if ((dV0DistToPVoverP*fgkMassLambda)>fCutMaxLambdaCtau) {
723  bIsLambda = kFALSE;
724  bIsAntiLa = kFALSE;
725  }
726 
727  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
728 //=============================================================================
729 
730  Double_t dV0ArmFrac = pV0RD->PtArmV0() / (TMath::Abs(pV0RD->AlphaV0())+1e-12);
731 
732  if (bIsKshort && (fCutMaxKshortArmFrac>0.)) if (dV0ArmFrac>fCutMaxKshortArmFrac) {
733  bIsKshort = kFALSE;
734  }
735 
736  if ((bIsLambda && bIsAntiLa) && (fCutMaxLambdaArmFrac>0.)) if (dV0ArmFrac>fCutMaxLambdaArmFrac) {
737  bIsLambda = kFALSE;
738  bIsAntiLa = kFALSE;
739  }
740 
741  if (!(bIsKshort || bIsLambda || bIsAntiLa)) return 0x0;
742 //=============================================================================
743 
744  Int_t wMask = 0;
745 
746  if (bIsKshort) {
747  TLorentzVector vPosPion; vPosPion.SetVectM(v3Pos, fgkMassPion);
748  TLorentzVector vNegPion; vNegPion.SetVectM(v3Neg, fgkMassPion);
749  TLorentzVector vKshort = vPosPion + vNegPion;
750 
751  Double_t dKshortInvM = vKshort.M();
752  Double_t dLower = 0.430006 - 0.0110029*dV0Pt;
753  Double_t dUpper = 0.563707 + 0.0114979*dV0Pt;
754  if ((dKshortInvM<dLower) || (dKshortInvM>dUpper)) return 0x0;
755 
756  if (fCutMinKshortDeltaM>0.) {
757  TLorentzVector vPosProton; vPosProton.SetVectM(v3Pos, fgkMassProton);
758  TLorentzVector vNegProton; vNegProton.SetVectM(v3Neg, fgkMassProton);
759 
760  TLorentzVector vLamvda = vPosProton + vNegPion;
761  TLorentzVector vAntiLa = vNegProton + vPosPion;
762 
763  Double_t dLambdaInvM = vLamvda.M();
764  Double_t dAntiLaInvM = vAntiLa.M();
765  if ((TMath::Abs(dLambdaInvM-fgkMassLambda)<fCutMinKshortDeltaM) ||
766  (TMath::Abs(dAntiLaInvM-fgkMassLambda)<fCutMinKshortDeltaM)) return 0x0;
767  }
768 
769  wMask = AliPicoHeaderCJ::kKshort;
770  }
771 
772  if (bIsLambda) {
773  TLorentzVector vPosProton; vPosProton.SetVectM(v3Pos, fgkMassProton);
774  TLorentzVector vNegPion; vNegPion.SetVectM(v3Neg, fgkMassPion);
775  TLorentzVector vLamvda = vPosProton + vNegPion;
776 
777  Double_t dLambdaInvM = vLamvda.M();
778  Double_t dLower = 1.09501 - 0.00523272*dV0Pt - 0.075269*TMath::Exp(-3.46339*dV0Pt);
779  Double_t dUpper = 1.13688 + 0.00527838*dV0Pt + 0.084222*TMath::Exp(-3.80595*dV0Pt);
780  if ((dLambdaInvM<dLower) || (dLambdaInvM>dUpper)) return 0x0;
781 
782  if (fCutMinLambdaDeletaM>0.) {
783  TLorentzVector vPosPion; vPosPion.SetVectM(v3Pos, fgkMassPion);
784  TLorentzVector vKshort = vPosPion + vNegPion;
785 
786  Double_t dKshortInvM = vKshort.M();
787  if ((TMath::Abs(dKshortInvM-fgkMassKshort)<fCutMinLambdaDeletaM)) return 0x0;
788  }
789 
790  wMask = AliPicoHeaderCJ::kLambda;
791  }
792 
793  if (bIsAntiLa) {
794  TLorentzVector vNegProton; vNegProton.SetVectM(v3Neg, fgkMassProton);
795  TLorentzVector vPosPion; vPosPion.SetVectM(v3Pos, fgkMassPion);
796  TLorentzVector vAntiLa = vNegProton + vPosPion;
797 
798  Double_t dAntiLaInvM = vAntiLa.M();
799  Double_t dLower = 1.09501 - 0.00523272*dV0Pt - 0.075269*TMath::Exp(-3.46339*dV0Pt);
800  Double_t dUpper = 1.13688 + 0.00527838*dV0Pt + 0.084222*TMath::Exp(-3.80595*dV0Pt);
801  if ((dAntiLaInvM<dLower) || (dAntiLaInvM>dUpper)) return 0x0;
802 
803  if (fCutMinLambdaDeletaM>0.) {
804  TLorentzVector vNegPion; vNegPion.SetVectM(v3Neg, fgkMassPion);
805  TLorentzVector vKshort = vPosPion + vNegPion;
806 
807  Double_t dKshortInvM = vKshort.M();
808  if ((TMath::Abs(dKshortInvM-fgkMassKshort)<fCutMinLambdaDeletaM)) return 0x0;
809  }
810 
812  }
813 //=============================================================================
814 
815  Bool_t bPosInJC = kFALSE;
816  Bool_t bNegInJC = kFALSE;
817  AliPicoV0MC *pPicoV0 = new AliPicoV0MC(wMask,
818  dV0Radius,
819  dV0CosPA,
820  dV0DistToPVoverP,
821  dDausDCA,
822  dPosDCAtoPV,
823  dNegDCAtoPV,
824  dDauXrowsTPC,
825  dDauXrowsOverFindableClusTPC,
826  v3Pos.Px(), v3Pos.Py(), v3Pos.Pz(),
827  v3Neg.Px(), v3Neg.Py(), v3Neg.Pz(),
828  bPosInJC, bNegInJC,
829  idvMC, wsvMC, pV0MC->Px(), pV0MC->Py(), pV0MC->Pz(), pV0MC->Energy(),
830  idmMC, wsmMC, dMotherPt, dMotherEta, dMotherRap);
831 
832 
833  return pPicoV0;
834 }
835 
836 //_____________________________________________________________________________
838 {
839 //
840 // AliAnalysisTaskSEPicoV0MakerMC::IsEventNotAcpt
841 //
842 
843  fEventAcptMask = 0;
844  if (!InputEvent()) return (fEventAcptMask==0);
845  if (!fInputHandler) return (fEventAcptMask==0);
846 
848  fCentInfo = InputEvent()->GetCentrality();
849  if (!fCentInfo) return (fEventAcptMask==0);
850  }
851 
852  fEventAOD = dynamic_cast<AliAODEvent*>(InputEvent());
853  fEventESD = dynamic_cast<AliESDEvent*>(InputEvent());
854  if ((!fEventAOD) && (!fEventESD)) return (fEventAcptMask==0);
855 
856  fRespoPID = fInputHandler->GetPIDResponse();
857  if (!fRespoPID) return kTRUE;
858 
859  if (MCEvent()) {
860  if (MCEvent()->GetNumberOfTracks()<=0) return (fEventAcptMask==0);
861  } else {
862  return (fEventAcptMask==0);
863  }
864 
865  AliHeader *pHeader = MCEvent()->Header(); if (!pHeader) return (fEventAcptMask==0);
866 
867  if (fIsDPMjetMC) {
868  AliGenDPMjetEventHeader *pDPMjetH = dynamic_cast<AliGenDPMjetEventHeader*>(pHeader->GenEventHeader());
869 
870  if (pDPMjetH) {
871  Int_t nd0=0, nd1=0, nd2=0; pDPMjetH->GetNDiffractive(nd1, nd2, nd0);
872  if ((nd1+nd2) != (pDPMjetH->ProjectileParticipants() + pDPMjetH->TargetParticipants())) return (fEventAcptMask==0);
873  }
874  }
875 
877 //=============================================================================
878 
881  } else {
882  if (fCentInfo->GetQuality()==0)
884  else
885  return (fEventAcptMask==0);
886  }
887 //=============================================================================
888 
889  UInt_t wMask = fInputHandler->IsEventSelected();
890  if ((wMask & fTriggerMask) != fTriggerMask) return (fEventAcptMask==0);
891  if (fIsSkipFastOnly) if ((wMask & AliVEvent::kFastOnly) == AliVEvent::kFastOnly) return (fEventAcptMask==0);
892 
894 //=============================================================================
895 
896  const AliVVertex *pVertex = InputEvent()->GetPrimaryVertex(); if (!pVertex) return (fEventAcptMask==0);
897  pVertex->GetXYZ(fPrimaryVtx); if (TMath::Abs(fPrimaryVtx[2])>fCutMaxEventVzAbs) return (fEventAcptMask==0);
898 
900  if ( fAnaUtils->IsFirstEventInChunk(InputEvent())) return (fEventAcptMask==0);
901  if (!fAnaUtils->IsVertexSelected2013pA(InputEvent())) return (fEventAcptMask==0);
902 
903 /* if (fEventAOD) {
904  const AliAODVertex *pVtxSPD = fEventAOD->GetPrimaryVertexSPD();
905  const AliAODVertex *pVtxTrk = fEventAOD->GetPrimaryVertex();
906  if ((!pVtxSPD) && (!pVtxTrk)) return (fEventAcptMask==0);
907  }*/
908 
909 /* if (fEventESD) {
910  Bool_t fHasVertex = kFALSE;
911  const AliESDVertex *pVtxESD = fEventESD->GetPrimaryVertexTracks();
912  if (pVtxESD->GetNContributors()<1) {
913  pVtxESD = fEventESD->GetPrimaryVertexSPD();
914  if (pVtxESD->GetNContributors()<1) fHasVertex = kFALSE;
915  else fHasVertex = kTRUE;
916 
917  Double_t cov[6] = { 0., 0., 0., 0., 0., 0. };
918  pVtxESD->GetCovarianceMatrix(cov);
919  Double_t zRes = TMath::Sqrt(cov[5]);
920  if (pVtxESD->IsFromVertexerZ() && (zRes>0.25)) fHasVertex = kFALSE;
921  } else fHasVertex = kTRUE;
922 
923  if (!fHasVertex) return (fEventAcptMask==0);
924  }*/
925 
926  } else {
927  if (fEventAOD) {
928  const AliAODVertex *pVtxSPD = fEventAOD->GetPrimaryVertexSPD(); if (!pVtxSPD) return (fEventAcptMask==0);
929  const AliAODVertex *pVtxTrk = fEventAOD->GetPrimaryVertex(); if (!pVtxTrk) return (fEventAcptMask==0);
930  }
931 
932  if (fEventESD) {
933  const AliESDVertex *pVtxPri = fEventESD->GetPrimaryVertex(); if (!pVtxPri) return (fEventAcptMask==0);
934  const AliESDVertex *pVtxSPD = fEventESD->GetPrimaryVertexSPD(); if (!pVtxSPD) return (fEventAcptMask==0);
935  const AliESDVertex *pVtxTrk = fEventESD->GetPrimaryVertexTracks(); if (!pVtxTrk) return (fEventAcptMask==0);
936  if ((!(pVtxPri->GetStatus())) && (!(pVtxSPD->GetStatus())) && (!(pVtxTrk->GetStatus()))) return (fEventAcptMask==0);
937  }
938  }
939 
941 //=============================================================================
942 
946  if (fAnaUtils->IsPileUpEvent(InputEvent())) return (fEventAcptMask==0);
947  }
948 
950 //=============================================================================
951 
952  if (fIsRefitV0sESD && fEventESD) {
953  Double_t dCuts[7] = { fCutMaxV0Chi2,
959  fCutMaxV0Radius };
960 
961  fEventESD->ResetV0s();
962  AliV0vertexer aV0vtxer;
963  aV0vtxer.SetDefaultCuts(dCuts);
964  aV0vtxer.Tracks2V0vertices(fEventESD);
965  }
966 
967  return (fEventAcptMask==0);
968 }
969 
970 //_____________________________________________________________________________
972 {
973 //
974 // AliAnalysisTaskSEPicoV0MakerMC::IsEventNotINEL
975 //
976 
977  if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccCheck) != AliPicoHeaderCJ::kEventAccCheck) return kTRUE;
978  if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccMult) != AliPicoHeaderCJ::kEventAccMult) return kTRUE;
979 
980  return kFALSE;
981 }
982 
983 //_____________________________________________________________________________
985 {
986 //
987 // AliAnalysisTaskSEPicoV0MakerMC::IsEventNotMBsa
988 //
989 
990  if (IsEventNotINEL()) return kTRUE;
991 
992  if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccTrigger) != AliPicoHeaderCJ::kEventAccTrigger) return kTRUE;
993  if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccVertex) != AliPicoHeaderCJ::kEventAccVertex) return kTRUE;
994  if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccPileup) != AliPicoHeaderCJ::kEventAccPileup) return kTRUE;
995 
996  return kFALSE;
997 }
998 
999 //_____________________________________________________________________________
1001 {
1002 //
1003 // AliAnalysisTaskSEPicoV0MakerMC::FillHistograms
1004 //
1005 
1006  Float_t dV0M = fCentInfo->GetCentralityPercentile("V0M");
1007  Float_t dV0A = fCentInfo->GetCentralityPercentile("V0A");
1008  Float_t dCL1 = fCentInfo->GetCentralityPercentile("CL1");
1009  Float_t dZNA = fCentInfo->GetCentralityPercentile("ZNA");
1010 
1011  if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccCheck) == AliPicoHeaderCJ::kEventAccCheck) {
1012  ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_V0M"))->Fill(dV0M);
1013  ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_V0A"))->Fill(dV0A);
1014  ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_CL1"))->Fill(dCL1);
1015  ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_ZNA"))->Fill(dZNA);
1016  }
1017 
1019  ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_V0M"))->Fill(dV0M);
1020  ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_V0A"))->Fill(dV0A);
1021  ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_CL1"))->Fill(dCL1);
1022  ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_ZNA"))->Fill(dZNA);
1023  }
1024 
1026  ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_V0M"))->Fill(dV0M);
1027  ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_V0A"))->Fill(dV0A);
1028  ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_CL1"))->Fill(dCL1);
1029  ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_ZNA"))->Fill(dZNA);
1030  }
1031 
1033  ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_V0M"))->Fill(dV0M);
1034  ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_V0A"))->Fill(dV0A);
1035  ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_CL1"))->Fill(dCL1);
1036  ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_ZNA"))->Fill(dZNA);
1037  }
1038 
1040  ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_V0M"))->Fill(dV0M);
1041  ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_V0A"))->Fill(dV0A);
1042  ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_CL1"))->Fill(dCL1);
1043  ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_ZNA"))->Fill(dZNA);
1044  }
1045 
1046  return;
1047 }
1048 
1049 //_____________________________________________________________________________
1051 {
1052 //
1053 // AliAnalysisTaskSEPicoV0MakerMC::CreateHistograms
1054 //
1055 
1056  Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
1057  TH1::AddDirectory(kFALSE);
1058 //=============================================================================
1059 
1060  TH1D *h1 = 0;
1061  h1 = new TH1D("hEventAccCheck_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1062  h1 = new TH1D("hEventAccCheck_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1063  h1 = new TH1D("hEventAccCheck_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1064  h1 = new TH1D("hEventAccCheck_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1065 
1066  h1 = new TH1D("hEventAccMult_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1067  h1 = new TH1D("hEventAccMult_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1068  h1 = new TH1D("hEventAccMult_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1069  h1 = new TH1D("hEventAccMult_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1070 
1071  h1 = new TH1D("hEventAccTrigger_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1072  h1 = new TH1D("hEventAccTrigger_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1073  h1 = new TH1D("hEventAccTrigger_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1074  h1 = new TH1D("hEventAccTrigger_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1075 
1076  h1 = new TH1D("hEventAccVertex_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1077  h1 = new TH1D("hEventAccVertex_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1078  h1 = new TH1D("hEventAccVertex_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1079  h1 = new TH1D("hEventAccVertex_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1080 
1081  h1 = new TH1D("hEventAccPileup_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1082  h1 = new TH1D("hEventAccPileup_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1083  h1 = new TH1D("hEventAccPileup_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1084  h1 = new TH1D("hEventAccPileup_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1085 
1086 
1087  TH2D *h2 = 0;
1088  h2 = new TH2D("hKshortPtInvM", "", 1000, 0., 100., 300, fgkMassKshort-0.15, fgkMassKshort+0.15);
1089  h2->Sumw2(); fListUserOutputs->Add(h2); h2=0;
1090 
1091  h2 = new TH2D("hLambdaPtInvM", "", 1000, 0., 100., 200, fgkMassLambda-0.10, fgkMassLambda+0.10);
1092  h2->Sumw2(); fListUserOutputs->Add(h2); h2=0;
1093 
1094  h2 = new TH2D("hAntiLaPtInvM", "", 1000, 0., 100., 200, fgkMassLambda-0.10, fgkMassLambda+0.10);
1095  h2->Sumw2(); fListUserOutputs->Add(h2); h2=0;
1096 
1097  TH1::AddDirectory(bStatusTmpH);
1098  return;
1099 }
1100 
1101 //_____________________________________________________________________________
1103 {
1104 //
1105 // AliAnalysisTaskSEPicoV0MakerMC::InitAnalysis
1106 //
1107 
1108  fAnaUtils = new AliAnalysisUtils();
1109  fAnaUtils->SetMinVtxContr(fCutMinEventVtxContr);
1110  fAnaUtils->SetMaxVtxZ(fCutMaxEventVzAbs);
1111 
1112  return;
1113 }
1114 
1115 //_____________________________________________________________________________
1117 {
1118 //
1119 // AliAnalysisTaskSEPicoV0MakerMC::SetCuts
1120 //
1121 
1122  fCutMinV0Radius = d[0];
1123  fCutMaxV0Radius = d[1];
1124 
1125  fCutMaxDausDCA = d[2];
1126  fCutMinDauDCAtoPV = d[3];
1127  fCutMinDauXrowsTPC = d[4];
1129 
1130  fCutMaxKshortSigmaTPC = d[6];
1131  fCutMinKshortCosPA = d[7];
1132  fCutMaxKshortCtau = d[8];
1133  fCutMinKshortDeltaM = d[9];
1134 
1135  fCutMaxLambdaSigmaTPC = d[10];
1136  fCutMinLambdaCosPA = d[11];
1137  fCutMaxLambdaCtau = d[12];
1138  fCutMinLambdaDeletaM = d[13];
1139 
1140  return;
1141 }
void FillAntiLaPtInvM(TH2D *h)
AliPicoV0MC * SelectV0Candidate(AliAODv0 const *pV0)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void FillLambdaPtInvM(TH2D *h)
void FillKshortPtInvM(TH2D *h)