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