@@ -542,21 +542,24 @@ class CharmHadronBuilder
542542 }
543543 }
544544
545- // / Write one row for the given mass hypothesis, if PWGHF accepted it.
546- // / A candidate passing both hypotheses is stored twice, once per hypothesis.
545+ // / pass-through accepts every candidate once, under the pKPi prong mapping
546+ template <bool isPKPi, typename T>
547+ bool acceptsHypothesis (T const & candidate) const
548+ {
549+ if (mCharmHadronSelection .isPassThrough ()) {
550+ return isPKPi;
551+ }
552+ return isPKPi ? candidate.isSelLcToPKPi () : candidate.isSelLcToPiKP ();
553+ }
554+
555+ // / a candidate passing both hypotheses is stored twice, once per hypothesis
547556 template <bool isPKPi, modes::System system, typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
548557 void fillLcHypothesis (T1 const & col, T2 & collisionBuilder, T3 & collisionProducts, T4 & trackProducts,
549558 T5 & charmHadronProducts, T6 const & candidate, T7 & trackBuilder,
550559 T8 const & prong0, T8 const & prong1, T8 const & prong2)
551560 {
552- if constexpr (isPKPi) {
553- if (!candidate.isSelLcToPKPi ()) {
554- return ;
555- }
556- } else {
557- if (!candidate.isSelLcToPiKP ()) {
558- return ;
559- }
561+ if (!this ->acceptsHypothesis <isPKPi>(candidate)) {
562+ return ;
560563 }
561564
562565 // remap the prongs onto the accepted hypothesis so that the proton is always first
@@ -582,14 +585,8 @@ class CharmHadronBuilder
582585 T10 const & mcParticles, T11 & mcBuilder, T12 & mcProducts,
583586 T13 const & prong0, T13 const & prong1, T13 const & prong2)
584587 {
585- if constexpr (isPKPi) {
586- if (!candidate.isSelLcToPKPi ()) {
587- return ;
588- }
589- } else {
590- if (!candidate.isSelLcToPiKP ()) {
591- return ;
592- }
588+ if (!this ->acceptsHypothesis <isPKPi>(candidate)) {
589+ return ;
593590 }
594591
595592 // remap the prongs onto the accepted hypothesis so that the proton is always first
0 commit comments