@@ -266,7 +266,10 @@ class strangenessBuilderHelper
266266 // _______________________________________________________________________
267267 // standard build V0 function. Populates ::v0 object
268268 // ::v0 will be initialized to defaults if build fails
269- template <bool useSelections = true , typename TTrack, typename TTrackParametrization>
269+ // --- useSelections: meant to maximize recovery, but beware high cost in CPU
270+ // --- calculateProngDCAtoPV: optionally don't propagate prongs to PV, saves
271+ // CPU, of interest when dealing with de-duplication (variable not checked)
272+ template <bool useSelections = true , bool calculateProngDCAtoPV = true , typename TTrack, typename TTrackParametrization>
270273 bool buildV0Candidate (int collisionIndex,
271274 float pvX, float pvY, float pvZ,
272275 TTrack const & positiveTrack,
@@ -306,31 +309,38 @@ class strangenessBuilderHelper
306309 }
307310 }
308311
309- // Calculate DCA with respect to the collision associated to the V0
310- std::array<float , 2 > dcaInfo;
312+ if constexpr (calculateProngDCAtoPV) {
313+ // Calculate DCA with respect to the collision associated to the V0
314+ std::array<float , 2 > dcaInfo;
311315
312- // do DCA to PV on copies instead of originals
313- auto positiveTrackParamCopy = positiveTrackParam;
314- auto negativeTrackParamCopy = negativeTrackParam;
316+ // do DCA to PV on TrackPar copies and not TrackParCov
317+ // TrackPar preferred: don't calculate multiple scattering / CovMat changes
318+ // Spares CPU since variables not checked
319+ o2::track::TrackPar positiveTrackParamCopy (positiveTrackParam);
320+ o2::track::TrackPar negativeTrackParamCopy (negativeTrackParam);
315321
316- o2::base::Propagator::Instance ()->propagateToDCABxByBz ({pvX, pvY, pvZ}, positiveTrackParamCopy, 2 .f , fitter.getMatCorrType (), &dcaInfo);
317- v0.positiveDCAxy = dcaInfo[0 ];
322+ o2::base::Propagator::Instance ()->propagateToDCABxByBz ({pvX, pvY, pvZ}, positiveTrackParamCopy, 2 .f , fitter.getMatCorrType (), &dcaInfo);
323+ v0.positiveDCAxy = dcaInfo[0 ];
318324
319- if constexpr (useSelections) {
320- if (std::fabs (v0.positiveDCAxy ) < v0selections.dcanegtopv ) {
321- v0 = {};
322- return false ;
325+ if constexpr (useSelections) {
326+ if (std::fabs (v0.positiveDCAxy ) < v0selections.dcanegtopv ) {
327+ v0 = {};
328+ return false ;
329+ }
323330 }
324- }
325331
326- o2::base::Propagator::Instance ()->propagateToDCABxByBz ({pvX, pvY, pvZ}, negativeTrackParamCopy, 2 .f , fitter.getMatCorrType (), &dcaInfo);
327- v0.negativeDCAxy = dcaInfo[0 ];
332+ o2::base::Propagator::Instance ()->propagateToDCABxByBz ({pvX, pvY, pvZ}, negativeTrackParamCopy, 2 .f , fitter.getMatCorrType (), &dcaInfo);
333+ v0.negativeDCAxy = dcaInfo[0 ];
328334
329- if constexpr (useSelections) {
330- if (std::fabs (v0.negativeDCAxy ) < v0selections.dcanegtopv ) {
331- v0 = {};
332- return false ;
335+ if constexpr (useSelections) {
336+ if (std::fabs (v0.negativeDCAxy ) < v0selections.dcanegtopv ) {
337+ v0 = {};
338+ return false ;
339+ }
333340 }
341+ }else {
342+ v0.positiveDCAxy = 0 .0f ; // default invalid
343+ v0.negativeDCAxy = 0 .0f ; // default invalid
334344 }
335345
336346 // Perform DCA fit
@@ -499,9 +509,11 @@ class strangenessBuilderHelper
499509 // Calculate DCA with respect to the collision associated to the V0
500510 std::array<float , 2 > dcaInfo;
501511
502- // do DCA to PV on copies instead of originals
503- auto positiveTrackParamCopy = positiveTrackParam;
504- auto negativeTrackParamCopy = negativeTrackParam;
512+ // do DCA to PV on TrackPar copies and not TrackParCov
513+ // TrackPar preferred: don't calculate multiple scattering / CovMat changes
514+ // Spares CPU since variables not checked
515+ o2::track::TrackPar positiveTrackParamCopy (positiveTrackParam);
516+ o2::track::TrackPar negativeTrackParamCopy (negativeTrackParam);
505517
506518 o2::base::Propagator::Instance ()->propagateToDCABxByBz ({pvX, pvY, pvZ}, positiveTrackParamCopy, 2 .f , fitter.getMatCorrType (), &dcaInfo);
507519 v0.positiveDCAxy = dcaInfo[0 ];
0 commit comments