00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #if defined G4PARTICLES_ALLOC_EXPORT
00038 extern G4DLLEXPORT G4Allocator<G4DynamicParticle> aDynamicParticleAllocator;
00039 #else
00040 extern G4DLLIMPORT G4Allocator<G4DynamicParticle> aDynamicParticleAllocator;
00041 #endif
00042
00043
00044
00045
00046
00047 inline void * G4DynamicParticle::operator new(size_t)
00048 {
00049 void * aDynamicParticle;
00050 aDynamicParticle = (void *) aDynamicParticleAllocator.MallocSingle();
00051 return aDynamicParticle;
00052 }
00053
00054 inline void G4DynamicParticle::operator delete(void * aDynamicParticle)
00055 {
00056 aDynamicParticleAllocator.FreeSingle((G4DynamicParticle *) aDynamicParticle);
00057 }
00058
00059
00060
00061
00062
00063 inline const G4ElectronOccupancy* G4DynamicParticle::GetElectronOccupancy() const
00064 {
00065 return theElectronOccupancy;
00066 }
00067
00068 inline G4int G4DynamicParticle::GetTotalOccupancy() const
00069 {
00070 G4int value = 0;
00071 if ( theElectronOccupancy != 0) {
00072 value = theElectronOccupancy->GetTotalOccupancy();
00073 }
00074 return value;
00075 }
00076
00077 inline G4int G4DynamicParticle::GetOccupancy(G4int orbit) const
00078 {
00079 G4int value = 0;
00080 if ( theElectronOccupancy != 0) {
00081 value = theElectronOccupancy->GetOccupancy(orbit);
00082 }
00083 return value;
00084 }
00085
00086 inline void G4DynamicParticle::AddElectron(G4int orbit, G4int number )
00087 {
00088 if ( theElectronOccupancy == 0) AllocateElectronOccupancy();
00089 if ( theElectronOccupancy != 0) {
00090 G4int n = theElectronOccupancy->AddElectron(orbit, number );
00091 theDynamicalCharge -= CLHEP::eplus * n;
00092 theDynamicalMass += GetElectronMass() * n;
00093 }
00094 }
00095
00096 inline void G4DynamicParticle::RemoveElectron(G4int orbit, G4int number)
00097 {
00098 if ( theElectronOccupancy == 0) AllocateElectronOccupancy();
00099 if ( theElectronOccupancy != 0) {
00100 G4int n = theElectronOccupancy->RemoveElectron(orbit, number );
00101 theDynamicalCharge += CLHEP::eplus * n;
00102 theDynamicalMass -= GetElectronMass() * n;
00103 }
00104 }
00105
00106
00107
00108 inline G4double G4DynamicParticle::GetCharge() const
00109 {
00110 return theDynamicalCharge;
00111 }
00112
00113 inline void G4DynamicParticle::SetCharge(G4double newCharge)
00114 {
00115 theDynamicalCharge = newCharge;
00116 }
00117
00118 inline void G4DynamicParticle::SetCharge(G4int newCharge)
00119 {
00120 theDynamicalCharge = newCharge*CLHEP::eplus;
00121 }
00122
00123 inline G4double G4DynamicParticle::GetMass() const
00124 {
00125 return theDynamicalMass;
00126 }
00127
00128
00129 inline G4double G4DynamicParticle::GetSpin() const
00130 {
00131 return theDynamicalSpin;
00132 }
00133
00134 inline void G4DynamicParticle::SetSpin(G4double spin)
00135 {
00136 theDynamicalSpin = spin;
00137 }
00138
00139 inline void G4DynamicParticle::SetSpin(G4int spinInUnitOfHalfInteger)
00140 {
00141 theDynamicalSpin = spinInUnitOfHalfInteger * 0.5;
00142 }
00143
00144 inline G4double G4DynamicParticle::GetMagneticMoment() const
00145 {
00146 return theDynamicalMagneticMoment;
00147 }
00148
00149 inline void G4DynamicParticle::SetMagneticMoment(G4double magneticMoment)
00150 {
00151 theDynamicalMagneticMoment = magneticMoment;
00152 }
00153
00154 inline void G4DynamicParticle::SetMass(G4double newMass)
00155 {
00156 theDynamicalMass = newMass;
00157 }
00158
00159 inline const G4ThreeVector& G4DynamicParticle::GetMomentumDirection() const
00160 {
00161 return theMomentumDirection;
00162 }
00163
00164 inline G4ThreeVector G4DynamicParticle::GetMomentum() const
00165 {
00166 G4double pModule = std::sqrt(theKineticEnergy*theKineticEnergy +
00167 2*theKineticEnergy*theDynamicalMass);
00168 G4ThreeVector pMomentum(theMomentumDirection.x()*pModule,
00169 theMomentumDirection.y()*pModule,
00170 theMomentumDirection.z()*pModule);
00171 return pMomentum;
00172 }
00173
00174 inline G4LorentzVector G4DynamicParticle::Get4Momentum() const
00175 {
00176 G4double mass = theDynamicalMass;
00177 G4double energy = theKineticEnergy;
00178 G4double momentum = std::sqrt(energy*energy+2.0*mass*energy);
00179 G4LorentzVector p4( theMomentumDirection.x()*momentum,
00180 theMomentumDirection.y()*momentum,
00181 theMomentumDirection.z()*momentum,
00182 energy+mass);
00183 return p4;
00184 }
00185
00186 inline G4double G4DynamicParticle::GetTotalMomentum() const
00187 {
00188
00189 return std::sqrt((theKineticEnergy + 2.*theDynamicalMass)* theKineticEnergy);
00190 }
00191
00192 inline G4ParticleDefinition* G4DynamicParticle::GetDefinition() const
00193 {
00194 return const_cast<G4ParticleDefinition*>(theParticleDefinition);
00195 }
00196
00197 inline const G4ParticleDefinition* G4DynamicParticle::GetParticleDefinition() const
00198 {
00199 return const_cast<G4ParticleDefinition*>(theParticleDefinition);
00200 }
00201
00202 inline const G4ThreeVector& G4DynamicParticle::GetPolarization() const
00203 {
00204 return thePolarization;
00205 }
00206
00207 inline G4double G4DynamicParticle::GetProperTime() const
00208 {
00209 return theProperTime;
00210 }
00211
00212 inline G4double G4DynamicParticle::GetTotalEnergy() const
00213 {
00214 return (theKineticEnergy+theDynamicalMass);
00215 }
00216
00217 inline G4double G4DynamicParticle::GetKineticEnergy() const
00218 {
00219 return theKineticEnergy;
00220 }
00221
00222 inline void G4DynamicParticle::SetMomentumDirection(const G4ThreeVector &aDirection)
00223 {
00224 theMomentumDirection = aDirection;
00225 }
00226
00227 inline void G4DynamicParticle::SetMomentumDirection(G4double px, G4double py, G4double pz)
00228 {
00229 theMomentumDirection.setX(px);
00230 theMomentumDirection.setY(py);
00231 theMomentumDirection.setZ(pz);
00232 }
00233
00234
00235 inline void G4DynamicParticle::SetPolarization(G4double polX, G4double polY, G4double polZ)
00236 {
00237 thePolarization.setX(polX);
00238 thePolarization.setY(polY);
00239 thePolarization.setZ(polZ);
00240 }
00241
00242 inline void G4DynamicParticle::SetKineticEnergy(G4double aEnergy)
00243 {
00244 theKineticEnergy = aEnergy;
00245 }
00246
00247 inline void G4DynamicParticle::SetProperTime(G4double atime)
00248 {
00249 theProperTime = atime;
00250 }
00251
00252 inline const G4DecayProducts* G4DynamicParticle::GetPreAssignedDecayProducts() const
00253 {
00254 return thePreAssignedDecayProducts;
00255 }
00256
00257 inline void G4DynamicParticle::SetPreAssignedDecayProducts(G4DecayProducts* aDecayProducts)
00258 {
00259 thePreAssignedDecayProducts = aDecayProducts;
00260 }
00261
00262 inline G4double G4DynamicParticle::GetPreAssignedDecayProperTime() const
00263 {
00264 return thePreAssignedDecayTime;
00265 }
00266
00267 inline void G4DynamicParticle::SetPreAssignedDecayProperTime(G4double aTime)
00268 {
00269 thePreAssignedDecayTime = aTime;
00270 }
00271
00272 inline
00273 void G4DynamicParticle::SetVerboseLevel(G4int value)
00274 {
00275 verboseLevel = value;
00276 }
00277
00278 inline
00279 G4int G4DynamicParticle::GetVerboseLevel() const
00280 {
00281 return verboseLevel;
00282 }
00283
00284 inline
00285 void G4DynamicParticle::SetPrimaryParticle(G4PrimaryParticle* p)
00286 {
00287 primaryParticle=p;
00288 }
00289
00290 inline
00291 G4PrimaryParticle* G4DynamicParticle::GetPrimaryParticle() const
00292 {
00293 return primaryParticle;
00294 }
00295
00296 inline
00297 G4int G4DynamicParticle::GetPDGcode() const
00298 {
00299 G4int code = theParticleDefinition->GetPDGEncoding();
00300 if(code==0) code = thePDGcode;
00301 return code;
00302 }
00303
00304 inline
00305 void G4DynamicParticle::SetPDGcode(G4int c)
00306 {
00307 thePDGcode = c;
00308 }
00309
00310
00311
00312
00313
00314
00315