20#include <G4IonTable.hh>
24#include <TVirtualMC.h>
25#include <TVirtualMCStack.h>
34 fDoExclusiveStep(false)
40 "Cannot create two instances of singleton.");
66 const G4Track& , G4double , G4ForceCondition* condition)
71 *condition = InActivated;
74 *condition = ExclusivelyForced;
77 *condition = StronglyForced;
86 const G4Track& track,
const G4Step& )
90 aParticleChange.Initialize(track);
94 Int_t currentTrackId =
fMCStack->GetCurrentTrackNumber();
96 aParticleChange.SetNumberOfSecondaries(
97 aParticleChange.GetNumberOfSecondaries() + nofTracksToPop);
99 for (G4int i = 0; i < nofTracksToPop; ++i) {
103 TParticle* particle =
fMCStack->PopNextTrack(itrack);
108 "TG4StackPopper",
"PostStepDoIt",
"No particle popped from stack!");
109 return &aParticleChange;
117 G4DynamicParticle* dynamicParticle =
119 if (!dynamicParticle) {
121 "Conversion from Root particle -> G4 particle failed.");
126 G4ThreeVector position =
130 G4Track* secondaryTrack =
new G4Track(dynamicParticle, time, position);
139 secondaryTrack->SetUserInformation(trackInformation);
142 aParticleChange.AddSecondary(secondaryTrack);
147 fMCStack->SetCurrentTrack(currentTrackId);
155 return &aParticleChange;
Definition of the TG4G3Units class.
Definition of the TG4ParticlesManager class.
Definition of the TG4StackPopper class.
static void Exception(const TString &className, const TString &methodName, const TString &text)
G4DynamicParticle * CreateDynamicParticle(const TParticle *particle) const
G4ThreeVector GetParticlePosition(const TParticle *particle) const
static TG4ParticlesManager * Instance()
The process which pops particles defined by user from the VMC stack and passes them to tracking.
G4bool HasPoppedTracks() const
void SetDoExclusiveStep(G4TrackStatus trackStatus)
static G4ThreadLocal TG4StackPopper * fgInstance
this instance
G4TrackStatus fTrackStatus
The track status to be restored after performing exclusive step.
TG4StackPopper(const G4String &processName="stackPopper")
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)
TVirtualMCStack * fMCStack
Cached pointer to thread-local VMC stack.
G4int fNofDoneTracks
the counter for popped tracks
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
virtual ~TG4StackPopper()