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 // G4ParticleChangeForLoss 26 // G4ParticleChangeForLoss 27 // 27 // 28 // Class description: 28 // Class description: 29 // 29 // 30 // Concrete class for ParticleChange for Energ 30 // Concrete class for ParticleChange for EnergyLoss. 31 31 32 // Author: Hisaya Kurashige, 23 March 1998 32 // Author: Hisaya Kurashige, 23 March 1998 33 // Revision: Vladimir Ivantchenko, 16 January 33 // Revision: Vladimir Ivantchenko, 16 January 2004 34 // 24 August 2 << 35 // ------------------------------------------- 34 // -------------------------------------------------------------------- 36 #ifndef G4ParticleChangeForLoss_hh 35 #ifndef G4ParticleChangeForLoss_hh 37 #define G4ParticleChangeForLoss_hh 1 36 #define G4ParticleChangeForLoss_hh 1 38 37 >> 38 #include "globals.hh" >> 39 #include "G4ios.hh" 39 #include "G4VParticleChange.hh" 40 #include "G4VParticleChange.hh" 40 #include "G4DynamicParticle.hh" << 41 41 42 class G4ParticleChangeForLoss final : public G << 42 class G4DynamicParticle; 43 { << 44 public: << 45 43 46 G4ParticleChangeForLoss(); << 44 class G4ParticleChangeForLoss : public G4VParticleChange >> 45 { >> 46 public: 47 47 48 ~G4ParticleChangeForLoss() override = defaul << 48 G4ParticleChangeForLoss(); >> 49 // Default constructor 49 50 50 G4ParticleChangeForLoss(const G4ParticleChan << 51 virtual ~G4ParticleChangeForLoss(); 51 G4ParticleChangeForLoss& operator=(const G4P << 52 // Destructor 52 53 53 // --- the following methods are for updatin 54 // --- the following methods are for updating G4Step ----- 54 55 55 G4Step* UpdateStepForAlongStep(G4Step* step) << 56 G4Step* UpdateStepForAlongStep(G4Step* Step); 56 G4Step* UpdateStepForPostStep(G4Step* step) << 57 G4Step* UpdateStepForPostStep(G4Step* Step); >> 58 // A physics process gives the final state of the particle >> 59 // based on information of G4Track >> 60 >> 61 void InitializeForAlongStep(const G4Track&); >> 62 void InitializeForPostStep(const G4Track&); >> 63 // Initialize all properties by using G4Track information >> 64 >> 65 inline G4double GetProposedCharge() const; >> 66 inline void SetProposedCharge(G4double theCharge); >> 67 // Get/Set theCharge >> 68 >> 69 inline G4double GetCharge() const; >> 70 inline void ProposeCharge(G4double finalCharge); >> 71 // Get/Propose the final dynamical charge in G4DynamicParticle >> 72 >> 73 inline G4double GetProposedKineticEnergy() const; >> 74 inline void SetProposedKineticEnergy(G4double proposedKinEnergy); >> 75 // Get/Set the final kinetic energy of the current particle >> 76 >> 77 inline const G4ThreeVector& GetProposedMomentumDirection() const; >> 78 inline void SetProposedMomentumDirection(const G4ThreeVector& dir); >> 79 inline const G4ThreeVector& GetMomentumDirection() const; >> 80 inline void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz); >> 81 inline void ProposeMomentumDirection(const G4ThreeVector& Pfinal); >> 82 // Get/Propose the MomentumDirection vector: it is the final momentum >> 83 // direction >> 84 >> 85 inline const G4ThreeVector& GetProposedPolarization() const; >> 86 inline void ProposePolarization(const G4ThreeVector& dir); >> 87 inline void ProposePolarization(G4double Px, G4double Py, G4double Pz); >> 88 >> 89 inline const G4Track* GetCurrentTrack() const; >> 90 >> 91 inline void SetLowEnergyLimit(G4double elimit); 57 92 58 // Initialize all used properties << 93 virtual void DumpInfo() const; 59 inline void InitializeForAlongStep(const G4T << 60 inline void InitializeForPostStep(const G4Tr << 61 94 62 // Get/Set dynamic charge << 95 virtual G4bool CheckIt(const G4Track&); 63 inline G4double GetProposedCharge() const; << 64 inline void SetProposedCharge(G4double theCh << 65 96 66 // Get/Set the final kinetic energy of the c << 97 protected: 67 inline G4double GetProposedKineticEnergy() c << 68 inline void SetProposedKineticEnergy(G4doubl << 69 98 70 // Get/Propose the MomentumDirection vector: << 99 G4ParticleChangeForLoss(const G4ParticleChangeForLoss& right); 71 // direction << 100 G4ParticleChangeForLoss& operator=(const G4ParticleChangeForLoss& right); 72 inline const G4ThreeVector& GetProposedMomen << 101 // Hidden copy constructor and assignment operator 73 inline void SetProposedMomentumDirection(con << 74 inline void ProposeMomentumDirection(const G << 75 102 76 inline const G4ThreeVector& GetProposedPolar << 103 private: 77 inline void ProposePolarization(const G4Thre << 78 inline void ProposePolarization(G4double Px, << 79 104 80 void DumpInfo() const final; << 105 const G4Track* currentTrack = nullptr; >> 106 // The pointer to G4Track 81 107 82 private: << 108 G4double proposedKinEnergy = 0.0; >> 109 // The final kinetic energy of the current particle 83 110 84 G4double proposedKinEnergy = 0.0; << 111 G4double lowEnergyLimit = 0.0; 85 // The final kinetic energy of the current p << 112 // The limit kinetic energy below which particle is stopped 86 113 87 G4double currentCharge = 0.0; << 114 G4double currentCharge = 0.0; 88 // The final charge of the current parti 115 // The final charge of the current particle 89 116 90 G4ThreeVector proposedMomentumDirection; << 117 G4ThreeVector proposedMomentumDirection; 91 // The final momentum direction of the curre << 118 // The final momentum direction of the current particle 92 119 93 G4ThreeVector proposedPolarization; << 120 G4ThreeVector proposedPolarization; 94 // The final polarization of the current par << 121 // The final polarization of the current particle 95 }; 122 }; 96 123 97 // ---------------------- 124 // ---------------------- 98 // Inline methods 125 // Inline methods 99 // ---------------------- 126 // ---------------------- 100 127 101 inline 128 inline 102 G4double G4ParticleChangeForLoss::GetProposedK 129 G4double G4ParticleChangeForLoss::GetProposedKineticEnergy() const 103 { 130 { 104 return proposedKinEnergy; 131 return proposedKinEnergy; 105 } 132 } 106 133 107 inline 134 inline 108 void G4ParticleChangeForLoss::SetProposedKinet 135 void G4ParticleChangeForLoss::SetProposedKineticEnergy(G4double energy) 109 { 136 { 110 proposedKinEnergy = energy; 137 proposedKinEnergy = energy; 111 } 138 } 112 139 113 inline G4double G4ParticleChangeForLoss::GetPr << 140 inline >> 141 G4double G4ParticleChangeForLoss::GetProposedCharge() const >> 142 { >> 143 return currentCharge; >> 144 } >> 145 >> 146 inline >> 147 G4double G4ParticleChangeForLoss::GetCharge() const 114 { 148 { 115 return currentCharge; 149 return currentCharge; 116 } 150 } 117 151 118 inline 152 inline 119 void G4ParticleChangeForLoss::SetProposedCharg 153 void G4ParticleChangeForLoss::SetProposedCharge(G4double theCharge) 120 { 154 { 121 currentCharge = theCharge; 155 currentCharge = theCharge; 122 } 156 } 123 157 124 inline 158 inline >> 159 void G4ParticleChangeForLoss::ProposeCharge(G4double theCharge) >> 160 { >> 161 currentCharge = theCharge; >> 162 } >> 163 >> 164 inline 125 const G4ThreeVector& 165 const G4ThreeVector& 126 G4ParticleChangeForLoss::GetProposedMomentumDi 166 G4ParticleChangeForLoss::GetProposedMomentumDirection() const 127 { 167 { 128 return proposedMomentumDirection; 168 return proposedMomentumDirection; 129 } 169 } 130 170 131 inline 171 inline >> 172 const G4ThreeVector& G4ParticleChangeForLoss::GetMomentumDirection() const >> 173 { >> 174 return proposedMomentumDirection; >> 175 } >> 176 >> 177 inline 132 void G4ParticleChangeForLoss::ProposeMomentumD 178 void G4ParticleChangeForLoss::ProposeMomentumDirection(const G4ThreeVector& dir) 133 { 179 { 134 proposedMomentumDirection = dir; 180 proposedMomentumDirection = dir; 135 } 181 } 136 182 137 inline 183 inline 138 void 184 void 139 G4ParticleChangeForLoss::SetProposedMomentumDi 185 G4ParticleChangeForLoss::SetProposedMomentumDirection(const G4ThreeVector& dir) 140 { 186 { 141 proposedMomentumDirection = dir; 187 proposedMomentumDirection = dir; 142 } 188 } 143 189 144 inline 190 inline >> 191 void G4ParticleChangeForLoss::ProposeMomentumDirection(G4double Px, >> 192 G4double Py, >> 193 G4double Pz) >> 194 { >> 195 proposedMomentumDirection.setX(Px); >> 196 proposedMomentumDirection.setY(Py); >> 197 proposedMomentumDirection.setZ(Pz); >> 198 } >> 199 >> 200 inline >> 201 const G4Track* G4ParticleChangeForLoss::GetCurrentTrack() const >> 202 { >> 203 return currentTrack; >> 204 } >> 205 >> 206 inline 145 const G4ThreeVector& G4ParticleChangeForLoss:: 207 const G4ThreeVector& G4ParticleChangeForLoss::GetProposedPolarization() const 146 { 208 { 147 return proposedPolarization; 209 return proposedPolarization; 148 } 210 } 149 211 150 inline 212 inline 151 void G4ParticleChangeForLoss::ProposePolarizat 213 void G4ParticleChangeForLoss::ProposePolarization(const G4ThreeVector& dir) 152 { 214 { 153 proposedPolarization = dir; 215 proposedPolarization = dir; 154 } 216 } 155 217 156 inline void G4ParticleChangeForLoss::ProposePo << 218 inline 157 << 219 void G4ParticleChangeForLoss::ProposePolarization(G4double Px, 158 << 220 G4double Py, 159 { << 221 G4double Pz) 160 proposedPolarization.set(Px, Py, Pz); << 222 { >> 223 proposedPolarization.setX(Px); >> 224 proposedPolarization.setY(Py); >> 225 proposedPolarization.setZ(Pz); 161 } 226 } 162 227 163 inline 228 inline 164 void G4ParticleChangeForLoss::InitializeForAlo 229 void G4ParticleChangeForLoss::InitializeForAlongStep(const G4Track& track) 165 { 230 { 166 InitializeSecondaries(); << 231 theStatusChange = track.GetTrackStatus(); 167 InitializeLocalEnergyDeposit(); << 232 theLocalEnergyDeposit = 0.0; 168 InitializeParentWeight(track); << 233 theNonIonizingEnergyDeposit = 0.0; 169 InitializeStatusChange(track); << 234 InitializeSecondaries(track); >> 235 theParentWeight = track.GetWeight(); >> 236 // isParentWeightProposed = false; 170 proposedKinEnergy = track.GetKineticEnergy() 237 proposedKinEnergy = track.GetKineticEnergy(); 171 currentCharge = track.GetDynamicParticle()-> << 238 currentCharge = track.GetDynamicParticle()->GetCharge(); 172 } 239 } 173 240 174 inline 241 inline 175 void G4ParticleChangeForLoss::InitializeForPos 242 void G4ParticleChangeForLoss::InitializeForPostStep(const G4Track& track) 176 { 243 { 177 InitializeForAlongStep(track); << 244 theStatusChange = track.GetTrackStatus(); >> 245 theLocalEnergyDeposit = 0.0; >> 246 theNonIonizingEnergyDeposit = 0.0; >> 247 InitializeSecondaries(track); >> 248 theParentWeight = track.GetWeight(); >> 249 // isParentWeightProposed = false; >> 250 proposedKinEnergy = track.GetKineticEnergy(); >> 251 currentCharge = track.GetDynamicParticle()->GetCharge(); 178 proposedMomentumDirection = track.GetMomentu 252 proposedMomentumDirection = track.GetMomentumDirection(); 179 proposedPolarization = track.GetPolarization << 253 proposedPolarization = track.GetPolarization(); >> 254 currentTrack = &track; >> 255 } >> 256 >> 257 inline >> 258 void G4ParticleChangeForLoss::SetLowEnergyLimit(G4double elimit) >> 259 { >> 260 lowEnergyLimit = elimit; 180 } 261 } 181 262 182 #endif 263 #endif 183 264