1 /**************************************************************************
2 * Copyright(c) 1998-2011, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------
19 // Class for HF corrections as a function of many variables and steps
20 // For Lc->V0+bachelor
22 // - Based on AliCFVertexingHFCascade -
24 // Contact : A.De Caro - decaro@sa.infn.it
25 // Centro 'E.Fermi' - Rome (Italy)
26 // INFN and University of Salerno (Italy)
28 //-----------------------------------------------------------------------
30 #include "AliAODRecoDecayHF2Prong.h"
31 #include "AliAODMCParticle.h"
32 #include "AliAODEvent.h"
33 #include "TClonesArray.h"
34 #include "AliCFVertexingHF.h"
35 #include "AliESDtrack.h"
36 #include "TDatabasePDG.h"
37 #include "AliAODRecoCascadeHF.h"
39 #include "AliCFVertexingHFLctoV0bachelor.h"
40 #include "AliCFContainer.h"
41 #include "AliCFTaskVertexingHF.h"
43 #include <Riostream.h>
48 ClassImp(AliCFVertexingHFLctoV0bachelor)
50 //_________________________________________
51 AliCFVertexingHFLctoV0bachelor::AliCFVertexingHFLctoV0bachelor():
54 // standard constructor
57 //_____________________________________
58 AliCFVertexingHFLctoV0bachelor::AliCFVertexingHFLctoV0bachelor(TClonesArray *mcArray, UShort_t originDselection, Int_t lcDecay):
59 AliCFVertexingHF(mcArray, originDselection),
62 // standard constructor
65 fPtAccCut=new Float_t[fProngs];
66 fEtaAccCut=new Float_t[fProngs];
67 for(Int_t iP=0; iP<fProngs; iP++){
75 //_____________________________________
76 AliCFVertexingHFLctoV0bachelor& AliCFVertexingHFLctoV0bachelor::operator=(const AliCFVertexingHFLctoV0bachelor& c)
81 AliCFVertexingHF::operator=(c);
88 //__________________________________________
89 Bool_t AliCFVertexingHFLctoV0bachelor::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand)
91 // set the AliAODRecoDecay candidate
93 Bool_t bSignAssoc = kFALSE;
95 fRecoCandidate = recoCand;
96 if (!fRecoCandidate) {
97 AliError("fRecoCandidate not found, problem in assignement\n");
101 if (fRecoCandidate->GetPrimaryVtx()) AliDebug(3,"fReco Candidate has a pointer to PrimVtx\n");
103 AliAODRecoCascadeHF* lcV0bachelor = (AliAODRecoCascadeHF*)fRecoCandidate;
105 if ( !(lcV0bachelor->Getv0()) ) return bSignAssoc;
107 Int_t nentries = fmcArray->GetEntriesFast();
108 AliDebug(3,Form("nentries = %d\n", nentries));
110 Int_t pdgCand = 4122;
112 Int_t mcLabelK0S = -1;
113 Int_t mcLabelLambda = -1;
116 Int_t pdgDgLctoV0bachelor[2]={310,2212};
117 Int_t pdgDgV0toDaughters[2]={211,211};
118 mcLabelK0S = lcV0bachelor->MatchToMC(pdgCand,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,fmcArray,kTRUE);
119 // Lc->Lambda+pi and cc
120 pdgDgLctoV0bachelor[0]=3122, pdgDgLctoV0bachelor[1]=211;
121 pdgDgV0toDaughters[0]=2212, pdgDgV0toDaughters[1]=211;
122 mcLabelLambda = lcV0bachelor->MatchToMC(pdgCand,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,fmcArray,kTRUE);
124 if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
125 AliInfo("Strange: current Lc->V0+bachelor candidate has two MC different labels!");
127 if (fGenLcOption==kCountAllLctoV0) {
128 if (mcLabelK0S!=-1) mcLabel=mcLabelK0S;
129 if (mcLabelLambda!=-1) mcLabel=mcLabelLambda;
131 else if (fGenLcOption==kCountK0Sp) {
132 if (mcLabelK0S!=-1) mcLabel=mcLabelK0S;
133 if (mcLabelLambda!=-1) {
135 fFake = 0; // fake candidate
136 if (fFakeSelection==1) return bSignAssoc;
139 else if (fGenLcOption==kCountLambdapi) {
140 if (mcLabelLambda!=-1) mcLabel=mcLabelLambda;
141 if (mcLabelK0S!=-1) {
143 fFake = 0; // fake candidate
144 if (fFakeSelection==1) return bSignAssoc;
148 if (mcLabel==-1) return bSignAssoc;
150 if (fRecoCandidate->NumberOfFakeDaughters()>0){
151 fFake = 0; // fake candidate
152 if (fFakeSelection==1) return bSignAssoc;
154 if (fRecoCandidate->NumberOfFakeDaughters()==0){
155 fFake = 2; // non-fake candidate
156 if (fFakeSelection==2) return bSignAssoc;
160 fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel));
162 if (!fmcPartCandidate){
163 AliDebug(3,"No part candidate");
171 //______________________________________________
172 Bool_t AliCFVertexingHFLctoV0bachelor::GetGeneratedValuesFromMCParticle(Double_t* vectorMC)
175 // collecting all the necessary info (pt, y, invMassV0, cosPAwrtPVxV0, onTheFlyStatusV0) from MC particle
176 // (additional infos: pTbachelor, pTV0pos, pTV0neg, phi, dcaV0, cTV0, cT, cosPA)
179 Bool_t bGenValues = kFALSE;
181 if (fmcPartCandidate->GetNDaughters()!=2) return bGenValues;
183 Int_t daughter0lc = fmcPartCandidate->GetDaughter(0);
184 Int_t daughter1lc = fmcPartCandidate->GetDaughter(1);
187 AliAODMCParticle* mcPartDaughterV0=0;
188 if (fGenLcOption==kCountLambdapi) {
189 mcPartDaughterV0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0lc)); // strange baryon (0)
190 if(mcPartDaughterV0){
191 AliInfo(Form(" Case Lc->Lambda+pi: (V0) daughter0_Lc=%d (%d)",daughter0lc,mcPartDaughterV0->GetPdgCode()));
194 else if (fGenLcOption==kCountK0Sp) {
195 AliAODMCParticle* mcPartDaughterK0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1lc)); // strange meson (1)
196 if (!mcPartDaughterK0) return bGenValues;
197 if (TMath::Abs(mcPartDaughterK0->GetPdgCode())!=311) return bGenValues;
198 Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);
199 mcPartDaughterV0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterK0));
200 if (!mcPartDaughterV0) return bGenValues;
201 if (TMath::Abs(mcPartDaughterV0->GetPdgCode())!=310) return bGenValues;
202 AliInfo(Form(" Case Lc->K0S+p: (V0) daughter1_Lc=%d (%d to %d)",daughter1lc,mcPartDaughterK0->GetPdgCode(),
203 mcPartDaughterV0->GetPdgCode()));
207 AliAODMCParticle* mcPartDaughterBachelor=0;
208 if (fGenLcOption==kCountLambdapi) {
209 mcPartDaughterBachelor = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1lc)); // meson (1)
210 if(mcPartDaughterBachelor){
211 AliInfo(Form(" Case Lc->Lambda+pi: (bachelor) daughter1_Lc=%d (%d)",daughter1lc,mcPartDaughterBachelor->GetPdgCode()));
214 if (fGenLcOption==kCountK0Sp) {
215 mcPartDaughterBachelor = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0lc)); // baryon (0)
216 if(mcPartDaughterBachelor){
217 AliInfo(Form(" Case Lc->K0S+p: (bachelor) daughter0_Lc=%d (%d)",daughter0lc,mcPartDaughterBachelor->GetPdgCode()));
221 if (!mcPartDaughterV0 || !mcPartDaughterBachelor) return bGenValues;
223 if (fGenLcOption==kCountLambdapi) {
224 if ( !(mcPartDaughterV0->GetPdgCode()==3122 &&
225 mcPartDaughterBachelor->GetPdgCode()==211) )
226 AliInfo("It isn't a Lc->Lambda+pion candidate");
228 if (fGenLcOption==kCountK0Sp) {
229 if ( !(mcPartDaughterV0->GetPdgCode()==310 &&
230 mcPartDaughterBachelor->GetPdgCode()==2212) )
231 AliInfo("It isn't a Lc->K0S+proton candidate");
234 Double_t vtx1[3] = {0,0,0}; // primary vertex
235 fmcPartCandidate->XvYvZv(vtx1); // cm
237 // getting vertex from daughters
238 Double_t vtx1daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
239 Double_t vtx1daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
240 mcPartDaughterBachelor->XvYvZv(vtx1daughter0); //cm
241 mcPartDaughterV0->XvYvZv(vtx1daughter1); //cm
242 if (TMath::Abs(vtx1daughter0[0]-vtx1daughter1[0])>1E-5 ||
243 TMath::Abs(vtx1daughter0[1]-vtx1daughter1[1])>1E-5 ||
244 TMath::Abs(vtx1daughter0[2]-vtx1daughter1[2])>1E-5) {
245 AliError("Daughters have different secondary vertex, skipping the track");
249 // getting the momentum from the daughters
250 Double_t px1[2] = {mcPartDaughterBachelor->Px(), mcPartDaughterV0->Px()};
251 Double_t py1[2] = {mcPartDaughterBachelor->Py(), mcPartDaughterV0->Py()};
252 Double_t pz1[2] = {mcPartDaughterBachelor->Pz(), mcPartDaughterV0->Pz()};
255 Short_t charge = mcPartDaughterBachelor->Charge();
256 Double_t d0[2] = {0.,0.};
257 AliAODRecoDecayHF* decayLc = new AliAODRecoDecayHF(vtx1,vtx1daughter0,nprongs,charge,px1,py1,pz1,d0);
258 Double_t cosPAwrtPrimVtxLc = decayLc->CosPointingAngle();
261 Int_t daughter0 = mcPartDaughterV0->GetDaughter(0);
262 Int_t daughter1 = mcPartDaughterV0->GetDaughter(1);
263 AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); //V0daughter0
264 AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); //V0daughter1
266 if (!mcPartDaughter0 || !mcPartDaughter1) return kFALSE;
268 // getting vertex from daughters
269 Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
270 Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
271 mcPartDaughter0->XvYvZv(vtx2daughter0); //cm
272 mcPartDaughter1->XvYvZv(vtx2daughter1); //cm
273 if (TMath::Abs(vtx2daughter0[0]-vtx2daughter1[0])>1E-5 ||
274 TMath::Abs(vtx2daughter0[1]-vtx2daughter1[1])>1E-5 ||
275 TMath::Abs(vtx2daughter0[2]-vtx2daughter1[2])>1E-5) {
276 AliError("Daughters have different secondary vertex, skipping the track");
280 // always instantiate the AliAODRecoDecay with the positive daughter first, the negative second
281 AliAODMCParticle* positiveDaugh = mcPartDaughter0;
282 AliAODMCParticle* negativeDaugh = mcPartDaughter1;
283 if (mcPartDaughter0->GetPdgCode()<0 && mcPartDaughter1->GetPdgCode()>0){
284 // inverting in case the positive daughter is the second one
285 positiveDaugh = mcPartDaughter1;
286 negativeDaugh = mcPartDaughter0;
288 // getting the momentum from the daughters
289 Double_t px[2] = {positiveDaugh->Px(), negativeDaugh->Px()};
290 Double_t py[2] = {positiveDaugh->Py(), negativeDaugh->Py()};
291 Double_t pz[2] = {positiveDaugh->Pz(), negativeDaugh->Pz()};
295 AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vtx1,vtx2daughter0,nprongs,charge,px,py,pz,d0);
296 Double_t cosPAwrtPrimVtxV0 = decay->CosPointingAngle();
300 if (fGenLcOption==kCountK0Sp) {
301 cTV0 = decay->Ct(310); // by default wrt Primary Vtx
302 } else if (fGenLcOption==kCountLambdapi) {
303 cTV0 = decay->Ct(3122); // by default wrt Primary Vtx
306 Double_t cTLc = Ctau(fmcPartCandidate); // by default wrt Primary Vtx
308 // get the bachelor pT
309 Double_t pTbach = 0.;
311 if (TMath::Abs(fmcPartCandidate->GetPdgCode()) == 4122)
312 pTbach = mcPartDaughterBachelor->Pt();
314 Double_t invMass = 0.;
315 if (fGenLcOption==kCountK0Sp) {
316 invMass = decay->InvMass2Prongs(0,1,211,211);
317 } else if (fGenLcOption==kCountLambdapi) {
318 if (fmcPartCandidate->GetPdgCode() == 4122)
319 invMass = decay->InvMass2Prongs(0,1,2212,211);
320 else if (fmcPartCandidate->GetPdgCode() ==-4122)
321 invMass = decay->InvMass2Prongs(0,1,211,2212);
324 switch (fConfiguration){
325 case AliCFTaskVertexingHF::kSnail:
326 vectorMC[0] = fmcPartCandidate->Pt();
327 vectorMC[1] = fmcPartCandidate->Y() ;
328 vectorMC[2] = fmcPartCandidate->Phi();
329 vectorMC[3] = cosPAwrtPrimVtxV0;
330 vectorMC[4] = 0; // dummy value x MC, onTheFlyStatus
331 vectorMC[5] = fCentValue; // reconstructed centrality
332 vectorMC[6] = 1; // dummy value x MC, fFake
333 vectorMC[7] = fMultiplicity; // reconstructed multiplicity
335 vectorMC[8] = pTbach;
336 vectorMC[9] = positiveDaugh->Pt();
337 vectorMC[10] = negativeDaugh->Pt();
338 vectorMC[11] = invMass;
339 vectorMC[12] = 0; // dummy value x MC, V0 DCA
340 vectorMC[13] = cTV0*1.E4; // in micron
341 vectorMC[14] = cTLc*1.E4; // in micron
342 vectorMC[15] = cosPAwrtPrimVtxLc;
344 case AliCFTaskVertexingHF::kCheetah:
345 vectorMC[0] = fmcPartCandidate->Pt();
346 vectorMC[1] = fmcPartCandidate->Y() ;
347 vectorMC[2] = fmcPartCandidate->Phi();
348 vectorMC[3] = cosPAwrtPrimVtxV0;
349 vectorMC[4] = 0; // dummy value x MC, onTheFlyStatus
350 vectorMC[5] = fCentValue; // reconstructed centrality
351 vectorMC[6] = 1; // dummy value x MC, fFake
352 vectorMC[7] = fMultiplicity; // reconstructed multiplicity
363 //____________________________________________
364 Bool_t AliCFVertexingHFLctoV0bachelor::GetRecoValuesFromCandidate(Double_t *vectorReco) const
366 // read the variables for the container
368 Bool_t bFillRecoValues = kFALSE;
370 //Get the Lc and the V0 from Lc
371 AliAODRecoCascadeHF* lcV0bachelor = (AliAODRecoCascadeHF*)fRecoCandidate;
373 if ( !(lcV0bachelor->Getv0()) ) return bFillRecoValues;
375 AliAODVertex *vtx0 = (AliAODVertex*)lcV0bachelor->GetPrimaryVtx();
376 if (vtx0) AliDebug(1,"lcV0bachelor has primary vtx");
378 AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->GetBachelor();
379 AliAODv0* v0toDaughters = (AliAODv0*)lcV0bachelor->Getv0();
380 Bool_t onTheFlyStatus = v0toDaughters->GetOnFlyStatus();
381 AliAODTrack* v0positiveTrack = (AliAODTrack*)lcV0bachelor->Getv0PositiveTrack();
382 AliAODTrack* v0negativeTrack = (AliAODTrack*)lcV0bachelor->Getv0NegativeTrack();
384 Double_t pt = lcV0bachelor->Pt();
385 Double_t rapidity = lcV0bachelor->Y(4122);
386 Double_t invMassV0 = 0.;
387 Double_t primVtxPos[3]; vtx0->GetXYZ(primVtxPos);
388 Double_t cosPAwrtPrimVtxV0 = v0toDaughters->CosPointingAngle(primVtxPos);
391 Double_t pTbachelor = bachelor->Pt();
392 Double_t pTV0pos = v0positiveTrack->Pt();
393 Double_t pTV0neg = v0negativeTrack->Pt();
394 Double_t phi = lcV0bachelor->Phi();
395 Double_t dcaV0 = v0toDaughters->GetDCA();
396 Double_t cTLc = lcV0bachelor->Ct(4122); // wrt PrimVtx
397 //Double_t dcaLc = lcV0bachelor->GetDCA();
398 Double_t cosPointingAngleLc = lcV0bachelor->CosPointingAngle();
400 if (fGenLcOption==kCountK0Sp) {
401 cTV0 = v0toDaughters->Ct(310,primVtxPos);
402 } else if (fGenLcOption==kCountLambdapi) {
403 cTV0 = v0toDaughters->Ct(3122,primVtxPos);
406 Short_t bachelorCharge = bachelor->Charge();
407 if (fGenLcOption==kCountLambdapi) {
408 if (bachelorCharge==1) {
409 invMassV0 = v0toDaughters->MassLambda();
410 } else if (bachelorCharge==-1) {
411 invMassV0 = v0toDaughters->MassAntiLambda();
414 } else if (fGenLcOption==kCountK0Sp) {
415 invMassV0 = v0toDaughters->MassK0Short();
418 switch (fConfiguration){
419 case AliCFTaskVertexingHF::kSnail:
421 vectorReco[1] = rapidity;
423 vectorReco[3] = cosPAwrtPrimVtxV0;
424 vectorReco[4] = onTheFlyStatus;
425 vectorReco[5] = fCentValue;
426 vectorReco[6] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2)
427 vectorReco[7] = fMultiplicity;
429 vectorReco[8] = pTbachelor;
430 vectorReco[9] = pTV0pos;
431 vectorReco[10] = pTV0neg;
432 vectorReco[11] = invMassV0;
433 vectorReco[12] = dcaV0;
434 vectorReco[13] = cTV0*1.E4; // in micron
435 vectorReco[14] = cTLc*1.E4; // in micron
436 vectorReco[15] = cosPointingAngleLc;
439 case AliCFTaskVertexingHF::kCheetah:
441 vectorReco[1] = rapidity;
443 vectorReco[3] = cosPAwrtPrimVtxV0;
444 vectorReco[4] = onTheFlyStatus;
445 vectorReco[5] = fCentValue;
446 vectorReco[6] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2)
447 vectorReco[7] = fMultiplicity;
451 bFillRecoValues = kTRUE;
453 return bFillRecoValues;
456 //_____________________________________________________________
457 Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
459 // check the required decay channel
461 Bool_t checkCD = kFALSE;
463 if (fmcPartCandidate->GetNDaughters()!=2) return checkCD;
465 Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
466 Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
467 AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
468 AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
470 if (!mcPartDaughter0 || !mcPartDaughter1) {
471 AliDebug (2,"Problems in the MC Daughters\n");
475 // Lc -> Lambda + pion AND cc
476 if (fGenLcOption==kCountLambdapi) {
478 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
479 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
480 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
481 TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
482 AliDebug(2, "The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
484 } else if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
485 if (mcPartDaughter0->GetNDaughters()!=2) return checkCD;
486 Int_t daughter0D0 = mcPartDaughter0->GetDaughter(0);
487 AliAODMCParticle* mcPartDaughter0D0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0D0));
488 if(!mcPartDaughter0D0){
489 AliError("Daughter particle not found in MC array");
492 Int_t daughter0D1 = mcPartDaughter0->GetDaughter(1);
493 AliAODMCParticle* mcPartDaughter0D1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0D1));
494 if(!mcPartDaughter0D1){
495 AliError("Daughter particle not found in MC array");
498 if (!(TMath::Abs(mcPartDaughter0D0->GetPdgCode())==211 &&
499 TMath::Abs(mcPartDaughter0D1->GetPdgCode())==2212) &&
500 !(TMath::Abs(mcPartDaughter0D0->GetPdgCode())==2212 &&
501 TMath::Abs(mcPartDaughter0D1->GetPdgCode())==211)) {
502 AliDebug(2, "The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
505 } else if (TMath::Abs(mcPartDaughter1->GetPdgCode())==3122) {
506 if (mcPartDaughter1->GetNDaughters()!=2) return checkCD;
507 Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
508 AliAODMCParticle* mcPartDaughter1D0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D0));
509 if(!mcPartDaughter1D0){
510 AliError("Daughter particle not found in MC array");
513 Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
514 AliAODMCParticle* mcPartDaughter1D1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1D1));
515 if(!mcPartDaughter1D1){
516 AliError("Daughter particle not found in MC array");
519 if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
520 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
521 !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
522 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
523 AliDebug(2, "The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
528 } else if (fGenLcOption==kCountK0Sp) {
529 // Lc -> K0bar + proton AND cc
531 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
532 TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
533 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
534 TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
535 AliDebug(2, "The Lc MC doesn't decay in K0+proton (or cc), skipping!!");
539 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
540 Int_t daughter = mcPartDaughter0->GetDaughter(0);
541 AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter));
543 AliError("Daughter particle not found in MC array");
547 if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
548 AliDebug(2, "The K0 (or K0bar) MC doesn't go in K0S, skipping!!");
551 if (mcPartDaughter->GetNDaughters()!=2) return checkCD;
552 Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
553 AliAODMCParticle* mcPartDaughterD0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
554 if(!mcPartDaughterD0){
555 AliError("Daughter particle not found in MC array");
558 Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
559 AliAODMCParticle* mcPartDaughterD1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
560 if(!mcPartDaughterD1){
561 AliError("Daughter particle not found in MC array");
564 if (!(TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
565 TMath::Abs(mcPartDaughterD1->GetPdgCode())==211)) {
566 AliDebug(2, "The K0S MC doesn't decay in pi+pi, skipping!!");
572 if (TMath::Abs(mcPartDaughter1->GetPdgCode())==311) {
573 Int_t daughter = mcPartDaughter1->GetDaughter(0);
574 AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter));
576 AliError("Daughter particle not found in MC array");
579 if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
580 AliDebug(2, "The K0 (or K0bar) MC doesn't go in K0S, skipping!!");
583 if (mcPartDaughter->GetNDaughters()!=2) return checkCD;
584 Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
585 AliAODMCParticle* mcPartDaughterD0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
586 if(!mcPartDaughterD0){
587 AliError("Daughter particle not found in MC array");
590 Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
591 AliAODMCParticle* mcPartDaughterD1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
592 if(!mcPartDaughterD1){
593 AliError("Daughter particle not found in MC array");
596 if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
597 TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
598 AliDebug(2, "The K0S MC doesn't decay in pi+pi, skipping!!");
611 //___________________________________________________________
613 void AliCFVertexingHFLctoV0bachelor::SetPtAccCut(Float_t* ptAccCut)
616 // setting the pt cut to be used in the Acceptance steps (MC+Reco)
619 AliInfo("The 1st element of the pt cut array will correspond to the cut applied to the bachelor - please check that it is correct");
621 for (Int_t iP=0; iP<fProngs; iP++){
622 fPtAccCut[iP]=ptAccCut[iP];
628 //___________________________________________________________
630 void AliCFVertexingHFLctoV0bachelor::SetEtaAccCut(Float_t* etaAccCut)
633 // setting the eta cut to be used in the Acceptance steps (MC+Reco)
636 AliInfo("The 1st element of the pt cut array will correspond to the cut applied to the bachelor - please check that it is correct");
638 for (Int_t iP=0; iP<fProngs; iP++){
639 fEtaAccCut[iP]=etaAccCut[iP];
645 //___________________________________________________________
647 void AliCFVertexingHFLctoV0bachelor::SetAccCut(Float_t* ptAccCut, Float_t* etaAccCut)
650 // setting the pt and eta cut to be used in the Acceptance steps (MC+Reco)
653 AliInfo("The 1st element of the pt cut array will correspond to the cut applied to the bachelor - please check that it is correct");
655 for (Int_t iP=0; iP<fProngs; iP++){
656 fPtAccCut[iP]=ptAccCut[iP];
657 fEtaAccCut[iP]=etaAccCut[iP];
663 //___________________________________________________________
665 void AliCFVertexingHFLctoV0bachelor::SetAccCut()
668 // setting the pt and eta cut to be used in the Acceptance steps (MC+Reco)
671 AliAODMCParticle* mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[0])); // bachelor
672 if (!mcPartDaughter) return;
673 Int_t mother = mcPartDaughter->GetMother();
674 AliAODMCParticle* mcMother = dynamic_cast<AliAODMCParticle*>(fmcArray->At(mother));
675 if (!mcMother) return;
677 if (fGenLcOption==kCountK0Sp) {
678 if ( !(TMath::Abs(mcPartDaughter->GetPdgCode())== 2212) )
679 AliFatal(Form("Apparently the proton bachelor is not in the first position (%d <- %d), causing a crash!!",
680 mcPartDaughter->GetPdgCode(),mcMother->GetPdgCode()));
682 else if (fGenLcOption==kCountLambdapi) {
683 if ( !(TMath::Abs(mcPartDaughter->GetPdgCode())== 211) )
684 AliFatal(Form("Apparently the pion bachelor is not in the first position (%d <- %d), causing a crash!!",
685 mcPartDaughter->GetPdgCode(),mcMother->GetPdgCode()));
689 fPtAccCut[0]=0.3; // bachelor
690 fEtaAccCut[0]=0.9; // bachelor
691 for (Int_t iP=1; iP<fProngs; iP++){
701 //_____________________________________________________________
702 Double_t AliCFVertexingHFLctoV0bachelor::GetEtaProng(Int_t iProng) const
705 // getting eta of the prong - overload the mother class method
708 if (fRecoCandidate) {
710 AliAODRecoCascadeHF* lcV0bachelor = (AliAODRecoCascadeHF*)fRecoCandidate;
712 Double_t etaProng =-9999;
713 if (iProng==0) etaProng = lcV0bachelor->GetBachelor()->Eta();
714 else if (iProng==1) etaProng = lcV0bachelor->Getv0PositiveTrack()->Eta();
715 else if (iProng==2) etaProng = lcV0bachelor->Getv0NegativeTrack()->Eta();
723 //_____________________________________________________________
725 Double_t AliCFVertexingHFLctoV0bachelor::GetPtProng(Int_t iProng) const
728 // getting pt of the prong
731 Double_t ptProng=-9999.;
733 if (!fRecoCandidate) return ptProng;
735 AliAODRecoCascadeHF* lcV0bachelor = (AliAODRecoCascadeHF*)fRecoCandidate;
737 if (iProng==0) ptProng = lcV0bachelor->GetBachelor()->Pt();
738 else if (iProng==1) ptProng = lcV0bachelor->Getv0PositiveTrack()->Pt();
739 else if (iProng==2) ptProng = lcV0bachelor->Getv0NegativeTrack()->Pt();
745 //_____________________________________________________________
747 Double_t AliCFVertexingHFLctoV0bachelor::Ctau(AliAODMCParticle *mcPartCandidate)
750 Double_t cTau = 999999.;
752 Double_t vtx1[3] = {0,0,0}; // primary vertex
753 Bool_t hasProdVertex = mcPartCandidate->XvYvZv(vtx1); // cm
755 AliAODMCParticle *mcPartDaughter0 = (AliAODMCParticle*)fmcArray->At(mcPartCandidate->GetDaughter(0));
756 AliAODMCParticle *mcPartDaughter1 = (AliAODMCParticle*)fmcArray->At(mcPartCandidate->GetDaughter(1));
757 if (!mcPartDaughter0 && !mcPartDaughter1) return cTau;
758 Double_t vtx1daughter[3] = {0,0,0}; // secondary vertex
760 hasProdVertex = hasProdVertex || mcPartDaughter0->XvYvZv(vtx1daughter); //cm
762 hasProdVertex = hasProdVertex || mcPartDaughter1->XvYvZv(vtx1daughter); //cm
764 if (!hasProdVertex) return cTau;
766 Double_t decayLength = 0.;
767 for (Int_t ii=0; ii<3; ii++) decayLength += (vtx1daughter[ii]-vtx1[ii])*(vtx1daughter[ii]-vtx1[ii]);
768 decayLength = TMath::Sqrt(decayLength);
770 cTau = decayLength * mcPartCandidate->M()/mcPartCandidate->P();
771 AliDebug(2,Form(" cTau(4122)=%f",cTau));