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