diff --git a/Event/EventPacker/src/lib/PackedTrack.cpp b/Event/EventPacker/src/lib/PackedTrack.cpp index 3a954939e3ecef27480805ef74b3abe6a52d0b36..53b2934bc5b9191dfca2d8460d7e5ec5514618e8 100644 --- a/Event/EventPacker/src/lib/PackedTrack.cpp +++ b/Event/EventPacker/src/lib/PackedTrack.cpp @@ -103,8 +103,10 @@ void TrackPacker::convertState( const LHCb::State& state, PackedDataVector& ptra newState.z = StandardPacker::position( state.z() ); newState.tx = StandardPacker::slope( state.tx() ); newState.ty = StandardPacker::slope( state.ty() ); - const auto qp = std::abs( state.qOverP() ) < TrackParameters::lowTolerance ? 0. : 1. / state.qOverP(); - newState.p = StandardPacker::energy( qp ); + const auto qp = std::isfinite( 1. / state.qOverP() ) + ? 1. / state.qOverP() + : std::copysign( std::numeric_limits<double>::max(), state.qOverP() ); + newState.p = StandardPacker::energy( qp ); //== Get the coded value in case of saturation, to code properly the error later const auto p = StandardPacker::energy( newState.p );