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 // G4ParticleChange 26 // G4ParticleChange 27 // 27 // 28 // Class description: 28 // Class description: 29 // 29 // 30 // Concrete class for ParticleChange containin 30 // Concrete class for ParticleChange containing the results after 31 // invocation of a physics process. 31 // invocation of a physics process. 32 // This includes final states of parent partic 32 // This includes final states of parent particle (momentum, energy, 33 // etc) and secondary particles generated by t 33 // etc) and secondary particles generated by the interaction. 34 // The tracking assumes that all the values of 34 // The tracking assumes that all the values of energy and momentum 35 // are in global reference system, therefore a 35 // are in global reference system, therefore all the needed Lorentz 36 // transformations must have been already comp 36 // transformations must have been already computed when filling the 37 // data-members of this class. 37 // data-members of this class. 38 // 38 // 39 // IMPORTANT NOTE: Despite the name, what this 39 // IMPORTANT NOTE: Despite the name, what this class stores/returns 40 // through its methods, are the "FINAL" values 40 // through its methods, are the "FINAL" values of the Position, 41 // Momentum, etc. 41 // Momentum, etc. 42 42 43 // Author: Hisaya Kurashige, 23 March 1998 43 // Author: Hisaya Kurashige, 23 March 1998 44 // ------------------------------------------- 44 // -------------------------------------------------------------------- 45 #ifndef G4ParticleChange_hh 45 #ifndef G4ParticleChange_hh 46 #define G4ParticleChange_hh 1 46 #define G4ParticleChange_hh 1 47 47 48 #include "globals.hh" 48 #include "globals.hh" 49 #include "G4ios.hh" 49 #include "G4ios.hh" 50 #include "G4ThreeVector.hh" 50 #include "G4ThreeVector.hh" >> 51 #include "G4ThreeVector.hh" 51 #include "G4VParticleChange.hh" 52 #include "G4VParticleChange.hh" 52 53 53 class G4DynamicParticle; 54 class G4DynamicParticle; 54 55 55 class G4ParticleChange : public G4VParticleCha 56 class G4ParticleChange : public G4VParticleChange 56 { 57 { 57 public: 58 public: 58 59 59 G4ParticleChange(); 60 G4ParticleChange(); 60 // Default constructor 61 // Default constructor 61 62 62 ~G4ParticleChange() override = default; << 63 virtual ~G4ParticleChange(); 63 // Destructor 64 // Destructor 64 65 65 G4ParticleChange(const G4ParticleChange& r << 66 G4bool operator==(const G4ParticleChange& right) const; 66 G4ParticleChange& operator=(const G4Partic << 67 G4bool operator!=(const G4ParticleChange& right) const; >> 68 // Equality operators 67 69 68 // --- the following methods are for updatin 70 // --- the following methods are for updating G4Step ----- 69 // Return the pointer to G4Step after updati 71 // Return the pointer to G4Step after updating the Step information 70 // by using final state of the track given b 72 // by using final state of the track given by a physics process 71 73 72 G4Step* UpdateStepForAlongStep(G4Step* Ste << 74 virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 73 // A physics process gives the final sta 75 // A physics process gives the final state of the particle 74 // relative to the initial state at the 76 // relative to the initial state at the beginning of the Step, 75 // i.e., based on information of G4Track 77 // i.e., based on information of G4Track (or equivalently 76 // the PreStepPoint). 78 // the PreStepPoint). 77 // In this method, the differences (delt 79 // In this method, the differences (delta) between these two states 78 // are calculated, and are accumulated i 80 // are calculated, and are accumulated in PostStepPoint. 79 // Take note that the return type of Get 81 // Take note that the return type of GetMomentumChange() is a 80 // pointer to G4ParticleMomentum. Also i 82 // pointer to G4ParticleMomentum. Also it is a normalized 81 // momentum vector 83 // momentum vector 82 84 83 G4Step* UpdateStepForAtRest(G4Step* Step) << 85 virtual G4Step* UpdateStepForAtRest(G4Step* Step); 84 G4Step* UpdateStepForPostStep(G4Step* Step << 86 virtual G4Step* UpdateStepForPostStep(G4Step* Step); 85 // A physics process gives the final sta 87 // A physics process gives the final state of the particle 86 // based on information of G4Track (or e 88 // based on information of G4Track (or equivalently the PreStepPoint) 87 89 88 void Initialize(const G4Track&) override; << 90 virtual void Initialize(const G4Track&); 89 // Initialize all propoerties by using G 91 // Initialize all propoerties by using G4Track information 90 92 91 // --- methods to keep information of the fi 93 // --- methods to keep information of the final state --- 92 // 94 // 93 // The ProposeXXX methods store (and return 95 // The ProposeXXX methods store (and return in GetXXX methods) 94 // the "FINAL" values of the Position, Mome 96 // the "FINAL" values of the Position, Momentum, etc. 95 97 96 inline const G4ThreeVector* GetMomentumDir << 98 const G4ThreeVector* GetMomentumDirection() const; 97 inline void ProposeMomentumDirection(G4dou << 99 void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz); 98 inline void ProposeMomentumDirection(const << 100 void ProposeMomentumDirection(const G4ThreeVector& Pfinal); 99 // Get/Propose the MomentumDirection vec 101 // Get/Propose the MomentumDirection vector: it is the final momentum 100 // direction 102 // direction 101 103 102 inline const G4ThreeVector* GetPolarizatio << 104 const G4ThreeVector* GetPolarization() const; 103 inline void ProposePolarization(G4double P << 105 void ProposePolarization(G4double Px, G4double Py, G4double Pz); 104 inline void ProposePolarization(const G4Th << 106 void ProposePolarization(const G4ThreeVector& finalPoralization); 105 // Get/Propose the final Polarization ve 107 // Get/Propose the final Polarization vector 106 108 107 inline G4double GetEnergy() const; << 109 G4double GetEnergy() const; 108 inline void ProposeEnergy(G4double finalEn << 110 void ProposeEnergy(G4double finalEnergy); 109 // Get/Propose the final kinetic energy 111 // Get/Propose the final kinetic energy of the current particle 110 112 111 inline G4double GetVelocity() const; << 113 G4double GetVelocity() const; 112 inline void ProposeVelocity(G4double final << 114 void ProposeVelocity(G4double finalVelocity); 113 // Get/Propose the final velocity of the 115 // Get/Propose the final velocity of the current particle 114 116 115 inline G4double GetProperTime() const; << 117 G4double GetProperTime() const; 116 inline void ProposeProperTime(G4double fin << 118 void ProposeProperTime(G4double finalProperTime); 117 // Get/Propose the final ProperTime 119 // Get/Propose the final ProperTime 118 120 119 inline const G4ThreeVector* GetPosition() << 121 const G4ThreeVector* GetPosition() const; 120 inline void ProposePosition(G4double x, G4 << 122 void ProposePosition(G4double x, G4double y, G4double z); 121 inline void ProposePosition(const G4ThreeV << 123 void ProposePosition(const G4ThreeVector& finalPosition); 122 // Get/Propose the final position of the 124 // Get/Propose the final position of the current particle 123 125 124 inline void ProposeGlobalTime(G4double t); << 126 void ProposeGlobalTime(G4double t); 125 inline void ProposeLocalTime(G4double t); << 127 void ProposeLocalTime(G4double t); 126 // Get/Propose the final global/local Ti 128 // Get/Propose the final global/local Time. 127 // NOTE: DO NOT INVOKE both methods in a 129 // NOTE: DO NOT INVOKE both methods in a step 128 // Each method affects both local 130 // Each method affects both local and global time 129 131 130 inline G4double GetGlobalTime(G4double tim << 132 G4double GetGlobalTime(G4double timeDelay = 0.0) const; 131 inline G4double GetLocalTime(G4double time << 133 G4double GetLocalTime(G4double timeDelay = 0.0) const; 132 // Convert the time delay to the glocbal 134 // Convert the time delay to the glocbal/local time. 133 // Can get the final global/local time w 135 // Can get the final global/local time without argument 134 136 135 inline G4double GetMass() const; << 137 G4double GetMass() const; 136 inline void ProposeMass(G4double finalMass << 138 void ProposeMass(G4double finalMass); 137 // Get/Propose the final dynamical mass 139 // Get/Propose the final dynamical mass in G4DynamicParticle 138 140 139 inline G4double GetCharge() const; << 141 G4double GetCharge() const; 140 inline void ProposeCharge(G4double finalCh << 142 void ProposeCharge(G4double finalCharge); 141 // Get/Propose the final dynamical charg 143 // Get/Propose the final dynamical charge in G4DynamicParticle 142 144 143 inline G4double GetMagneticMoment() const; << 145 G4double GetMagneticMoment() const; 144 inline void ProposeMagneticMoment(G4double << 146 void ProposeMagneticMoment(G4double finalMagneticMoment); 145 // Get/Propose the final MagneticMoment 147 // Get/Propose the final MagneticMoment in G4DynamicParticle 146 148 147 inline G4ThreeVector << 149 G4ThreeVector GetGlobalPosition(const G4ThreeVector& displacement) const; 148 GetGlobalPosition(const G4ThreeVector& dis << 149 // Convert the position displacement to 150 // Convert the position displacement to the global position 150 151 151 inline G4ThreeVector CalcMomentum(G4double << 152 G4ThreeVector CalcMomentum(G4double energy, G4ThreeVector direction, 152 G4double << 153 G4double mass) const; 153 // Calculate momentum by using Energy, M 154 // Calculate momentum by using Energy, Momentum Direction, and Mass 154 155 155 // --- methods for adding secondaries --- 156 // --- methods for adding secondaries --- 156 157 157 void AddSecondary(G4Track* aSecondary); 158 void AddSecondary(G4Track* aSecondary); 158 // Add a secondary particle to theListOf 159 // Add a secondary particle to theListOfSecondaries 159 160 160 void AddSecondary(G4DynamicParticle* aSeco 161 void AddSecondary(G4DynamicParticle* aSecondary, 161 G4bool IsGoodForTracking 162 G4bool IsGoodForTracking = false); 162 // Add a secondary particle to theListOf 163 // Add a secondary particle to theListOfSecondaries. 163 // Position and time are same as thePosi 164 // Position and time are same as thePositionChange and theTimeChange 164 165 165 void AddSecondary(G4DynamicParticle* aSeco 166 void AddSecondary(G4DynamicParticle* aSecondary, G4ThreeVector position, 166 G4bool IsGoodForTracking 167 G4bool IsGoodForTracking = false); 167 // Add a secondary particle to theListOf 168 // Add a secondary particle to theListOfSecondaries. 168 // Global time are same as theTimeChange 169 // Global time are same as theTimeChange and theTimeChange 169 170 170 void AddSecondary(G4DynamicParticle* aSeco 171 void AddSecondary(G4DynamicParticle* aSecondary, G4double time, 171 G4bool IsGoodForTracking 172 G4bool IsGoodForTracking = false); 172 // Add a secondary particle to theListOf 173 // Add a secondary particle to theListOfSecondaries. 173 // Position and are same as thePositionC 174 // Position and are same as thePositionChange 174 175 175 // --- Dump and debug methods --- 176 // --- Dump and debug methods --- 176 177 177 void DumpInfo() const override; << 178 virtual void DumpInfo() const; >> 179 >> 180 virtual G4bool CheckIt(const G4Track&); 178 181 179 protected: 182 protected: 180 183 >> 184 G4ParticleChange(const G4ParticleChange& right); >> 185 G4ParticleChange& operator=(const G4ParticleChange& right); >> 186 // Hidden copy constructor and assignment operator >> 187 181 G4Step* UpdateStepInfo(G4Step* Step); 188 G4Step* UpdateStepInfo(G4Step* Step); 182 // Update the G4Step specific attributes 189 // Update the G4Step specific attributes 183 // (i.e. SteppingControl, LocalEnergyDep 190 // (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength) 184 191 185 G4ThreeVector theMomentumDirectionChange; 192 G4ThreeVector theMomentumDirectionChange; 186 // It is the vector containing the final 193 // It is the vector containing the final momentum direction 187 // after the invoked process. The applic 194 // after the invoked process. The application of the change 188 // of the momentum direction of the part 195 // of the momentum direction of the particle is not done here. 189 // The responsibility to apply the chang 196 // The responsibility to apply the change is up to the entity 190 // which invoked the process 197 // which invoked the process 191 198 192 G4ThreeVector thePolarizationChange; 199 G4ThreeVector thePolarizationChange; 193 // The changed (final) polarization of a 200 // The changed (final) polarization of a given track 194 201 195 G4double theEnergyChange = 0.0; 202 G4double theEnergyChange = 0.0; 196 // The final kinetic energy of the curre 203 // The final kinetic energy of the current track 197 204 198 G4double theVelocityChange = 0.0; 205 G4double theVelocityChange = 0.0; 199 G4bool isVelocityChanged = false; 206 G4bool isVelocityChanged = false; 200 // The final velocity of the current tra 207 // The final velocity of the current track 201 208 202 G4ThreeVector thePositionChange; 209 G4ThreeVector thePositionChange; 203 // The changed (final) position of a giv 210 // The changed (final) position of a given track 204 211 205 G4double theGlobalTime0 = 0.0; 212 G4double theGlobalTime0 = 0.0; 206 // The global time at Initial 213 // The global time at Initial 207 G4double theLocalTime0 = 0.0; 214 G4double theLocalTime0 = 0.0; 208 // The local time at Initial 215 // The local time at Initial 209 216 210 G4double theTimeChange = 0.0; 217 G4double theTimeChange = 0.0; 211 // The change of local time of a given p 218 // The change of local time of a given particle 212 219 213 G4double theProperTimeChange = 0.0; 220 G4double theProperTimeChange = 0.0; 214 // The changed (final) proper time of a 221 // The changed (final) proper time of a given track 215 222 216 G4double theMassChange = 0.0; 223 G4double theMassChange = 0.0; 217 // The Changed (final) mass of a given t 224 // The Changed (final) mass of a given track 218 225 219 G4double theChargeChange = 0.0; 226 G4double theChargeChange = 0.0; 220 // The Changed (final) charge of a given 227 // The Changed (final) charge of a given track 221 228 222 G4double theMagneticMomentChange = 0.0; 229 G4double theMagneticMomentChange = 0.0; 223 // The Changed (final) MagneticMoment of 230 // The Changed (final) MagneticMoment of a given track >> 231 >> 232 const G4Track* theCurrentTrack = nullptr; 224 }; 233 }; 225 234 226 #include "G4ParticleChange.icc" 235 #include "G4ParticleChange.icc" 227 236 228 #endif 237 #endif 229 238