diff --git a/Tools/KFparticle/KFUtilities.h b/Tools/KFparticle/KFUtilities.h index 0da468ad2a7..1c590a1efd7 100644 --- a/Tools/KFparticle/KFUtilities.h +++ b/Tools/KFparticle/KFUtilities.h @@ -393,9 +393,10 @@ std::pair kfCalculateImpactParameterZ(const KFParticle& candidate, candidate.GetDistanceFromVertexXY(vtx, distanceToVertexXY, errDistanceToVertexXY); const float distanceToVertex = candidate.GetDistanceFromVertex(vtx); const float chi2ToVertex = candidate.GetDeviationFromVertex(vtx); - const float distanceToVertexZ2 = distanceToVertex*distanceToVertex - distanceToVertexXY*distanceToVertexXY; + const float distanceToVertexZ2 = distanceToVertex * distanceToVertex - distanceToVertexXY * distanceToVertexXY; const float distanceToVertexZ = distanceToVertexZ2 > 0 ? std::sqrt(distanceToVertexZ2) : -std::sqrt(-distanceToVertexZ2); - const float errDistanceToVertexZ2 = (distanceToVertex*distanceToVertex*distanceToVertex*distanceToVertex/chi2ToVertex - distanceToVertexXY*distanceToVertexXY*errDistanceToVertexXY*errDistanceToVertexXY) / distanceToVertexZ2; const float errDistanceToVertexZ = errDistanceToVertexZ2 > 0 ? std::sqrt(errDistanceToVertexZ2) : -std::sqrt(-errDistanceToVertexZ2); + const float errDistanceToVertexZ2 = (distanceToVertex * distanceToVertex * distanceToVertex * distanceToVertex / chi2ToVertex - distanceToVertexXY * distanceToVertexXY * errDistanceToVertexXY * errDistanceToVertexXY) / distanceToVertexZ2; + const float errDistanceToVertexZ = errDistanceToVertexZ2 > 0 ? std::sqrt(errDistanceToVertexZ2) : -std::sqrt(-errDistanceToVertexZ2); return std::make_pair(distanceToVertexZ, errDistanceToVertexZ); }