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 // G4DynamicParticle << 27 // 26 // 28 // Class description: << 29 // 27 // 30 // A G4DynamicParticle aggregates the informat << 28 // 31 // of a G4Particle, such as energy, momentum, << 29 // ------------------------------------------------------------ 32 // as well as the "particle definition", holdi << 30 // GEANT 4 class header file 33 // It contains the purely dynamic aspects of a << 31 // 34 << 32 // History: first implementation, based on object model of 35 // History: << 33 // 2nd December 1995, G.Cosmo 36 // - 2 December 1995, G.Cosmo - first design, << 34 // ---------------- G4DynamicParticle ---------------- 37 // - 29 January 1996, M.Asai - first implement << 35 // first implementation by Makoto Asai, 29 January 1996 38 // - 1996 - 2007, H.Kurashige - revisions. << 36 // revised by G.Cosmo, 29 February 1996 39 // - 15 March 2019, M.Novak - log-kinetic en << 37 // revised by Hisaya Kurashige, 24 July 1996 40 // on demand if its stored << 38 // revised by Hisaya Kurashige, 19 Oct 1996 41 // ------------------------------------------- << 39 // revised by Hisaya Kurashige, 19 Feb 1997 42 #ifndef G4DynamicParticle_hh << 40 // ------------------------ 43 #define G4DynamicParticle_hh 1 << 41 // Add theDynamicCharge and theElectronOccupancy >> 42 // 17 AUg. 1999 H.Kurashige >> 43 // Add thePreAssignedDecayTime 18 Jan. 2001 H.Kurashige >> 44 // Added MagneticMoment Mar. 2007 >> 45 // Added GetLogKineticEnergy: the log-kinetic energy value is computed only >> 46 // on demand if its stored value is not up-to-date. 15 March 2019 M. Novak >> 47 // ------------------------------------------------------------ >> 48 >> 49 #ifndef G4DynamicParticle_h >> 50 #define G4DynamicParticle_h 1 >> 51 >> 52 #include <cmath> >> 53 #include <CLHEP/Units/SystemOfUnits.h> >> 54 #include <CLHEP/Units/PhysicalConstants.h> >> 55 >> 56 #include "globals.hh" >> 57 #include "G4ios.hh" 44 58 >> 59 #include "G4ParticleDefinition.hh" 45 #include "G4Allocator.hh" 60 #include "G4Allocator.hh" 46 #include "G4ElectronOccupancy.hh" << 47 #include "G4Log.hh" << 48 #include "G4LorentzVector.hh" 61 #include "G4LorentzVector.hh" 49 #include "G4ParticleDefinition.hh" << 62 #include "G4Log.hh" 50 #include "G4ParticleMomentum.hh" // NOTE: mea << 51 #include "G4ios.hh" << 52 #include "globals.hh" << 53 63 54 #include <CLHEP/Units/PhysicalConstants.h> << 64 #include "G4ParticleMomentum.hh" 55 #include <CLHEP/Units/SystemOfUnits.h> << 65 // G4ParticleMomentum is "momentum direction" not "momentum vector" >> 66 // The name is miss-leading so you should not use G4ParticleMomentum >> 67 // and you are recommended to use G4ThreeVector instead 56 68 57 #include <cmath> << 69 #include "G4ElectronOccupancy.hh" 58 70 59 class G4PrimaryParticle; 71 class G4PrimaryParticle; 60 class G4DecayProducts; 72 class G4DecayProducts; 61 73 62 class G4DynamicParticle << 74 class G4DynamicParticle 63 { 75 { 64 public: << 76 // Class Description 65 //- constructors << 77 // The dynamic particle is a class which contains the purely 66 G4DynamicParticle(); << 78 // dynamic aspects of a moving particle. It also has a 67 << 79 // pointer to a G4ParticleDefinition object, which holds 68 G4DynamicParticle(const G4ParticleDefiniti << 80 // all the static information. 69 const G4ThreeVector& aMo << 81 // 70 G4DynamicParticle(const G4ParticleDefiniti << 82 71 const G4ThreeVector& aPa << 83 public: // With Description 72 G4DynamicParticle(const G4ParticleDefiniti << 84 //- constructors 73 const G4LorentzVector& a << 85 G4DynamicParticle(); 74 G4DynamicParticle(const G4ParticleDefiniti << 86 75 const G4ThreeVector& aPa << 87 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition, 76 G4DynamicParticle(const G4ParticleDefiniti << 88 const G4ThreeVector& aMomentumDirection, 77 const G4ThreeVector& aMo << 89 G4double aKineticEnergy); 78 const G4double dynamical << 90 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition, 79 << 91 const G4ThreeVector& aParticleMomentum); 80 G4DynamicParticle(const G4DynamicParticle& << 92 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition, 81 << 93 const G4LorentzVector &aParticleMomentum); 82 //- destructor << 94 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition, 83 ~G4DynamicParticle(); << 95 G4double aTotalEnergy, 84 << 96 const G4ThreeVector &aParticleMomentum); 85 //- operators << 97 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition, 86 G4DynamicParticle& operator=(const G4Dynam << 98 const G4ThreeVector& aMomentumDirection, 87 G4bool operator==(const G4DynamicParticle& << 99 G4double aKineticEnergy, 88 G4bool operator!=(const G4DynamicParticle& << 100 const G4double dynamicalMass); 89 << 101 90 //- Move constructor & operator << 102 G4DynamicParticle(const G4DynamicParticle &right); 91 G4DynamicParticle(G4DynamicParticle&& from << 103 92 G4DynamicParticle& operator=(G4DynamicPart << 104 //- destructor 93 << 105 ~G4DynamicParticle(); 94 //- new/delete operators are oberloded to << 106 95 inline void* operator new(size_t); << 107 //- operators 96 inline void operator delete(void* aDynamic << 108 G4DynamicParticle & operator=(const G4DynamicParticle &right); 97 << 109 G4bool operator==(const G4DynamicParticle &right) const; 98 //- Set/Get methods << 110 G4bool operator!=(const G4DynamicParticle &right) const; 99 << 111 100 // Returns the normalized direction of the << 112 // new/delete operators are oberloded to use G4Allocator 101 inline const G4ThreeVector& GetMomentumDir << 113 inline void *operator new(size_t); 102 << 114 inline void operator delete(void *aDynamicParticle); 103 // Sets the normalized direction of the mo << 115 104 inline void SetMomentumDirection(const G4T << 116 //- Set/Get methods 105 << 117 106 // Sets the normalized direction of the mo << 118 inline const G4ThreeVector& GetMomentumDirection() const; 107 inline void SetMomentumDirection(G4double << 119 // Returns the normalized direction of the momentum 108 << 120 inline void SetMomentumDirection(const G4ThreeVector &aDirection); 109 // Returns the current particle momentum v << 121 // Sets the normalized direction of the momentum 110 inline G4ThreeVector GetMomentum() const; << 122 inline void SetMomentumDirection(G4double px, G4double py, G4double pz); 111 << 123 // Sets the normalized direction of the momentum by coordinates 112 // set the current particle momentum vecto << 124 113 void SetMomentum(const G4ThreeVector& mome << 125 inline G4ThreeVector GetMomentum() const; 114 << 126 // Returns the current particle momentum vector 115 // Returns the current particle energy-mom << 127 void SetMomentum( const G4ThreeVector &momentum); 116 inline G4LorentzVector Get4Momentum() cons << 128 // set the current particle momentum vector 117 << 129 118 // Set the current particle energy-momentu << 130 inline G4LorentzVector Get4Momentum() const; 119 void Set4Momentum(const G4LorentzVector& m << 131 // Returns the current particle energy-momentum 4vector 120 << 132 void Set4Momentum( const G4LorentzVector &momentum); 121 // Returns the module of the momentum vect << 133 // Set the current particle energy-momentum 4vector 122 inline G4double GetTotalMomentum() const; << 134 123 << 135 inline G4double GetTotalMomentum() const; 124 // Returns the total energy of the particl << 136 // Returns the module of the momentum vector 125 inline G4double GetTotalEnergy() const; << 137 inline G4double GetTotalEnergy() const; 126 << 138 // Returns the total energy of the particle 127 // Returns the kinetic energy of a particl << 139 128 inline G4double GetKineticEnergy() const; << 140 inline G4double GetKineticEnergy() const; 129 << 141 // Returns the kinetic energy of a particle 130 // Returns: << 142 inline G4double GetLogKineticEnergy() const; 131 // - natural logarithm of the particle kin << 143 // Returns: 132 // - LOG_EKIN_MIN otherwise << 144 // - natural logarithm of the particle kinetic energy (E_k) if E_k > 0 133 inline G4double GetLogKineticEnergy() cons << 145 // - LOG_EKIN_MIN otherwise 134 << 146 inline void SetKineticEnergy(G4double aEnergy); 135 // Sets the kinetic energy of a particle << 147 // Sets the kinetic energy of a particle 136 inline void SetKineticEnergy(G4double aEne << 148 137 << 149 inline G4double GetProperTime() const; 138 // Access Lorentz beta << 150 // Returns the current particle proper time 139 inline G4double GetBeta() const; << 151 inline void SetProperTime( G4double ); 140 << 152 // Set the current particle Proper Time 141 // Returns the current particle proper tim << 153 142 inline G4double GetProperTime() const; << 154 inline const G4ThreeVector& GetPolarization() const; 143 << 155 inline void SetPolarization(const G4ThreeVector&); 144 // Set the current particle Proper Time << 156 inline void SetPolarization(G4double polX, G4double polY, G4double polZ); 145 inline void SetProperTime(G4double); << 157 // Set/Get polarization vector 146 << 158 147 // Set/Get polarization vector << 159 inline G4double GetMass() const; 148 inline const G4ThreeVector& GetPolarizatio << 160 inline void SetMass(G4double mass); 149 inline void SetPolarization(const G4ThreeV << 161 // set/get dynamical mass 150 inline void SetPolarization(G4double polX, << 162 // the dynamical mass is set to PDG mass in default 151 << 163 152 // Set/Get dynamical mass << 164 inline G4double GetCharge() const; 153 // The dynamical mass is set to PDG mass i << 165 inline void SetCharge(G4double charge); 154 inline G4double GetMass() const; << 166 inline void SetCharge(G4int chargeInUnitOfEplus); 155 inline void SetMass(G4double mass); << 167 // set/get dynamical charge 156 << 168 // the dynamical mass is set to PDG charge in default 157 // Set/Get dynamical charge << 169 158 // The dynamical mass is set to PDG charge << 170 inline G4double GetSpin() const; 159 inline G4double GetCharge() const; << 171 inline void SetSpin(G4double spin); 160 inline void SetCharge(G4double charge); << 172 inline void SetSpin(G4int spinInUnitOfHalfInteger); 161 inline void SetCharge(G4int chargeInUnitOf << 173 // set/get dynamical spin 162 << 174 // the dynamical spin is set to PDG spin in default 163 // Set/Get dynamical spin << 175 164 // The dynamical spin is set to PDG spin i << 176 inline G4double GetMagneticMoment() const; 165 inline G4double GetSpin() const; << 177 inline void SetMagneticMoment(G4double magneticMoment); 166 inline void SetSpin(G4double spin); << 178 // set/get dynamical MagneticMoment 167 inline void SetSpin(G4int spinInUnitOfHalf << 179 // the dynamical mass is set to PDG MagneticMoment in default 168 << 180 169 // Set/Get dynamical MagneticMoment << 181 inline const G4ElectronOccupancy* GetElectronOccupancy() const; 170 // The dynamical mass is set to PDG Magnet << 182 // Get electron occupancy 171 inline G4double GetMagneticMoment() const; << 183 // ElectronOccupancy is valid only if the particle is ion 172 inline void SetMagneticMoment(G4double mag << 184 inline G4int GetTotalOccupancy() const; 173 << 185 inline G4int GetOccupancy(G4int orbit) const; 174 // Get electron occupancy << 186 inline void AddElectron(G4int orbit, G4int number = 1); 175 // ElectronOccupancy is valid only if the << 187 inline void RemoveElectron(G4int orbit, G4int number = 1); 176 inline const G4ElectronOccupancy* GetElect << 188 177 inline G4int GetTotalOccupancy() const; << 189 inline const G4ParticleDefinition* GetParticleDefinition() const; 178 inline G4int GetOccupancy(G4int orbit) con << 190 void SetDefinition(const G4ParticleDefinition * aParticleDefinition); 179 inline void AddElectron(G4int orbit, G4int << 191 // Set/Get particle definition 180 inline void RemoveElectron(G4int orbit, G4 << 192 // following method of GetDefinition remains 181 << 193 // because of backward compatiblity. It will be removed in future 182 // Set/Get particle definition << 194 inline G4ParticleDefinition* GetDefinition() const; 183 inline const G4ParticleDefinition* GetPart << 195 184 void SetDefinition(const G4ParticleDefinit << 196 inline const G4DecayProducts *GetPreAssignedDecayProducts() const; 185 << 197 inline void SetPreAssignedDecayProducts(G4DecayProducts *aDecayProducts); 186 // Following method of GetDefinition() rem << 198 // Set/Get pre-assigned decay channel 187 // because of backward compatiblity. May b << 199 188 inline G4ParticleDefinition* GetDefinition << 200 inline G4double GetPreAssignedDecayProperTime() const; 189 << 201 inline void SetPreAssignedDecayProperTime(G4double); 190 // Set/Get pre-assigned decay channel << 202 // Set/Get pre-assigned proper time when the particle will decay 191 inline const G4DecayProducts* GetPreAssign << 203 192 inline void SetPreAssignedDecayProducts(G4 << 204 //- print out information 193 << 205 void DumpInfo(G4int mode= 0) const; 194 // Set/Get pre-assigned proper time when t << 206 // mode 0 : default )(minimum) 195 inline G4double GetPreAssignedDecayProperT << 207 // mode 1 : 0 + electron occupancy 196 inline void SetPreAssignedDecayProperTime( << 208 197 << 209 protected: 198 // Print out information << 210 void AllocateElectronOccupancy(); 199 // - mode 0 : default )(minimum) << 211 G4double GetElectronMass() const; 200 // - mode 1 : 0 + electron occupancy << 212 201 void DumpInfo(G4int mode = 0) const; << 213 public: // With Description 202 << 214 inline void SetVerboseLevel(G4int value); 203 // Set/Get controle flag for output messag << 215 inline G4int GetVerboseLevel() const; 204 // - 0: Silent << 216 // Set/Get controle flag for output message 205 // - 1: Warning message << 217 // 0: Silent 206 // - 2: More << 218 // 1: Warning message 207 inline void SetVerboseLevel(G4int value); << 219 // 2: More 208 inline G4int GetVerboseLevel() const; << 220 209 << 221 inline void SetPrimaryParticle(G4PrimaryParticle* p); 210 inline void SetPrimaryParticle(G4PrimaryPa << 222 inline void SetPDGcode(G4int c); 211 inline void SetPDGcode(G4int c); << 223 212 << 224 public: // With Description 213 // Return the pointer to the corresponding << 225 inline G4PrimaryParticle* GetPrimaryParticle() const; 214 // if this particle is a primary particle << 226 // Return the pointer to the corresponding G4PrimaryParticle object 215 // pre-assigned decay product. Otherwise r << 227 // if this particle is a primary particle OR is defined as a pre-assigned 216 inline G4PrimaryParticle* GetPrimaryPartic << 228 // decay product. Otherwise return null. 217 << 229 218 // Return the PDG code of this particle. I << 230 inline G4int GetPDGcode() const; 219 // Geant4, its PDG code defined in G4Parti << 231 // Return the PDG code of this particle. If the particle is known to Geant4 220 // If it is unknown (i.e. PDG code in G4Pa << 232 // its PDG code defined in G4ParticleDefinition is returned. If it is unknown 221 // PDG code defined in the corresponding p << 233 // (i.e. PDG code in G4ParticleDefinition is 0), PDG code defined in the 222 // pre-assigned decay product will be retu << 234 // corresponding primary particle or pre-assigned decay product will be 223 // Otherwise (e.g. for geantino) returns 0 << 235 // returned if available. Otherwise (e.g. for geantino) returns 0. 224 inline G4int GetPDGcode() const; << 236 225 << 237 private: 226 protected: << 238 227 void AllocateElectronOccupancy(); << 239 G4ThreeVector theMomentumDirection; 228 G4double GetElectronMass() const; << 240 // The normalized momentum vector 229 << 241 230 private: << 242 G4ThreeVector thePolarization; 231 inline void ComputeBeta() const; << 243 232 << 244 const G4ParticleDefinition *theParticleDefinition; 233 // The normalized momentum vector << 245 // Contains the static information of this particle. 234 G4ThreeVector theMomentumDirection; << 246 235 << 247 G4ElectronOccupancy* theElectronOccupancy; 236 G4ThreeVector thePolarization; << 248 237 << 249 G4DecayProducts *thePreAssignedDecayProducts; 238 // Contains the static information of this << 250 239 const G4ParticleDefinition* theParticleDef << 251 G4PrimaryParticle* primaryParticle; 240 << 252 // This void pointer is used by G4EventManager to maintain the 241 G4ElectronOccupancy* theElectronOccupancy << 253 // link between pre-assigned decay products and corresponding 242 << 254 // primary particle. 243 G4DecayProducts* thePreAssignedDecayProduc << 255 244 << 256 G4double theKineticEnergy; 245 // This void pointer is used by G4EventMan << 257 246 // link between pre-assigned decay product << 258 mutable G4double theLogKineticEnergy; 247 // primary particle << 259 248 G4PrimaryParticle* primaryParticle = nullp << 260 G4double theProperTime; 249 << 261 250 G4double theKineticEnergy = 0.0; << 262 G4double theDynamicalMass; 251 << 263 252 mutable G4double theLogKineticEnergy = DBL << 264 G4double theDynamicalCharge; 253 << 265 254 mutable G4double theBeta = -1.0; << 266 G4double theDynamicalSpin; 255 << 256 G4double theProperTime = 0.0; << 257 << 258 G4double theDynamicalMass = 0.0; << 259 << 260 G4double theDynamicalCharge = 0.0; << 261 << 262 G4double theDynamicalSpin = 0.0; << 263 267 264 G4double theDynamicalMagneticMoment = 0.0; << 268 G4double theDynamicalMagneticMoment; 265 269 266 G4double thePreAssignedDecayTime = -1.0; << 270 G4double thePreAssignedDecayTime; 267 271 268 G4int verboseLevel = 1; << 272 G4int verboseLevel; 269 273 270 G4int thePDGcode = 0; << 274 G4int thePDGcode; 271 }; 275 }; 272 276 273 #include "G4DynamicParticle.icc" 277 #include "G4DynamicParticle.icc" 274 278 275 #endif 279 #endif 276 280