53 NumberOfParticlesToBeGenerated = numberofparticles;
54 SetParticleDefinition( particleDef );
104 if(!aParticleDefinition)
106 G4Exception(
"G4ParticleGun::SetParticleDefinition()",
"Event0101",
114 ED <<
"G4ParticleGun does not support shooting a short-lived particle without a valid decay table." <<
G4endl;
115 ED <<
"G4ParticleGun::SetParticleDefinition for "
117 G4Exception(
"G4ParticleGun::SetParticleDefinition()",
"Event0102",
122 particle_definition = aParticleDefinition;
124 if(particle_momentum>0.0)
126 G4double mass = particle_definition->GetPDGMass();
128 std::sqrt(particle_momentum*particle_momentum+mass*mass)-mass;
142 G4cout <<
" was defined in terms of Momentum: "
144 G4cout <<
" is now defined in terms of KineticEnergy: "
159 G4cout <<
" was defined in terms of KineticEnergy: "
161 G4cout <<
" is now defined in terms Momentum: "
166 G4cout <<
"Particle Definition not defined yet for G4ParticleGun"<<
G4endl;
189 G4cout <<
" was defined in terms of KineticEnergy: "
191 G4cout <<
" is now defined in terms Momentum: "
192 << aMomentum.mag()/
GeV <<
"GeV/c" <<
G4endl;
196 G4cout <<
"Particle Definition not defined yet for G4ParticleGun"<<
G4endl;
217 ED <<
"Particle definition is not defined." <<
G4endl;
218 ED <<
"G4ParticleGun::SetParticleDefinition() has to be invoked beforehand." <<
G4endl;
219 G4Exception(
"G4ParticleGun::GeneratePrimaryVertex()",
"Event0109",
void SetParticleMomentum(G4double aMomentum)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
void AddPrimaryVertex(G4PrimaryVertex *aPrimaryVertex)
G4double particle_momentum
virtual void GeneratePrimaryVertex(G4Event *evt)
G4ParticleDefinition * particle_definition
const G4String & GetParticleName() const
G4ThreeVector particle_position
void SetKineticEnergy(G4double eKin)
G4DecayTable * GetDecayTable() const
G4ParticleMomentum particle_momentum_direction
G4GLOB_DLL std::ostream G4cout
virtual void SetInitialValues()
void SetMass(G4double mas)
G4ThreeVector particle_polarization
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetParticleEnergy(G4double aKineticEnergy)
G4int NumberOfParticlesToBeGenerated
G4bool IsShortLived() const
G4double GetPDGMass() const
G4ParticleGunMessenger * theMessenger
void SetMomentumDirection(const G4ThreeVector &p)
void SetCharge(G4double chg)
static constexpr double GeV
void SetPrimary(G4PrimaryParticle *pp)
G4double GetPDGCharge() const
G4ThreeVector G4ParticleMomentum
void SetPolarization(const G4ThreeVector &pol)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)