diff --git a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp index b023b3dcd673e1670cd8d74f6ec5f6be67ed2916..01cad1e1cf94e9ca2b1a1717dc894eb68d9ce67e 100644 --- a/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/CaloSensitiveDetector.cpp @@ -33,6 +33,10 @@ CaloSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) { // std::cout << "CaloSensitiveDetector::ProcessHits" << std::endl; dd4hep::sim::Geant4StepHandler h(step); + + // if there is no deposit energy, don't create hit object + if (h.deposit() <= 0) return true; + if(m_applyBirksLaw) h.doApplyBirksLaw(); dd4hep::Position pos = 0.5 * (h.prePos() + h.postPos()); HitContribution contrib = dd4hep::sim::Geant4Hit::extractContribution(step); diff --git a/Simulation/DetSimSD/src/MuonBarrelSensitiveDetector.cpp b/Simulation/DetSimSD/src/MuonBarrelSensitiveDetector.cpp index 6d8c5d81355e79db6285c2175e37ef966b832f3e..56db862ba0e43b215968c61664d7fe32c94eba82 100644 --- a/Simulation/DetSimSD/src/MuonBarrelSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/MuonBarrelSensitiveDetector.cpp @@ -23,10 +23,9 @@ void MuonBarrelSensitiveDetector::Initialize(G4HCofThisEvent* HCE){ } G4bool MuonBarrelSensitiveDetector::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; + if (h.deposit() <= 0 && !Geant4Hit::isGeantino(step->GetTrack())) return true; dd4hep::Position prePos = h.prePos(); dd4hep::Position postPos = h.postPos(); diff --git a/Simulation/DetSimSD/src/MuonEndcapSensitiveDetector.cpp b/Simulation/DetSimSD/src/MuonEndcapSensitiveDetector.cpp index d66a2004ac3119f1f1cb2b8b06dcd43e87b7e9d8..9bb09b5c6ad0b246b3f968b6126fe510946a79e4 100644 --- a/Simulation/DetSimSD/src/MuonEndcapSensitiveDetector.cpp +++ b/Simulation/DetSimSD/src/MuonEndcapSensitiveDetector.cpp @@ -24,10 +24,9 @@ void MuonEndcapSensitiveDetector::Initialize(G4HCofThisEvent* HCE){ } G4bool MuonEndcapSensitiveDetector::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; + if (h.deposit() <= 0 && !Geant4Hit::isGeantino(step->GetTrack())) return true; dd4hep::Position prePos = h.prePos(); dd4hep::Position postPos = h.postPos();