diff options
| author | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-08-16 14:01:19 +0100 |
|---|---|---|
| committer | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-08-16 14:01:19 +0100 |
| commit | 3a83ec3bce239359f1cd71d1c0bfbf23b61d0db8 (patch) | |
| tree | 7b75a539576992ec9a82ec0add0d0e9b565347dd /src/G4BeamTestUserTrackingAction.cxx | |
| download | G4BeamTest-3a83ec3bce239359f1cd71d1c0bfbf23b61d0db8.tar.gz G4BeamTest-3a83ec3bce239359f1cd71d1c0bfbf23b61d0db8.zip | |
initial commit
Diffstat (limited to 'src/G4BeamTestUserTrackingAction.cxx')
| -rw-r--r-- | src/G4BeamTestUserTrackingAction.cxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/G4BeamTestUserTrackingAction.cxx b/src/G4BeamTestUserTrackingAction.cxx new file mode 100644 index 0000000..d554152 --- /dev/null +++ b/src/G4BeamTestUserTrackingAction.cxx @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2011 + * The IceCube collaboration + * ID: $Id$ + * + * @file G4BeamTestUserTrackingAction.cxx + * @version $Revision$ + * @date $Date$ + * @author Thomas Melzig + * + * $LastChangedBy$ + */ + + +#include <g4-tankresponse/g4classes/G4BeamTestUserTrackingAction.h> + +#include "G4Track.hh" +#include "G4UserLimits.hh" +#include "G4TrackVector.hh" +#include "G4TrackingManager.hh" + +G4BeamTestUserTrackingAction::G4BeamTestUserTrackingAction(){} + +void G4BeamTestUserTrackingAction::PreUserTrackingAction(const G4Track*){} + +void G4BeamTestUserTrackingAction::PostUserTrackingAction(const G4Track* 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); + G4TrackVector* secondaries = fpTrackingManager->GimmeSecondaries(); + if(secondaries) + { + size_t nSeco = secondaries->size(); + if(nSeco>0) + { + for(size_t i=0;i<nSeco;i++) + { + //check if secondary particle is a gamma + if((*secondaries)[i]->GetDefinition()->GetParticleName() == "gamma") + { + //check if particle energy is below threshold; if true, kill the particle + G4double energy = (*secondaries)[i]->GetTotalEnergy(); + if(energy < threshold) (*secondaries)[i]->SetTrackStatus(fStopAndKill); + } + } + } + } +} |
