]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/FlavourJetTasks/AliAnalysisTaskSEPicoV0MakerMC.cxx
Converting PWGCaloTrackCorrBase to native cmake
[u/mrichter/AliRoot.git] / PWGJE / FlavourJetTasks / AliAnalysisTaskSEPicoV0MakerMC.cxx
CommitLineData
b254f323 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
16/////////////////////////////////////////////////////////////
17//
18// AliAnalysisTaskSE for RecoDecay object (K0 short, Lambda,
19// D mesons ...) filtering
20//
21// Author: X-M. Zhang, xmzhang@lbl.gov
22/////////////////////////////////////////////////////////////
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"
57#include "AliAnalysisTaskSEPicoV0MakerMC.h"
58
59ClassImp(AliAnalysisTaskSEPicoV0MakerMC)
60//=============================================================================
61
62const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassPion = 0.13957;
63const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassKshort = 0.497614;
64const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassProton = 0.938272;
65const Double_t AliAnalysisTaskSEPicoV0MakerMC::fgkMassLambda = 1.11568;
66
67//_____________________________________________________________________________
68AliAnalysisTaskSEPicoV0MakerMC::AliAnalysisTaskSEPicoV0MakerMC() :
69AliAnalysisTaskSE(),
70fEventAOD(0),
71fEventESD(0),
72fCentInfo(0),
73fRespoPID(0),
74fAnaUtils(0),
75fEventAcptMask(0),
76fTriggerMask(0),
77fCollisionType(0),
78fCentEst(""),
79fIsRefitV0sESD(kFALSE),
80fIsSkipFastOnly(kFALSE),
81fIsDPMjetMC(kFALSE),
82fCutMinEventVtxContr(0),
83fCutMaxEventVzAbs(0.),
84fCutMinV0Pt(0.),
85fCutMaxV0Pt(0.),
86fCutMinV0Rap(0.),
87fCutMaxV0Rap(0.),
88fCutMinDauPt(0.),
89fCutMinDauEta(0.),
90fCutMaxDauEta(0.),
91fCutMaxV0Chi2(0.),
92fCutMinV0Radius(0.),
93fCutMaxV0Radius(0.),
94fCutMaxDausDCA(0.),
95fCutMinDauDCAtoPV(0.),
96fCutMinDauXrowsTPC(0.),
97fCutMinDauXrowsOverFindableClusTPC(0.),
98fCutMaxKshortSigmaTPC(0.),
99fCutMinKshortCosPA(0.),
100fCutMaxKshortCtau(0.),
101fCutMaxKshortArmFrac(0.),
102fCutMinKshortDeltaM(0.),
103fCutMaxLambdaSigmaTPC(0.),
104fCutMinLambdaCosPA(0.),
105fCutMaxLambdaCtau(0.),
106fCutMaxLambdaArmFrac(0.),
107fCutMinLambdaDeletaM(0.),
108fPicoV0sClArr(0),
109fListUserOutputs(0)
110{
111//
112// Default constructor
113//
114
115 for (Int_t i=3; i--;) fPrimaryVtx[i] = 0.;
116}
117
118//_____________________________________________________________________________
119AliAnalysisTaskSEPicoV0MakerMC::AliAnalysisTaskSEPicoV0MakerMC(const char *name) :
120AliAnalysisTaskSE(name),
121fEventAOD(0),
122fEventESD(0),
123fCentInfo(0),
124fRespoPID(0),
125fAnaUtils(0),
126fEventAcptMask(0),
127fTriggerMask(0),
128fCollisionType(AliPicoHeaderCJ::kPP),
129fCentEst("V0M"),
130fIsRefitV0sESD(kFALSE),
131fIsSkipFastOnly(kFALSE),
132fIsDPMjetMC(kFALSE),
133fCutMinEventVtxContr(2),
134fCutMaxEventVzAbs(10.),
135fCutMinV0Pt(0.),
136fCutMaxV0Pt(100.),
137fCutMinV0Rap(-10.),
138fCutMaxV0Rap(10.),
139fCutMinDauPt(0.),
140fCutMinDauEta(-10.),
141fCutMaxDauEta(10.),
142fCutMaxV0Chi2(33.),
143fCutMinV0Radius(0.5),
144fCutMaxV0Radius(200.),
145fCutMaxDausDCA(1.),
146fCutMinDauDCAtoPV(0.06),
147fCutMinDauXrowsTPC(70.),
148fCutMinDauXrowsOverFindableClusTPC(0.8),
149fCutMaxKshortSigmaTPC(5.),
150fCutMinKshortCosPA(0.97),
151fCutMaxKshortCtau(20.),
152fCutMaxKshortArmFrac(-1.),
153fCutMinKshortDeltaM(0.005),
154fCutMaxLambdaSigmaTPC(5.),
155fCutMinLambdaCosPA(0.995),
156fCutMaxLambdaCtau(30.),
157fCutMaxLambdaArmFrac(-1.),
158fCutMinLambdaDeletaM(0.01),
159fPicoV0sClArr(0),
160fListUserOutputs(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//_____________________________________________________________________________
172AliAnalysisTaskSEPicoV0MakerMC::~AliAnalysisTaskSEPicoV0MakerMC()
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; }
185 if (fListUserOutputs) { delete fListUserOutputs; fListUserOutputs = 0; }
186}
187
188//_____________________________________________________________________________
189void AliAnalysisTaskSEPicoV0MakerMC::Init()
190{
191//
192// AliAnalysisTaskSEPicoV0MakerMC::Init
193//
194
195 return;
196}
197
198//_____________________________________________________________________________
199void AliAnalysisTaskSEPicoV0MakerMC::UserCreateOutputObjects()
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
215 CreateHistograms();
216 PostData(1, fListUserOutputs);
217 return;
218}
219
220//_____________________________________________________________________________
221void AliAnalysisTaskSEPicoV0MakerMC::UserExec(Option_t */*opt*/)
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//_____________________________________________________________________________
240void AliAnalysisTaskSEPicoV0MakerMC::Terminate(Option_t */*opt*/)
241{
242//
243// AliAnalysisTaskSEPicoV0MakerMC::Terminate
244//
245
246 return;
247}
248
249//_____________________________________________________________________________
250void AliAnalysisTaskSEPicoV0MakerMC::NotifyRun()
251{
252//
253// AliAnalysisTaskSEPicoV0MakerMC::NotifyRun
254//
255
256 return;
257}
258
259//_____________________________________________________________________________
260void AliAnalysisTaskSEPicoV0MakerMC::FillPicoV0s()
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//_____________________________________________________________________________
308AliPicoV0MC* AliAnalysisTaskSEPicoV0MakerMC::SelectV0Candidate(AliAODv0 const *pV0RD)
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
542 wMask = AliPicoHeaderCJ::kAntiLambda;
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//_____________________________________________________________________________
568AliPicoV0MC* AliAnalysisTaskSEPicoV0MakerMC::SelectV0Candidate(AliESDv0 const *pV0RD)
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
811 wMask = AliPicoHeaderCJ::kAntiLambda;
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//_____________________________________________________________________________
837Bool_t AliAnalysisTaskSEPicoV0MakerMC::IsEventNotAcpt()
838{
839//
840// AliAnalysisTaskSEPicoV0MakerMC::IsEventNotAcpt
841//
842
843 fEventAcptMask = 0;
844 if (!InputEvent()) return (fEventAcptMask==0);
845 if (!fInputHandler) return (fEventAcptMask==0);
846
847 if (fCollisionType!=(AliPicoHeaderCJ::kPP)) {
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
876 fEventAcptMask |= AliPicoHeaderCJ::kEventAccCheck;
877//=============================================================================
878
879 if (fCollisionType==(AliPicoHeaderCJ::kPP)) {
880 fEventAcptMask |= AliPicoHeaderCJ::kEventAccMult;
881 } else {
882 if (fCentInfo->GetQuality()==0)
883 fEventAcptMask |= AliPicoHeaderCJ::kEventAccMult;
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
893 fEventAcptMask |= AliPicoHeaderCJ::kEventAccTrigger;
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
899 if ((fCollisionType==(AliPicoHeaderCJ::kPA)) || (fCollisionType==(AliPicoHeaderCJ::kAP))) {
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 TString vtxTyp = pVtxESD->GetTitle();
918 Double_t cov[6] = { 0., 0., 0., 0., 0., 0. };
919 pVtxESD->GetCovarianceMatrix(cov);
920 Double_t zRes = TMath::Sqrt(cov[5]);
921 if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) fHasVertex = kFALSE;
922 } else fHasVertex = kTRUE;
923
924 if (!fHasVertex) return (fEventAcptMask==0);
925 }*/
926
927 } else {
928 if (fEventAOD) {
929 const AliAODVertex *pVtxSPD = fEventAOD->GetPrimaryVertexSPD(); if (!pVtxSPD) return (fEventAcptMask==0);
930 const AliAODVertex *pVtxTrk = fEventAOD->GetPrimaryVertex(); if (!pVtxTrk) return (fEventAcptMask==0);
931 }
932
933 if (fEventESD) {
934 const AliESDVertex *pVtxPri = fEventESD->GetPrimaryVertex(); if (!pVtxPri) return (fEventAcptMask==0);
935 const AliESDVertex *pVtxSPD = fEventESD->GetPrimaryVertexSPD(); if (!pVtxSPD) return (fEventAcptMask==0);
936 const AliESDVertex *pVtxTrk = fEventESD->GetPrimaryVertexTracks(); if (!pVtxTrk) return (fEventAcptMask==0);
937 if ((!(pVtxPri->GetStatus())) && (!(pVtxSPD->GetStatus())) && (!(pVtxTrk->GetStatus()))) return (fEventAcptMask==0);
938 }
939 }
940
941 fEventAcptMask |= AliPicoHeaderCJ::kEventAccVertex;
942//=============================================================================
943
944 if ((fCollisionType==AliPicoHeaderCJ::kPP) ||
945 (fCollisionType==AliPicoHeaderCJ::kPA) ||
946 (fCollisionType==AliPicoHeaderCJ::kAP)) {
947 if (fAnaUtils->IsPileUpEvent(InputEvent())) return (fEventAcptMask==0);
948 }
949
950 fEventAcptMask |= AliPicoHeaderCJ::kEventAccPileup;
951//=============================================================================
952
953 if (fIsRefitV0sESD && fEventESD) {
954 Double_t dCuts[7] = { fCutMaxV0Chi2,
955 fCutMinDauDCAtoPV,
956 fCutMinDauDCAtoPV,
957 fCutMaxDausDCA,
958 fCutMinKshortCosPA,
959 fCutMinV0Radius,
960 fCutMaxV0Radius };
961
962 fEventESD->ResetV0s();
963 AliV0vertexer aV0vtxer;
964 aV0vtxer.SetDefaultCuts(dCuts);
965 aV0vtxer.Tracks2V0vertices(fEventESD);
966 }
967
968 return (fEventAcptMask==0);
969}
970
971//_____________________________________________________________________________
972Bool_t AliAnalysisTaskSEPicoV0MakerMC::IsEventNotINEL()
973{
974//
975// AliAnalysisTaskSEPicoV0MakerMC::IsEventNotINEL
976//
977
978 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccCheck) != AliPicoHeaderCJ::kEventAccCheck) return kTRUE;
979 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccMult) != AliPicoHeaderCJ::kEventAccMult) return kTRUE;
980
981 return kFALSE;
982}
983
984//_____________________________________________________________________________
985Bool_t AliAnalysisTaskSEPicoV0MakerMC::IsEventNotMBsa()
986{
987//
988// AliAnalysisTaskSEPicoV0MakerMC::IsEventNotMBsa
989//
990
991 if (IsEventNotINEL()) return kTRUE;
992
993 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccTrigger) != AliPicoHeaderCJ::kEventAccTrigger) return kTRUE;
994 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccVertex) != AliPicoHeaderCJ::kEventAccVertex) return kTRUE;
995 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccPileup) != AliPicoHeaderCJ::kEventAccPileup) return kTRUE;
996
997 return kFALSE;
998}
999
1000//_____________________________________________________________________________
1001void AliAnalysisTaskSEPicoV0MakerMC::FillHistograms()
1002{
1003//
1004// AliAnalysisTaskSEPicoV0MakerMC::FillHistograms
1005//
1006
1007 Float_t dV0M = fCentInfo->GetCentralityPercentile("V0M");
1008 Float_t dV0A = fCentInfo->GetCentralityPercentile("V0A");
1009 Float_t dCL1 = fCentInfo->GetCentralityPercentile("CL1");
1010 Float_t dZNA = fCentInfo->GetCentralityPercentile("ZNA");
1011
1012 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccCheck) == AliPicoHeaderCJ::kEventAccCheck) {
1013 ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_V0M"))->Fill(dV0M);
1014 ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_V0A"))->Fill(dV0A);
1015 ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_CL1"))->Fill(dCL1);
1016 ((TH1D*)fListUserOutputs->FindObject("hEventAccCheck_ZNA"))->Fill(dZNA);
1017 }
1018
1019 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccMult) == AliPicoHeaderCJ::kEventAccMult) {
1020 ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_V0M"))->Fill(dV0M);
1021 ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_V0A"))->Fill(dV0A);
1022 ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_CL1"))->Fill(dCL1);
1023 ((TH1D*)fListUserOutputs->FindObject("hEventAccMult_ZNA"))->Fill(dZNA);
1024 }
1025
1026 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccTrigger) == AliPicoHeaderCJ::kEventAccTrigger) {
1027 ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_V0M"))->Fill(dV0M);
1028 ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_V0A"))->Fill(dV0A);
1029 ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_CL1"))->Fill(dCL1);
1030 ((TH1D*)fListUserOutputs->FindObject("hEventAccTrigger_ZNA"))->Fill(dZNA);
1031 }
1032
1033 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccVertex) == AliPicoHeaderCJ::kEventAccVertex) {
1034 ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_V0M"))->Fill(dV0M);
1035 ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_V0A"))->Fill(dV0A);
1036 ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_CL1"))->Fill(dCL1);
1037 ((TH1D*)fListUserOutputs->FindObject("hEventAccVertex_ZNA"))->Fill(dZNA);
1038 }
1039
1040 if ((fEventAcptMask & AliPicoHeaderCJ::kEventAccPileup) == AliPicoHeaderCJ::kEventAccPileup) {
1041 ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_V0M"))->Fill(dV0M);
1042 ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_V0A"))->Fill(dV0A);
1043 ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_CL1"))->Fill(dCL1);
1044 ((TH1D*)fListUserOutputs->FindObject("hEventAccPileup_ZNA"))->Fill(dZNA);
1045 }
1046
1047 return;
1048}
1049
1050//_____________________________________________________________________________
1051void AliAnalysisTaskSEPicoV0MakerMC::CreateHistograms()
1052{
1053//
1054// AliAnalysisTaskSEPicoV0MakerMC::CreateHistograms
1055//
1056
1057 Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
1058 TH1::AddDirectory(kFALSE);
1059//=============================================================================
1060
1061 TH1D *h1 = 0;
1062 h1 = new TH1D("hEventAccCheck_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1063 h1 = new TH1D("hEventAccCheck_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1064 h1 = new TH1D("hEventAccCheck_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1065 h1 = new TH1D("hEventAccCheck_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1066
1067 h1 = new TH1D("hEventAccMult_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1068 h1 = new TH1D("hEventAccMult_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1069 h1 = new TH1D("hEventAccMult_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1070 h1 = new TH1D("hEventAccMult_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1071
1072 h1 = new TH1D("hEventAccTrigger_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1073 h1 = new TH1D("hEventAccTrigger_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1074 h1 = new TH1D("hEventAccTrigger_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1075 h1 = new TH1D("hEventAccTrigger_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1076
1077 h1 = new TH1D("hEventAccVertex_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1078 h1 = new TH1D("hEventAccVertex_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1079 h1 = new TH1D("hEventAccVertex_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1080 h1 = new TH1D("hEventAccVertex_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1081
1082 h1 = new TH1D("hEventAccPileup_V0M", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1083 h1 = new TH1D("hEventAccPileup_V0A", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1084 h1 = new TH1D("hEventAccPileup_CL1", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1085 h1 = new TH1D("hEventAccPileup_ZNA", "", 210, -10., 200.); h1->Sumw2(); fListUserOutputs->Add(h1);
1086
1087
1088 TH2D *h2 = 0;
1089 h2 = new TH2D("hKshortPtInvM", "", 1000, 0., 100., 300, fgkMassKshort-0.15, fgkMassKshort+0.15);
1090 h2->Sumw2(); fListUserOutputs->Add(h2); h2=0;
1091
1092 h2 = new TH2D("hLambdaPtInvM", "", 1000, 0., 100., 200, fgkMassLambda-0.10, fgkMassLambda+0.10);
1093 h2->Sumw2(); fListUserOutputs->Add(h2); h2=0;
1094
1095 h2 = new TH2D("hAntiLaPtInvM", "", 1000, 0., 100., 200, fgkMassLambda-0.10, fgkMassLambda+0.10);
1096 h2->Sumw2(); fListUserOutputs->Add(h2); h2=0;
1097
1098 TH1::AddDirectory(bStatusTmpH);
1099 return;
1100}
1101
1102//_____________________________________________________________________________
1103void AliAnalysisTaskSEPicoV0MakerMC::InitAnalysis()
1104{
1105//
1106// AliAnalysisTaskSEPicoV0MakerMC::InitAnalysis
1107//
1108
1109 fAnaUtils = new AliAnalysisUtils();
1110 fAnaUtils->SetMinVtxContr(fCutMinEventVtxContr);
1111 fAnaUtils->SetMaxVtxZ(fCutMaxEventVzAbs);
1112
1113 return;
1114}
1115
1116//_____________________________________________________________________________
1117void AliAnalysisTaskSEPicoV0MakerMC::SetV0Cuts(Double_t d[14])
1118{
1119//
1120// AliAnalysisTaskSEPicoV0MakerMC::SetCuts
1121//
1122
1123 fCutMinV0Radius = d[0];
1124 fCutMaxV0Radius = d[1];
1125
1126 fCutMaxDausDCA = d[2];
1127 fCutMinDauDCAtoPV = d[3];
1128 fCutMinDauXrowsTPC = d[4];
1129 fCutMinDauXrowsOverFindableClusTPC = d[5];
1130
1131 fCutMaxKshortSigmaTPC = d[6];
1132 fCutMinKshortCosPA = d[7];
1133 fCutMaxKshortCtau = d[8];
1134 fCutMinKshortDeltaM = d[9];
1135
1136 fCutMaxLambdaSigmaTPC = d[10];
1137 fCutMinLambdaCosPA = d[11];
1138 fCutMaxLambdaCtau = d[12];
1139 fCutMinLambdaDeletaM = d[13];
1140
1141 return;
1142}