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 << 27 // 26 // 28 // Class description: << 27 // $Id: G4VParticleChange.hh,v 1.16 2007-03-25 22:54:52 kurasige Exp $ >> 28 // GEANT4 tag $Name: not supported by cvs2svn $ 29 // 29 // 30 // Abstract class for "Particle Change". << 30 // >> 31 // ------------------------------------------------------------ >> 32 // GEANT 4 class header file 31 // 33 // 32 // The ParticleChange class contains the resul << 33 // of a physics process. This includes final s << 34 // (momentum, energy, etc) and secondary parti << 35 // interaction. << 36 // The tracking assumes that all the values of << 37 // in global reference system, therefore all t << 38 // transformations must have been already comp << 39 // data-members of this class. << 40 // 34 // 41 // This abstract class has following four virt << 35 // ------------------------------------------------------------ >> 36 // Implemented for the new scheme 23 Mar. 1998 H.Kurahige >> 37 // >> 38 // Class Description >> 39 // This class is the abstract class for ParticleChange. >> 40 //- >> 41 // The ParticleChange class ontains the results after invocation >> 42 // of a physics process. This includes final states of parent >> 43 // particle (momentum, energy, etc) and secondary particles generated >> 44 // by the interaction. >> 45 // The tracking assumes that all the values of energy and >> 46 // momentum are in global reference system, therefore all the >> 47 // needed Lorentz transformations must have been already Done >> 48 // when filling the data-members of this class. >> 49 //- >> 50 //- >> 51 // This abstract class has following four virtual methods 42 // virtual G4Step* UpdateStepForAtRest(G4S 52 // virtual G4Step* UpdateStepForAtRest(G4Step* Step); 43 // virtual G4Step* UpdateStepForAlongStep( 53 // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 44 // virtual G4Step* UpdateStepForPostStep(G 54 // virtual G4Step* UpdateStepForPostStep(G4Step* Step); 45 // virtual void Initialize(const G4Track&) 55 // virtual void Initialize(const G4Track&); 46 // The UpdateStep methods return the pointer t << 56 // The UpdateStep methods return the pointer to the G4Step 47 // the given Step information by using final s << 57 // after updating the given Step information by using final state 48 // given by a physics process. << 58 // information of the track given by a physics process. 49 // User must add methods to keep the final sta << 59 // User must add methods to keep the final state information 50 // class as well as implement UpdateStep() met << 60 // in his derived class as well as implement UpdateStep methods 51 // << 61 // which he want to use. 52 // The Initialize() methods are provided to re << 62 //- 53 // information and should be called by each pr << 63 // The Initialize methods is provided to refresh the final >> 64 // state information and should be called by each process >> 65 // at the beginning of DoIt. >> 66 // >> 67 // ------------------------------------------------------------ >> 68 // Implement Event Biasing Scheme 9 Nov.,98 H.Kurashige >> 69 // add CheckIt 13 Apr.,99 H.Kurashige >> 70 // add accuracy leveles 5 May, 99 H.Kurashige >> 71 // add check secondaries 11 June, 03 H.Kurashige >> 72 // add new methods of ProposeXXX 08 May, 04 H.Kurashige >> 73 // remove obsolete methods of SetXXX 19 Sep, 04 H.Kurashige >> 74 // add flag for first/last step in volume 30 Oct. 2006 H.Kurashige >> 75 // add nonIonizingEnergyLoss 26 Mar 2007 H.Kurashige >> 76 // modify/fix bugs related to weight 17 Sep. 2011 H.Kurashige >> 77 // 54 78 55 // Author: Hisaya Kurashige, 23 March 1998 << 79 #ifndef G4VParticleChange_h 56 // ------------------------------------------- << 80 #define G4VParticleChange_h 1 57 #ifndef G4VParticleChange_hh << 58 #define G4VParticleChange_hh 1 << 59 81 60 #include <vector> << 61 #include "globals.hh" 82 #include "globals.hh" 62 #include "G4ios.hh" 83 #include "G4ios.hh" >> 84 #include <cmath> >> 85 >> 86 class G4Track; >> 87 class G4Step; >> 88 >> 89 #include "G4TrackFastVector.hh" 63 #include "G4TrackStatus.hh" 90 #include "G4TrackStatus.hh" 64 #include "G4SteppingControl.hh" 91 #include "G4SteppingControl.hh" 65 #include "G4Step.hh" << 66 #include "G4Track.hh" << 67 92 68 class G4VParticleChange << 93 >> 94 class G4VParticleChange 69 { 95 { 70 public: 96 public: 71 << 97 // default constructor 72 G4VParticleChange(); 98 G4VParticleChange(); 73 99 74 virtual ~G4VParticleChange() = default; << 100 // destructor >> 101 virtual ~G4VParticleChange(); 75 102 76 G4VParticleChange(const G4VParticleChange& << 103 // equal/unequal operator 77 G4VParticleChange& operator=(const G4VPart << 104 G4bool operator==(const G4VParticleChange &right) const; 78 << 105 G4bool operator!=(const G4VParticleChange &right) const; 79 // --- the following methods are for updatin << 106 // "equal" means that teo objects have the same pointer. 80 107 >> 108 protected: >> 109 // hide copy constructor and assignment operaor as protected >> 110 G4VParticleChange(const G4VParticleChange &right); >> 111 G4VParticleChange & operator=(const G4VParticleChange &right); >> 112 >> 113 public: // with description >> 114 // --- the following methods are for updating G4Step ----- 81 virtual G4Step* UpdateStepForAtRest(G4Step 115 virtual G4Step* UpdateStepForAtRest(G4Step* Step); 82 virtual G4Step* UpdateStepForAlongStep(G4S 116 virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 83 virtual G4Step* UpdateStepForPostStep(G4St 117 virtual G4Step* UpdateStepForPostStep(G4Step* Step); 84 // Return the pointer to the G4Step afte << 118 // Return the pointer to the G4Step after updating the Step information 85 // by using final state information of t << 119 // by using final state information of the track given by a physics 86 // process << 120 // process 87 << 121 88 virtual void Initialize(const G4Track&); << 122 protected: // with description 89 // This methods will be called by each p << 123 G4Step* UpdateStepInfo(G4Step* Step); 90 // of DoIt() if necessary << 124 // Update the G4Step specific attributes 91 << 125 // (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength) 92 // --- the following methods are for TruePat << 93 << 94 inline G4double GetTrueStepLength() const; << 95 inline void ProposeTrueStepLength(G4double << 96 // Get/Propose theTrueStepLength << 97 << 98 // --- the following methods are for LocalEn << 99 << 100 inline G4double GetLocalEnergyDeposit() co << 101 inline void ProposeLocalEnergyDeposit(G4do << 102 // Get/Propose the locally deposited ene << 103 << 104 // --- the following methods are for nonIoni << 105 << 106 inline G4double GetNonIonizingEnergyDeposi << 107 inline void ProposeNonIonizingEnergyDeposi << 108 // Get/Propose the non-ionizing deposite << 109 << 110 // --- the following methods are for TrackSt << 111 << 112 inline G4TrackStatus GetTrackStatus() cons << 113 inline void ProposeTrackStatus(G4TrackStat << 114 // Get/Propose the final TrackStatus of << 115 << 116 inline const G4Track* GetCurrentTrack() co << 117 // Get primary track pointer << 118 126 119 // --- the following methods are for managem << 120 127 121 inline G4SteppingControl GetSteppingContro << 128 public: // with description 122 inline void ProposeSteppingControl(G4Stepp << 129 virtual void Initialize(const G4Track&); 123 // Set/Propose a flag to control steppin << 130 // This methods will be called by each process at the beginning of DoIt >> 131 // if necessary. 124 132 125 // --- the following methods are for managem << 133 protected: >> 134 void InitializeTrueStepLength(const G4Track&); >> 135 void InitializeLocalEnergyDeposit(const G4Track&); >> 136 void InitializeSteppingControl(const G4Track&); >> 137 void InitializeParentWeight(const G4Track&); >> 138 >> 139 void InitializeStatusChange(const G4Track&); >> 140 void InitializeSecondaries(const G4Track&); >> 141 void InitializeStepInVolumeFlags(const G4Track&); >> 142 // ------------------------------------------------------ >> 143 >> 144 public: // with description >> 145 //---- the following methods are for TruePathLength ---- >> 146 G4double GetTrueStepLength() const; >> 147 void ProposeTrueStepLength(G4double truePathLength); >> 148 // Get/Propose theTrueStepLength >> 149 >> 150 //---- the following methods are for LocalEnergyDeposit ---- >> 151 G4double GetLocalEnergyDeposit() const; >> 152 void ProposeLocalEnergyDeposit(G4double anEnergyPart); >> 153 // Get/Propose the locally deposited energy >> 154 >> 155 //---- the following methods are for nonIonizingEnergyDeposit ---- >> 156 G4double GetNonIonizingEnergyDeposit() const; >> 157 void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart); >> 158 // Get/Propose the non-ionizing deposited energy >> 159 >> 160 //---- the following methods are for TrackStatus ----- >> 161 G4TrackStatus GetTrackStatus() const; >> 162 void ProposeTrackStatus(G4TrackStatus status); >> 163 // Get/Propose the final TrackStatus of the current particle. >> 164 // ------------------------------------------------------ >> 165 >> 166 //---- the following methods are for managements of SteppingControl -- >> 167 G4SteppingControl GetSteppingControl() const; >> 168 void ProposeSteppingControl(G4SteppingControl StepControlFlag); >> 169 // Set/Propose a flag to control stepping manager behavier >> 170 // ------------------------------------------------------ >> 171 >> 172 //---- the following methods are for managements of initial/last step >> 173 G4bool GetFirstStepInVolume() const; >> 174 G4bool GetLastStepInVolume() const; >> 175 void ProposeFirstStepInVolume(G4bool flag); >> 176 void ProposeLastStepInVolume(G4bool flag); >> 177 >> 178 //---- the following methods are for managements of secondaries -- >> 179 void Clear(); >> 180 // Clear the contents of this objects >> 181 // This method should be called after the Tracking(Stepping) >> 182 // manager removes all secondaries in theListOfSecondaries >> 183 >> 184 void SetNumberOfSecondaries(G4int totSecondaries); >> 185 // SetNumberOfSecondaries must be called just before AddSecondary() >> 186 // in order to secure memory space for theListOfSecondaries >> 187 // This method resets theNumberOfSecondaries to 0 >> 188 // (that will be incremented at every AddSecondary() call). >> 189 >> 190 G4int GetNumberOfSecondaries() const; >> 191 // Returns the number of secondaries current stored in >> 192 // G4TrackFastVector. >> 193 >> 194 G4Track* GetSecondary(G4int anIndex) const; >> 195 // Returns the pointer to the generated secondary particle >> 196 // which is specified by an Index. 126 197 127 inline G4bool GetFirstStepInVolume() const << 198 void AddSecondary(G4Track* aSecondary); 128 inline G4bool GetLastStepInVolume() const; << 199 // Add a secondary particle to theListOfSecondaries. 129 inline void ProposeFirstStepInVolume(G4boo << 200 // ------------------------------------------------------ 130 inline void ProposeLastStepInVolume(G4bool << 131 201 132 // --- the following methods are for managem << 202 G4double GetWeight() const; >> 203 G4double GetParentWeight() const ; >> 204 // Get weight of the parent (i.e. current) track >> 205 void ProposeWeight(G4double finalWeight); >> 206 void ProposeParentWeight(G4double finalWeight); >> 207 // Propse new weight of the parent (i.e. current) track >> 208 >> 209 void SetSecondaryWeightByProcess(G4bool); >> 210 G4bool IsSecondaryWeightSetByProcess() const; >> 211 // In default (fSecondaryWeightByProcess flag is true), >> 212 // the weight of secondary tracks will not be changed >> 213 // (i.e. the process determine the secodary weight) >> 214 // If fSecondaryWeightByProcess flag is false, the weight of >> 215 // secondary tracks will be set to the parent weight >> 216 >> 217 void SetParentWeightByProcess(G4bool); >> 218 // Weight of parent track can be changed only via ParticleChange >> 219 // If you set this flag to 'false', >> 220 // the weight of the parent track will not be modified, >> 221 // but the proposed weight is applied to secondaries >> 222 // (if SetSecondaryWeightByProcess is set to false) >> 223 G4bool IsParentWeightSetByProcess() const; 133 224 134 inline void Clear(); << 225 virtual void DumpInfo() const; 135 // Clear the contents of this objects << 226 // Print out information 136 // This method should be called after th << 137 // manager removes all secondaries in th << 138 227 139 inline void SetNumberOfSecondaries(G4int t << 228 void SetVerboseLevel(G4int vLevel); 140 // SetNumberOfSecondaries must be called << 229 G4int GetVerboseLevel() const; 141 // in order to secure memory space for t << 142 // This method resets theNumberOfSeconda << 143 // (that will be incremented at every Ad << 144 230 145 inline G4int GetNumberOfSecondaries() cons << 231 protected: 146 // Returns the number of secondaries cur << 147 232 148 inline G4Track* GetSecondary(G4int anIndex << 233 G4TrackFastVector* theListOfSecondaries; 149 // Returns the pointer to the generated << 234 // The vector of secondaries. 150 // which is specified by an Index, no ch << 151 235 152 void AddSecondary(G4Track* aSecondary); << 236 G4int theNumberOfSecondaries; 153 // Adds a secondary particle to theListO << 237 // The total number of secondaries produced by each process. 154 238 155 // --- the following methods are for managem << 239 G4int theSizeOftheListOfSecondaries; >> 240 // TheSizeOftheListOfSecondaries; 156 241 157 inline G4double GetWeight() const; << 242 G4TrackStatus theStatusChange; 158 inline G4double GetParentWeight() const; << 243 // The changed (final) track status of a given particle. 159 // Get weight of the parent (i.e. curren << 244 160 << 245 G4SteppingControl theSteppingControlFlag; 161 inline void ProposeWeight(G4double finalWe << 246 // a flag to control stepping manager behavior 162 inline void ProposeParentWeight(G4double f << 247 163 // Propose new weight of the parent (i.e << 248 G4double theLocalEnergyDeposit; 164 // As for AlongStepDoIt, the parent weig << 249 // It represents the part of the energy lost for discrete 165 // in accumulated manner, i.e. - If two << 250 // or semi-continuous processes which is due to secondaries 166 // weight of W1 and W2 respectively for << 251 // not generated because they would have been below their cut 167 // weight of W0 the final weight is set << 252 // threshold. 168 << 253 // The sum of the locally deposited energy + the delta-energy 169 inline void SetSecondaryWeightByProcess(G4 << 254 // coming from the continuous processes gives the 170 inline G4bool IsSecondaryWeightSetByProces << 255 // total energy loss localized in the current Step. 171 // In default (fSecondaryWeightByProcess << 256 172 // the weight of secondary tracks will b << 257 G4double theNonIonizingEnergyDeposit; 173 // If fSecondaryWeightByProcess flag is << 258 // non-ionizing energu deposit is defined as 174 // tracks will not be changed by the Par << 259 // a part of local energy deposit, which does not cause 175 // determine the secondary weight) << 260 // ionization of atoms 176 // NOTE: << 261 177 // Make sure that only one process in Al << 262 G4double theTrueStepLength; 178 // parent weight; if several processes i << 263 // The value of "True" Step Length 179 // the parent weight and add secondaties << 264 180 // is set to false, secondary weights ma << 265 G4double theParentWeight; 181 << 266 // Weight ofparent track 182 void SetParentWeightByProcess(G4bool); << 267 G4bool isParentWeightSetByProcess; 183 G4bool IsParentWeightSetByProcess() const; << 268 G4bool isParentWeightProposed; 184 // Obsolete << 269 // flags for Weight ofparent track >> 270 G4bool fSetSecondaryWeightByProcess; >> 271 // flag for setting weight of secondaries >> 272 >> 273 // flag for initial/last step >> 274 G4bool theFirstStepInVolume; >> 275 G4bool theLastStepInVolume; 185 276 186 // --- Dump and debug methods --- << 187 277 188 virtual void DumpInfo() const; << 278 G4int verboseLevel; 189 // Print out information << 279 // The Verbose level 190 << 191 inline void SetVerboseLevel(G4int vLevel); << 192 inline G4int GetVerboseLevel() const; << 193 280 >> 281 public: // with description >> 282 // CheckIt method is provided for debug 194 virtual G4bool CheckIt(const G4Track&); 283 virtual G4bool CheckIt(const G4Track&); 195 // CheckIt method for general control in << 284 196 << 285 // CheckIt method is activated 197 inline void ClearDebugFlag(); << 286 // if debug flag is set and 'G4VERBOSE' is defined 198 inline void SetDebugFlag(); << 287 void ClearDebugFlag(); 199 inline G4bool GetDebugFlag() const; << 288 void SetDebugFlag(); 200 // CheckIt method is activated if debug << 289 G4bool GetDebugFlag() const; 201 // and 'G4VERBOSE' is defined << 202 290 203 protected: 291 protected: 204 << 292 // CheckSecondary method is provided for debug 205 G4Step* UpdateStepInfo(G4Step* Step); << 206 // Update the G4Step specific attributes << 207 // (i.e. SteppingControl, LocalEnergyDep << 208 << 209 inline void InitializeLocalEnergyDeposit() << 210 inline void InitializeSteppingControl(); << 211 inline void InitializeParentWeight(const G << 212 inline void InitializeStatusChange(const G << 213 inline void InitializeSecondaries(); << 214 inline void InitializeFromStep(const G4Ste << 215 << 216 inline G4double ComputeBeta(G4double kinEn << 217 << 218 G4bool CheckSecondary(G4Track&); 293 G4bool CheckSecondary(G4Track&); 219 // CheckSecondary method is provided to << 294 220 // in debug regime << 221 << 222 G4double GetAccuracyForWarning() const; 295 G4double GetAccuracyForWarning() const; 223 G4double GetAccuracyForException() const; 296 G4double GetAccuracyForException() const; 224 297 225 protected: << 298 protected: 226 << 299 G4bool debugFlag; >> 300 >> 301 // accuracy levels 227 static const G4double accuracyForWarning; 302 static const G4double accuracyForWarning; 228 static const G4double accuracyForException << 303 static const G4double accuracyForException; 229 static const G4int maxError; << 230 // accuracy levels << 231 << 232 const G4Track* theCurrentTrack = nullptr; << 233 << 234 G4TrackStatus theStatusChange = fAlive; << 235 // The changed (final) track status of a << 236 << 237 G4SteppingControl theSteppingControlFlag = << 238 // A flag to control stepping manager be << 239 << 240 G4double theLocalEnergyDeposit = 0.0; << 241 // It represents the part of the energy << 242 // or semi-continuous processes which is << 243 // not generated because they would have << 244 // threshold. << 245 // The sum of the locally deposited ener << 246 // coming from the continuous processes << 247 // total energy loss localized in the cu << 248 << 249 G4double theNonIonizingEnergyDeposit = 0.0 << 250 // Non-ionizing energu deposit is define << 251 // energy deposit, which does not cause << 252 << 253 G4double theTrueStepLength = 0.0; << 254 // The value of "True" Step Length << 255 << 256 G4double theParentWeight = 1.0; << 257 // Weight ofparent track << 258 << 259 G4double theParentGlobalTime = 0.0; << 260 // Global time of the parent. << 261 // This is used only for checking << 262 << 263 G4int theNumberOfSecondaries = 0; << 264 // The total number of secondaries produ << 265 << 266 G4int theSizeOftheListOfSecondaries = 0; << 267 // TheSizeOftheListOfSecondaries; << 268 << 269 G4int verboseLevel = 1; << 270 // The Verbose level << 271 << 272 G4int nError = 0; << 273 << 274 G4bool theFirstStepInVolume = false; << 275 G4bool theLastStepInVolume = false; << 276 // Flag for initial/last step << 277 << 278 G4bool isParentWeightProposed = false; << 279 // Flag for Weight of parent track << 280 G4bool fSetSecondaryWeightByProcess = fals << 281 // Flag for setting weight of secondarie << 282 << 283 G4bool debugFlag = false; << 284 << 285 std::vector<G4Track*> theListOfSecondaries << 286 // The vector of secondaries << 287 }; 304 }; 288 305 >> 306 #include "G4Step.hh" >> 307 #include "G4Track.hh" 289 #include "G4VParticleChange.icc" 308 #include "G4VParticleChange.icc" 290 309 291 #endif 310 #endif 292 311