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");
84 if (fRandomizePrimary) {
111 auto ekin = std::sqrt(
pp*
pp+mass*mass)-mass;
123 void B5PrimaryGeneratorAction::DefineCommands()
129 "Primary generator control");
134 "Mean momentum of primaries.");
143 auto& sigmaMomentumCmd
145 "MeV", fSigmaMomentum,
"Sigma momentum of primaries.");
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");
B5PrimaryGeneratorAction()
CLHEP::Hep3Vector G4ThreeVector
This class is generic messenger.
Command & DeclareProperty(const G4String &name, const G4AnyType &variable, const G4String &doc="")
Declare Methods.
static G4double angle[DIM]
virtual void GeneratePrimaries(G4Event *)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
Command & SetDefaultValue(const G4String &)
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double m
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
Command & SetRange(const G4String &range)
void SetParticleEnergy(G4double aKineticEnergy)
G4double GetPDGMass() const
static G4ParticleTable * GetParticleTable()
Definition of the B5PrimaryGeneratorAction class.
G4ParticleDefinition * GetParticleDefinition() const
Command & SetParameterName(const G4String &, G4bool, G4bool=false)
static constexpr double MeV
virtual ~B5PrimaryGeneratorAction()
static constexpr double deg
Command & DeclarePropertyWithUnit(const G4String &name, const G4String &defaultUnit, const G4AnyType &variable, const G4String &doc="")
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)