@@ -208,12 +208,12 @@ struct HfCandidateCreator3Prong {
208208 LOGP (fatal, " Process function for UPC is only available in Run 3!" );
209209 }
210210 std::array<bool , 5 > creationFlags = {createDplus, createDs, createLc, createXic, createCharmNuclei};
211- if (std::accumulate (creationFlags.begin (), creationFlags.end (), 0 ) == 0 ) {
211+ const int nParticlesToCreate = std::accumulate (creationFlags.begin (), creationFlags.end (), 0 );
212+ if (nParticlesToCreate == 0 ) {
212213 LOGP (fatal, " At least one particle specie should be enabled for the creation." );
213214 }
214-
215- if (createLc && createXic && applyInvMassConstraint) {
216- LOGP (fatal, " Unable to apply invariant mass constraint due to ambiguity of mass hypothesis: only one of Lc and Xic and Cd can be reconstructed." );
215+ if (nParticlesToCreate > 1 && applyInvMassConstraint) {
216+ LOGP (fatal, " Invariant mass constraint can be applied only when one particle specie is requested for creation." );
217217 }
218218
219219 // histograms
@@ -651,11 +651,15 @@ struct HfCandidateCreator3Prong {
651651 const float massPiK = kfPairPiK.GetMass ();
652652
653653 if (applyInvMassConstraint) { // constraints applied after minv getters - to preserve unbiased values of minv
654- kfCandPKPi.SetNonlinearMassConstraint (createLc ? static_cast <float >(MassLambdaCPlus) : static_cast <float >(MassXiCPlus));
655- kfCandPiKP.SetNonlinearMassConstraint (createLc ? static_cast <float >(MassLambdaCPlus) : static_cast <float >(MassXiCPlus));
656- kfCandPiKPi.SetNonlinearMassConstraint (static_cast <float >(MassDPlus));
657- kfCandKKPi.SetNonlinearMassConstraint (static_cast <float >(MassDS));
658- kfCandPiKK.SetNonlinearMassConstraint (static_cast <float >(MassDS));
654+ if (createLc) {
655+ kfCandGeneric->SetNonlinearMassConstraint (MassLambdaCPlus);
656+ } else if (createXic) {
657+ kfCandGeneric->SetNonlinearMassConstraint (MassXiCPlus);
658+ } else if (createDplus) {
659+ kfCandGeneric->SetNonlinearMassConstraint (MassDPlus);
660+ } else if (createDs) {
661+ kfCandGeneric->SetNonlinearMassConstraint (MassDS);
662+ }
659663 }
660664
661665 const float chi2geo = kfCandGeneric->Chi2 () / static_cast <float >(kfCandGeneric->NDF ());
0 commit comments