45 fParticleGun(0), fMessenger(0),
46 fPositron(0), fMuon(0), fPion(0), fKaon(0), fProton(0),
48 fSigmaMomentum(50.*
MeV),
50 fRandomizePrimary(true)
57 fPositron = particleTable->
FindParticle(particleName=
"e+");
60 fKaon = particleTable->
FindParticle(particleName=
"kaon+");
61 fProton = particleTable->
FindParticle(particleName=
"proton");
85 if (fRandomizePrimary)
115 G4double Ekin = std::sqrt(pp*pp+mass*mass)-mass;
127 void B5PrimaryGeneratorAction::DefineCommands()
133 "Primary generator control");
138 "Mean momentum of primaries.");
149 "MeV", fSigmaMomentum,
"Sigma momentum of primaries.");
151 sigmaMomentumCmd.
SetRange(
"sp>=0.");
157 "Sigma angle divergence of primaries.");
166 =
"Boolean flag for randomizing primary particle types.\n";
168 +=
"In case this flag is false, you can select the primary particle\n";
169 guidance +=
" with /gun/particle command.";
B5PrimaryGeneratorAction()
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
This class is generic messenger.
Command & DeclareProperty(const G4String &name, const G4AnyType &variable, const G4String &doc="")
Declare Methods.
virtual void GeneratePrimaries(G4Event *)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
Command & SetDefaultValue(const G4String &)
void SetParticlePosition(G4ThreeVector aPosition)
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)
virtual ~B5PrimaryGeneratorAction()
Command & DeclarePropertyWithUnit(const G4String &name, const G4String &defaultUnit, const G4AnyType &variable, const G4String &doc="")
Command & SetGuidance(const G4String &s)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)