49 : fParticleGun(fPtclGun)
54 gunDirectory->
SetGuidance(
"Particle Gun control commands.");
61 particleCmd->
SetGuidance(
"Set particle to be generated.");
63 particleCmd->
SetGuidance(
" (ion can be specified for shooting ions)");
78 candidateList +=
"ion ";
82 directionCmd->
SetGuidance(
"Set momentum direction.");
83 directionCmd->
SetGuidance(
" Direction needs not to be a unit vector.");
85 directionCmd->
SetRange(
"ex != 0 || ey != 0 || ez != 0");
95 momCmd->
SetGuidance(
"Set momentum. This command is equivalent to two commands");
96 momCmd->
SetGuidance(
" /gun/direction and /gun/momentumAmp");
98 momCmd->
SetRange(
"px != 0 || py != 0 || pz != 0");
102 momAmpCmd->
SetGuidance(
"Set absolute value of momentum.");
103 momAmpCmd->
SetGuidance(
" Direction should be set by /gun/direction command.");
104 momAmpCmd->
SetGuidance(
" This command should be used alternatively with /gun/energy.");
109 positionCmd->
SetGuidance(
"Set starting position of the particle.");
116 timeCmd->
SetGuidance(
"Set initial time of the particle.");
125 polCmd->
SetRange(
"Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
128 numberCmd->
SetGuidance(
"Set number of particles to be generated.");
133 ionCmd->
SetGuidance(
"Set properties of ion to be generated.");
134 ionCmd->
SetGuidance(
"[usage] /gun/ion Z A [Q E flb]");
137 ionCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
138 ionCmd->
SetGuidance(
" E:(double) Excitation energy (in keV)");
139 ionCmd->
SetGuidance(
" flb:(char) Floating level base");
158 ionLvlCmd->
SetGuidance(
"THIS COMMAND IS DEPRECATED and will be removed in future releases.");
160 ionLvlCmd->
SetGuidance(
" Set properties of ion to be generated.");
161 ionLvlCmd->
SetGuidance(
" [usage] /gun/ionL Z A [Q I]");
164 ionLvlCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
165 ionLvlCmd->
SetGuidance(
" I:(int) Level number of metastable state (0 = ground)");
209 if (command==listCmd)
213 else if (command==particleCmd)
215 if (newValues ==
"ion")
229 ed <<
"Particle [" << newValues <<
"] is not found.";
234 }
else if( command==directionCmd )
236 else if( command==energyCmd )
238 else if( command==momCmd )
240 else if( command==momAmpCmd )
242 else if( command==positionCmd )
244 else if( command==timeCmd )
246 else if( command==polCmd )
248 else if( command==numberCmd )
250 else if( command==ionCmd )
254 IonCommand(newValues);
258 ed <<
"Set /gun/particle to ion before using /gun/ion command";
262 else if( command==ionLvlCmd )
265 depWarn <<
"\nCommand /gun/ionL is deprecated and will be removed in future releases.\n"
266 <<
"Use /gun/ion instead.\n";
267 G4Exception(
"G4ParticleGunMessenger::SetNewValue",
"IonLWarn",
272 IonLevelCommand(newValues);
276 ed <<
"Set /gun/particle to ion before using /gun/ion command";
286 if( command==directionCmd )
288 else if( command==particleCmd )
290 else if( command==energyCmd )
294 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
298 else if( command==momCmd || command==momAmpCmd )
303 G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy."
308 if( command==momCmd )
314 else if( command==positionCmd )
316 else if( command==timeCmd )
318 else if( command==polCmd )
320 else if( command==numberCmd )
322 else if( command==ionCmd )
326 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
327 cv +=
ItoS(fIonCharge);
337void G4ParticleGunMessenger::IonLevelCommand(
const G4String& newValues)
343 fAtomicNumber =
StoI(next());
344 fAtomicMass =
StoI(next());
346 if (sQ.empty() ||
StoI(sQ)<0)
348 fIonCharge = fAtomicNumber;
352 fIonCharge =
StoI(sQ);
361 fIonEnergyLevel =
StoI(sQ);
364 ->
GetIon(fAtomicNumber,fAtomicMass,fIonEnergyLevel);
368 ed <<
"Ion with Z = " << fAtomicNumber <<
", A = " << fAtomicMass
369 <<
", I = " << fIonEnergyLevel <<
" is not defined ";
379void G4ParticleGunMessenger::IonCommand(
const G4String& newValues)
385 fAtomicNumber =
StoI(next());
386 fAtomicMass =
StoI(next());
387 fIonCharge = fAtomicNumber;
388 fIonExciteEnergy = 0.0;
389 fIonFloatingLevelBase =
'\0';
394 fIonCharge =
StoI(sQ);
399 fIonExciteEnergy =
StoD(sQ) * keV;
402 if (sQ.empty()||sQ==
"noFloat")
403 { fIonFloatingLevelBase =
'\0'; }
405 { fIonFloatingLevelBase = sQ[(std::size_t)0]; }
409 ->
GetIon(fAtomicNumber,fAtomicMass,fIonExciteEnergy,fIonFloatingLevelBase);
413 ed <<
"Ion with Z=" << fAtomicNumber;
414 ed <<
" A=" << fAtomicMass <<
"is not defined";
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
static G4Geantino * Geantino()
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
static G4IonTable * GetIonTable()
G4bool IsShortLived() const
G4DecayTable * GetDecayTable() const
const G4String & GetParticleName() const
void SetNewValue(G4UIcommand *command, G4String newValues) override
~G4ParticleGunMessenger() override
G4ParticleGunMessenger(G4ParticleGun *fPtclGun)
G4String GetCurrentValue(G4UIcommand *command) override
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 SetParticleMomentumDirection(G4ParticleMomentum aMomDirection)
void SetParticleMomentum(G4double aMomentum)
G4double GetParticleEnergy() const
void SetParticleCharge(G4double aCharge)
void reset(G4bool ifSkipIon=true)
G4PTblDicIterator * GetIterator() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
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 CommandFailed(G4int errCode, G4ExceptionDescription &ed)
void SetRange(const char *rs)
G4double StoD(const G4String &s)
G4int StoI(const G4String &s)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterCandidates(const char *theString)
void SetParticleTime(G4double aTime)
G4double GetParticleTime()
G4ThreeVector GetParticlePosition()
void SetParticlePosition(G4ThreeVector aPosition)