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

#include <G4ITReactionChange.hh>

Public Member Functions

 G4ITReactionChange ()
 
virtual ~G4ITReactionChange ()
 
void Initialize (const G4Track &, const G4Track &, G4VParticleChange *particleChangeA=0, G4VParticleChange *particleChangeB=0)
 
void AddSecondary (G4Track *aSecondary)
 
void KillParents (G4bool)
 
G4VParticleChangeGetParticleChange (const G4Track *)
 
void UpdateStepInfo (G4Step *, G4Step *)
 
G4TrackGetSecondary (G4int) const
 
std::vector< G4Track * > * GetfSecondary ()
 
G4int GetNumberOfSecondaries () const
 
G4bool WereParentsKilled () const
 
const G4TrackGetTrackA ()
 
const G4TrackGetTrackB ()
 

Protected Member Functions

 G4ITReactionChange (const G4ITReactionChange &other)
 
G4ITReactionChangeoperator= (const G4ITReactionChange &other)
 
G4bool operator== (const G4ITReactionChange &right) const
 
G4bool operator!= (const G4ITReactionChange &right) const
 

Protected Attributes

std::map< const G4Track *, G4VParticleChange * > fParticleChange
 
std::vector< G4Track * > * fSecondaries
 
G4int fNumberOfSecondaries
 
G4bool fKillParents
 
G4bool fParticleChangeIsSet
 

Detailed Description

Similar to G4ParticleChange, but deal with two tracks rather than one.

Definition at line 58 of file G4ITReactionChange.hh.

Constructor & Destructor Documentation

◆ G4ITReactionChange() [1/2]

G4ITReactionChange::G4ITReactionChange ( )

Default constructor

Definition at line 37 of file G4ITReactionChange.cc.

37 :
38 fSecondaries(0),
40 fKillParents(false),
42{
43 //ctor
44}
std::vector< G4Track * > * fSecondaries

◆ ~G4ITReactionChange()

G4ITReactionChange::~G4ITReactionChange ( )
virtual

Default destructor

Definition at line 46 of file G4ITReactionChange.cc.

47{
48 //dtor
49 delete fSecondaries;
50 fSecondaries = 0;
51}

◆ G4ITReactionChange() [2/2]

G4ITReactionChange::G4ITReactionChange ( const G4ITReactionChange other)
protected

Copy constructor

Parameters
otherObject to copy from

Definition at line 54 of file G4ITReactionChange.cc.

54 :
55 fSecondaries(0),
57 fKillParents(false),
59{
60 //copy ctor
61}

Member Function Documentation

◆ AddSecondary()

void G4ITReactionChange::AddSecondary ( G4Track aSecondary)

Definition at line 108 of file G4ITReactionChange.cc.

109{
110 if (fSecondaries == 0) fSecondaries = new std::vector<G4Track*>();
111 fSecondaries->push_back(aTrack);
113}

◆ GetfSecondary()

std::vector< G4Track * > * G4ITReactionChange::GetfSecondary ( )
inline

Definition at line 138 of file G4ITReactionChange.hh.

139{
140 return fSecondaries;
141}

◆ GetNumberOfSecondaries()

G4int G4ITReactionChange::GetNumberOfSecondaries ( ) const
inline

Definition at line 123 of file G4ITReactionChange.hh.

124{
126}

◆ GetParticleChange()

G4VParticleChange * G4ITReactionChange::GetParticleChange ( const G4Track track)

Definition at line 121 of file G4ITReactionChange.cc.

122{
123 std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange
124 .find(track);
125
126 if (it == fParticleChange.end()) return 0;
127 else return it->second;
128}
std::map< const G4Track *, G4VParticleChange * > fParticleChange

◆ GetSecondary()

G4Track * G4ITReactionChange::GetSecondary ( G4int  anIndex) const
inline

Definition at line 117 of file G4ITReactionChange.hh.

118{
119 if (fSecondaries) return (*fSecondaries)[anIndex];
120 else return 0;
121}

◆ GetTrackA()

const G4Track * G4ITReactionChange::GetTrackA ( )

Definition at line 130 of file G4ITReactionChange.cc.

131{
132 auto it = fParticleChange.begin();
133 if (it != fParticleChange.end())
134 {
135 return it->first;
136 }
137
138 G4ExceptionDescription exceptionDescription;
139 exceptionDescription
140 << "No track A found ! Have you initialized the ReactionChange ?";
141 G4Exception("G4ITReactionChange::GetTrackA", "ITReactionChange001",
142 FatalErrorInArgument, exceptionDescription);
143 return 0;
144}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40

◆ GetTrackB()

const G4Track * G4ITReactionChange::GetTrackB ( )

Definition at line 146 of file G4ITReactionChange.cc.

147{
148 auto it = fParticleChange.begin();
149 auto next = it++;
150 if (next == fParticleChange.end())
151 {
152 G4ExceptionDescription exceptionDescription;
153 exceptionDescription
154 << "No track B found ! Have you initialized the ReactionChange ?";
155 G4Exception("G4ITReactionChange::GetTrackB", "ITReactionChange002",
156 FatalErrorInArgument, exceptionDescription);
157 }
158
159 return it->first;
160}

◆ Initialize()

void G4ITReactionChange::Initialize ( const G4Track trackA,
const G4Track trackB,
G4VParticleChange particleChangeA = 0,
G4VParticleChange particleChangeB = 0 
)

Definition at line 71 of file G4ITReactionChange.cc.

75{
76 fParticleChange.clear();
77 fParticleChange[&trackA] = particleChangeA;
78 fParticleChange[&trackB] = particleChangeB;
79
80 if (particleChangeA || particleChangeB)
81 {
82 G4bool test = particleChangeA && particleChangeB;
83
84 if (test == false)
85 {
86 G4ExceptionDescription exceptionDescription;
87 exceptionDescription << "If you give for one track a particleChange, ";
88 exceptionDescription
89 << "G4ITReactionChange is expecting that you give for both ";
90 exceptionDescription << "reacting tracks a particleChange.";
91 G4Exception("G4ITReactionChange::Initialize", "ITReactionChange001",
92 FatalErrorInArgument, exceptionDescription);
93 }
94
96
97 fParticleChange[&trackA]->Initialize(trackA);
98 fParticleChange[&trackB]->Initialize(trackB);
99 ;
100
101 }
102
103 fSecondaries = 0;
105 fKillParents = false;
106}
bool G4bool
Definition: G4Types.hh:86

◆ KillParents()

void G4ITReactionChange::KillParents ( G4bool  kill)
inline

Definition at line 128 of file G4ITReactionChange.hh.

129{
130 fKillParents = kill;
131}

◆ operator!=()

G4bool G4ITReactionChange::operator!= ( const G4ITReactionChange right) const
protected

◆ operator=()

G4ITReactionChange & G4ITReactionChange::operator= ( const G4ITReactionChange other)
protected

Assignment operator

Parameters
otherObject to assign from
Returns
A reference to this

Definition at line 64 of file G4ITReactionChange.cc.

65{
66 if (this == &rhs) return *this; // handle self assignment
67 //assignment operator
68 return *this;
69}

◆ operator==()

G4bool G4ITReactionChange::operator== ( const G4ITReactionChange right) const
protected

◆ UpdateStepInfo()

void G4ITReactionChange::UpdateStepInfo ( G4Step stepA,
G4Step stepB 
)

Definition at line 115 of file G4ITReactionChange.cc.

116{
117 fParticleChange[stepA->GetTrack()]->UpdateStepForPostStep(stepA);
118 fParticleChange[stepB->GetTrack()]->UpdateStepForPostStep(stepB);
119}
G4Track * GetTrack() const

◆ WereParentsKilled()

G4bool G4ITReactionChange::WereParentsKilled ( ) const
inline

Definition at line 133 of file G4ITReactionChange.hh.

134{
135 return fKillParents;
136}

Member Data Documentation

◆ fKillParents

G4bool G4ITReactionChange::fKillParents
protected

Definition at line 113 of file G4ITReactionChange.hh.

Referenced by Initialize(), KillParents(), and WereParentsKilled().

◆ fNumberOfSecondaries

G4int G4ITReactionChange::fNumberOfSecondaries
protected

Definition at line 112 of file G4ITReactionChange.hh.

Referenced by AddSecondary(), GetNumberOfSecondaries(), and Initialize().

◆ fParticleChange

std::map<const G4Track*, G4VParticleChange*> G4ITReactionChange::fParticleChange
protected

◆ fParticleChangeIsSet

G4bool G4ITReactionChange::fParticleChangeIsSet
protected

Definition at line 114 of file G4ITReactionChange.hh.

Referenced by Initialize().

◆ fSecondaries

std::vector<G4Track*>* G4ITReactionChange::fSecondaries
protected

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