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 // G4ParticleChangeForGamma << 27 // 26 // 28 // Class description: << 27 // $Id: G4ParticleChangeForGamma.hh,v 1.5 2006/06/29 21:14:21 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-01 $ 29 // 29 // 30 // Concrete class for ParticleChange for gamma << 30 // 31 << 31 // ------------------------------------------------------------ 32 // Author: Hisaya Kurashige, 23 March 1998 << 32 // GEANT 4 class header file 33 // Revision: Vladimir Ivantchenko, 15 April 20 << 33 // 34 // 24 August 2 << 34 // 35 // ------------------------------------------- << 35 // ------------------------------------------------------------ 36 #ifndef G4ParticleChangeForGamma_hh << 36 // 15 April 2005 V.Ivanchenko for gamma EM processes 37 #define G4ParticleChangeForGamma_hh 1 << 37 // >> 38 // Modified: >> 39 // 30.05.05 : add UpdateStepForAtRest (V.Ivanchenko) >> 40 // 04.12.05 : apply UpdateStepForPostStep in any case (mma) >> 41 // >> 42 // ------------------------------------------------------------ >> 43 // >> 44 // Class Description >> 45 // This class is a concrete class for ParticleChange for gamma processes >> 46 // >> 47 #ifndef G4ParticleChangeForGamma_h >> 48 #define G4ParticleChangeForGamma_h 1 38 49 39 #include "globals.hh" 50 #include "globals.hh" 40 #include "G4ios.hh" 51 #include "G4ios.hh" 41 #include "G4VParticleChange.hh" 52 #include "G4VParticleChange.hh" 42 53 43 class G4DynamicParticle; 54 class G4DynamicParticle; 44 55 45 class G4ParticleChangeForGamma final : public << 56 class G4ParticleChangeForGamma: public G4VParticleChange 46 { 57 { 47 public: 58 public: 48 << 59 // default constructor 49 G4ParticleChangeForGamma(); 60 G4ParticleChangeForGamma(); 50 61 51 ~G4ParticleChangeForGamma() override = defau << 62 // destructor 52 << 63 virtual ~G4ParticleChangeForGamma(); 53 G4ParticleChangeForGamma(const G4ParticleCha << 54 G4ParticleChangeForGamma& operator=(const G4 << 55 64 >> 65 // with description >> 66 // ---------------------------------------------------- 56 // --- the following methods are for updatin 67 // --- the following methods are for updating G4Step ----- 57 68 58 G4Step* UpdateStepForAtRest(G4Step* pStep) f << 69 G4Step* UpdateStepForAtRest(G4Step* pStep); 59 G4Step* UpdateStepForPostStep(G4Step* Step) << 70 G4Step* UpdateStepForPostStep(G4Step* Step); 60 // A physics process gives the final sta << 71 // A physics process gives the final state of the particle 61 // based on information of G4Track << 72 // based on information of G4Track 62 73 63 inline void InitializeForPostStep(const G4Tr << 74 void InitializeForPostStep(const G4Track&); 64 // Initialize all properties by using G4 << 75 //Initialize all propoerties by using G4Track information 65 76 66 void AddSecondary(G4DynamicParticle* aPartic 77 void AddSecondary(G4DynamicParticle* aParticle); 67 // Add next secondary << 78 // Add next secondary 68 << 69 inline G4double GetProposedKineticEnergy() c << 70 inline void SetProposedKineticEnergy(G4doubl << 71 // Get/Set the final kinetic energy of t << 72 << 73 inline const G4ThreeVector& GetProposedMomen << 74 inline void ProposeMomentumDirection(const G << 75 // Get/Set the final momentum direction << 76 79 77 inline const G4ThreeVector& GetProposedPolar << 80 G4double GetProposedKineticEnergy() const; 78 inline void ProposePolarization(const G4Thre << 81 void SetProposedKineticEnergy(G4double proposedKinEnergy); 79 inline void ProposePolarization(G4double Px, << 82 // Get/Set the final kinetic energy of the current particle. 80 << 83 81 void DumpInfo() const override; << 84 const G4ThreeVector& GetProposedMomentumDirection() const; >> 85 void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz); >> 86 void ProposeMomentumDirection(const G4ThreeVector& Pfinal); >> 87 // Get/Propose the MomentumDirection vector: it is the final momentum direction. >> 88 >> 89 const G4ThreeVector& GetProposedPolarization() const; >> 90 void ProposePolarization(const G4ThreeVector& dir); >> 91 void ProposePolarization(G4double Px, G4double Py, G4double Pz); >> 92 >> 93 virtual void DumpInfo() const; >> 94 >> 95 // for Debug >> 96 virtual G4bool CheckIt(const G4Track&); >> 97 >> 98 protected: >> 99 // hide copy constructor and assignment operaor as protected >> 100 G4ParticleChangeForGamma(const G4ParticleChangeForGamma &right); >> 101 G4ParticleChangeForGamma & operator=(const G4ParticleChangeForGamma &right); 82 102 83 private: 103 private: 84 104 85 G4double proposedKinEnergy = 0.0; << 105 const G4Track* currentTrack; 86 // The final kinetic energy of the curre << 106 // The pointer to G4Track >> 107 >> 108 G4double proposedKinEnergy; >> 109 // The final kinetic energy of the current particle. 87 110 88 G4ThreeVector proposedMomentumDirection; 111 G4ThreeVector proposedMomentumDirection; 89 // The final momentum direction of the c << 112 // The final momentum direction of the current particle. 90 113 91 G4ThreeVector proposedPolarization; 114 G4ThreeVector proposedPolarization; 92 // The final polarization of the current << 115 // The final momentum direction of the current particle. 93 }; 116 }; 94 117 95 // ---------------------- << 118 // ------------------------------------------------------------ 96 // Inline methods << 97 // ---------------------- << 98 119 99 inline << 120 inline G4double G4ParticleChangeForGamma::GetProposedKineticEnergy() const 100 G4double G4ParticleChangeForGamma::GetProposed << 101 { 121 { 102 return proposedKinEnergy; 122 return proposedKinEnergy; 103 } 123 } 104 124 105 inline << 125 inline void G4ParticleChangeForGamma::SetProposedKineticEnergy(G4double energy) 106 void G4ParticleChangeForGamma::SetProposedKine << 107 { 126 { 108 proposedKinEnergy = energy; 127 proposedKinEnergy = energy; 109 } 128 } 110 129 111 inline 130 inline 112 const G4ThreeVector& G4ParticleChangeForGamma: << 131 const G4ThreeVector& G4ParticleChangeForGamma::GetProposedMomentumDirection() const 113 GetProposedMomentumDirection() const << 114 { 132 { 115 return proposedMomentumDirection; 133 return proposedMomentumDirection; 116 } 134 } 117 135 118 inline 136 inline 119 void G4ParticleChangeForGamma:: << 137 void G4ParticleChangeForGamma::ProposeMomentumDirection(const G4ThreeVector& dir) 120 ProposeMomentumDirection(const G4ThreeVector& << 121 { 138 { 122 proposedMomentumDirection = dir; 139 proposedMomentumDirection = dir; 123 } 140 } 124 141 125 inline 142 inline 126 const G4ThreeVector& G4ParticleChangeForGamma: << 143 void G4ParticleChangeForGamma::ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz) >> 144 { >> 145 proposedMomentumDirection.setX(Px); >> 146 proposedMomentumDirection.setY(Py); >> 147 proposedMomentumDirection.setZ(Pz); >> 148 } >> 149 >> 150 inline >> 151 const G4ThreeVector& G4ParticleChangeForGamma::GetProposedPolarization() const 127 { 152 { 128 return proposedPolarization; 153 return proposedPolarization; 129 } 154 } 130 155 131 inline 156 inline 132 void G4ParticleChangeForGamma::ProposePolariza << 157 void G4ParticleChangeForGamma::ProposePolarization(const G4ThreeVector& dir) 133 { 158 { 134 proposedPolarization = dir; 159 proposedPolarization = dir; 135 } 160 } 136 161 137 inline 162 inline 138 void G4ParticleChangeForGamma::ProposePolariza << 163 void G4ParticleChangeForGamma::ProposePolarization(G4double Px, G4double Py, G4double Pz) 139 << 140 << 141 { 164 { 142 proposedPolarization.setX(Px); 165 proposedPolarization.setX(Px); 143 proposedPolarization.setY(Py); 166 proposedPolarization.setY(Py); 144 proposedPolarization.setZ(Pz); 167 proposedPolarization.setZ(Pz); 145 } 168 } 146 169 147 inline << 170 inline void G4ParticleChangeForGamma::InitializeForPostStep(const G4Track& track) 148 void G4ParticleChangeForGamma::InitializeForPo << 149 { 171 { 150 InitializeSecondaries(); << 172 theStatusChange = track.GetTrackStatus(); 151 InitializeLocalEnergyDeposit(); << 173 theLocalEnergyDeposit = 0.0; 152 InitializeParentWeight(track); << 174 InitializeSecondaries(track); 153 InitializeStatusChange(track); << 175 theParentWeight = track.GetWeight(); 154 proposedKinEnergy = track.GetKinetic << 176 proposedKinEnergy = track.GetKineticEnergy(); 155 proposedMomentumDirection = track.GetMomentu 177 proposedMomentumDirection = track.GetMomentumDirection(); 156 proposedPolarization = track.GetPolariz << 178 proposedPolarization = track.GetPolarization(); >> 179 currentTrack = &track; >> 180 } >> 181 >> 182 //---------------------------------------------------------------- >> 183 // method for updating G4Step >> 184 // >> 185 >> 186 inline G4Step* G4ParticleChangeForGamma::UpdateStepForAtRest(G4Step* pStep) >> 187 { >> 188 pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit ); >> 189 pStep->SetStepLength( 0.0 ); >> 190 return pStep; >> 191 } >> 192 >> 193 inline G4Step* G4ParticleChangeForGamma::UpdateStepForPostStep(G4Step* pStep) >> 194 { >> 195 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint(); >> 196 pPostStepPoint->SetKineticEnergy( proposedKinEnergy ); >> 197 pPostStepPoint->SetMomentumDirection( proposedMomentumDirection ); >> 198 pPostStepPoint->AddPolarization( proposedPolarization ); >> 199 >> 200 // update weight >> 201 // this feature is commented out, it should be overwritten in case >> 202 // if energy loss processes will use biasing >> 203 // pPostStepPoint->SetWeight( theProposedWeight ); >> 204 >> 205 pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit ); >> 206 return pStep; >> 207 } >> 208 >> 209 inline void G4ParticleChangeForGamma::AddSecondary(G4DynamicParticle* aParticle) >> 210 { >> 211 // create track >> 212 G4Track* aTrack = new G4Track(aParticle, currentTrack->GetGlobalTime(), >> 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); 157 } 220 } 158 221 159 #endif 222 #endif >> 223 160 224