diff --git a/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp b/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp index d250079ef0a8aa5f15e50fb801b1de90c46d3a17..5e9ba1a6af4cf2dbe994a1bf7d686f3bfcbf19f7 100644 --- a/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/GenericTrackerSensitiveDetector.cpp @@ -23,10 +23,11 @@ void GenericTrackerSensitiveDetector::Initialize(G4HCofThisEvent* HCE){ } G4bool GenericTrackerSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*){ - G4TouchableHandle touchPost = step->GetPostStepPoint()->GetTouchableHandle(); G4TouchableHandle touchPre = step->GetPreStepPoint()->GetTouchableHandle(); dd4hep::sim::Geant4StepHandler h(step); + if (fabs(h.trackDef()->GetPDGCharge()) < 0.01) return true; + dd4hep::Position prePos = h.prePos(); dd4hep::Position postPos = h.postPos(); dd4hep::Position direction = postPos - prePos; diff --git a/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.cpp b/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.cpp index 0d53d3b99c915a4428be09f2dfceec72040f7195..591c3cf3273a872f8533a8d11f3301fe60a408eb 100644 --- a/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/TrackerCombineSensitiveDetector.cpp @@ -23,6 +23,8 @@ void TrackerCombineSensitiveDetector::Initialize(G4HCofThisEvent* HCE){ G4bool TrackerCombineSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*){ dd4hep::sim::Geant4StepHandler h(step); + if (fabs(h.trackDef()->GetPDGCharge()) < 0.01) return true; + bool return_code = false; if ( userData.current == -1 ) userData.start(getCellID(step), step, h.pre); else if ( !userData.track || userData.current != h.track->GetTrackID() ) {