Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VParticleChange.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4VParticleChange
27//
28// Class description:
29//
30// Abstract class for "Particle Change".
31//
32// The ParticleChange class contains the results after invocation
33// of a physics process. This includes final states of parent particle
34// (momentum, energy, etc) and secondary particles generated by the
35// interaction.
36// The tracking assumes that all the values of energy and momentum are
37// in global reference system, therefore all the needed Lorentz
38// transformations must have been already computed when filling the
39// data-members of this class.
40//
41// This abstract class has following four virtual methods:
42// virtual G4Step* UpdateStepForAtRest(G4Step* Step);
43// virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
44// virtual G4Step* UpdateStepForPostStep(G4Step* Step);
45// virtual void Initialize(const G4Track&);
46// The UpdateStep methods return the pointer to the G4Step after updating
47// the given Step information by using final state information of the track
48// given by a physics process.
49// User must add methods to keep the final state information in the derived
50// class as well as implement UpdateStep() methods wished to use.
51//
52// The Initialize() methods are provided to refresh the final state
53// information and should be called by each process at the beginning of DoIt().
54
55// Author: Hisaya Kurashige, 23 March 1998
56// --------------------------------------------------------------------
57#ifndef G4VParticleChange_hh
58#define G4VParticleChange_hh 1
59
60#include <vector>
61#include "globals.hh"
62#include "G4ios.hh"
63#include "G4TrackStatus.hh"
64#include "G4SteppingControl.hh"
65#include "G4Step.hh"
66#include "G4Track.hh"
67
69{
70 public:
71
73
74 virtual ~G4VParticleChange() = default;
75
76 G4VParticleChange(const G4VParticleChange& right) = delete;
78
79 // --- the following methods are for updating G4Step ---
80
81 virtual G4Step* UpdateStepForAtRest(G4Step* Step);
82 virtual G4Step* UpdateStepForAlongStep(G4Step* Step);
83 virtual G4Step* UpdateStepForPostStep(G4Step* Step);
84 // Return the pointer to the G4Step after updating the Step information
85 // by using final state information of the track given by a physics
86 // process
87
88 virtual void Initialize(const G4Track&);
89 // This methods will be called by each process at the beginning
90 // of DoIt() if necessary
91
92 // --- the following methods are for TruePathLength ---
93
95 inline void ProposeTrueStepLength(G4double truePathLength);
96 // Get/Propose theTrueStepLength
97
98 // --- the following methods are for LocalEnergyDeposit ---
99
101 inline void ProposeLocalEnergyDeposit(G4double anEnergyPart);
102 // Get/Propose the locally deposited energy
103
104 // --- the following methods are for nonIonizingEnergyDeposit ---
105
107 inline void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart);
108 // Get/Propose the non-ionizing deposited energy
109
110 // --- the following methods are for TrackStatus ---
111
114 // Get/Propose the final TrackStatus of the current particle
115
116 inline const G4Track* GetCurrentTrack() const;
117 // Get primary track pointer
118
119 // --- the following methods are for management of SteppingControl ---
120
122 inline void ProposeSteppingControl(G4SteppingControl StepControlFlag);
123 // Set/Propose a flag to control stepping manager behaviour
124
125 // --- the following methods are for management of initial/last step
126
131
132 // --- the following methods are for management of secondaries ---
133
134 inline void Clear();
135 // Clear the contents of this objects
136 // This method should be called after the Tracking(Stepping)
137 // manager removes all secondaries in theListOfSecondaries
138
139 inline void SetNumberOfSecondaries(G4int totSecondaries);
140 // SetNumberOfSecondaries must be called just before AddSecondary()
141 // in order to secure memory space for theListOfSecondaries
142 // This method resets theNumberOfSecondaries to zero
143 // (that will be incremented at every AddSecondary() call)
144
146 // Returns the number of secondaries current stored in G4TrackFastVector
147
148 inline G4Track* GetSecondary(G4int anIndex) const;
149 // Returns the pointer to the generated secondary particle,
150 // which is specified by an Index, no check on boundary is performed
151
152 void AddSecondary(G4Track* aSecondary);
153 // Adds a secondary particle to theListOfSecondaries
154
155 // --- the following methods are for management of weights ---
156
157 inline G4double GetWeight() const;
158 inline G4double GetParentWeight() const;
159 // Get weight of the parent (i.e. current) track
160
161 inline void ProposeWeight(G4double finalWeight);
162 inline void ProposeParentWeight(G4double finalWeight);
163 // Propose new weight of the parent (i.e. current) track
164 // As for AlongStepDoIt, the parent weight will be set
165 // in accumulated manner, i.e. - If two processes propose
166 // weight of W1 and W2 respectively for the track with initial
167 // weight of W0 the final weight is set to: (W1/W0) * (W2/W0) * W0
168
171 // In default (fSecondaryWeightByProcess flag is false),
172 // the weight of secondary tracks will be set to the parent weight
173 // If fSecondaryWeightByProcess flag is true, the weight of secondary
174 // tracks will not be changed by the ParticleChange (i.e. the process
175 // determine the secondary weight)
176 // NOTE:
177 // Make sure that only one process in AlongStepDoIt() proposes the
178 // parent weight; if several processes in AlongStepDoIt() propose
179 // the parent weight and add secondaties with fSecondaryWeightByProcess
180 // is set to false, secondary weights may be wrong
181
184 // Obsolete
185
186 // --- Dump and debug methods ---
187
188 virtual void DumpInfo() const;
189 // Print out information
190
191 inline void SetVerboseLevel(G4int vLevel);
192 inline G4int GetVerboseLevel() const;
193
194 virtual G4bool CheckIt(const G4Track&);
195 // CheckIt method for general control in debug regime
196
197 inline void ClearDebugFlag();
198 inline void SetDebugFlag();
199 inline G4bool GetDebugFlag() const;
200 // CheckIt method is activated if debug flag is set
201 // and 'G4VERBOSE' is defined
202
203 protected:
204
206 // Update the G4Step specific attributes
207 // (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength)
208
211 inline void InitializeParentWeight(const G4Track&);
212 inline void InitializeStatusChange(const G4Track&);
214 inline void InitializeFromStep(const G4Step*);
215
216 inline G4double ComputeBeta(G4double kinEnergy);
217
219 // CheckSecondary method is provided to control secondary track
220 // in debug regime
221
224
225 protected:
226
229 static const G4int maxError;
230 // accuracy levels
231
232 const G4Track* theCurrentTrack = nullptr;
233
234 std::vector<G4Track*> theListOfSecondaries;
235 // The vector of secondaries
236
238 // The changed (final) track status of a given particle
239
241 // A flag to control stepping manager behavior
242
244 // It represents the part of the energy lost for discrete
245 // or semi-continuous processes which is due to secondaries
246 // not generated because they would have been below their cut
247 // threshold.
248 // The sum of the locally deposited energy + the delta-energy
249 // coming from the continuous processes gives the
250 // total energy loss localized in the current Step
251
253 // Non-ionizing energu deposit is defined as a part of local
254 // energy deposit, which does not cause ionization of atoms
255
257 // The value of "True" Step Length
258
260 // Weight ofparent track
261
263 // Global time of the parent.
264 // This is used only for checking
265
267 // The total number of secondaries produced by each process.
268
270 // TheSizeOftheListOfSecondaries;
271
273 // The Verbose level
274
276
279 // Flag for initial/last step
280
282 // Flag for Weight of parent track
284 // Flag for setting weight of secondaries
285
287};
288
289#include "G4VParticleChange.icc"
290
291#endif
G4SteppingControl
@ NormalCondition
G4TrackStatus
@ fAlive
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
Definition: G4Step.hh:62
G4double ComputeBeta(G4double kinEnergy)
G4VParticleChange(const G4VParticleChange &right)=delete
G4VParticleChange & operator=(const G4VParticleChange &right)=delete
void InitializeLocalEnergyDeposit()
G4bool GetFirstStepInVolume() const
void InitializeFromStep(const G4Step *)
G4double GetNonIonizingEnergyDeposit() const
G4double GetParentWeight() const
void InitializeSteppingControl()
virtual G4bool CheckIt(const G4Track &)
static const G4double accuracyForException
void InitializeStatusChange(const G4Track &)
void ProposeTrackStatus(G4TrackStatus status)
G4TrackStatus theStatusChange
const G4Track * GetCurrentTrack() const
G4SteppingControl theSteppingControlFlag
void SetSecondaryWeightByProcess(G4bool)
static const G4double accuracyForWarning
G4bool IsParentWeightSetByProcess() const
void ProposeLastStepInVolume(G4bool flag)
void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart)
G4SteppingControl GetSteppingControl() const
virtual G4Step * UpdateStepForAlongStep(G4Step *Step)
void ProposeWeight(G4double finalWeight)
virtual G4Step * UpdateStepForAtRest(G4Step *Step)
virtual void Initialize(const G4Track &)
G4double GetLocalEnergyDeposit() const
static const G4int maxError
G4bool GetLastStepInVolume() const
void SetVerboseLevel(G4int vLevel)
G4double theNonIonizingEnergyDeposit
virtual G4Step * UpdateStepForPostStep(G4Step *Step)
G4double GetAccuracyForException() const
G4int GetNumberOfSecondaries() const
void AddSecondary(G4Track *aSecondary)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetNumberOfSecondaries(G4int totSecondaries)
G4bool GetDebugFlag() const
void SetParentWeightByProcess(G4bool)
G4int GetVerboseLevel() const
G4double GetAccuracyForWarning() const
std::vector< G4Track * > theListOfSecondaries
virtual void DumpInfo() const
const G4Track * theCurrentTrack
G4double GetWeight() const
void InitializeSecondaries()
G4bool CheckSecondary(G4Track &)
G4Step * UpdateStepInfo(G4Step *Step)
void ProposeSteppingControl(G4SteppingControl StepControlFlag)
void ProposeParentWeight(G4double finalWeight)
void ProposeFirstStepInVolume(G4bool flag)
G4bool IsSecondaryWeightSetByProcess() const
G4Track * GetSecondary(G4int anIndex) const
void ProposeTrueStepLength(G4double truePathLength)
void InitializeParentWeight(const G4Track &)
G4TrackStatus GetTrackStatus() const
virtual ~G4VParticleChange()=default
G4double GetTrueStepLength() const