diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index 5ef04a91ab7..a76d43d5cd2 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -271,7 +271,7 @@ class CascadeSelection : public BaseSelection - bool checkCandidate(const T& cascade) const + bool checkFilters(const T& cascade) const { // check kinematics const bool kinematicsOK = @@ -390,24 +390,25 @@ class CascadeBuilder int64_t posDaughterIndex = 0; int64_t negDaughterIndex = 0; for (const auto& cascade : fullCascades) { - if (!mCascadeSelection.checkCandidate(cascade)) { + if (!mCascadeSelection.checkFilters(cascade)) { continue; } mCascadeSelection.applySelections(cascade, fullTracks, col); - if (mCascadeSelection.passesAllRequiredSelections()) { + if (!mCascadeSelection.passesAllRequiredSelections()) { + continue; + } - auto bachelor = cascade.template bachelor_as(); - auto posDaughter = cascade.template posTrack_as(); - auto negDaughter = cascade.template negTrack_as(); + auto bachelor = cascade.template bachelor_as(); + auto posDaughter = cascade.template posTrack_as(); + auto negDaughter = cascade.template negTrack_as(); - collisionBuilder.template fillCollision(collisionProducts, col); + collisionBuilder.template fillCollision(collisionProducts, col); - bachelorIndex = trackBuilder.template getDaughterIndex(bachelor, trackProducts, collisionProducts, indexMap); - posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); - negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); + bachelorIndex = trackBuilder.template getDaughterIndex(bachelor, trackProducts, collisionProducts, indexMap); + posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); + negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); - fillCascade(collisionProducts, cascadeProducts, cascade, col, bachelorIndex, posDaughterIndex, negDaughterIndex); - } + fillCascade(collisionProducts, cascadeProducts, cascade, col, bachelorIndex, posDaughterIndex, negDaughterIndex); } } diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index c4558e5b567..9ac2ea0ad8b 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -222,7 +222,11 @@ class CloseTrackRejection } } // for small momemeta the calculation of phistar might fail, if the particle did not reach a certain radius - mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / count; // only average values if phistar could be computed + if (count > 0) { + mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / count; // only average values if phistar could be computed + } else { + mAverageDphistar = 0.f; // if computation at all radii fail, set it 0 + } } void fill(float kstar) diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index e5931365ff5..a1add5f0a27 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -320,7 +320,7 @@ class TwoTrackResonanceSelection : public BaseSelection mMassMin && mMass < mMassMax) && (mPt > mPtMin && mPt < mPtMax) && @@ -526,10 +526,15 @@ class TwoTrackResonanceBuilder { mTwoTrackResonanceSelection.reconstructResonance(posDaughter, negDaughter); - if (!mTwoTrackResonanceSelection.checkCandidate()) { + if (!mTwoTrackResonanceSelection.checkFilters()) { return; } mTwoTrackResonanceSelection.applySelections(posDaughter, negDaughter); // for resonances selection are only applied to daughter tracks + + if (!mTwoTrackResonanceSelection.passesAllRequiredSelections()) { + return; + } + int64_t posDaughterIndex = 0; int64_t negDaughterIndex = 0; diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 38f71a51e0b..64eb59bd960 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -268,7 +268,7 @@ class V0Selection : public BaseSelection - bool checkCandidate(const T& v0) const + bool checkFilters(const T& v0) const { // check kinematics first const bool kinematicsOK = @@ -380,28 +380,29 @@ class V0Builder int64_t posDaughterIndex = 0; int64_t negDaughterIndex = 0; for (const auto& v0 : v0s) { - if (!mV0Selection.checkCandidate(v0)) { + if (!mV0Selection.checkFilters(v0)) { continue; } mV0Selection.applySelections(v0, tracks); - if (mV0Selection.passesAllRequiredSelections()) { - auto posDaughter = v0.template posTrack_as(); - auto negDaughter = v0.template negTrack_as(); - - collisionBuilder.template fillCollision(collisionProducts, col); - - posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); - negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); - - if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { - fillLambda(collisionProducts, v0products, v0, 1.f, posDaughterIndex, negDaughterIndex); - } - if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { - fillLambda(collisionProducts, v0products, v0, -1.f, posDaughterIndex, negDaughterIndex); - } - if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { - fillK0short(collisionProducts, v0products, v0, posDaughterIndex, negDaughterIndex); - } + if (!mV0Selection.passesAllRequiredSelections()) { + continue; + } + auto posDaughter = v0.template posTrack_as(); + auto negDaughter = v0.template negTrack_as(); + + collisionBuilder.template fillCollision(collisionProducts, col); + + posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts, indexMap); + negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts, indexMap); + + if constexpr (modes::isEqual(v0Type, modes::V0::kLambda)) { + fillLambda(collisionProducts, v0products, v0, 1.f, posDaughterIndex, negDaughterIndex); + } + if constexpr (modes::isEqual(v0Type, modes::V0::kAntiLambda)) { + fillLambda(collisionProducts, v0products, v0, -1.f, posDaughterIndex, negDaughterIndex); + } + if constexpr (modes::isEqual(v0Type, modes::V0::kK0short)) { + fillK0short(collisionProducts, v0products, v0, posDaughterIndex, negDaughterIndex); } } }