50 : fParticleGun(fPtclGun)
55 gunDirectory->
SetGuidance(
"Particle Gun control commands.");
62 particleCmd->
SetGuidance(
"Set particle to be generated.");
64 particleCmd->
SetGuidance(
" (ion can be specified for shooting ions)");
79 candidateList +=
"ion ";
83 directionCmd->
SetGuidance(
"Set momentum direction.");
84 directionCmd->
SetGuidance(
" Direction needs not to be a unit vector.");
86 directionCmd->
SetRange(
"ex != 0 || ey != 0 || ez != 0");
96 momCmd->
SetGuidance(
"Set momentum. This command is equivalent to two commands");
97 momCmd->
SetGuidance(
" /gun/direction and /gun/momentumAmp");
99 momCmd->
SetRange(
"px != 0 || py != 0 || pz != 0");
103 momAmpCmd->
SetGuidance(
"Set absolute value of momentum.");
104 momAmpCmd->
SetGuidance(
" Direction should be set by /gun/direction command.");
105 momAmpCmd->
SetGuidance(
" This command should be used alternatively with /gun/energy.");
110 positionCmd->
SetGuidance(
"Set starting position of the particle.");
117 timeCmd->
SetGuidance(
"Set initial time of the particle.");
126 polCmd->
SetRange(
"Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
129 numberCmd->
SetGuidance(
"Set number of particles to be generated.");
134 ionCmd->
SetGuidance(
"Set properties of ion to be generated.");
135 ionCmd->
SetGuidance(
"[usage] /gun/ion Z A [Q E flb]");
138 ionCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
139 ionCmd->
SetGuidance(
" E:(double) Excitation energy (in keV)");
140 ionCmd->
SetGuidance(
" flb:(char) Floating level base");
159 ionLvlCmd->
SetGuidance(
"THIS COMMAND IS DEPRECATED and will be removed in future releases.");
161 ionLvlCmd->
SetGuidance(
" Set properties of ion to be generated.");
162 ionLvlCmd->
SetGuidance(
" [usage] /gun/ionL Z A [Q I]");
165 ionLvlCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
166 ionLvlCmd->
SetGuidance(
" I:(int) Level number of metastable state (0 = ground)");
210 if (command==listCmd)
214 else if (command==particleCmd)
216 if (newValues ==
"ion")
230 ed <<
"Particle [" << newValues <<
"] is not found.";
235 }
else if( command==directionCmd )
237 else if( command==energyCmd )
239 else if( command==momCmd )
241 else if( command==momAmpCmd )
243 else if( command==positionCmd )
245 else if( command==timeCmd )
247 else if( command==polCmd )
249 else if( command==numberCmd )
251 else if( command==ionCmd )
255 IonCommand(newValues);
259 ed <<
"Set /gun/particle to ion before using /gun/ion command";
263 else if( command==ionLvlCmd )
266 depWarn <<
"\nCommand /gun/ionL is deprecated and will be removed in future releases.\n"
267 <<
"Use /gun/ion instead.\n";
268 G4Exception(
"G4ParticleGunMessenger::SetNewValue",
"IonLWarn",
273 IonLevelCommand(newValues);
277 ed <<
"Set /gun/particle to ion before using /gun/ion command";
287 if( command==directionCmd )
289 else if( command==particleCmd )
291 else if( command==energyCmd )
295 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
299 else if( command==momCmd || command==momAmpCmd )
304 G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy."
309 if( command==momCmd )
315 else if( command==positionCmd )
317 else if( command==timeCmd )
319 else if( command==polCmd )
321 else if( command==numberCmd )
323 else if( command==ionCmd )
327 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
328 cv +=
ItoS(fIonCharge);
338void G4ParticleGunMessenger::IonLevelCommand(
const G4String& newValues)
344 fAtomicNumber =
StoI(next());
345 fAtomicMass =
StoI(next());
347 if (sQ.empty() ||
StoI(sQ)<0)
349 fIonCharge = fAtomicNumber;
353 fIonCharge =
StoI(sQ);
362 fIonEnergyLevel =
StoI(sQ);
365 ->
GetIon(fAtomicNumber,fAtomicMass,fIonEnergyLevel);
369 ed <<
"Ion with Z = " << fAtomicNumber <<
", A = " << fAtomicMass
370 <<
", I = " << fIonEnergyLevel <<
" is not defined ";
380void G4ParticleGunMessenger::IonCommand(
const G4String& newValues)
386 fAtomicNumber =
StoI(next());
387 fAtomicMass =
StoI(next());
388 fIonCharge = fAtomicNumber;
389 fIonExciteEnergy = 0.0;
390 fIonFloatingLevelBase =
'\0';
395 fIonCharge =
StoI(sQ);
400 fIonExciteEnergy =
StoD(sQ) * keV;
403 if (sQ.empty()||sQ==
"noFloat")
404 { fIonFloatingLevelBase =
'\0'; }
406 { fIonFloatingLevelBase = sQ[(std::size_t)0]; }
410 ->
GetIon(fAtomicNumber,fAtomicMass,fIonExciteEnergy,fIonFloatingLevelBase);
414 ed <<
"Ion with Z=" << fAtomicNumber;
415 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)