Skip to content

Commit 4f3d453

Browse files
committed
Cleanup and safety features
1 parent dbc7ff4 commit 4f3d453

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

PWGLF/Utils/strangenessBuilderHelper.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ class strangenessBuilderHelper
280280
bool calculateCovariance = false,
281281
bool acceptTPCOnly = false)
282282
{
283+
v0 = {}; // safe initialization: start new
284+
283285
if constexpr (useSelections) {
284286
// verify track quality
285287
if (positiveTrack.tpcNClsCrossedRows() < v0selections.minCrossedRows) {
@@ -312,6 +314,7 @@ class strangenessBuilderHelper
312314
if constexpr (calculateProngDCAtoPV) {
313315
// Calculate DCA with respect to the collision associated to the V0
314316
std::array<float, 2> dcaInfo;
317+
dcaInfo[0] = dcaInfo[1] = 0.0f; // invalid
315318

316319
// do DCA to PV on TrackPar copies and not TrackParCov
317320
// TrackPar preferred: don't calculate multiple scattering / CovMat changes
@@ -350,10 +353,12 @@ class strangenessBuilderHelper
350353
nCand = fitter.process(positiveTrackParam, negativeTrackParam);
351354
} catch (...) {
352355
v0 = {};
356+
fitter.setCollinear(false); // even if returned, reset
353357
return false;
354358
}
355359
if (nCand == 0) {
356360
v0 = {};
361+
fitter.setCollinear(false); // even if returned, reset
357362
return false;
358363
}
359364
fitter.setCollinear(false); // proper cleaning: when exiting this loop, always reset to not collinear
@@ -508,6 +513,7 @@ class strangenessBuilderHelper
508513

509514
// Calculate DCA with respect to the collision associated to the V0
510515
std::array<float, 2> dcaInfo;
516+
dcaInfo[0] = dcaInfo[1] = 0.0f; // invalid
511517

512518
// do DCA to PV on TrackPar copies and not TrackParCov
513519
// TrackPar preferred: don't calculate multiple scattering / CovMat changes
@@ -738,6 +744,7 @@ class strangenessBuilderHelper
738744
// bachelor DCA track to PV
739745
// Calculate DCA with respect to the collision associated to the V0, not individual tracks
740746
std::array<float, 2> dcaInfo;
747+
dcaInfo[0] = dcaInfo[1] = 0.0f; // invalid
741748

742749
auto bachTrackPar = getTrackPar(bachelorTrack);
743750
o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, bachTrackPar, 2.f, fitter.getMatCorrType(), &dcaInfo);

0 commit comments

Comments
 (0)