Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4ParticleChangeForLoss << 27 // 23 // 28 // Class description: << 24 // $Id: G4ParticleChangeForLoss.hh,v 1.12 2004/06/15 08:17:38 vnivanch Exp $ >> 25 // GEANT4 tag $Name: geant4-06-02 $ 29 // 26 // 30 // Concrete class for ParticleChange for Energ << 27 // 31 << 28 // ------------------------------------------------------------ 32 // Author: Hisaya Kurashige, 23 March 1998 << 29 // GEANT 4 class header file 33 // Revision: Vladimir Ivantchenko, 16 January << 30 // 34 // 24 August 2 << 31 // 35 // ------------------------------------------- << 32 // ------------------------------------------------------------ 36 #ifndef G4ParticleChangeForLoss_hh << 33 // Implemented for the new scheme 23 Mar. 1998 H.Kurahige 37 #define G4ParticleChangeForLoss_hh 1 << 34 // >> 35 // Modified: >> 36 // 16.01.04 V.Ivanchenko update for model variant of energy loss >> 37 // >> 38 // ------------------------------------------------------------ >> 39 // >> 40 // Class Description >> 41 // This class is a concrete class for ParticleChange for EnergyLoss >> 42 // >> 43 #ifndef G4ParticleChangeForLoss_h >> 44 #define G4ParticleChangeForLoss_h 1 38 45 >> 46 #include "globals.hh" >> 47 #include "G4ios.hh" 39 #include "G4VParticleChange.hh" 48 #include "G4VParticleChange.hh" 40 #include "G4DynamicParticle.hh" << 41 49 42 class G4ParticleChangeForLoss final : public G << 50 class G4DynamicParticle; >> 51 >> 52 class G4ParticleChangeForLoss: public G4VParticleChange 43 { 53 { 44 public: 54 public: 45 << 55 // default constructor 46 G4ParticleChangeForLoss(); 56 G4ParticleChangeForLoss(); 47 57 48 ~G4ParticleChangeForLoss() override = defaul << 58 // destructor 49 << 59 virtual ~G4ParticleChangeForLoss(); 50 G4ParticleChangeForLoss(const G4ParticleChan << 51 G4ParticleChangeForLoss& operator=(const G4P << 52 60 >> 61 // with description >> 62 // ---------------------------------------------------- 53 // --- the following methods are for updatin 63 // --- the following methods are for updating G4Step ----- 54 64 55 G4Step* UpdateStepForAlongStep(G4Step* step) << 65 virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 56 G4Step* UpdateStepForPostStep(G4Step* step) << 66 virtual G4Step* UpdateStepForPostStep(G4Step* Step); 57 << 67 // A physics process gives the final state of the particle 58 // Initialize all used properties << 68 // based on information of G4Track 59 inline void InitializeForAlongStep(const G4T << 69 60 inline void InitializeForPostStep(const G4Tr << 70 void InitializeForAlongStep(const G4Track&); 61 << 71 void InitializeForPostStep(const G4Track&); 62 // Get/Set dynamic charge << 72 //Initialize all propoerties by using G4Track information 63 inline G4double GetProposedCharge() const; << 73 64 inline void SetProposedCharge(G4double theCh << 74 void AddSecondary(G4DynamicParticle* aParticle); 65 << 75 // Add next secondary 66 // Get/Set the final kinetic energy of the c << 76 67 inline G4double GetProposedKineticEnergy() c << 77 G4double GetProposedCharge() const; 68 inline void SetProposedKineticEnergy(G4doubl << 78 void SetProposedCharge(G4double theCharge); 69 << 79 // Get/Set theCharge 70 // Get/Propose the MomentumDirection vector: << 80 71 // direction << 81 G4double GetCharge() const; 72 inline const G4ThreeVector& GetProposedMomen << 82 void ProposeCharge(G4double finalCharge); 73 inline void SetProposedMomentumDirection(con << 83 // Get/Propose the final dynamical Charge in G4DynamicParticle 74 inline void ProposeMomentumDirection(const G << 84 75 << 85 G4double GetProposedKineticEnergy() const; 76 inline const G4ThreeVector& GetProposedPolar << 86 void SetProposedKineticEnergy(G4double proposedKinEnergy); 77 inline void ProposePolarization(const G4Thre << 87 // Get/Set the final kinetic energy of the current particle. 78 inline void ProposePolarization(G4double Px, << 88 79 << 89 // G4double GetEnergy() const; 80 void DumpInfo() const final; << 90 // void ProposeEnergy(G4double finalEnergy); >> 91 // Get/Propose the final kinetic energy of the current particle. >> 92 >> 93 const G4ThreeVector& GetProposedMomentumDirection() const; >> 94 void SetProposedMomentumDirection(const G4ThreeVector& dir); >> 95 const G4ThreeVector& GetMomentumDirection() const; >> 96 void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz); >> 97 void ProposeMomentumDirection(const G4ThreeVector& Pfinal); >> 98 // Get/Propose the MomentumDirection vector: it is the final momentum direction. >> 99 >> 100 virtual void DumpInfo() const; >> 101 >> 102 // for Debug >> 103 virtual G4bool CheckIt(const G4Track&); >> 104 >> 105 protected: >> 106 // hide copy constructor and assignment operaor as protected >> 107 G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right); >> 108 G4ParticleChangeForLoss & operator=(const G4ParticleChangeForLoss &right); 81 109 82 private: 110 private: 83 111 84 G4double proposedKinEnergy = 0.0; << 112 const G4Track* currentTrack; 85 // The final kinetic energy of the current p << 113 // The pointer to G4Track 86 114 87 G4double currentCharge = 0.0; << 115 G4double proposedKinEnergy; 88 // The final charge of the current parti << 116 // The final kinetic energy of the current particle. 89 117 90 G4ThreeVector proposedMomentumDirection; << 118 G4double currentCharge; 91 // The final momentum direction of the curre << 119 // The final charge of the current particle. 92 120 93 G4ThreeVector proposedPolarization; << 121 G4ThreeVector proposedMomentumDirection; 94 // The final polarization of the current par << 122 // The final momentum direction of the current particle. 95 }; 123 }; 96 124 97 // ---------------------- << 125 inline G4double G4ParticleChangeForLoss::GetProposedKineticEnergy() const 98 // Inline methods << 99 // ---------------------- << 100 << 101 inline << 102 G4double G4ParticleChangeForLoss::GetProposedK << 103 { 126 { 104 return proposedKinEnergy; 127 return proposedKinEnergy; 105 } 128 } 106 129 107 inline << 130 inline void G4ParticleChangeForLoss::SetProposedKineticEnergy(G4double energy) 108 void G4ParticleChangeForLoss::SetProposedKinet << 109 { 131 { 110 proposedKinEnergy = energy; 132 proposedKinEnergy = energy; 111 } 133 } 112 134 113 inline G4double G4ParticleChangeForLoss::GetPr 135 inline G4double G4ParticleChangeForLoss::GetProposedCharge() const 114 { 136 { 115 return currentCharge; 137 return currentCharge; 116 } 138 } 117 139 118 inline << 140 inline G4double G4ParticleChangeForLoss::GetCharge() const 119 void G4ParticleChangeForLoss::SetProposedCharg << 141 { >> 142 return currentCharge; >> 143 } >> 144 >> 145 inline void G4ParticleChangeForLoss::SetProposedCharge(G4double theCharge) >> 146 { >> 147 currentCharge = theCharge; >> 148 } >> 149 >> 150 inline void G4ParticleChangeForLoss::ProposeCharge(G4double theCharge) 120 { 151 { 121 currentCharge = theCharge; 152 currentCharge = theCharge; 122 } 153 } 123 154 124 inline 155 inline 125 const G4ThreeVector& << 156 const G4ThreeVector& G4ParticleChangeForLoss::GetProposedMomentumDirection() const 126 G4ParticleChangeForLoss::GetProposedMomentumDi << 127 { 157 { 128 return proposedMomentumDirection; 158 return proposedMomentumDirection; 129 } 159 } 130 160 131 inline 161 inline 132 void G4ParticleChangeForLoss::ProposeMomentumD << 162 const G4ThreeVector& G4ParticleChangeForLoss::GetMomentumDirection() const 133 { 163 { 134 proposedMomentumDirection = dir; << 164 return proposedMomentumDirection; 135 } 165 } 136 166 137 inline 167 inline 138 void << 168 void G4ParticleChangeForLoss::ProposeMomentumDirection(const G4ThreeVector& dir) 139 G4ParticleChangeForLoss::SetProposedMomentumDi << 140 { 169 { 141 proposedMomentumDirection = dir; 170 proposedMomentumDirection = dir; 142 } 171 } 143 172 144 inline 173 inline 145 const G4ThreeVector& G4ParticleChangeForLoss:: << 174 void G4ParticleChangeForLoss::SetProposedMomentumDirection(const G4ThreeVector& dir) 146 { 175 { 147 return proposedPolarization; << 176 proposedMomentumDirection = dir; 148 } 177 } 149 178 150 inline 179 inline 151 void G4ParticleChangeForLoss::ProposePolarizat << 180 void G4ParticleChangeForLoss::ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz) 152 { 181 { 153 proposedPolarization = dir; << 182 proposedMomentumDirection.setX(Px); >> 183 proposedMomentumDirection.setY(Py); >> 184 proposedMomentumDirection.setZ(Pz); 154 } 185 } 155 186 156 inline void G4ParticleChangeForLoss::ProposePo << 187 inline void G4ParticleChangeForLoss::InitializeForAlongStep(const G4Track& track) 157 << 158 << 159 { 188 { 160 proposedPolarization.set(Px, Py, Pz); << 189 theStatusChange = track.GetTrackStatus(); >> 190 theLocalEnergyDeposit = 0.0; >> 191 InitializeSecondaries(track); >> 192 theParentWeight = track.GetWeight(); >> 193 proposedKinEnergy = track.GetKineticEnergy(); >> 194 currentCharge = track.GetDynamicParticle()->GetCharge(); 161 } 195 } 162 196 163 inline << 197 inline void G4ParticleChangeForLoss::InitializeForPostStep(const G4Track& track) 164 void G4ParticleChangeForLoss::InitializeForAlo << 165 { 198 { 166 InitializeSecondaries(); << 199 theStatusChange = track.GetTrackStatus(); 167 InitializeLocalEnergyDeposit(); << 200 theLocalEnergyDeposit = 0.0; 168 InitializeParentWeight(track); << 201 InitializeSecondaries(track); 169 InitializeStatusChange(track); << 202 theParentWeight = track.GetWeight(); 170 proposedKinEnergy = track.GetKineticEnergy() 203 proposedKinEnergy = track.GetKineticEnergy(); 171 currentCharge = track.GetDynamicParticle()-> 204 currentCharge = track.GetDynamicParticle()->GetCharge(); >> 205 proposedMomentumDirection = track.GetMomentumDirection(); >> 206 currentTrack = &track; 172 } 207 } 173 208 174 inline << 209 inline void G4ParticleChangeForLoss::AddSecondary(G4DynamicParticle* aParticle) 175 void G4ParticleChangeForLoss::InitializeForPos << 176 { 210 { 177 InitializeForAlongStep(track); << 211 // create track 178 proposedMomentumDirection = track.GetMomentu << 212 G4Track* aTrack = new G4Track(aParticle, currentTrack->GetGlobalTime(), 179 proposedPolarization = track.GetPolarization << 213 currentTrack->GetPosition()); >> 214 >> 215 // Touchable handle is copied to keep the pointer >> 216 aTrack->SetTouchableHandle(currentTrack->GetTouchableHandle()); >> 217 >> 218 // add a secondary >> 219 G4VParticleChange::AddSecondary(aTrack); 180 } 220 } 181 221 182 #endif 222 #endif >> 223 183 224