aboutsummaryrefslogtreecommitdiffstats
path: root/src/G4BeamTestUserSteppingAction.cxx
diff options
context:
space:
mode:
authorshivesh <s.p.mandalia@qmul.ac.uk>2018-11-20 17:26:02 +0000
committershivesh <s.p.mandalia@qmul.ac.uk>2018-11-20 17:26:02 +0000
commitd0533d03d0c85f2f993f1793a6b9ea2af3391207 (patch)
tree682c2fefe2d113319f21c07bded00fed5245e19b /src/G4BeamTestUserSteppingAction.cxx
parent738c2f88939a041fbc8b6b9cfa3c547b86bc6e42 (diff)
downloadG4BeamTest-d0533d03d0c85f2f993f1793a6b9ea2af3391207.tar.gz
G4BeamTest-d0533d03d0c85f2f993f1793a6b9ea2af3391207.zip
Tue 20 Nov 17:26:02 GMT 2018
Diffstat (limited to 'src/G4BeamTestUserSteppingAction.cxx')
-rw-r--r--src/G4BeamTestUserSteppingAction.cxx43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/G4BeamTestUserSteppingAction.cxx b/src/G4BeamTestUserSteppingAction.cxx
index e064628..f81ab62 100644
--- a/src/G4BeamTestUserSteppingAction.cxx
+++ b/src/G4BeamTestUserSteppingAction.cxx
@@ -5,11 +5,26 @@
#include "G4LogicalVolume.hh"
#include "G4UserLimits.hh"
#include "G4SteppingManager.hh"
+#include "G4OpticalPhoton.hh"
+#include "G4RunManager.hh"
G4BeamTestUserSteppingAction::G4BeamTestUserSteppingAction(){}
-void G4BeamTestUserSteppingAction::UserSteppingAction(const G4Step*)
+void G4BeamTestUserSteppingAction::UserSteppingAction(const G4Step* step)
{
+ G4int eventNumber = G4RunManager::GetRunManager()->
+ GetCurrentEvent()->GetEventID();
+
+ if (eventNumber != fEventNumber) {
+ /* G4cout << " Number of Scintillation Photons in previous event: " */
+ /* << fScintillationCounter << G4endl; */
+ /* G4cout << " Number of Cerenkov Photons in previous event: " */
+ /* << fCerenkovCounter << G4endl; */
+ fEventNumber = eventNumber;
+ fScintillationCounter = 0;
+ fCerenkovCounter = 0;
+ }
+
G4Track* track = fpSteppingManager->GetTrack();
if(track)
{
@@ -18,11 +33,33 @@ void G4BeamTestUserSteppingAction::UserSteppingAction(const G4Step*)
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")
+ G4String particle = track->GetDefinition()->GetParticleName();
+ /* G4cout << "particle = " << particle << G4endl; */
+ if(particle == "gamma")
{
//check if particle energy is below threshold; if true, kill the particle
G4double energy = track->GetTotalEnergy();
- if(energy < threshold) track->SetTrackStatus(fStopAndKill);
+ if(energy < threshold){
+ G4cout << "SteppingAction: killing particle " << particle << " with energy " << energy << " < " << threshold << G4endl;
+ track->SetTrackStatus(fStopAndKill);
+ }
}
}
+
+ const std::vector<const G4Track*>* secondaries =
+ step->GetSecondaryInCurrentStep();
+
+ if (secondaries->size()>0) {
+ for(unsigned int i=0; i<secondaries->size(); ++i) {
+ if (secondaries->at(i)->GetParentID()>0) {
+ if(secondaries->at(i)->GetDynamicParticle()->GetParticleDefinition()
+ == G4OpticalPhoton::OpticalPhotonDefinition()){
+ if (secondaries->at(i)->GetCreatorProcess()->GetProcessName()
+ == "Scintillation")fScintillationCounter++;
+ if (secondaries->at(i)->GetCreatorProcess()->GetProcessName()
+ == "Cerenkov")fCerenkovCounter++;
+ }
+ }
+ }
+ }
}