From 5541344dce88070a9cf861a43acf213703f3711a Mon Sep 17 00:00:00 2001 From: Chengdong Fu <fucd@ihep.ac.cn> Date: Mon, 1 Apr 2024 14:22:36 +0800 Subject: [PATCH] remove very short path --- Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp b/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp index 5e9ba1a6..c1b8aca9 100644 --- a/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp @@ -33,10 +33,12 @@ G4bool GenericTrackerSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHis dd4hep::Position direction = postPos - prePos; dd4hep::Position position = mean_direction(prePos,postPos); double hit_len = direction.R(); + if (hit_len < 1E-9) return true; if (hit_len > 0) { double new_len = mean_length(h.preMom(),h.postMom())/hit_len; direction *= new_len/hit_len; } + dd4hep::sim::Geant4TrackerHit* hit = nullptr; hit = new dd4hep::sim::Geant4TrackerHit(h.track->GetTrackID(), h.track->GetDefinition()->GetPDGEncoding(), -- GitLab