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();
392 vectorReco[3] = onTheFlyStatus;
395 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;
416 bFillRecoValues = kTRUE;
418 return bFillRecoValues;
433 AliDebug(2, Form(
"The MC particle doesn't decay in 2 particles, skipping!!"));
439 if (daughter0<=0 || daughter1<=0){
440 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
443 AliAODMCParticle* mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
444 AliAODMCParticle* mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
445 if (!mcPartDaughter0 || !mcPartDaughter1) {
446 AliDebug(2,
"Problems in the MC Daughters\n");
453 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
454 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
455 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
456 TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
457 AliDebug(2,
"The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
461 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
462 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
463 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
465 if (!mcPartDaughter0 || !mcPartDaughter1) {
466 AliDebug(2,
"Problems in the MC Daughters\n");
470 sumPxDau+=mcPartDaughter0->Px();
471 sumPyDau+=mcPartDaughter0->Py();
472 sumPzDau+=mcPartDaughter0->Pz();
474 if (mcPartDaughter1->GetNDaughters()!=2) {
475 AliDebug(2,
"The Lambda MC particle doesn't decay in 2 particles, skipping!!");
479 Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
480 Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
481 if (daughter1D0<=0 || daughter1D1<=0) {
482 AliDebug(2, Form(
"The Lambda MC particle doesn't have correct daughters, skipping!!"));
486 AliAODMCParticle* mcPartDaughter1D0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D0));
487 AliAODMCParticle* mcPartDaughter1D1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D1));
488 if(!mcPartDaughter1D0 || !mcPartDaughter1D1) {
489 AliError(
"The Lambda daughter particle not found in MC array");
493 if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
494 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
495 !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
496 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
497 AliDebug(2,
"The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
502 sumPxDau+=mcPartDaughter1D0->Px();
503 sumPyDau+=mcPartDaughter1D0->Py();
504 sumPzDau+=mcPartDaughter1D0->Pz();
505 sumPxDau+=mcPartDaughter1D1->Px();
506 sumPyDau+=mcPartDaughter1D1->Py();
507 sumPzDau+=mcPartDaughter1D1->Pz();
511 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
512 TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
513 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
514 TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
515 AliDebug(2,
"The Lc MC doesn't decay in K0+proton (or cc), skipping!!");
519 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
520 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
521 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
523 if (!mcPartDaughter0 || !mcPartDaughter1) {
524 AliDebug(2,
"Problems in the MC Daughters after swapping V0 and bachelor\n");
529 sumPxDau+=mcPartDaughter0->Px();
530 sumPyDau+=mcPartDaughter0->Py();
531 sumPzDau+=mcPartDaughter0->Pz();
533 if (mcPartDaughter1->GetNDaughters()!=1) {
534 AliDebug(2,
"The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
538 Int_t daughter = mcPartDaughter1->GetDaughter(0);
540 AliDebug(2, Form(
"The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
544 AliAODMCParticle* mcPartDaughter =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter));
546 AliError(
"The K0/K0bar daughter particle not found in MC array");
550 if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
551 AliDebug(2,
"The K0/K0bar MC doesn't go in K0S, skipping!!");
555 if (mcPartDaughter->GetNDaughters()!=2) {
556 AliDebug(2,
"The K0S MC doesn't decay in 2 particles, skipping!!");
560 Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
561 Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
562 if (daughterD0<=0 || daughterD1<=0) {
563 AliDebug(2, Form(
"The K0S MC particle doesn't have correct daughters, skipping!!"));
567 AliAODMCParticle* mcPartDaughterD0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD0));
568 AliAODMCParticle* mcPartDaughterD1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD1));
569 if (!mcPartDaughterD0 || !mcPartDaughterD1) {
570 AliError(
"Daughter particle not found in MC array");
574 if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
575 TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
576 AliDebug(2,
"The K0S MC doesn't decay in pi+ pi-, skipping!!");
581 sumPxDau+=mcPartDaughterD0->Px();
582 sumPyDau+=mcPartDaughterD0->Py();
583 sumPzDau+=mcPartDaughterD0->Pz();
584 sumPxDau+=mcPartDaughterD1->Px();
585 sumPyDau+=mcPartDaughterD1->Py();
586 sumPzDau+=mcPartDaughterD1->Pz();
593 if(TMath::Abs(pxMother-sumPxDau)/(TMath::Abs(pxMother)+1.e-13)>0.00001 ||
594 TMath::Abs(pyMother-sumPyDau)/(TMath::Abs(pyMother)+1.e-13)>0.00001 ||
595 TMath::Abs(pzMother-sumPzDau)/(TMath::Abs(pzMother)+1.e-13)>0.00001){
596 AliDebug(2,
"Momentum conservation violated, skipping!!");
615 AliDebug(2,
"No reco candidate selected");
620 AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->
GetBachelor();
623 if (!(lcV0bachelor->
Getv0()) || !bachelor || !v0Pos || !v0Neg) {
624 AliDebug(2,
"No V0 for this reco candidate selected");
628 if (iProng==0) etaProng = bachelor->Eta();
629 else if (iProng==1) etaProng = v0Pos->Eta();
630 else if (iProng==2) etaProng = v0Neg->Eta();
632 AliDebug(4,Form(
"Eta value for prong number %1d = %f",iProng,etaProng));
649 AliDebug(2,
"No reco candidate selected");
654 AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->
GetBachelor();
657 if (!(lcV0bachelor->
Getv0()) || !bachelor || !v0Pos || !v0Neg) {
658 AliDebug(2,
"No V0 for this reco candidate selected");
662 if (iProng==0) ptProng = bachelor->Pt();
663 else if (iProng==1) ptProng = v0Pos->Pt();
664 else if (iProng==2) ptProng = v0Neg->Pt();
666 AliDebug(4,Form(
"Pt value for prong number %1d = %f",iProng,ptProng));
679 Int_t daughterD0 = mcPartCandidate->GetDaughter(0);
680 Int_t daughterD1 = mcPartCandidate->GetDaughter(1);
681 if (daughterD0<=0 || daughterD1<=0) {
682 AliDebug(2, Form(
"The Lc MC particle doesn't have correct daughters, skipping!!"));
686 AliAODMCParticle *mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD0));
687 AliAODMCParticle *mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD1));
688 if (!mcPartDaughter0 || !mcPartDaughter1) {
689 AliDebug(2,
"The candidate daughter particles not found in MC array");
694 Bool_t hasProdVertex = mcPartCandidate->XvYvZv(vtx1);
697 Bool_t v0Vertex = mcPartDaughter0->XvYvZv(vtx1daughter);
699 Bool_t bachVertex = hasProdVertex && mcPartDaughter1->XvYvZv(vtx2daughter);
701 if (!hasProdVertex || !v0Vertex || !bachVertex) {
702 AliDebug(2,
"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
706 if (TMath::Abs(vtx1daughter[0]-vtx2daughter[0])>1E-5 ||
707 TMath::Abs(vtx1daughter[1]-vtx2daughter[1])>1E-5 ||
708 TMath::Abs(vtx1daughter[2]-vtx2daughter[2])>1E-5) {
709 AliDebug(2,
"Bachelor and V0 haven't common vtx!");
714 for (
Int_t ii=0; ii<3; ii++) decayLength += (vtx1daughter[ii]-vtx1[ii])*(vtx1daughter[ii]-vtx1[ii]);
715 decayLength = TMath::Sqrt(decayLength);
717 cTau = decayLength * mcPartCandidate->M()/mcPartCandidate->P();
719 AliDebug(2,Form(
" cTau(4122)=%f",cTau));
735 AliDebug(2, Form(
"The MC particle have %d daughters (not 2), skipping!!",
fmcPartCandidate->GetNDaughters()));
742 if (daughter0<=0 || daughter1<=0){
743 AliDebug(2, Form(
"The MC particle doesn't have correct daughters, skipping!!"));
747 AliAODMCParticle* mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
748 AliAODMCParticle* mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
749 if (!mcPartDaughter0 || !mcPartDaughter1) {
750 AliDebug(2,
"Problems in the MC Daughters\n");
759 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==3122 &&
760 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
761 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
762 TMath::Abs(mcPartDaughter1->GetPdgCode())==3122)) {
763 AliDebug(2,
"The Lc MC doesn't decay in Lambda+pion (or cc), skipping!!");
770 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==3122) {
771 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
772 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
773 Int_t daughterTemp = daughter0;
774 daughter0 = daughter1;
775 daughter1 = daughterTemp;
778 if (mcPartDaughter1->GetNDaughters()!=2) {
779 AliDebug(2,
"The Lambda MC particle doesn't decay in 2 particles, skipping!!");
785 Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
786 Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
787 if (daughter1D0<=0 || daughter1D1<=0) {
788 AliDebug(2, Form(
"The Lambda MC particle doesn't have correct daughters, skipping!!"));
794 AliAODMCParticle* mcPartDaughter1D0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D0));
795 AliAODMCParticle* mcPartDaughter1D1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1D1));
796 if (!mcPartDaughter1D0 || !mcPartDaughter1D1) {
797 AliError(
"The Lambda daughter particles not found in MC array");
803 if (!(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==211 &&
804 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==2212) &&
805 !(TMath::Abs(mcPartDaughter1D0->GetPdgCode())==2212 &&
806 TMath::Abs(mcPartDaughter1D1->GetPdgCode())==211)) {
807 AliDebug(2,
"The Lambda MC doesn't decay in pi+proton (or cc), skipping!!");
819 if (mcPartDaughter1D0->GetPdgCode()==2212) {
822 }
else if (mcPartDaughter1D1->GetPdgCode()==2212) {
829 if (mcPartDaughter1D0->GetPdgCode()==211) {
832 }
else if (mcPartDaughter1D1->GetPdgCode()==211) {
841 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==311 &&
842 TMath::Abs(mcPartDaughter1->GetPdgCode())==2212) &&
843 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==2212 &&
844 TMath::Abs(mcPartDaughter1->GetPdgCode())==311)) {
845 AliDebug(2,
"The Lc MC doesn't decay in K0bar+proton (or cc), skipping!!");
851 if (TMath::Abs(mcPartDaughter0->GetPdgCode())==311) {
852 mcPartDaughter0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter1));
853 mcPartDaughter1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter0));
854 Int_t daughterTemp = daughter0;
855 daughter0 = daughter1;
856 daughter1 = daughterTemp;
859 if(!mcPartDaughter1){
860 AliDebug(2,
"Null pointer to K0 particle, skipping!!");
866 if (mcPartDaughter1->GetNDaughters()!=1) {
867 AliDebug(2,
"The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
873 Int_t daughter = mcPartDaughter1->GetDaughter(0);
875 AliDebug(2, Form(
"The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
881 AliAODMCParticle* mcPartDaughter =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughter));
882 if (!mcPartDaughter) {
883 AliError(
"The K0/K0bar daughter particle not found in MC array");
889 if (!(TMath::Abs(mcPartDaughter->GetPdgCode())==310)) {
890 AliDebug(2,
"The K0/K0bar MC doesn't go in K0S, skipping!!");
896 if (mcPartDaughter->GetNDaughters()!=2) {
897 AliDebug(2,
"The K0S MC doesn't decay in 2 particles, skipping!!");
903 Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
904 Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
905 if (daughterD0<=0 || daughterD1<=0) {
906 AliDebug(2, Form(
"The K0S MC particle doesn't have correct daughters, skipping!!"));
912 AliAODMCParticle* mcPartDaughterD0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD0));
913 AliAODMCParticle* mcPartDaughterD1 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterD1));
914 if (!mcPartDaughterD0 || !mcPartDaughterD1) {
915 AliError(
"The K0S daughter particles not found in MC array");
921 if (! ( TMath::Abs(mcPartDaughterD0->GetPdgCode())==211 &&
922 TMath::Abs(mcPartDaughterD1->GetPdgCode())==211 ) ) {
923 AliDebug(2,
"The K0S MC doesn't decay in pi+ pi-, skipping!!");
933 if (mcPartDaughterD0->GetPdgCode()==211) {
936 AliDebug(2,Form(
" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD0,daughterD1,mcPartDaughterD0->GetLabel(),mcPartDaughterD1->GetLabel()));
937 }
else if (mcPartDaughterD1->GetPdgCode()==211) {
940 AliDebug(2,Form(
" daughter0=%d ------ daughter1=%d ------ dg0->GetLabel()=%d ------ dg1->GetLabel()=%d ",daughterD1,daughterD0,mcPartDaughterD1->GetLabel(),mcPartDaughterD0->GetLabel()));
954 AliAODMCParticle *mcPartDaughterK0,
959 Bool_t bGenValues = kFALSE;
961 AliAODMCParticle *mcPartV0DaughterPos =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(
fLabelArray[1]));
962 AliAODMCParticle *mcPartV0DaughterNeg =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(
fLabelArray[2]));
963 AliAODMCParticle *mcPartDaughterV0 = 0x0;
965 if(!mcPartV0DaughterPos || !mcPartV0DaughterNeg)
return bGenValues;
967 if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==311) {
968 Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);
970 AliDebug(2, Form(
"The K0/K0bar particle doesn't have correct daughter, skipping!!"));
973 mcPartDaughterV0 =
dynamic_cast<AliAODMCParticle*
>(
fmcArray->At(daughterK0));
974 if (!mcPartDaughterV0) {
975 AliDebug(2,
"The K0/K0bar daughter particle not found in MC array");
978 if (TMath::Abs(mcPartDaughterV0->GetPdgCode())!=310) {
979 AliDebug(2,
"The K0/K0bar daughter particle is not a K0S");
982 }
else if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==3122) {
983 mcPartDaughterV0 =
dynamic_cast<AliAODMCParticle*
>(mcPartDaughterK0);
984 if (!mcPartDaughterV0) {
985 AliDebug(2,
"The Lambda particle not found in MC array");
990 if (!mcPartDaughterV0) {
991 AliDebug(2,
"V0 particle not found in MC array");
997 Double_t pbach = mcPartDaughterBachelor->P();
1003 Double_t vtx1daughter0[3] = {0,0,0};
1004 Bool_t hasSecVtx1 = mcPartDaughterBachelor->XvYvZv(vtx1daughter0);
1005 Double_t vtx1daughter1[3] = {0,0,0};
1006 Bool_t hasSecVtx2 = mcPartDaughterV0->XvYvZv(vtx1daughter1);
1007 if (!hasPrimVtx || !hasSecVtx1 || !hasSecVtx2) {
1008 AliDebug(2,
"At least one of Prim.vtx, V0vtx, BachelorVtx doesn't exist!");
1012 if (TMath::Abs(vtx1daughter0[0]-vtx1daughter1[0])>1E-5 ||
1013 TMath::Abs(vtx1daughter0[1]-vtx1daughter1[1])>1E-5 ||
1014 TMath::Abs(vtx1daughter0[2]-vtx1daughter1[2])>1E-5) {
1015 AliError(
"Daughters have different secondary vertex, skipping the track");
1020 Double_t px1[2] = {mcPartDaughterBachelor->Px(), mcPartDaughterV0->Px()};
1021 Double_t py1[2] = {mcPartDaughterBachelor->Py(), mcPartDaughterV0->Py()};
1022 Double_t pz1[2] = {mcPartDaughterBachelor->Pz(), mcPartDaughterV0->Pz()};
1032 Double_t vtx2daughter0[3] = {0,0,0};
1033 Bool_t hasSecVtx3 = mcPartV0DaughterPos->XvYvZv(vtx2daughter0);
1034 Double_t vtx2daughter1[3] = {0,0,0};
1035 Bool_t hasSecVtx4 = mcPartV0DaughterNeg->XvYvZv(vtx2daughter1);
1036 if (!hasSecVtx3 || !hasSecVtx4) {
1037 AliDebug(2,
"At least one of V0Posvtx, V0Negtx doesn't exist!");
1041 if (TMath::Abs(vtx2daughter0[0]-vtx2daughter1[0])>1E-5 ||
1042 TMath::Abs(vtx2daughter0[1]-vtx2daughter1[1])>1E-5 ||
1043 TMath::Abs(vtx2daughter0[2]-vtx2daughter1[2])>1E-5) {
1044 AliError(
"Daughters have different secondary vertex, skipping the track");
1049 Double_t px[2] = {mcPartV0DaughterPos->Px(), mcPartV0DaughterNeg->Px()};
1050 Double_t py[2] = {mcPartV0DaughterPos->Py(), mcPartV0DaughterNeg->Py()};
1051 Double_t pz[2] = {mcPartV0DaughterPos->Pz(), mcPartV0DaughterNeg->Pz()};
1068 invMass = decay->InvMass2Prongs(0,1,211,211);
1071 invMass = decay->InvMass2Prongs(0,1,2212,211);
1073 invMass = decay->InvMass2Prongs(0,1,211,2212);
1088 vectorMC[8] = pbach;
1089 vectorMC[9] = mcPartDaughterV0->Pt();
1090 vectorMC[10] = mcPartDaughterV0->Y();
1091 vectorMC[11] = mcPartDaughterV0->Phi();
1092 vectorMC[12] = invMass;
1094 vectorMC[14] = cosPAwrtPrimVtxV0;
1095 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
ClassImp(AliAnalysisTaskDeltaPt) AliAnalysisTaskDeltaPt
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)
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.