@@ -280,9 +280,17 @@ struct Alice3strangenessFinder {
280280 hPtRes1DPosDau->GetXaxis ()->SetTitle (" (p_{T}^{gen} - p_{T}^{reco})/p_{T}^{gen}" );
281281
282282 auto hV0Building = histos.add <TH1 >(" hV0Building" , " hV0Building" , kTH1D , {{10 , 0.5 , 10.5 }});
283- hV0Building->GetXaxis ()->SetBinLabel (1 , " Pair" );
284- hV0Building->GetXaxis ()->SetBinLabel (2 , " Pdg check" );
285- hV0Building->GetXaxis ()->SetBinLabel (3 , " DCA Fitter" );
283+ if (doprocessFindV0CandidateOTF || doprocessFindV0CandidateACTS){
284+ hV0Building->GetXaxis ()->SetBinLabel (1 , " Pair" );
285+ hV0Building->GetXaxis ()->SetBinLabel (2 , " Pdg check" );
286+ hV0Building->GetXaxis ()->SetBinLabel (3 , " DCA Fitter" );
287+ }
288+ if (doprocessMCTrueFromACTS){
289+ hV0Building->GetXaxis ()->SetBinLabel (1 , " Pair" );
290+ hV0Building->GetXaxis ()->SetBinLabel (2 , " PID" );
291+ hV0Building->GetXaxis ()->SetBinLabel (3 , " Mother Check" );
292+ hV0Building->GetXaxis ()->SetBinLabel (4 , " DCA Fitter" );
293+ }
286294
287295 auto hCascadeBuilding = histos.add <TH1 >(" hCascadeBuilding" , " hCascadeBuilding" , kTH1D , {{10 , 0.5 , 10.5 }});
288296 hCascadeBuilding->GetXaxis ()->SetBinLabel (1 , " Attempts" );
@@ -394,14 +402,17 @@ struct Alice3strangenessFinder {
394402 return returnValue;
395403 }
396404 template <typename TMCParticle>
397- bool checkSameMotherGen (TMCParticle const & mcParticle1, TMCParticle const & mcParticle2)
405+ bool checkSameMotherGen (TMCParticle const & mcParticle1, TMCParticle const & mcParticle2, Alice3MCParticles const & mcParticles )
398406 {
399407 bool returnValue = false ;
400408 if (mcParticle1.has_mothers () && mcParticle2.has_mothers ()) {
401409 auto motherIds1 = mcParticle1.mothersIds ();
402410 auto motherIds2 = mcParticle2.mothersIds ();
403411 if (!motherIds1.empty () && !motherIds2.empty () && motherIds1[0 ] == motherIds2[0 ]) {
404- returnValue = true ;
412+ auto mother = mcParticles.rawIteratorAt (motherIds1[0 ] - mcParticles.rawIteratorAt (0 ).globalIndex ());
413+ if (mother.isPhysicalPrimary ()) {
414+ returnValue = true ;
415+ }
405416 }
406417 } // end association check
407418 return returnValue;
@@ -778,7 +789,7 @@ struct Alice3strangenessFinder {
778789 } // end posTrack
779790 }
780791
781- void processMCTrueFromACTS (aod::McCollision const & collision, Alice3MCParticles const &, aod::McParticles const & )
792+ void processMCTrueFromACTS (aod::McCollision const & collision, Alice3MCParticles const & mcParticles )
782793 {
783794
784795 auto negativeMCParticlesGrouped = negativeMCParticles->sliceByCached (aod::mcparticle::mcCollisionId, collision.globalIndex (), cache);
@@ -791,41 +802,78 @@ struct Alice3strangenessFinder {
791802 bool isLambda = false ;
792803 bool isAntiLambda = false ;
793804 int iPosPart = 0 ;
805+ auto posMotherPdgCode = 0 ;
806+ auto negMotherPdgCode = 0 ;
794807 for (auto const & posParticle : positiveMCParticlesGrouped) {
795- radiusPos = std::hypot (posParticle.vx (), posParticle.vy ());
796- histos.fill (HIST (" hRadiusVsHitsPos" ), radiusPos, posParticle.nHits ());
808+ if (posParticle.pdgCode () != kPiPlus && posParticle.pdgCode () != kProton ) {
809+ continue ;
810+ }
811+
812+ if (posParticle.has_mothers ()) {
813+ auto motherIds = posParticle.mothersIds ();
814+ if (!motherIds.empty ()) {
815+ auto mother = mcParticles.rawIteratorAt (motherIds[0 ] - mcParticles.rawIteratorAt (0 ).globalIndex ());
816+ if (mother.isPhysicalPrimary ()) {
817+ radiusPos = std::hypot (posParticle.vx (), posParticle.vy ());
818+ histos.fill (HIST (" hRadiusVsHitsPos" ), radiusPos, posParticle.nHits ());
819+ posMotherPdgCode = mother.pdgCode ();
820+ if (posMotherPdgCode == kK0Short ) {
821+ histos.fill (HIST (" K0Short/hPosDaughterGenPtEta" ), posParticle.pt (), posParticle.eta ());
822+ }
823+ if (posMotherPdgCode == kLambda0 ) {
824+ histos.fill (HIST (" Lambda/hPosDaughterGenPtEta" ), posParticle.pt (), posParticle.eta ());
825+ }
826+ if (posMotherPdgCode == kLambda0Bar ) {
827+ histos.fill (HIST (" AntiLambda/hPosDaughterGenPtEta" ), posParticle.pt (), posParticle.eta ());
828+ }
829+ }
830+ }
831+ }
832+
797833 for (auto const & negParticle : negativeMCParticlesGrouped) {
798834 if (negParticle.pdgCode () != kPiMinus && negParticle.pdgCode () != kProtonBar ) {
799835 continue ;
800836 }
801837 radiusNeg = std::hypot (negParticle.vx (), negParticle.vy ());
802838 if (iPosPart == 0 ) {
803- histos.fill (HIST (" hRadiusVsHitsNeg" ), radiusNeg, negParticle.nHits ());
839+ if (negParticle.has_mothers ()) {
840+ auto motherIds = negParticle.mothersIds ();
841+ if (!motherIds.empty ()) {
842+ auto mother = mcParticles.rawIteratorAt (motherIds[0 ] - mcParticles.rawIteratorAt (0 ).globalIndex ());
843+ if (mother.isPhysicalPrimary ()) {
844+ radiusNeg = std::hypot (negParticle.vx (), negParticle.vy ());
845+ histos.fill (HIST (" hRadiusVsHitsNeg" ), radiusNeg, negParticle.nHits ());
846+ negMotherPdgCode = mother.pdgCode ();
847+ if (negMotherPdgCode == kK0Short ) {
848+ histos.fill (HIST (" K0Short/hNegDaughterGenPtEta" ), negParticle.pt (), negParticle.eta ());
849+ }
850+ if (negMotherPdgCode == kLambda0 ) {
851+ histos.fill (HIST (" Lambda/hNegDaughterGenPtEta" ), negParticle.pt (), negParticle.eta ());
852+ }
853+ if (negMotherPdgCode == kLambda0Bar ) {
854+ histos.fill (HIST (" AntiLambda/hNegDaughterGenPtEta" ), negParticle.pt (), negParticle.eta ());
855+ }
856+ }
857+ }
858+ }
804859 }
805860 if (radiusPos == radiusNeg) {
806- isK0s = (posParticle.pdgCode () == kPiPlus && negParticle.pdgCode () == kPiMinus );
807- isLambda = (posParticle.pdgCode () == kProton && negParticle.pdgCode () == kPiMinus );
808- isAntiLambda = (posParticle.pdgCode () == kPiPlus && negParticle.pdgCode () == kProtonBar );
861+ histos.fill (HIST (" hV0Building" ), 1.0 );
862+ isK0s = (posParticle.pdgCode () == kPiPlus && negParticle.pdgCode () == kPiMinus && posMotherPdgCode == kK0Short && negMotherPdgCode == kK0Short );
863+ isLambda = (posParticle.pdgCode () == kProton && negParticle.pdgCode () == kPiMinus && posMotherPdgCode == kLambda0 && negMotherPdgCode == kLambda0 );
864+ isAntiLambda = (posParticle.pdgCode () == kPiPlus && negParticle.pdgCode () == kProtonBar && posMotherPdgCode == kLambda0Bar && negMotherPdgCode == kLambda0Bar );
809865 if (isK0s || isLambda || isAntiLambda) {
810866 if (!isK0s && isK0Gun) {
811867 continue ;
812868 }
813869 if (!isLambda && isLambdaGun) {
814870 continue ;
815871 }
816- if (isK0s && checkSameMotherGen (posParticle, negParticle)) {
817- histos.fill (HIST (" K0Short/hPosDaughterGenPtEta" ), posParticle.pt (), posParticle.eta ());
818- histos.fill (HIST (" K0Short/hNegDaughterGenPtEta" ), negParticle.pt (), negParticle.eta ());
819- }
820- if (isLambda && checkSameMotherGen (posParticle, negParticle)) {
821- histos.fill (HIST (" Lambda/hPosDaughterGenPtEta" ), posParticle.pt (), posParticle.eta ());
822- histos.fill (HIST (" Lambda/hNegDaughterGenPtEta" ), negParticle.pt (), negParticle.eta ());
823- }
824- if (isAntiLambda && checkSameMotherGen (posParticle, negParticle)) {
825- histos.fill (HIST (" AntiLambda/hPosDaughterGenPtEta" ), posParticle.pt (), posParticle.eta ());
826- histos.fill (HIST (" AntiLambda/hNegDaughterGenPtEta" ), negParticle.pt (), negParticle.eta ());
872+ histos.fill (HIST (" hV0Building" ), 2.0 );
873+ if (mcSameMotherCheck && !checkSameMotherGen (posParticle, negParticle, mcParticles)) {
874+ continue ;
827875 }
828-
876+ histos. fill ( HIST ( " hV0Building " ), 3.0 );
829877 Candidate v0cand;
830878 std::vector<double > v0DecayVertex;
831879 v0DecayVertex.push_back (negParticle.vx ());
@@ -840,6 +888,7 @@ struct Alice3strangenessFinder {
840888 if (!buildDecayCandidateTwoBody (posParCov, negParCov, vtx, v0cand)) {
841889 continue ;
842890 }
891+ histos.fill (HIST (" hV0Building" ), 4.0 );
843892 v0CandidateIndices (collision.globalIndex (),
844893 posParticle.globalIndex (),
845894 negParticle.globalIndex (),
@@ -860,8 +909,10 @@ struct Alice3strangenessFinder {
860909 }
861910 }
862911 }
912+ negMotherPdgCode = 0 ;
863913 }
864914 iPosPart++;
915+ posMotherPdgCode = 0 ;
865916 }
866917 }
867918 template <typename TTracksGrouped>
@@ -880,7 +931,7 @@ struct Alice3strangenessFinder {
880931 auto mcParticle = track.template mcParticle_as <aod::McParticles>();
881932 if (mcParticle.has_mothers ()) {
882933 for (const auto & m1 : mcParticle.template mothers_as <aod::McParticles>()) {
883- if (daughEff.analyseK0Daughters && m1.pdgCode () == kK0Short ) {
934+ if (daughEff.analyseK0Daughters && m1.pdgCode () == kK0Short && m1. isPhysicalPrimary () ) {
884935 if (daughterType == 0 && mcParticle.pdgCode () == kPiMinus ) {
885936 histos.fill (HIST (" K0Short/hNegDaughterRecoTruePtEta" ), mcParticle.pt (), mcParticle.eta ());
886937 histos.fill (HIST (" K0Short/hNegDaughterRecoPtEta" ), pt, eta);
@@ -894,7 +945,7 @@ struct Alice3strangenessFinder {
894945 histos.fill (HIST (" hPtRes1DPosDau" ), (mcParticle.pt () - pt) / mcParticle.pt ());
895946 }
896947 }
897- if (daughEff.analyseLambdaDaughters && m1.pdgCode () == kLambda0 ) {
948+ if (daughEff.analyseLambdaDaughters && m1.pdgCode () == kLambda0 && m1. isPhysicalPrimary () ) {
898949 if (daughterType == 0 && mcParticle.pdgCode () == kPiMinus ) {
899950 histos.fill (HIST (" Lambda/hNegDaughterRecoTruePtEta" ), mcParticle.pt (), mcParticle.eta ());
900951 histos.fill (HIST (" Lambda/hNegDaughterRecoPtEta" ), pt, eta);
@@ -908,7 +959,7 @@ struct Alice3strangenessFinder {
908959 histos.fill (HIST (" hPtRes1DPosDau" ), (mcParticle.pt () - pt) / mcParticle.pt ());
909960 }
910961 }
911- if (daughEff.analyseAntiLambdaDaughters && m1.pdgCode () == kLambda0Bar ) {
962+ if (daughEff.analyseAntiLambdaDaughters && m1.pdgCode () == kLambda0Bar && m1. isPhysicalPrimary () ) {
912963 if (daughterType == 0 && mcParticle.pdgCode () == kProtonBar ) {
913964 histos.fill (HIST (" AntiLambda/hNegDaughterRecoTruePtEta" ), mcParticle.pt (), mcParticle.eta ());
914965 histos.fill (HIST (" AntiLambda/hNegDaughterRecoPtEta" ), pt, eta);
0 commit comments