179 if ((mass < 0.) && (G4code !=
nullptr)) {
180 mass = G4code->GetPDGMass();
182 G4double pmom = std::sqrt(px * px + py * py + pz * pz);
184 direction.setX(px / pmom);
185 direction.setY(py / pmom);
186 direction.setZ(pz / pmom);
188 kinE = std::sqrt(px * px + py * py + pz * pz + mass * mass) - mass;
193 G4double pmom = std::sqrt(px * px + py * py + pz * pz);
195 direction.setX(px / pmom);
196 direction.setY(py / pmom);
197 direction.setZ(pz / pmom);
199 G4double mas2 = E * E - pmom * pmom;
201 mass = std::sqrt(mas2);
204 if (G4code !=
nullptr) {
205 mass = G4code->GetPDGMass();
207 E = std::sqrt(pmom * pmom + mass * mass);
G4Allocator< G4PrimaryParticle > *& aPrimaryParticleAllocator()
G4int GetPDGEncoding() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void SetPDGcode(G4int Pcode)
G4bool operator==(const G4PrimaryParticle &right) const
G4PrimaryParticle & operator=(const G4PrimaryParticle &right)
G4bool operator!=(const G4PrimaryParticle &right) const
void Set4Momentum(G4double px, G4double py, G4double pz, G4double E)
void SetMomentum(G4double px, G4double py, G4double pz)
G4double GetTotalMomentum() const
void SetParticleDefinition(const G4ParticleDefinition *pdef)
virtual ~G4PrimaryParticle()