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