48 :fParticleGun(fPtclGun),fShootIon(false),
49 fAtomicNumber(0),fAtomicMass(0),fIonCharge(0),fIonExciteEnergy(0.0),fIonEnergyLevel(0)
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 /gun/direction and /gun/momentumAmp");
97 momCmd->
SetRange(
"px != 0 || py != 0 || pz != 0");
101 momAmpCmd->
SetGuidance(
"Set absolute value of momentum.");
102 momAmpCmd->
SetGuidance(
"Direction should be set by /gun/direction command.");
103 momAmpCmd->
SetGuidance(
"This command should be used alternatively with /gun/energy.");
108 positionCmd->
SetGuidance(
"Set starting position of the particle.");
115 timeCmd->
SetGuidance(
"Set initial time of the particle.");
124 polCmd->
SetRange(
"Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
127 numberCmd->
SetGuidance(
"Set number of particles to be generated.");
132 ionCmd->
SetGuidance(
"Set properties of ion to be generated.");
136 ionCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
137 ionCmd->
SetGuidance(
" E:(double) Excitation energy (in keV)");
154 ionLvlCmd->
SetGuidance(
"Set properties of ion to be generated.");
155 ionLvlCmd->
SetGuidance(
"[usage] /gun/ion Z A Q I");
158 ionLvlCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
159 ionLvlCmd->
SetGuidance(
" I:(int) Level number of metastable state (0 = ground)");
202 if (command==listCmd) {
204 }
else if (command==particleCmd) {
205 if (newValues ==
"ion") {
214 }
else if( command==directionCmd )
216 else if( command==energyCmd )
218 else if( command==momCmd )
220 else if( command==momAmpCmd )
222 else if( command==positionCmd )
224 else if( command==timeCmd )
226 else if( command==polCmd )
228 else if( command==numberCmd )
230 else if( command==ionCmd )
231 { IonCommand(newValues); }
232 else if( command==ionLvlCmd )
233 { IonLevelCommand(newValues); }
240 if( command==directionCmd )
242 else if( command==particleCmd )
244 else if( command==energyCmd )
248 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
252 else if( command==momCmd || command==momAmpCmd )
256 {
G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy." <<
G4endl; }
259 if( command==momCmd )
265 else if( command==positionCmd )
267 else if( command==timeCmd )
269 else if( command==polCmd )
271 else if( command==numberCmd )
273 else if( command==ionCmd )
276 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
277 cv +=
ItoS(fIonCharge);
287 void G4ParticleGunMessenger::IonLevelCommand(
G4String newValues)
292 fAtomicNumber =
StoI(next());
293 fAtomicMass =
StoI(next());
296 fIonCharge = fAtomicNumber;
298 fIonCharge =
StoI(sQ);
303 fIonEnergyLevel =
StoI(sQ);
309 G4cout <<
"Ion with Z = " << fAtomicNumber <<
", A = " << fAtomicMass
310 <<
", I = " << fIonEnergyLevel <<
" is not defined " <<
G4endl;
316 G4cout <<
"Set /gun/particle to ion before using /gun/ion command";
321 void G4ParticleGunMessenger::IonCommand(
G4String newValues)
326 fAtomicNumber =
StoI(next());
327 fAtomicMass =
StoI(next());
330 fIonCharge = fAtomicNumber;
332 fIonCharge =
StoI(sQ);
335 fIonExciteEnergy = 0.0;
337 fIonExciteEnergy =
StoD(sQ) *
keV;
344 G4cout <<
"Ion with Z=" << fAtomicNumber;
345 G4cout <<
" A=" << fAtomicMass <<
"is not defined" <<
G4endl;
351 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 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)
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 G4Geantino * Geantino()
void SetCandidates(const char *candidateList)
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)