From 4098bca91efd35302e8cc99c9c6282fb51d764f3 Mon Sep 17 00:00:00 2001
From: Johannes Josef Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Mon, 29 Mar 2021 22:46:49 +0200
Subject: [PATCH] Fix FPE due to too few DoF

---
 .../MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
index 67bba1ae5aca..48458e1a8857 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
@@ -610,7 +610,8 @@ namespace MuonCombined {
         TrkDriftCircleMath::Segment segment = result;
         segment.hitsOnTrack(dcs.size());
         unsigned int ndofFit = segment.ndof();
-        double chi2NdofSegmentFit = segment.chi2()/(double)(ndofFit);
+        if (ndofFit < 1) continue;
+        double chi2NdofSegmentFit = segment.chi2()/ndofFit;
         bool hasDropHit = false;
         unsigned int dropDepth = 0;
         if( !segmentFinder.dropHits(segment, hasDropHit, dropDepth) ){
@@ -698,8 +699,8 @@ namespace MuonCombined {
 
         if( !isSelected ) continue;
 
-        hits.push_back(Muon::TimePointBetaFitter::Hit(distance,time,er));
-        candidate.stauHits.push_back(MuGirlNS::StauHit(MuGirlNS::MDTT_STAU_HIT, time+tof, ix, iy, iz, id, ie, er,sh, isEta, propTime));
+        hits.emplace_back(distance,time,er);
+        candidate.stauHits.emplace_back(MuGirlNS::MDTT_STAU_HIT, time+tof, ix, iy, iz, id, ie, er,sh, isEta, propTime);
       }
     }
     // fit data
-- 
GitLab