30 #include "TDatabasePDG.h" 31 #include "TClonesArray.h" 33 #include "AliAODMCParticle.h" 37 #include "AliCFContainer.h" 41 #include <Riostream.h> 93 Bool_t bSignAssoc = kFALSE;
97 AliError(
"fRecoCandidate not found, problem in assignement\n");
105 AliDebug(2,
"cascade doesn't exist, skipped!");
109 if (!lcV0bachelor->GetSecondaryVtx()) {
110 AliDebug(2,
"No secondary vertex for cascade");
114 if (lcV0bachelor->GetNDaughters()!=2) {
115 AliDebug(2,Form(
"No 2 daughters for current cascade (nDaughters=%d)",lcV0bachelor->GetNDaughters()));
119 AliVTrack *cascTrk0 =
dynamic_cast<AliVTrack*
>(lcV0bachelor->GetDaughter(0));
120 AliVTrack *cascTrk1 =
dynamic_cast<AliVTrack*
>(lcV0bachelor->GetDaughter(1));
121 if (!cascTrk0 || !cascTrk1) {
122 AliDebug(2,
"At least one of V0daughters doesn't exist");
126 AliAODv0 * v0part =
dynamic_cast<AliAODv0*
>(lcV0bachelor->
Getv0());
127 AliAODTrack * bachPart =
dynamic_cast<AliAODTrack*
>(lcV0bachelor->
GetBachelor());
128 if (!v0part || !bachPart) {
129 AliDebug(2,
"No V0 or no bachelor for current cascade");
133 if (bachPart->GetID()<0) {
134 AliDebug(2,Form(
"Bachelor has negative ID %d",bachPart->GetID()));
138 if (!v0part->GetSecondaryVtx()) {
139 AliDebug(2,
"No secondary vertex for V0 by cascade");
143 if (v0part->GetNDaughters()!=2) {
144 AliDebug(2,Form(
"No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters()));
148 AliVTrack *trk0 =
dynamic_cast<AliVTrack*
>(v0part->GetDaughter(0));
149 AliVTrack *trk1 =
dynamic_cast<AliVTrack*
>(v0part->GetDaughter(1));
150 if (!trk0 || !trk1) {
151 AliDebug(2,
"At least one of V0daughters doesn't exist");
160 if (trk0->GetID()<0 || trk1->GetID()<0) {
161 AliDebug(2,Form(
"At least one of V0 daughters has negative ID %d %d",trk0->GetID(),trk1->GetID()));
165 Int_t pdgCand = 4122;
167 Int_t mcLabelK0S = -1;
168 Int_t mcLabelLambda = -1;
171 Int_t pdgDgLctoV0bachelor[2]={2212,310};
172 Int_t pdgDgV0toDaughters[2]={211,211};
173 mcLabelK0S = lcV0bachelor->
MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,
fmcArray,kTRUE);
176 pdgDgLctoV0bachelor[0]=211, pdgDgLctoV0bachelor[1]=3122;
177 pdgDgV0toDaughters[0]=2212, pdgDgV0toDaughters[1]=211;
178 mcLabelLambda = lcV0bachelor->
MatchToMC(pdgCand,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,
fmcArray,kTRUE);
180 if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
181 AliDebug(2,
"Strange: current Lc->V0+bachelor candidate has two MC different labels!");
184 if (mcLabelK0S!=-1) mcLabel=mcLabelK0S;
185 if (mcLabelLambda!=-1) {
192 if (mcLabelLambda!=-1) mcLabel=mcLabelLambda;
193 if (mcLabelK0S!=-1) {
201 AliDebug(4,
"No mcLabel found for current candidate");
204 AliDebug(1,Form(
"Found mcLabel (%d) for current candidate (onTheFly=%1d)",mcLabel,v0part->GetOnFlyStatus()));
218 AliDebug(3,
"No MC object for current candidate");
235 Bool_t bGenValues = kFALSE;
238 AliDebug(2,
"Lc MC particle doesn't decay in 2 daughters");
244 if (daughter0lc<=0 || daughter1lc<=0) {
245 AliDebug(2,
"Lc daughters are not in MC array");
249 AliAODMCParticle* mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0lc));
250 AliAODMCParticle* mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1lc));
251 if (!mcPartDaughter0 || !mcPartDaughter1) {
252 AliDebug(2,
"Problems in the MC Daughters\n");
257 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
258 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
259 !(TMath::Abs(mcPartDaughter1->GetPdgCode())==3122 &&
260 TMath::Abs(mcPartDaughter0->GetPdgCode())==211) )
return bGenValues;
262 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
263 TMath::Abs(mcPartDaughter1->GetPdgCode())==311) &&
264 !(TMath::Abs(mcPartDaughter1->GetPdgCode())==2212 &&
265 TMath::Abs(mcPartDaughter0->GetPdgCode())==311) )
return bGenValues;
267 if ( (TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
268 TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) ||
269 (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
270 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) )
272 else if ( (TMath::Abs(mcPartDaughter1->GetPdgCode())==311 &&
273 TMath::Abs(mcPartDaughter0->GetPdgCode())==2212) ||
274 (TMath::Abs(mcPartDaughter1->GetPdgCode())==3122 &&
275 TMath::Abs(mcPartDaughter0->GetPdgCode())==211) )
279 AliDebug(2,
"There is something wrong in filling MC vector");
290 Bool_t bFillRecoValues = kFALSE;
296 AliDebug(2,
"Current cascade doesn't exist, skipped");
297 return bFillRecoValues;
300 if (!lcV0bachelor->GetSecondaryVtx()) {
301 AliDebug(2,
"No secondary vertex for cascade");
302 return bFillRecoValues;
305 if (lcV0bachelor->GetNDaughters()!=2) {
306 AliDebug(2,Form(
"No 2 daughters for current cascade (nDaughters=%d)",lcV0bachelor->GetNDaughters()));
307 return bFillRecoValues;
310 AliAODTrack* bachelor =
dynamic_cast<AliAODTrack*
>(lcV0bachelor->
GetBachelor());
311 AliAODv0* v0toDaughters =
dynamic_cast<AliAODv0*
>(lcV0bachelor->
Getv0());
312 if (!bachelor || !v0toDaughters) {
313 AliDebug(2,
"No V0 or bachelor in this reco candidate, skipping!");
314 return bFillRecoValues;
317 if (!v0toDaughters->GetSecondaryVtx()) {
318 AliDebug(2,
"No secondary vertex for V0 by cascade");
319 return bFillRecoValues;
322 if (v0toDaughters->GetNDaughters()!=2) {
323 AliDebug(2,Form(
"current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0toDaughters->GetOnFlyStatus(),v0toDaughters->GetNDaughters()));
324 return bFillRecoValues;
327 Bool_t onTheFlyStatus = v0toDaughters->GetOnFlyStatus();
328 AliAODTrack* v0positiveTrack;
329 AliAODTrack* v0negativeTrack;
330 if (onTheFlyStatus) {
338 if (!v0positiveTrack || !v0negativeTrack) {
339 AliDebug(2,
"No V0daughters in this reco candidate, skipping!");
340 return bFillRecoValues;
353 Double_t dcaV0 = v0toDaughters->GetDCA();
376 Short_t bachelorCharge = bachelor->Charge();
377 if (bachelorCharge==1) {
378 invMassV0 = v0toDaughters->MassLambda();
379 }
else if (bachelorCharge==-1) {
380 invMassV0 = v0toDaughters->MassAntiLambda();
385 invMassV0 = v0toDaughters->MassK0Short();
394 vectorReco[3] = onTheFlyStatus;
397 vectorReco[6] =
fFake;
400 vectorReco[8] = pbachelor;
401 vectorReco[9] = v0toDaughters->Pt();
403 vectorReco[10] = v0toDaughters->Y(3122);
405 vectorReco[10] = v0toDaughters->Y(310);
407 vectorReco[11] = v0toDaughters->Phi();
408 vectorReco[12] = invMassV0;
409 vectorReco[13] = dcaV0;
410 vectorReco[14] = cosPAwrtPrimVtxV0;
411 vectorReco[15] = cosPointingAngleLc;
419 vectorReco[3] = onTheFlyStatus;
422 vectorReco[6] =
fFake;
432 bFillRecoValues = kTRUE;
434 return bFillRecoValues;
449 AliDebug(2, Form(
"The MC particle doesn't decay in 2 particles, skipping!!"));
455 if (daughter0<=0 || daughter1<=0){
456 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
459 AliAODMCParticle* mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
460 AliAODMCParticle* mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
461 if (!mcPartDaughter0 || !mcPartDaughter1) {
462 AliDebug(2,
"Problems in the MC Daughters\n");
469 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
470 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
471 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
472 TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
473 AliDebug(2,
"The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
477 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
478 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
479 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
481 if (!mcPartDaughter0 || !mcPartDaughter1) {
482 AliDebug(2,
"Problems in the MC Daughters\n");
486 sumPxDau+=mcPartDaughter0->Px();
487 sumPyDau+=mcPartDaughter0->Py();
488 sumPzDau+=mcPartDaughter0->Pz();
490 if (mcPartDaughter1->GetNDaughters()!=2) {
491 AliDebug(2,
"The Lambda MC particle doesn't decay in 2 particles, skipping!!");
495 Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
496 Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
497 if (daughter1D0<=0 || daughter1D1<=0) {
498 AliDebug(2, Form(
"The Lambda MC particle doesn't have correct daughters, skipping!!"));
502 AliAODMCParticle* mcPartDaughter1D0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D0));
503 AliAODMCParticle* mcPartDaughter1D1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D1));
504 if(!mcPartDaughter1D0 || !mcPartDaughter1D1) {
505 AliError(
"The Lambda daughter particle not found in MC array");
509 if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
510 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
511 !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
512 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
513 AliDebug(2,
"The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
518 sumPxDau+=mcPartDaughter1D0->Px();
519 sumPyDau+=mcPartDaughter1D0->Py();
520 sumPzDau+=mcPartDaughter1D0->Pz();
521 sumPxDau+=mcPartDaughter1D1->Px();
522 sumPyDau+=mcPartDaughter1D1->Py();
523 sumPzDau+=mcPartDaughter1D1->Pz();
527 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
528 TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
529 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
530 TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
531 AliDebug(2,
"The Lc MC doesn't decay in K0+proton (or cc), skipping!!");
535 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
536 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
537 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
539 if (!mcPartDaughter0 || !mcPartDaughter1) {
540 AliDebug(2,
"Problems in the MC Daughters after swapping V0 and bachelor\n");
545 sumPxDau+=mcPartDaughter0->Px();
546 sumPyDau+=mcPartDaughter0->Py();
547 sumPzDau+=mcPartDaughter0->Pz();
549 if (mcPartDaughter1->GetNDaughters()!=1) {
550 AliDebug(2,
"The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
554 Int_t daughter = mcPartDaughter1->GetDaughter(0);
556 AliDebug(2, Form(
"The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
560 AliAODMCParticle* mcPartDaughter =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter));
562 AliError(
"The K0/K0bar daughter particle not found in MC array");
566 if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
567 AliDebug(2,
"The K0/K0bar MC doesn't go in K0S, skipping!!");
571 if (mcPartDaughter->GetNDaughters()!=2) {
572 AliDebug(2,
"The K0S MC doesn't decay in 2 particles, skipping!!");
576 Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
577 Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
578 if (daughterD0<=0 || daughterD1<=0) {
579 AliDebug(2, Form(
"The K0S MC particle doesn't have correct daughters, skipping!!"));
583 AliAODMCParticle* mcPartDaughterD0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD0));
584 AliAODMCParticle* mcPartDaughterD1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD1));
585 if (!mcPartDaughterD0 || !mcPartDaughterD1) {
586 AliError(
"Daughter particle not found in MC array");
590 if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
591 TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
592 AliDebug(2,
"The K0S MC doesn't decay in pi+ pi-, skipping!!");
597 sumPxDau+=mcPartDaughterD0->Px();
598 sumPyDau+=mcPartDaughterD0->Py();
599 sumPzDau+=mcPartDaughterD0->Pz();
600 sumPxDau+=mcPartDaughterD1->Px();
601 sumPyDau+=mcPartDaughterD1->Py();
602 sumPzDau+=mcPartDaughterD1->Pz();
609 if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
610 TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
611 TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
612 AliDebug(2,
"Momentum conservation violated, skipping!!");
631 AliDebug(2,
"No reco candidate selected");
636 AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->
GetBachelor();
639 if (!(lcV0bachelor->
Getv0()) || !bachelor || !v0Pos || !v0Neg) {
640 AliDebug(2,
"No V0 for this reco candidate selected");
644 if (iProng==0) etaProng = bachelor->Eta();
645 else if (iProng==1) etaProng = v0Pos->Eta();
646 else if (iProng==2) etaProng = v0Neg->Eta();
648 AliDebug(4,Form(
"Eta value for prong number %1d = %f",iProng,etaProng));
665 AliDebug(2,
"No reco candidate selected");
670 AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->
GetBachelor();
673 if (!(lcV0bachelor->
Getv0()) || !bachelor || !v0Pos || !v0Neg) {
674 AliDebug(2,
"No V0 for this reco candidate selected");
678 if (iProng==0) ptProng = bachelor->Pt();
679 else if (iProng==1) ptProng = v0Pos->Pt();
680 else if (iProng==2) ptProng = v0Neg->Pt();
682 AliDebug(4,Form(
"Pt value for prong number %1d = %f",iProng,ptProng));
695 Int_t daughterD0 = mcPartCandidate->GetDaughter(0);
696 Int_t daughterD1 = mcPartCandidate->GetDaughter(1);
697 if (daughterD0<=0 || daughterD1<=0) {
698 AliDebug(2, Form(
"The Lc MC particle doesn't have correct daughters, skipping!!"));
702 AliAODMCParticle *mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD0));
703 AliAODMCParticle *mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD1));
704 if (!mcPartDaughter0 || !mcPartDaughter1) {
705 AliDebug(2,
"The candidate daughter particles not found in MC array");
710 Bool_t hasProdVertex = mcPartCandidate->XvYvZv(vtx1);
713 Bool_t v0Vertex = mcPartDaughter0->XvYvZv(vtx1daughter);
715 Bool_t bachVertex = hasProdVertex && mcPartDaughter1->XvYvZv(vtx2daughter);
717 if (!hasProdVertex || !v0Vertex || !bachVertex) {
718 AliDebug(2,
"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
722 if (TMath::Abs(vtx1daughter[0]-vtx2daughter[0])>1E-5 ||
723 TMath::Abs(vtx1daughter[1]-vtx2daughter[1])>1E-5 ||
724 TMath::Abs(vtx1daughter[2]-vtx2daughter[2])>1E-5) {
725 AliDebug(2,
"Bachelor and V0 haven't common vtx!");
730 for (
Int_t ii=0; ii<3; ii++) decayLength += (vtx1daughter[ii]-vtx1[ii])*(vtx1daughter[ii]-vtx1[ii]);
731 decayLength = TMath::Sqrt(decayLength);
733 cTau = decayLength * mcPartCandidate->M()/mcPartCandidate->P();
735 AliDebug(2,Form(
" cTau(4122)=%f",cTau));
751 AliDebug(2, Form(
"The MC particle have %d daughters (not 2), skipping!!",
fmcPartCandidate->GetNDaughters()));
758 if (daughter0<=0 || daughter1<=0){
759 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
763 AliAODMCParticle* mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
764 AliAODMCParticle* mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
765 if (!mcPartDaughter0 || !mcPartDaughter1) {
766 AliDebug(2,
"Problems in the MC Daughters\n");
775 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
776 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
777 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
778 TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
779 AliDebug(2,
"The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
786 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
787 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
788 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
789 Int_t daughterTemp = daughter0;
790 daughter0 = daughter1;
791 daughter1 = daughterTemp;
794 if (mcPartDaughter1->GetNDaughters()!=2) {
795 AliDebug(2,
"The Lambda MC particle doesn't decay in 2 particles, skipping!!");
801 Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
802 Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
803 if (daughter1D0<=0 || daughter1D1<=0) {
804 AliDebug(2, Form(
"The Lambda MC particle doesn't have correct daughters, skipping!!"));
810 AliAODMCParticle* mcPartDaughter1D0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D0));
811 AliAODMCParticle* mcPartDaughter1D1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D1));
812 if (!mcPartDaughter1D0 || !mcPartDaughter1D1) {
813 AliError(
"The Lambda daughter particles not found in MC array");
819 if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
820 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
821 !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
822 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
823 AliDebug(2,
"The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
835 if (mcPartDaughter1D0->GetPdgCode()==2212) {
838 }
else if (mcPartDaughter1D1->GetPdgCode()==2212) {
845 if (mcPartDaughter1D0->GetPdgCode()==211) {
848 }
else if (mcPartDaughter1D1->GetPdgCode()==211) {
857 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
858 TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
859 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
860 TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
861 AliDebug(2,
"The Lc MC doesn't decay in K0bar+proton (or cc), skipping!!");
867 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
868 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
869 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
870 Int_t daughterTemp = daughter0;
871 daughter0 = daughter1;
872 daughter1 = daughterTemp;
875 if(!mcPartDaughter1){
876 AliDebug(2,
"Null pointer to K0 particle, skipping!!");
882 if (mcPartDaughter1->GetNDaughters()!=1) {
883 AliDebug(2,
"The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
889 Int_t daughter = mcPartDaughter1->GetDaughter(0);
891 AliDebug(2, Form(
"The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
897 AliAODMCParticle* mcPartDaughter =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter));
898 if (!mcPartDaughter) {
899 AliError(
"The K0/K0bar daughter particle not found in MC array");
905 if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
906 AliDebug(2,
"The K0/K0bar MC doesn't go in K0S, skipping!!");
912 if (mcPartDaughter->GetNDaughters()!=2) {
913 AliDebug(2,
"The K0S MC doesn't decay in 2 particles, skipping!!");
919 Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
920 Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
921 if (daughterD0<=0 || daughterD1<=0) {
922 AliDebug(2, Form(
"The K0S MC particle doesn't have correct daughters, skipping!!"));
928 AliAODMCParticle* mcPartDaughterD0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD0));
929 AliAODMCParticle* mcPartDaughterD1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD1));
930 if (!mcPartDaughterD0 || !mcPartDaughterD1) {
931 AliError(
"The K0S daughter particles not found in MC array");
937 if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
938 TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
939 AliDebug(2,
"The K0S MC doesn't decay in pi+ pi-, skipping!!");
949 if (mcPartDaughterD0->GetPdgCode()==211) {
952 AliDebug(2,Form(
" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD0,daughterD1,mcPartDaughterD0->GetLabel(),mcPartDaughterD1->GetLabel()));
953 }
else if (mcPartDaughterD1->GetPdgCode()==211) {
956 AliDebug(2,Form(
" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD1,daughterD0,mcPartDaughterD1->GetLabel(),mcPartDaughterD0->GetLabel()));
970 AliAODMCParticle *mcPartDaughterK0,
975 Bool_t bGenValues = kFALSE;
977 AliAODMCParticle *mcPartV0DaughterPos =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(
fLabelArray[1]));
978 AliAODMCParticle *mcPartV0DaughterNeg =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(
fLabelArray[2]));
979 AliAODMCParticle *mcPartDaughterV0 = 0x0;
981 if(!mcPartV0DaughterPos || !mcPartV0DaughterNeg)
return bGenValues;
983 if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==311) {
984 Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);
986 AliDebug(2, Form(
"The K0/K0bar particle doesn't have correct daughter, skipping!!"));
989 mcPartDaughterV0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterK0));
990 if (!mcPartDaughterV0) {
991 AliDebug(2,
"The K0/K0bar daughter particle not found in MC array");
994 if (TMath::Abs(mcPartDaughterV0->GetPdgCode())!=310) {
995 AliDebug(2,
"The K0/K0bar daughter particle is not a K0S");
998 }
else if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==3122) {
999 mcPartDaughterV0 =
dynamic_cast<AliAODMCParticle*
>(mcPartDaughterK0);
1000 if (!mcPartDaughterV0) {
1001 AliDebug(2,
"The Lambda particle not found in MC array");
1006 if (!mcPartDaughterV0) {
1007 AliDebug(2,
"V0 particle not found in MC array");
1013 Double_t pbach = mcPartDaughterBachelor->P();
1019 Double_t vtx1daughter0[3] = {0,0,0};
1020 Bool_t hasSecVtx1 = mcPartDaughterBachelor->XvYvZv(vtx1daughter0);
1021 Double_t vtx1daughter1[3] = {0,0,0};
1022 Bool_t hasSecVtx2 = mcPartDaughterV0->XvYvZv(vtx1daughter1);
1023 if (!hasPrimVtx || !hasSecVtx1 || !hasSecVtx2) {
1024 AliDebug(2,
"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
1028 if (TMath::Abs(vtx1daughter0[0]-vtx1daughter1[0])>1E-5 ||
1029 TMath::Abs(vtx1daughter0[1]-vtx1daughter1[1])>1E-5 ||
1030 TMath::Abs(vtx1daughter0[2]-vtx1daughter1[2])>1E-5) {
1031 AliError(
"Daughters have different secondary vertex, skipping the track");
1036 Double_t px1[2] = {mcPartDaughterBachelor->Px(), mcPartDaughterV0->Px()};
1037 Double_t py1[2] = {mcPartDaughterBachelor->Py(), mcPartDaughterV0->Py()};
1038 Double_t pz1[2] = {mcPartDaughterBachelor->Pz(), mcPartDaughterV0->Pz()};
1048 Double_t vtx2daughter0[3] = {0,0,0};
1049 Bool_t hasSecVtx3 = mcPartV0DaughterPos->XvYvZv(vtx2daughter0);
1050 Double_t vtx2daughter1[3] = {0,0,0};
1051 Bool_t hasSecVtx4 = mcPartV0DaughterNeg->XvYvZv(vtx2daughter1);
1052 if (!hasSecVtx3 || !hasSecVtx4) {
1053 AliDebug(2,
"At least one of V0Posvtx, V0Negtx doesn't exist!");
1057 if (TMath::Abs(vtx2daughter0[0]-vtx2daughter1[0])>1E-5 ||
1058 TMath::Abs(vtx2daughter0[1]-vtx2daughter1[1])>1E-5 ||
1059 TMath::Abs(vtx2daughter0[2]-vtx2daughter1[2])>1E-5) {
1060 AliError(
"Daughters have different secondary vertex, skipping the track");
1065 Double_t px[2] = {mcPartV0DaughterPos->Px(), mcPartV0DaughterNeg->Px()};
1066 Double_t py[2] = {mcPartV0DaughterPos->Py(), mcPartV0DaughterNeg->Py()};
1067 Double_t pz[2] = {mcPartV0DaughterPos->Pz(), mcPartV0DaughterNeg->Pz()};
1084 invMass = decay->InvMass2Prongs(0,1,211,211);
1087 invMass = decay->InvMass2Prongs(0,1,2212,211);
1089 invMass = decay->InvMass2Prongs(0,1,211,2212);
1104 vectorMC[8] = pbach;
1105 vectorMC[9] = mcPartDaughterV0->Pt();
1106 vectorMC[10] = mcPartDaughterV0->Y();
1107 vectorMC[11] = mcPartDaughterV0->Phi();
1108 vectorMC[12] = invMass;
1110 vectorMC[14] = cosPAwrtPrimVtxV0;
1111 vectorMC[15] = cosPAwrtPrimVtxLc;
AliCFVertexingHF & operator=(const AliCFVertexingHF &c)
Double_t Ctau(AliAODMCParticle *mcPartCandidate)
Bool_t GetRecoValuesFromCandidate(Double_t *) const
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
AliAODTrack * Getv0NegativeTrack() const
Double_t GetEtaProng(Int_t iProng) const
AliAODMCParticle * fmcPartCandidate
Reconstructed HF candidate.
virtual Bool_t SetLabelArray()
AliCFVertexingHFLctoV0bachelor & operator=(const AliCFVertexingHFLctoV0bachelor &other)
Bool_t FillVectorFromMCarray(AliAODMCParticle *mcPartDaughterBachelor, AliAODMCParticle *mcPartDaughterK0, Double_t *vectorMC)
Bool_t CheckMCChannelDecay() const
void SetNProngs(Int_t nProngs)
AliAODTrack * Getv0PositiveTrack() const
Float_t * fPtAccCut
centrality value
Float_t fFake
fakes selection: 0 –> all, 1 –> non-fake, 2 –> fake
Int_t fConfiguration
multiplicity of the event
AliAODTrack * GetBachelor() const
Bool_t GetGeneratedValuesFromMCParticle(Double_t *)
Double_t CosV0PointingAngle() const
Int_t * fLabelArray
n. of prongs
AliAODRecoDecayHF * fRecoCandidate
mcArray candidate
Double_t GetPtProng(Int_t iProng) const
Bool_t SetRecoCandidateParam(AliAODRecoDecayHF *recoCand)
Int_t fmcLabel
flag to keep only the charm particles that comes from beauty decays
Double_t fzPrimVertex
get Number of variables for the container from the channel decay
Int_t NumberOfFakeDaughters() const
AliCFVertexingHFLctoV0bachelor()
Int_t fProngs
results of the MatchToMC()
AliAODVertex * GetPrimaryVtx() const
Double_t CosPointingAngle() const
void SetMCLabel(Int_t mcLabel)
slow configuration, all variables
Double_t fzMCVertex
Reco z primary vertex.
Double_t fMultiplicity
flag to remove events not geenrated with PYTHIA
Class for HF corrections as a function of many variables and step.
fast configuration, only a subset of variables