28#include <G4EmParameters.hh>
30#include <G4HadronicParameters.hh>
31#include <G4Neutron.hh>
32#include <G4SteppingManager.hh>
35#include <TVirtualMCApplication.h>
50 fMaxNofSteps(kMaxNofSteps),
51 fStandardVerboseLevel(-1),
61 "Cannot create two instances of singleton.");
84 G4Track* track = step->GetTrack();
85 G4int stepNumber = track->GetCurrentStepNumber();
88 if (stepNumber == 1) {
101 track->SetTrackStatus(fStopAndKill);
113 G4cout <<
"*** Particle reached max step number (" <<
fMaxNofSteps
114 <<
"). ***" << G4endl;
135 G4ThreeVector position = step->GetPostStepPoint()->GetPosition();
143 G4cout <<
"*** Particle has reached user defined tracking region. ***"
149 step->GetTrack()->SetTrackStatus(fStopAndKill);
159 if (step->GetSecondaryInCurrentStep()->size() == 2 &&
160 ((*step->GetSecondaryInCurrentStep())[0]->GetCreatorProcess()->GetProcessName() ==
165 G4double minEtotPair =
170 if (minEtotPair > 0. && (*step->GetSecondary())[0]->GetTotalEnergy() +
171 (*step->GetSecondary())[1]->GetTotalEnergy() <
192 if (step->GetTrack()->GetNextVolume() != 0) {
197 if (modifiedLimits) {
199 ->GetPhysicalVolume()
206 if (step->GetTrack()->GetTrackStatus() == fAlive) {
210 step->GetPostStepPoint()
211 ->GetPhysicalVolume()
213 ->GetSensitiveDetector());
219 ->GetPhysicalVolume()
221 ->GetSensitiveDetector();
243 G4cout <<
"*******************************************************"
244 <<
"**************************************************" << G4endl;
245 G4cout <<
"* G4Track Information: "
246 <<
" Particle = " << track->GetDefinition()->GetParticleName() <<
","
247 <<
" Track ID = " << track->GetTrackID() <<
","
248 <<
" Parent ID = " << track->GetParentID() << G4endl;
249 G4cout <<
"*******************************************************"
250 <<
"**************************************************" << G4endl;
254#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
255 G4cout << std::setw(5) <<
"Step#"
256 <<
" " << std::setw(8) <<
"X"
257 <<
" " << std::setw(8) <<
"Y"
258 <<
" " << std::setw(8) <<
"Z"
259 <<
" " << std::setw(9) <<
"KineE"
260 <<
" " << std::setw(8) <<
"dE"
261 <<
" " << std::setw(12) <<
"StepLeng"
262 <<
" " << std::setw(12) <<
"TrackLeng"
263 <<
" " << std::setw(12) <<
"NextVolume"
264 <<
" " << std::setw(8) <<
"ProcName" << G4endl;
266 G4cout << std::setw(5) <<
"Step#"
267 <<
" " << std::setw(8) <<
"X(mm)"
268 <<
" " << std::setw(8) <<
"Y(mm)"
269 <<
" " << std::setw(8) <<
"Z(mm)"
270 <<
" " << std::setw(9) <<
"KinE(MeV)"
271 <<
" " << std::setw(8) <<
"dE(MeV)"
272 <<
" " << std::setw(8) <<
"StepLeng"
273 <<
" " << std::setw(9) <<
"TrackLeng"
274 <<
" " << std::setw(11) <<
"NextVolume"
275 <<
" " << std::setw(8) <<
"ProcName" << G4endl;
291 auto gammaGeneral = G4EmParameters::Instance()->GeneralProcessActive();
292 auto neutronGeneral = G4HadronicParameters::Instance()->EnableNeutronGeneralProcess();
294 if ((! gammaGeneral) && (! neutronGeneral))
return;
296 auto particle = step->GetTrack()->GetParticleDefinition();
297 auto nofSecondaries = step->GetNumberOfSecondariesInCurrentStep();
298 if (((particle==G4Gamma::GammaDefinition() && gammaGeneral) ||
299 (particle==G4Neutron::NeutronDefinition() && neutronGeneral)) && nofSecondaries>0) {
303 step->GetPostStepPoint()->GetProcessDefinedStep();
307 auto secondaries = step->GetSecondary();
308 auto nofAllSecondaries = secondaries ->size();
309 for (
auto it = nofAllSecondaries - nofSecondaries; it < nofAllSecondaries; ++it) {
310 auto secTrack = (*secondaries )[it];
311 if (secTrack->GetCreatorProcess() != limiterProcess) {
312 secTrack->SetCreatorProcess(limiterProcess);
327#include "TGeoManager.h"
328#include "TGeoVolume.h"
380 if (step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary &&
390 if (step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary) {
396 if (
fStackPopper && step->GetTrack()->GetTrackStatus() != fAlive &&
397 step->GetTrack()->GetTrackStatus() != fSuspend &&
403 G4Track* track =
const_cast<G4Track*
>(step->GetTrack());
405 track->SetTrackStatus(fAlive);
Definition of the TG4G3Units class.
Definition of the TG4Globals class and basic container types.
Definition of the TG4Limits class.
Definition of the TG4SDServices class.
Definition of the TG4SensitiveDetector class.
Definition of the TG4SpecialControlsV2 class.
Definition of the TG4StackPopper class.
Definition of the TG4StepManager class.
Definition of the TG4SteppingAction class.
Definition of the TG4TrackManager class.
Definition of the TG4TrackingAction class.
G4double GetMinEtotPair() const
void UpdateRootTrack(const G4Step *step)
static void Exception(const TString &className, const TString &methodName, const TString &text)
const TG4G3CutVector * GetCutVector() const
TG4SensitiveDetector * GetSensitiveDetector(G4VSensitiveDetector *sd) const
static TG4SDServices * Instance()
Sensitive detector class for calling a user defined stepping function.
virtual G4bool ProcessHitsOnBoundary(G4Step *step)
Bool_t IsApplicable() const
G4bool HasPoppedTracks() const
void SetDoExclusiveStep(G4TrackStatus trackStatus)
static TG4StackPopper * Instance()
TG4Limits * GetCurrentLimits() const
static TG4StepManager * Instance()
TG4Limits * GetLimitsModifiedOnFly() const
void ProcessTrackIfOutOfRegion(const G4Step *step)
static G4ThreadLocal TG4SteppingAction * fgInstance
this instance
G4int fStandardVerboseLevel
standard tracking verbose level
TG4SpecialControlsV2 * fSpecialControls
the special controls manager
void ProcessTrackIfBelowCut(const G4Step *step)
G4bool fIsPairCut
control of cut on e+e- pair
G4int fLoopStepCounter
counter of step in looping
virtual void UserSteppingAction(const G4Step *step)
TG4StepManager * fStepManager
Cached pointer to thread-local step manager.
virtual void SteppingAction(const G4Step *step)
void PrintTrackInfo(const G4Track *track) const
G4int fMaxNofSteps
max number of allowed steps
virtual ~TG4SteppingAction()
void ProcessTrackIfLooping(const G4Step *step)
void ProcessTrackIfGeneralProcess(const G4Step *step)
TG4StackPopper * fStackPopper
Cached pointer to thread-local stack popper.
TG4GeoTrackManager fGeoTrackManager
manager for collecting TGeo tracks
G4bool fCollectTracks
control to collect Root tracks
TVirtualMCApplication * fMCApplication
Cached pointer to thread-local VMC application.
void ProcessTrackOnBoundary(const G4Step *step)
G4int fLoopVerboseLevel
tracking verbose level for looping particles
TG4TrackManager * fTrackManager
Cached pointer to thread-local track manager.
void SaveSecondaries(const G4Track *track, const G4TrackVector *secondaries)
TG4TrackSaveControl GetTrackSaveControl() const
static TG4TrackManager * Instance()
TG4TrackInformation * GetTrackInformation(const G4Track *track) const
void SetParentToTrackInformation(const G4Track *aTrack)
@ kSaveInStep
save in step