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