Geant4 9.6.0
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
 
G4TrackFastVectorGetfSecondary ()
 
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
 
G4TrackFastVectorfSecondaries
 
G4int fNumberOfSecondaries
 
G4bool fKillParents
 
G4bool fParticleChangeIsSet
 

Detailed Description

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

Definition at line 50 of file G4ITReactionChange.hh.

Constructor & Destructor Documentation

◆ G4ITReactionChange() [1/2]

G4ITReactionChange::G4ITReactionChange ( )

Default constructor

Definition at line 38 of file G4ITReactionChange.cc.

38 :
39 fSecondaries(0),
41 fKillParents(false),
43{
44 //ctor
45}
G4TrackFastVector * fSecondaries

◆ ~G4ITReactionChange()

G4ITReactionChange::~G4ITReactionChange ( )
virtual

Default destructor

Definition at line 47 of file G4ITReactionChange.cc.

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

◆ G4ITReactionChange() [2/2]

G4ITReactionChange::G4ITReactionChange ( const G4ITReactionChange other)
protected

Copy constructor

Parameters
otherObject to copy from

Definition at line 55 of file G4ITReactionChange.cc.

55 :
56 fSecondaries(0),
58 fKillParents(false),
60{
61 //copy ctor
62}

Member Function Documentation

◆ AddSecondary()

void G4ITReactionChange::AddSecondary ( G4Track aSecondary)

Definition at line 108 of file G4ITReactionChange.cc.

109{
111
112 // add a secondary after size check
114 {
117 }
118 else
119 {
120 G4cerr << "G4ITReactionChange::AddSecondary() Warning ";
121 G4cerr << "fSecondaries is full !! " << G4endl;
122 G4cerr << " The object will not be added in fSecondaries" << G4endl;
123 }
124}
G4FastVector< G4Track, G4TrackFastVectorSize > G4TrackFastVector
const G4int G4TrackFastVectorSize
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
void SetElement(G4int anIndex, Type *anElement)
Definition: G4FastVector.hh:76

Referenced by G4DNAMolecularReaction::MakeReaction().

◆ GetfSecondary()

G4TrackFastVector * G4ITReactionChange::GetfSecondary ( )
inline

Definition at line 130 of file G4ITReactionChange.hh.

131{
132 return fSecondaries;
133}

◆ GetNumberOfSecondaries()

G4int G4ITReactionChange::GetNumberOfSecondaries ( ) const
inline

Definition at line 115 of file G4ITReactionChange.hh.

116{
118}

◆ GetParticleChange()

G4VParticleChange * G4ITReactionChange::GetParticleChange ( const G4Track track)

Definition at line 132 of file G4ITReactionChange.cc.

133{
134 std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange.find(track);
135
136 if(it == fParticleChange.end()) return 0;
137 else return it ->second;
138}
std::map< const G4Track *, G4VParticleChange * > fParticleChange

◆ GetSecondary()

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

Definition at line 110 of file G4ITReactionChange.hh.

111{
112 return (*fSecondaries)[anIndex];
113}

◆ GetTrackA()

const G4Track * G4ITReactionChange::GetTrackA ( )

Definition at line 140 of file G4ITReactionChange.cc.

141{
142 std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange.begin();
143 if(it != fParticleChange.end())
144 {
145 return it->first;
146 }
147
148 G4ExceptionDescription exceptionDescription ;
149 exceptionDescription << "No track A found ! Have you initialized the ReactionChange ?";
150 G4Exception("G4ITReactionChange::GetTrackA","ITReactionChange001",
151 FatalErrorInArgument,exceptionDescription);
152 return 0;
153}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

◆ GetTrackB()

const G4Track * G4ITReactionChange::GetTrackB ( )

Definition at line 155 of file G4ITReactionChange.cc.

156{
157 std::map<const G4Track*, G4VParticleChange*>::iterator it = fParticleChange.begin();
158 std::map<const G4Track*, G4VParticleChange*>::iterator next = it++;
159 if(next == fParticleChange.end())
160 {
161 G4ExceptionDescription exceptionDescription ;
162 exceptionDescription << "No track B found ! Have you initialized the ReactionChange ?";
163 G4Exception("G4ITReactionChange::GetTrackB","ITReactionChange002",
164 FatalErrorInArgument,exceptionDescription);
165 }
166
167 return it->first;
168}

◆ Initialize()

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

Definition at line 72 of file G4ITReactionChange.cc.

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

Referenced by G4DNAMolecularReaction::MakeReaction().

◆ KillParents()

void G4ITReactionChange::KillParents ( G4bool  kill)
inline

Definition at line 120 of file G4ITReactionChange.hh.

121{
122 fKillParents = kill;
123}

Referenced by G4DNAMolecularReaction::MakeReaction().

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

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

◆ operator==()

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

◆ UpdateStepInfo()

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

Definition at line 126 of file G4ITReactionChange.cc.

127{
128 fParticleChange[stepA->GetTrack()]->UpdateStepForPostStep(stepA);
129 fParticleChange[stepB->GetTrack()]->UpdateStepForPostStep(stepB);
130}
G4Track * GetTrack() const

◆ WereParentsKilled()

G4bool G4ITReactionChange::WereParentsKilled ( ) const
inline

Definition at line 125 of file G4ITReactionChange.hh.

126{
127 return fKillParents ;
128}

Member Data Documentation

◆ fKillParents

G4bool G4ITReactionChange::fKillParents
protected

Definition at line 106 of file G4ITReactionChange.hh.

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

◆ fNumberOfSecondaries

G4int G4ITReactionChange::fNumberOfSecondaries
protected

Definition at line 105 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 107 of file G4ITReactionChange.hh.

Referenced by Initialize().

◆ fSecondaries

G4TrackFastVector* G4ITReactionChange::fSecondaries
protected

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