Skip to content
Snippets Groups Projects
Commit ec1afecc authored by Savanna Shaw's avatar Savanna Shaw
Browse files

MuonTrackSegmentTool: prevent divide by zero

Adding some protection to avoid dividing by zero (from zero weights).
parent 1a6faa74
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonTrackToSegmentTool.h"
......@@ -117,7 +117,7 @@ namespace Muon {
}
if (!surfaceTransform) surfaceTransform = backupTransform;
// calculate distance new reference point, shift it 100 mm towards the start of the segment
double refDistance = weightedDistanceSquared / weightSquared - 100;
double refDistance = (weightSquared > 0 ? weightedDistanceSquared / weightSquared : 1) - 100;
ATH_MSG_DEBUG(" weighted distance " << refDistance);
Amg::Vector3D refPos = perigee->position() + refDistance * dir;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment