Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DecayKineticTracks Class Reference

#include <G4DecayKineticTracks.hh>

Public Member Functions

 G4DecayKineticTracks (G4KineticTrackVector *tracks=0)
 
void Decay (G4KineticTrackVector *tracks) const
 

Detailed Description

Definition at line 38 of file G4DecayKineticTracks.hh.

Constructor & Destructor Documentation

◆ G4DecayKineticTracks()

G4DecayKineticTracks::G4DecayKineticTracks ( G4KineticTrackVector tracks = 0)

Definition at line 39 of file G4DecayKineticTracks.cc.

39 {
40 if (tracks) Decay(tracks);
41}
void Decay(G4KineticTrackVector *tracks) const

Member Function Documentation

◆ Decay()

void G4DecayKineticTracks::Decay ( G4KineticTrackVector tracks) const

Definition at line 43 of file G4DecayKineticTracks.cc.

43 {
44 if (!tracks) return;
45
46 G4KineticTrackVector* daughters = 0;
47 for (size_t i=0; i<tracks->size(); ++i) {
48 G4KineticTrack* track = (*tracks)[i];
49 if (!track) continue;
50
51 // Select decay of current track, put daughters at end of vector
52 daughters = track->GetDefinition()->IsShortLived() ? track->Decay() : 0;
53 if (daughters) {
54 tracks->insert(tracks->end(), daughters->begin(), daughters->end());
55 delete track; // Remove parent track
56 delete daughters;
57 (*tracks)[i] = NULL; // Flag parent's slot for removal
58 }
59 }
60
61 // Find and remove null pointers created by decays above
62 for (int j=tracks->size()-1; j>=0; --j) {
63 if (NULL == (*tracks)[j]) tracks->erase(tracks->begin()+j);
64 }
65}
G4KineticTrackVector * Decay()
G4ParticleDefinition * GetDefinition() const

Referenced by G4DecayKineticTracks().


The documentation for this class was generated from the following files: