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