@@ -180,6 +180,7 @@ struct mcParticlePrediction {
180180 " Estimators enabled" };
181181 Configurable<bool > selectInelGt0{" selectInelGt0" , true , " Select only inelastic events" };
182182 Configurable<bool > selectPrimaries{" selectPrimaries" , true , " Select only primary particles" };
183+ Configurable<float > rapidityCut{" rapidityCut" , 0.5 , " Select only particles within |y| < cut" };
183184 Configurable<bool > requireCoincidenceEstimators{" requireCoincidenceEstimators" , false , " Asks for a coincidence when two estimators are used" };
184185 Configurable<bool > discardkIsGoodZvtxFT0vsPV{" discardkIsGoodZvtxFT0vsPV" , false , " Select only collisions with matching BC and MC BC" };
185186 Configurable<bool > discardMismatchedBCs{" discardMismatchedBCs" , false , " Select only collisions with matching BC and MC BC" };
@@ -493,9 +494,9 @@ struct mcParticlePrediction {
493494 continue ;
494495 }
495496
496- if (!particle.isPhysicalPrimary ()) {
497- continue ;
498- }
497+ // if (!particle.isPhysicalPrimary()) {
498+ // continue;
499+ // }
499500
500501 TParticlePDG* p = pdgDB->GetParticle (particle.pdgCode ());
501502 if (p) {
@@ -506,7 +507,28 @@ struct mcParticlePrediction {
506507 }
507508 }
508509
509- if (std::abs (particle.y ()) > 0.5 ) {
510+ if (std::abs (particle.y ()) >= rapidityCut) {
511+ continue ;
512+ }
513+
514+ // Check if particle has daughters (not a final state particle)
515+ auto daughters = particle.daughters_as <aod::McParticles>();
516+ bool isValid = false ;
517+
518+ if (daughters.size () > 0 ) {
519+ isValid = true ;
520+ for (const auto & daughter : daughters) {
521+ if (!daughter.isPhysicalPrimary ()) {
522+ isValid = false ;
523+ break ;
524+ }
525+ }
526+ } else {
527+ // Final state particle - check if particle itself is physical primary
528+ isValid = particle.isPhysicalPrimary ();
529+ }
530+
531+ if (!isValid) {
510532 continue ;
511533 }
512534
@@ -672,10 +694,10 @@ struct mcParticlePrediction {
672694 float nMultRecoMCBC[Estimators::nEstimators] = {0 };
673695 if (mcBC.has_ft0 ()) {
674696 const auto & ft0 = mcBC.ft0 ();
675- for (auto amplitude : ft0.amplitudeA ()) {
697+ for (const auto & amplitude : ft0.amplitudeA ()) {
676698 nMultRecoMCBC[Estimators::FT0A] += amplitude;
677699 }
678- for (auto amplitude : ft0.amplitudeC ()) {
700+ for (const auto & amplitude : ft0.amplitudeC ()) {
679701 nMultRecoMCBC[Estimators::FT0C] += amplitude;
680702 }
681703 nMultRecoMCBC[Estimators::FT0AC] = nMultRecoMCBC[Estimators::FT0A] + nMultRecoMCBC[Estimators::FT0C];
0 commit comments