|
||||
File indexing completed on 2025-01-18 09:59:25
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4VParticleChange 0027 // 0028 // Class description: 0029 // 0030 // Abstract class for "Particle Change". 0031 // 0032 // The ParticleChange class contains the results after invocation 0033 // of a physics process. This includes final states of parent particle 0034 // (momentum, energy, etc) and secondary particles generated by the 0035 // interaction. 0036 // The tracking assumes that all the values of energy and momentum are 0037 // in global reference system, therefore all the needed Lorentz 0038 // transformations must have been already computed when filling the 0039 // data-members of this class. 0040 // 0041 // This abstract class has following four virtual methods: 0042 // virtual G4Step* UpdateStepForAtRest(G4Step* Step); 0043 // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 0044 // virtual G4Step* UpdateStepForPostStep(G4Step* Step); 0045 // virtual void Initialize(const G4Track&); 0046 // The UpdateStep methods return the pointer to the G4Step after updating 0047 // the given Step information by using final state information of the track 0048 // given by a physics process. 0049 // User must add methods to keep the final state information in the derived 0050 // class as well as implement UpdateStep() methods wished to use. 0051 // 0052 // The Initialize() methods are provided to refresh the final state 0053 // information and should be called by each process at the beginning of DoIt(). 0054 0055 // Author: Hisaya Kurashige, 23 March 1998 0056 // -------------------------------------------------------------------- 0057 #ifndef G4VParticleChange_hh 0058 #define G4VParticleChange_hh 1 0059 0060 #include <vector> 0061 #include "globals.hh" 0062 #include "G4ios.hh" 0063 #include "G4TrackStatus.hh" 0064 #include "G4SteppingControl.hh" 0065 #include "G4Step.hh" 0066 #include "G4Track.hh" 0067 0068 class G4VParticleChange 0069 { 0070 public: 0071 0072 G4VParticleChange(); 0073 0074 virtual ~G4VParticleChange() = default; 0075 0076 G4VParticleChange(const G4VParticleChange& right) = delete; 0077 G4VParticleChange& operator=(const G4VParticleChange& right) = delete; 0078 0079 // --- the following methods are for updating G4Step --- 0080 0081 virtual G4Step* UpdateStepForAtRest(G4Step* Step); 0082 virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 0083 virtual G4Step* UpdateStepForPostStep(G4Step* Step); 0084 // Return the pointer to the G4Step after updating the Step information 0085 // by using final state information of the track given by a physics 0086 // process 0087 0088 virtual void Initialize(const G4Track&); 0089 // This methods will be called by each process at the beginning 0090 // of DoIt() if necessary 0091 0092 // --- the following methods are for TruePathLength --- 0093 0094 inline G4double GetTrueStepLength() const; 0095 inline void ProposeTrueStepLength(G4double truePathLength); 0096 // Get/Propose theTrueStepLength 0097 0098 // --- the following methods are for LocalEnergyDeposit --- 0099 0100 inline G4double GetLocalEnergyDeposit() const; 0101 inline void ProposeLocalEnergyDeposit(G4double anEnergyPart); 0102 // Get/Propose the locally deposited energy 0103 0104 // --- the following methods are for nonIonizingEnergyDeposit --- 0105 0106 inline G4double GetNonIonizingEnergyDeposit() const; 0107 inline void ProposeNonIonizingEnergyDeposit(G4double anEnergyPart); 0108 // Get/Propose the non-ionizing deposited energy 0109 0110 // --- the following methods are for TrackStatus --- 0111 0112 inline G4TrackStatus GetTrackStatus() const; 0113 inline void ProposeTrackStatus(G4TrackStatus status); 0114 // Get/Propose the final TrackStatus of the current particle 0115 0116 inline const G4Track* GetCurrentTrack() const; 0117 // Get primary track pointer 0118 0119 // --- the following methods are for management of SteppingControl --- 0120 0121 inline G4SteppingControl GetSteppingControl() const; 0122 inline void ProposeSteppingControl(G4SteppingControl StepControlFlag); 0123 // Set/Propose a flag to control stepping manager behaviour 0124 0125 // --- the following methods are for management of initial/last step 0126 0127 inline G4bool GetFirstStepInVolume() const; 0128 inline G4bool GetLastStepInVolume() const; 0129 inline void ProposeFirstStepInVolume(G4bool flag); 0130 inline void ProposeLastStepInVolume(G4bool flag); 0131 0132 // --- the following methods are for management of secondaries --- 0133 0134 inline void Clear(); 0135 // Clear the contents of this objects 0136 // This method should be called after the Tracking(Stepping) 0137 // manager removes all secondaries in theListOfSecondaries 0138 0139 inline void SetNumberOfSecondaries(G4int totSecondaries); 0140 // SetNumberOfSecondaries must be called just before AddSecondary() 0141 // in order to secure memory space for theListOfSecondaries 0142 // This method resets theNumberOfSecondaries to zero 0143 // (that will be incremented at every AddSecondary() call) 0144 0145 inline G4int GetNumberOfSecondaries() const; 0146 // Returns the number of secondaries current stored in G4TrackFastVector 0147 0148 inline G4Track* GetSecondary(G4int anIndex) const; 0149 // Returns the pointer to the generated secondary particle, 0150 // which is specified by an Index, no check on boundary is performed 0151 0152 void AddSecondary(G4Track* aSecondary); 0153 // Adds a secondary particle to theListOfSecondaries 0154 0155 // --- the following methods are for management of weights --- 0156 0157 inline G4double GetWeight() const; 0158 inline G4double GetParentWeight() const; 0159 // Get weight of the parent (i.e. current) track 0160 0161 inline void ProposeWeight(G4double finalWeight); 0162 inline void ProposeParentWeight(G4double finalWeight); 0163 // Propose new weight of the parent (i.e. current) track 0164 // As for AlongStepDoIt, the parent weight will be set 0165 // in accumulated manner, i.e. - If two processes propose 0166 // weight of W1 and W2 respectively for the track with initial 0167 // weight of W0 the final weight is set to: (W1/W0) * (W2/W0) * W0 0168 0169 inline void SetSecondaryWeightByProcess(G4bool); 0170 inline G4bool IsSecondaryWeightSetByProcess() const; 0171 // In default (fSecondaryWeightByProcess flag is false), 0172 // the weight of secondary tracks will be set to the parent weight 0173 // If fSecondaryWeightByProcess flag is true, the weight of secondary 0174 // tracks will not be changed by the ParticleChange (i.e. the process 0175 // determine the secondary weight) 0176 // NOTE: 0177 // Make sure that only one process in AlongStepDoIt() proposes the 0178 // parent weight; if several processes in AlongStepDoIt() propose 0179 // the parent weight and add secondaties with fSecondaryWeightByProcess 0180 // is set to false, secondary weights may be wrong 0181 0182 void SetParentWeightByProcess(G4bool); 0183 G4bool IsParentWeightSetByProcess() const; 0184 // Obsolete 0185 0186 // --- Dump and debug methods --- 0187 0188 virtual void DumpInfo() const; 0189 // Print out information 0190 0191 inline void SetVerboseLevel(G4int vLevel); 0192 inline G4int GetVerboseLevel() const; 0193 0194 virtual G4bool CheckIt(const G4Track&); 0195 // CheckIt method for general control in debug regime 0196 0197 inline void ClearDebugFlag(); 0198 inline void SetDebugFlag(); 0199 inline G4bool GetDebugFlag() const; 0200 // CheckIt method is activated if debug flag is set 0201 // and 'G4VERBOSE' is defined 0202 0203 protected: 0204 0205 G4Step* UpdateStepInfo(G4Step* Step); 0206 // Update the G4Step specific attributes 0207 // (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength) 0208 0209 inline void InitializeLocalEnergyDeposit(); 0210 inline void InitializeSteppingControl(); 0211 inline void InitializeParentWeight(const G4Track&); 0212 inline void InitializeStatusChange(const G4Track&); 0213 inline void InitializeSecondaries(); 0214 inline void InitializeFromStep(const G4Step*); 0215 0216 inline G4double ComputeBeta(G4double kinEnergy); 0217 0218 G4bool CheckSecondary(G4Track&); 0219 // CheckSecondary method is provided to control secondary track 0220 // in debug regime 0221 0222 G4double GetAccuracyForWarning() const; 0223 G4double GetAccuracyForException() const; 0224 0225 protected: 0226 0227 static const G4double accuracyForWarning; 0228 static const G4double accuracyForException; 0229 static const G4int maxError; 0230 // accuracy levels 0231 0232 const G4Track* theCurrentTrack = nullptr; 0233 0234 std::vector<G4Track*> theListOfSecondaries; 0235 // The vector of secondaries 0236 0237 G4TrackStatus theStatusChange = fAlive; 0238 // The changed (final) track status of a given particle 0239 0240 G4SteppingControl theSteppingControlFlag = NormalCondition; 0241 // A flag to control stepping manager behavior 0242 0243 G4double theLocalEnergyDeposit = 0.0; 0244 // It represents the part of the energy lost for discrete 0245 // or semi-continuous processes which is due to secondaries 0246 // not generated because they would have been below their cut 0247 // threshold. 0248 // The sum of the locally deposited energy + the delta-energy 0249 // coming from the continuous processes gives the 0250 // total energy loss localized in the current Step 0251 0252 G4double theNonIonizingEnergyDeposit = 0.0; 0253 // Non-ionizing energu deposit is defined as a part of local 0254 // energy deposit, which does not cause ionization of atoms 0255 0256 G4double theTrueStepLength = 0.0; 0257 // The value of "True" Step Length 0258 0259 G4double theParentWeight = 1.0; 0260 // Weight ofparent track 0261 0262 G4double theParentGlobalTime = 0.0; 0263 // Global time of the parent. 0264 // This is used only for checking 0265 0266 G4int theNumberOfSecondaries = 0; 0267 // The total number of secondaries produced by each process. 0268 0269 G4int theSizeOftheListOfSecondaries = 0; 0270 // TheSizeOftheListOfSecondaries; 0271 0272 G4int verboseLevel = 1; 0273 // The Verbose level 0274 0275 G4int nError = 0; 0276 0277 G4bool theFirstStepInVolume = false; 0278 G4bool theLastStepInVolume = false; 0279 // Flag for initial/last step 0280 0281 G4bool isParentWeightProposed = false; 0282 // Flag for Weight of parent track 0283 G4bool fSetSecondaryWeightByProcess = false; 0284 // Flag for setting weight of secondaries 0285 0286 G4bool debugFlag = false; 0287 }; 0288 0289 #include "G4VParticleChange.icc" 0290 0291 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |