48 :fParticleGun(fPtclGun),fShootIon(false),
49 fAtomicNumber(0),fAtomicMass(0),fIonCharge(0),fIonExciteEnergy(0.0),
50 fIonFloatingLevelBase(
'\0'),fIonEnergyLevel(0)
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 /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(
"Set properties of ion to be generated.");
159 ionLvlCmd->
SetGuidance(
"[usage] /gun/ionL Z A [Q I]");
162 ionLvlCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
163 ionLvlCmd->
SetGuidance(
" I:(int) Level number of metastable state (0 = ground)");
204 if (command==listCmd) {
206 }
else if (command==particleCmd) {
207 if (newValues ==
"ion") {
216 }
else if( command==directionCmd )
218 else if( command==energyCmd )
220 else if( command==momCmd )
222 else if( command==momAmpCmd )
224 else if( command==positionCmd )
226 else if( command==timeCmd )
228 else if( command==polCmd )
230 else if( command==numberCmd )
232 else if( command==ionCmd )
233 { IonCommand(newValues); }
234 else if( command==ionLvlCmd )
235 { IonLevelCommand(newValues); }
242 if( command==directionCmd )
244 else if( command==particleCmd )
246 else if( command==energyCmd )
250 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
254 else if( command==momCmd || command==momAmpCmd )
258 {
G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy." <<
G4endl; }
261 if( command==momCmd )
267 else if( command==positionCmd )
269 else if( command==timeCmd )
271 else if( command==polCmd )
273 else if( command==numberCmd )
275 else if( command==ionCmd )
278 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
279 cv +=
ItoS(fIonCharge);
289 void G4ParticleGunMessenger::IonLevelCommand(
G4String newValues)
294 fAtomicNumber =
StoI(next());
295 fAtomicMass =
StoI(next());
298 fIonCharge = fAtomicNumber;
300 fIonCharge =
StoI(sQ);
306 fIonEnergyLevel =
StoI(sQ);
311 G4cout <<
"Ion with Z = " << fAtomicNumber <<
", A = " << fAtomicMass
312 <<
", I = " << fIonEnergyLevel <<
" is not defined " <<
G4endl;
318 G4cout <<
"Set /gun/particle to ion before using /gun/ion command";
323 void G4ParticleGunMessenger::IonCommand(
G4String newValues)
328 fAtomicNumber =
StoI(next());
329 fAtomicMass =
StoI(next());
330 fIonCharge = fAtomicNumber;
331 fIonExciteEnergy = 0.0;
332 fIonFloatingLevelBase =
'\0';
337 fIonCharge =
StoI(sQ);
342 fIonExciteEnergy =
StoD(sQ) *
keV;
345 if (sQ.
isNull()||sQ==
"noFloat")
346 { fIonFloatingLevelBase =
'\0'; }
348 { fIonFloatingLevelBase = sQ[(size_t)0]; }
353 fIonExciteEnergy, fIonFloatingLevelBase);
355 G4cout <<
"Ion with Z=" << fAtomicNumber;
356 G4cout <<
" A=" << fAtomicMass <<
"is not defined" <<
G4endl;
362 G4cout <<
"Set /gun/particle to ion before using /gun/ion command";
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
G4String GetCurrentValue(G4UIcommand *command)
void SetParticleMomentum(G4double aMomentum)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
~G4ParticleGunMessenger()
CLHEP::Hep3Vector G4ThreeVector
static G4int GetNewIntValue(const char *paramString)
void SetParameterCandidates(const char *theString)
void SetDefaultUnit(const char *defUnit)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
G4double GetParticleMomentum() const
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetDefaultValue(const char *theDefaultValue)
static G4String ConvertToString(G4bool boolVal)
void SetNewValue(G4UIcommand *command, G4String newValues)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
static G4double GetNewDoubleValue(const char *paramString)
G4ThreeVector GetParticlePosition()
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
const G4String & GetParticleName() const
G4ParticleMomentum GetParticleMomentumDirection() const
G4DecayTable * GetDecayTable() const
void SetParticlePolarization(G4ThreeVector aVal)
G4ThreeVector GetParticlePolarization() const
void SetParticlePosition(G4ThreeVector aPosition)
G4GLOB_DLL std::ostream G4cout
void reset(G4bool ifSkipIon=true)
void SetParticleCharge(G4double aCharge)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetRange(const char *rs)
void SetGuidance(const char *aGuidance)
void SetNumberOfParticles(G4int i)
static constexpr double cm
static constexpr double eplus
G4ParticleGunMessenger(G4ParticleGun *fPtclGun)
static G4IonTable * GetIonTable()
G4int GetNumberOfParticles() const
void SetParticleEnergy(G4double aKineticEnergy)
G4bool IsShortLived() const
G4double GetParticleTime()
static G4ParticleTable * GetParticleTable()
void SetDefaultValue(const char *defVal)
G4double StoD(G4String s)
void SetDefaultUnit(const char *defUnit)
G4ParticleDefinition * GetParticleDefinition() const
static constexpr double GeV
static G4Geantino * Geantino()
void SetCandidates(const char *candidateList)
static constexpr double keV
G4PTblDicIterator * GetIterator() const
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G4double GetParticleEnergy() const
G4GLOB_DLL std::ostream G4cerr
void SetParticleTime(G4double aTime)