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)");
152 ionLvlCmd->
SetGuidance(
"Set properties of ion to be generated.");
153 ionLvlCmd->
SetGuidance(
"[usage] /gun/ion Z A Q I");
156 ionLvlCmd->
SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
157 ionLvlCmd->
SetGuidance(
" I:(int) Level number of metastable state (0 = ground)");
198 if (command==listCmd) {
200 }
else if (command==particleCmd) {
201 if (newValues ==
"ion") {
210 }
else if( command==directionCmd )
212 else if( command==energyCmd )
214 else if( command==momCmd )
216 else if( command==momAmpCmd )
218 else if( command==positionCmd )
220 else if( command==timeCmd )
222 else if( command==polCmd )
224 else if( command==numberCmd )
226 else if( command==ionCmd )
227 { IonCommand(newValues); }
228 else if( command==ionLvlCmd )
229 { IonLevelCommand(newValues); }
236 if( command==directionCmd )
238 else if( command==particleCmd )
240 else if( command==energyCmd )
244 {
G4cerr <<
" G4ParticleGun: was defined in terms of momentum." <<
G4endl; }
248 else if( command==momCmd || command==momAmpCmd )
252 {
G4cerr <<
" G4ParticleGun: was defined in terms of kinetic energy." <<
G4endl; }
255 if( command==momCmd )
261 else if( command==positionCmd )
263 else if( command==timeCmd )
265 else if( command==polCmd )
267 else if( command==numberCmd )
269 else if( command==ionCmd )
272 cv =
ItoS(fAtomicNumber) +
" " +
ItoS(fAtomicMass) +
" ";
273 cv +=
ItoS(fIonCharge);
283 void G4ParticleGunMessenger::IonLevelCommand(
G4String newValues)
288 fAtomicNumber =
StoI(next());
289 fAtomicMass =
StoI(next());
292 fIonCharge = fAtomicNumber;
294 fIonCharge =
StoI(sQ);
300 fIonEnergyLevel =
StoI(sQ);
305 G4cout <<
"Ion with Z = " << fAtomicNumber <<
", A = " << fAtomicMass
306 <<
", I = " << fIonEnergyLevel <<
" is not defined " <<
G4endl;
312 G4cout <<
"Set /gun/particle to ion before using /gun/ion command";
317 void G4ParticleGunMessenger::IonCommand(
G4String newValues)
322 fAtomicNumber =
StoI(next());
323 fAtomicMass =
StoI(next());
326 fIonCharge = fAtomicNumber;
328 fIonCharge =
StoI(sQ);
331 fIonExciteEnergy = 0.0;
333 fIonExciteEnergy =
StoD(sQ) *
keV;
339 G4cout <<
"Ion with Z=" << fAtomicNumber;
340 G4cout <<
" A=" << fAtomicMass <<
"is not defined" <<
G4endl;
346 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)