From f3518ce9b198a467fffcd0f36273daac33c0696a Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Fri, 24 Jul 2015 12:29:40 +0000 Subject: [PATCH] dont't store backscatter that create no hits --- DDG4/plugins/Geant4TCUserParticleHandler.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/DDG4/plugins/Geant4TCUserParticleHandler.cpp b/DDG4/plugins/Geant4TCUserParticleHandler.cpp index c7e3400ad..f32a73fa9 100644 --- a/DDG4/plugins/Geant4TCUserParticleHandler.cpp +++ b/DDG4/plugins/Geant4TCUserParticleHandler.cpp @@ -102,13 +102,18 @@ void Geant4TCUserParticleHandler::end(const G4Track* /* track */, Particle& p) bool ends_in_trk_vol = ( r_end <= m_rTracker && z_end <= m_zTracker ) ; // created and ended in calo - if( !starts_in_trk_vol && !ends_in_trk_vol ){ - p.reason = 0; - return ; + if( !starts_in_trk_vol ) { + + if( !ends_in_trk_vol ){ + p.reason = 0; + } + //fg: dont keep backscatter that did not create a tracker hit + else if( !( p.reason & G4PARTICLE_CREATED_TRACKER_HIT ) ) + p.reason = 0; } + + return ; - //fg: backscatter ?? - // if( !starts_in_trk_vol && ends_in_trk_vol ){ keep ? } } /// Post-event action callback -- GitLab