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