77 gunDirectory->SetGuidance(
"Particle Source control commands.");
81 listCmd->SetGuidance(
"List available particles.");
82 listCmd->SetGuidance(
" Invoke G4ParticleTable.");
86 particleCmd->SetGuidance(
"Set particle to be generated.");
87 particleCmd->SetGuidance(
" (geantino is default)");
88 particleCmd->SetGuidance(
" (ion can be specified for shooting ions)");
89 particleCmd->SetParameterName(
"particleName",
true);
90 particleCmd->SetDefaultValue(
"geantino");
92 G4int nPtcl = particleTable->entries();
93 for(
G4int i=0;i<nPtcl;i++)
95 candidateList += particleTable->GetParticleName(i);
98 candidateList +=
"ion ";
99 particleCmd->SetCandidates(candidateList);
104 directionCmd->SetGuidance(
"Set momentum direction.");
105 directionCmd->SetGuidance(
"Direction needs not to be a unit vector.");
106 directionCmd->SetParameterName(
"Px",
"Py",
"Pz",
true,
true);
107 directionCmd->SetRange(
"Px != 0 || Py != 0 || Pz != 0");
111 energyCmd->SetGuidance(
"Set kinetic energy.");
112 energyCmd->SetParameterName(
"Energy",
true,
true);
113 energyCmd->SetDefaultUnit(
"GeV");
118 positionCmd->SetGuidance(
"Set starting position of the particle.");
119 positionCmd->SetParameterName(
"X",
"Y",
"Z",
true,
true);
120 positionCmd->SetDefaultUnit(
"cm");
127 ionCmd->SetGuidance(
"Set properties of ion to be generated.");
128 ionCmd->SetGuidance(
"[usage] /gun/ion Z A Q E");
129 ionCmd->SetGuidance(
" Z:(int) AtomicNumber");
130 ionCmd->SetGuidance(
" A:(int) AtomicMass");
131 ionCmd->SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
132 ionCmd->SetGuidance(
" E:(double) Excitation energy (in keV)");
137 ionCmd->SetParameter(param);
140 ionCmd->SetParameter(param);
143 ionCmd->SetParameter(param);
146 ionCmd->SetParameter(param);
151 typeCmd->SetGuidance(
"Sets source distribution type.");
152 typeCmd->SetGuidance(
"Either Point or Volume");
153 typeCmd->SetParameterName(
"DisType",
true,
true);
154 typeCmd->SetDefaultValue(
"Point");
155 typeCmd->SetCandidates(
"Point Volume");
159 shapeCmd->SetGuidance(
"Sets source shape type.");
160 shapeCmd->SetParameterName(
"Shape",
true,
true);
161 shapeCmd->SetDefaultValue(
"NULL");
162 shapeCmd->SetCandidates(
"Sphere Cylinder");
166 centreCmd->SetGuidance(
"Set centre coordinates of source.");
167 centreCmd->SetParameterName(
"X",
"Y",
"Z",
true,
true);
168 centreCmd->SetDefaultUnit(
"cm");
169 centreCmd->SetUnitCandidates(
"nm um mm cm m km");
173 halfzCmd->SetGuidance(
"Set z half length of source.");
174 halfzCmd->SetParameterName(
"Halfz",
true,
true);
175 halfzCmd->SetDefaultUnit(
"cm");
176 halfzCmd->SetUnitCandidates(
"nm um mm cm m km");
180 radiusCmd->SetGuidance(
"Set radius of source.");
181 radiusCmd->SetParameterName(
"Radius",
true,
true);
182 radiusCmd->SetDefaultUnit(
"cm");
183 radiusCmd->SetUnitCandidates(
"nm um mm cm m km");
187 confineCmd->SetGuidance(
"Confine source to volume (NULL to unset).");
188 confineCmd->SetGuidance(
"usage: confine VolName");
189 confineCmd->SetParameterName(
"VolName",
true,
true);
190 confineCmd->SetDefaultValue(
"NULL");
194 angtypeCmd->SetGuidance(
"Sets angular source distribution type");
195 angtypeCmd->SetGuidance(
"Possible variables are: iso direction");
196 angtypeCmd->SetParameterName(
"AngDis",
true,
true);
197 angtypeCmd->SetDefaultValue(
"iso");
198 angtypeCmd->SetCandidates(
"iso direction");
202 energytypeCmd->SetGuidance(
"Sets energy distribution type");
203 energytypeCmd->SetGuidance(
"Possible variables are: Mono");
204 energytypeCmd->SetParameterName(
"EnergyDis",
true,
true);
205 energytypeCmd->SetDefaultValue(
"Mono");
206 energytypeCmd->SetCandidates(
"Mono");
210 verbosityCmd->SetGuidance(
"Set Verbose level for gun");
211 verbosityCmd->SetGuidance(
" 0 : Silent");
212 verbosityCmd->SetGuidance(
" 1 : Limited information");
213 verbosityCmd->SetGuidance(
" 2 : Detailed information");
214 verbosityCmd->SetParameterName(
"level",
false);
215 verbosityCmd->SetRange(
"level>=0 && level <=2");
229 delete energytypeCmd;
244 if(command == typeCmd)
245 fParticleGun->SetPosDisType(newValues);
247 else if(command == shapeCmd)
248 fParticleGun->SetPosDisShape(newValues);
250 else if(command == centreCmd)
251 fParticleGun->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues));
253 else if(command == halfzCmd)
254 fParticleGun->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues));
256 else if(command == radiusCmd)
257 fParticleGun->SetRadius(radiusCmd->GetNewDoubleValue(newValues));
259 else if(command == angtypeCmd)
260 fParticleGun->SetAngDistType(newValues);
262 else if(command == confineCmd)
263 fParticleGun->ConfineSourceToVolume(newValues);
265 else if(command == energytypeCmd)
266 fParticleGun->SetEnergyDisType(newValues);
268 else if(command == verbosityCmd)
269 fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
271 else if( command==particleCmd ) {
272 if (newValues ==
"ion") {
278 { fParticleGun->SetParticleDefinition( pd ); }
282 else if( command==ionCmd ) {
286 fAtomicNumber = StoI(next());
287 fAtomicMass = StoI(next());
290 fIonCharge = fAtomicNumber;
292 fIonCharge = StoI(sQ);
295 fIonExciteEnergy = 0.0;
297 fIonExciteEnergy = StoD(sQ) *
keV;
302 ion = particleTable->GetIon(fAtomicNumber,fAtomicMass,fIonExciteEnergy);
304 G4cout <<
"Ion with Z=" << fAtomicNumber;
305 G4cout <<
" A=" << fAtomicMass <<
"is not be defined" <<
G4endl;
307 fParticleGun->SetParticleDefinition(ion);
308 fParticleGun->SetParticleCharge(fIonCharge*
eplus);
311 G4cout<<
"Set /dmx/gun/particle to ion before using /dmx/gun/ion command";
316 else if( command==listCmd )
317 particleTable->DumpTable();
319 else if( command==directionCmd ) {
320 fParticleGun->SetAngDistType(
"direction");
321 fParticleGun->SetParticleMomentumDirection
322 (directionCmd->GetNew3VectorValue(newValues));
325 else if( command==energyCmd ) {
326 fParticleGun->SetEnergyDisType(
"Mono");
327 fParticleGun->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues));
330 else if( command==positionCmd ) {
331 fParticleGun->SetPosDisType(
"Point");
332 fParticleGun->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues));