Geant4 11.2.2
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=nullptr, G4VParticleChange *particleChangeB=nullptr)
 
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 {nullptr}
 
G4int fNumberOfSecondaries {0}
 
G4bool fKillParents {false}
 
G4bool fParticleChangeIsSet {false}
 

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

Default constructor

◆ ~G4ITReactionChange()

G4ITReactionChange::~G4ITReactionChange ( )
virtual

Default destructor

Definition at line 40 of file G4ITReactionChange.cc.

41{
42 //dtor
43 delete fSecondaries;
44 fSecondaries = nullptr;
45}
std::vector< G4Track * > * fSecondaries

◆ G4ITReactionChange() [2/2]

G4ITReactionChange::G4ITReactionChange ( const G4ITReactionChange & other)
protected

Copy constructor

Parameters
otherObject to copy from

Definition at line 48 of file G4ITReactionChange.cc.

49{
50}

Member Function Documentation

◆ AddSecondary()

void G4ITReactionChange::AddSecondary ( G4Track * aSecondary)

Definition at line 97 of file G4ITReactionChange.cc.

98{
99 if (fSecondaries == nullptr) fSecondaries = new std::vector<G4Track*>();
100 fSecondaries->push_back(aTrack);
102}

◆ 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 110 of file G4ITReactionChange.cc.

111{
112 auto it = fParticleChange
113 .find(track);
114
115 if (it == fParticleChange.end()) return nullptr;
116 return it->second;
117}
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 != nullptr) return (*fSecondaries)[anIndex];
120 return nullptr;
121}

◆ GetTrackA()

const G4Track * G4ITReactionChange::GetTrackA ( )

Definition at line 119 of file G4ITReactionChange.cc.

120{
121 auto it = fParticleChange.begin();
122 if (it != fParticleChange.end())
123 {
124 return it->first;
125 }
126
127 G4ExceptionDescription exceptionDescription;
128 exceptionDescription
129 << "No track A found ! Have you initialized the ReactionChange ?";
130 G4Exception("G4ITReactionChange::GetTrackA", "ITReactionChange001",
131 FatalErrorInArgument, exceptionDescription);
132 return nullptr;
133}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription

◆ GetTrackB()

const G4Track * G4ITReactionChange::GetTrackB ( )

Definition at line 135 of file G4ITReactionChange.cc.

136{
137 auto it = fParticleChange.begin();
138 auto next = it++;
139 if (next == fParticleChange.end())
140 {
141 G4ExceptionDescription exceptionDescription;
142 exceptionDescription
143 << "No track B found ! Have you initialized the ReactionChange ?";
144 G4Exception("G4ITReactionChange::GetTrackB", "ITReactionChange002",
145 FatalErrorInArgument, exceptionDescription);
146 }
147
148 return it->first;
149}

◆ Initialize()

void G4ITReactionChange::Initialize ( const G4Track & trackA,
const G4Track & trackB,
G4VParticleChange * particleChangeA = nullptr,
G4VParticleChange * particleChangeB = nullptr )

Definition at line 60 of file G4ITReactionChange.cc.

64{
65 fParticleChange.clear();
66 fParticleChange[&trackA] = particleChangeA;
67 fParticleChange[&trackB] = particleChangeB;
68
69 if ((particleChangeA != nullptr) || (particleChangeB != nullptr))
70 {
71 G4bool test = (particleChangeA != nullptr) && (particleChangeB != nullptr);
72
73 if (!test)
74 {
75 G4ExceptionDescription exceptionDescription;
76 exceptionDescription << "If you give for one track a particleChange, ";
77 exceptionDescription
78 << "G4ITReactionChange is expecting that you give for both ";
79 exceptionDescription << "reacting tracks a particleChange.";
80 G4Exception("G4ITReactionChange::Initialize", "ITReactionChange001",
81 FatalErrorInArgument, exceptionDescription);
82 }
83
85
86 fParticleChange[&trackA]->Initialize(trackA);
87 fParticleChange[&trackB]->Initialize(trackB);
88 ;
89
90 }
91
92 fSecondaries = nullptr;
94 fKillParents = false;
95}
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 53 of file G4ITReactionChange.cc.

54{
55 if (this == &rhs) return *this; // handle self assignment
56 //assignment operator
57 return *this;
58}

◆ operator==()

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

◆ UpdateStepInfo()

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

Definition at line 104 of file G4ITReactionChange.cc.

105{
106 fParticleChange[stepA->GetTrack()]->UpdateStepForPostStep(stepA);
107 fParticleChange[stepB->GetTrack()]->UpdateStepForPostStep(stepB);
108}
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 {false}
protected

Definition at line 113 of file G4ITReactionChange.hh.

113{false};

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

◆ fNumberOfSecondaries

G4int G4ITReactionChange::fNumberOfSecondaries {0}
protected

Definition at line 112 of file G4ITReactionChange.hh.

112{0};

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

◆ fParticleChange

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

◆ fParticleChangeIsSet

G4bool G4ITReactionChange::fParticleChangeIsSet {false}
protected

Definition at line 114 of file G4ITReactionChange.hh.

114{false};

Referenced by Initialize().

◆ fSecondaries

std::vector<G4Track*>* G4ITReactionChange::fSecondaries {nullptr}
protected

Definition at line 111 of file G4ITReactionChange.hh.

111{nullptr};

Referenced by AddSecondary(), GetfSecondary(), GetSecondary(), Initialize(), and ~G4ITReactionChange().


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