45 fParticleGun(nullptr), fMessenger(nullptr),
46 fPositron(nullptr), fMuon(nullptr), fPion(nullptr),
47 fKaon(nullptr), fProton(nullptr),
49 fSigmaMomentum(50.*
MeV),
51 fRandomizePrimary(true)
53 G4int nofParticles = 1;
57 fPositron = particleTable->FindParticle(
"e+");
58 fMuon = particleTable->FindParticle(
"mu+");
59 fPion = particleTable->FindParticle(
"pi+");
60 fKaon = particleTable->FindParticle(
"kaon+");
61 fProton = particleTable->FindParticle(
"proton");
111 auto ekin = std::sqrt(
pp*
pp+mass*mass)-mass;
129 "Primary generator control");
134 "Mean momentum of primaries.");
143 auto& sigmaMomentumCmd
147 sigmaMomentumCmd.
SetRange(
"sp>=0.");
153 "Sigma angle divergence of primaries.");
162 =
"Boolean flag for randomizing primary particle types.\n";
164 +=
"In case this flag is false, you can select the primary particle\n";
165 guidance +=
" with /gun/particle command.";
166 randomCmd.SetGuidance(guidance);
167 randomCmd.SetParameterName(
"flg",
true);
168 randomCmd.SetDefaultValue(
"true");
virtual void GeneratePrimaries(G4Event *)
This class is generic messenger.
CLHEP::Hep3Vector G4ThreeVector
Command & DeclarePropertyWithUnit(const G4String &name, const G4String &defaultUnit, const G4AnyType &variable, const G4String &doc="")
static G4ParticleTable * GetParticleTable()
static constexpr double MeV
Definition of the B5PrimaryGeneratorAction class.
Command & SetDefaultValue(const G4String &)
void SetParticlePosition(G4ThreeVector aPosition)
G4double GetPDGMass() const
G4ParticleGun * fParticleGun
static constexpr double m
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
static constexpr double deg
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4ParticleDefinition * fPion
Command & SetRange(const G4String &range)
G4GenericMessenger * fMessenger
G4ParticleDefinition * fProton
virtual ~B5PrimaryGeneratorAction()
Command & SetParameterName(const G4String &, G4bool, G4bool=false)
G4ParticleDefinition * fPositron
virtual void GeneratePrimaryVertex(G4Event *evt)
G4ParticleDefinition * fKaon
void SetParticleEnergy(G4double aKineticEnergy)
G4ParticleDefinition * fMuon
B5PrimaryGeneratorAction()
G4ParticleDefinition * GetParticleDefinition() const
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
Command & DeclareProperty(const G4String &name, const G4AnyType &variable, const G4String &doc="")
Declare Methods.