slic/include
diff -u -r1.14 -r1.15
--- SteppingAction.hh 27 Nov 2012 19:32:18 -0000 1.14
+++ SteppingAction.hh 30 Apr 2013 23:08:37 -0000 1.15
@@ -1,8 +1,11 @@
-// $Header: /cvs/lcd/slic/include/SteppingAction.hh,v 1.14 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/SteppingAction.hh,v 1.15 2013/04/30 23:08:37 jeremy Exp $
#ifndef SLIC_STEPPINGACTION_HH
#define SLIC_STEPPINGACTION_HH 1
+// slic
+#include "Module.hh"
+
// geant4
#include "G4UserSteppingAction.hh"
#include "G4Track.hh"
@@ -17,11 +20,16 @@
@class SteppingAction
@brief Implementation of G4UserSteppingAction.
*/
-class SteppingAction: public G4UserSteppingAction {
+class SteppingAction: public G4UserSteppingAction, Module {
public:
SteppingAction();
virtual ~SteppingAction();
virtual void UserSteppingAction(const G4Step*);
+private:
+ /**
+ * Check if a G4Track should be killed.
+ */
+ void checkKillTrack(const G4Step*);
};
}
slic/src
diff -u -r1.13 -r1.14
--- SteppingAction.cc 27 Nov 2012 19:32:19 -0000 1.13
+++ SteppingAction.cc 30 Apr 2013 23:08:37 -0000 1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/SteppingAction.cc,v 1.13 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/SteppingAction.cc,v 1.14 2013/04/30 23:08:37 jeremy Exp $
#include "SteppingAction.hh"
// slic
@@ -8,19 +8,34 @@
#include "G4UserRegionInformation.hh"
#include "TrackInformation.hh"
+// geant4
#include "G4UserSteppingAction.hh"
+#include "G4Track.hh"
namespace slic {
-SteppingAction::SteppingAction() {
+SteppingAction::SteppingAction() : Module("SteppingAction", false, true) {
}
SteppingAction::~SteppingAction() {
}
void SteppingAction::UserSteppingAction(const G4Step* aStep) {
- // TrajectoryManager's stepping action
+ /* TrajectoryManager's stepping action */
TrajectoryManager::instance()->stepping(aStep);
+
+ /* Check if the track should be killed. */
+ checkKillTrack(aStep);
}
+
+void SteppingAction::checkKillTrack(const G4Step* aStep) {
+ /* Check if the preStepPoint region has tracking killing enabled. */
+ G4UserRegionInformation* regionInfo = G4UserRegionInformation::getRegionInformation(aStep->GetPreStepPoint());
+ if (regionInfo->getKillTracks()) {
+ /* Kill the track if region track kill flag is set to true. */
+ log() << LOG::always << "Killing track: " << aStep->GetTrack()->GetTrackID() << LOG::done;
+ aStep->GetTrack()->SetTrackStatus(fStopAndKill);
+ }
}
+} // namespace slic