From d0533d03d0c85f2f993f1793a6b9ea2af3391207 Mon Sep 17 00:00:00 2001 From: shivesh Date: Tue, 20 Nov 2018 17:26:02 +0000 Subject: Tue 20 Nov 17:26:02 GMT 2018 --- src/G4BeamTestUserTrackingAction.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/G4BeamTestUserTrackingAction.cxx') diff --git a/src/G4BeamTestUserTrackingAction.cxx b/src/G4BeamTestUserTrackingAction.cxx index c6317df..f7c053b 100644 --- a/src/G4BeamTestUserTrackingAction.cxx +++ b/src/G4BeamTestUserTrackingAction.cxx @@ -24,11 +24,15 @@ void G4BeamTestUserTrackingAction::PostUserTrackingAction(const G4Track* track) for(size_t i=0;iGetDefinition()->GetParticleName() == "gamma") + G4String particle = (*secondaries)[i]->GetDefinition()->GetParticleName(); + if(particle == "gamma" || particle == "opticalphoton") { //check if particle energy is below threshold; if true, kill the particle G4double energy = (*secondaries)[i]->GetTotalEnergy(); - if(energy < threshold) (*secondaries)[i]->SetTrackStatus(fStopAndKill); + if(energy < threshold){ + G4cout << "TrackingAction: killing particle " << particle << " with energy " << energy << " < " << threshold << G4endl; + (*secondaries)[i]->SetTrackStatus(fStopAndKill); + } } } } -- cgit v1.2.3