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