48 :fParticleGun(fPtclGun),fShootIon(false)
53 gunDirectory->
SetGuidance(
"Particle Gun control commands.");
60 particleCmd->
SetGuidance(
"Set particle to be generated.");
62 particleCmd->
SetGuidance(
" (ion can be specified for shooting ions)");
67 for(
G4int i=0;i<nPtcl;i++)
76 candidateList +=
"ion ";
80 directionCmd->
SetGuidance(
"Set momentum direction.");
81 directionCmd->
SetGuidance(
"Direction needs not to be a unit vector.");
83 directionCmd->
SetRange(
"ex != 0 || ey != 0 || ez != 0");
93 momCmd->
SetGuidance(
"Set momentum. This command is equivalent to two commands /gun/direction and /gun/momentumAmp");
95 momCmd->
SetRange(
"px != 0 || py != 0 || pz != 0");
99 momAmpCmd->
SetGuidance(
"Set absolute value of momentum.");
100 momAmpCmd->
SetGuidance(
"Direction should be set by /gun/direction command.");
101 momAmpCmd->
SetGuidance(
"This command should be used alternatively with /gun/energy.");
106 positionCmd->
SetGuidance(
"Set starting position of the particle.");
113 timeCmd->
SetGuidance(
"Set initial time of the particle.");
122 polCmd->
SetRange(
"Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
125 numberCmd->
SetGuidance(
"Set number of particles to be generated.");
130 ionCmd->
SetGuidance(
"Set properties of ion to be generated.");
134 ionCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
135 ionCmd->
SetGuidance(
" E:(double) Excitation energy (in keV)");
177 if( command==listCmd )
179 else if( command==particleCmd )
181 if (newValues ==
"ion") {
190 else if( command==directionCmd )
192 else if( command==energyCmd )
194 else if( command==momCmd )
196 else if( command==momAmpCmd )
198 else if( command==positionCmd )
200 else if( command==timeCmd )
202 else if( command==polCmd )
204 else if( command==numberCmd )
206 else if( command==ionCmd )
207 { IonCommand(newValues); }
214 if( command==directionCmd )
216 else if( command==particleCmd )
218 else if( command==energyCmd )
222 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
226 else if( command==momCmd || command==momAmpCmd )
230 {
G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy." <<
G4endl; }
233 if( command==momCmd )
239 else if( command==positionCmd )
241 else if( command==timeCmd )
243 else if( command==polCmd )
245 else if( command==numberCmd )
247 else if( command==ionCmd )
250 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
251 cv +=
ItoS(fIonCharge);
259void G4ParticleGunMessenger::IonCommand(
G4String newValues)
264 fAtomicNumber =
StoI(next());
265 fAtomicMass =
StoI(next());
268 fIonCharge = fAtomicNumber;
270 fIonCharge =
StoI(sQ);
273 fIonExciteEnergy = 0.0;
275 fIonExciteEnergy =
StoD(sQ) * keV;
280 ion = particleTable->
GetIon( fAtomicNumber, fAtomicMass, fIonExciteEnergy);
282 G4cout <<
"Ion with Z=" << fAtomicNumber;
283 G4cout <<
" A=" << fAtomicMass <<
"is not be defined" <<
G4endl;
289 G4cout <<
"Set /gun/particle to ion before using /gun/ion command";
CLHEP::Hep3Vector G4ThreeVector
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
static G4Geantino * Geantino()
G4bool IsShortLived() const
G4DecayTable * GetDecayTable() const
const G4String & GetParticleName() const
~G4ParticleGunMessenger()
G4ParticleGunMessenger(G4ParticleGun *fPtclGun)
void SetNewValue(G4UIcommand *command, G4String newValues)
G4String GetCurrentValue(G4UIcommand *command)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
G4ThreeVector GetParticlePolarization() const
G4ParticleMomentum GetParticleMomentumDirection() const
G4double GetParticleMomentum() const
void SetNumberOfParticles(G4int i)
void SetParticlePolarization(G4ThreeVector aVal)
G4ParticleDefinition * GetParticleDefinition() const
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4int GetNumberOfParticles() const
void SetParticleEnergy(G4double aKineticEnergy)
void SetParticleMomentum(G4double aMomentum)
G4double GetParticleEnergy() const
void SetParticleCharge(G4double aCharge)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * GetParticle(G4int index)
G4ParticleDefinition * GetIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
void DumpTable(const G4String &particle_name="ALL")
void SetDefaultUnit(const char *defUnit)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultUnit(const char *defUnit)
static G4double GetNewDoubleValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
static G4String ConvertToString(G4bool boolVal)
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void SetRange(const char *rs)
G4double StoD(G4String s)
void SetDefaultValue(const char *theDefaultValue)
void SetParticleTime(G4double aTime)
G4double GetParticleTime()
G4ThreeVector GetParticlePosition()
void SetParticlePosition(G4ThreeVector aPosition)