4 #include "G4ParticleTypes.hh" 23 oldpos = G4ThreeVector(0,0,0);
31 G4ThreeVector pos = aStep->GetPostStepPoint()->GetPosition();
32 G4Track* track = aStep->GetTrack();
33 string volname(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName());
37 fabs(pos.z()) >
max_z_pos ) track->SetTrackStatus(fStopAndKill);
40 track->SetTrackStatus(fStopAndKill);
43 if(track->GetMaterial()->GetName() ==
"Kryptonite")
45 track->SetTrackStatus(fStopAndKill);
49 if(track->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
51 if(track->GetLogicalVolumeAtVertex()->GetMaterial()->GetName() ==
"SemiMirror")
53 track->SetTrackStatus(fStopAndKill);
69 cout <<
" Track is stuck. PID: " << track->GetDefinition()->GetPDGEncoding() <<
" Volume: " 70 << volname <<
". Killing this track. " << endl;
71 cout <<
" Last step of : " << pos -
oldpos <<
" was at " << pos <<
" track id: " << track->GetTrackID() << endl;
73 track->SetTrackStatus(fStopAndKill);
84 int nsteps = aStep->GetTrack()->GetCurrentStepNumber();
85 if(nsteps >= 1000) aStep->GetTrack()->SetTrackStatus(fStopAndKill);
double max_x_pos
Max X Position in millimeters.
void UserSteppingAction(const G4Step *)
double Energy_cut
Set to the ENERGY_CUT from options. This avoids a billion lookups in the map.
gemc_opts gemcOpt
gemc options map
double max_y_pos
Max Y Position in millimeters.
double max_z_pos
Max Z Position in millimeters.
virtual ~MSteppingAction()
MSteppingAction(gemc_opts)
map< string, opts > args
Options map.