From 3a83ec3bce239359f1cd71d1c0bfbf23b61d0db8 Mon Sep 17 00:00:00 2001 From: shivesh Date: Thu, 16 Aug 2018 14:01:19 +0100 Subject: initial commit --- src/G4BeamTestUserSteppingAction.cxx | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/G4BeamTestUserSteppingAction.cxx (limited to 'src/G4BeamTestUserSteppingAction.cxx') diff --git a/src/G4BeamTestUserSteppingAction.cxx b/src/G4BeamTestUserSteppingAction.cxx new file mode 100644 index 0000000..b16098c --- /dev/null +++ b/src/G4BeamTestUserSteppingAction.cxx @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2011 + * The IceCube collaboration + * ID: $Id$ + * + * @file G4BeamTestUserSteppingAction.cxx + * @version $Revision$ + * @date $Date$ + * @author Thomas Melzig + * + * $LastChangedBy$ + */ + + +#include + +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4LogicalVolume.hh" +#include "G4UserLimits.hh" +#include "G4SteppingManager.hh" + +G4BeamTestUserSteppingAction::G4BeamTestUserSteppingAction(){} + +void G4BeamTestUserSteppingAction::UserSteppingAction(const G4Step*) +{ + G4Track* track = fpSteppingManager->GetTrack(); + if(track) + { + const G4LogicalVolume *volume = track->GetLogicalVolumeAtVertex(); + G4UserLimits *limit = volume->GetUserLimits(); + if(!limit) G4cout << "----> G4LogicalVolume: " << volume->GetName() << " has no defined G4UserLimit" << G4endl; + G4double threshold = limit->GetUserMinEkine(*track); + //check if particle is a gamma + if(track->GetDefinition()->GetParticleName() == "gamma") + { + //check if particle energy is below threshold; if true, kill the particle + G4double energy = track->GetTotalEnergy(); + if(energy < threshold) track->SetTrackStatus(fStopAndKill); + } + } +} -- cgit v1.2.3