Geant4 10.7.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
41 if (tracks) Decay(tracks);
42}
void Decay(G4KineticTrackVector *tracks) const

Member Function Documentation

◆ Decay()

void G4DecayKineticTracks::Decay ( G4KineticTrackVector tracks) const

Definition at line 44 of file G4DecayKineticTracks.cc.

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

Referenced by G4DecayKineticTracks().


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