78 gunDirectory->SetGuidance(
"Particle Source control commands.");
82 listCmd->SetGuidance(
"List available particles.");
83 listCmd->SetGuidance(
" Invoke G4ParticleTable.");
87 particleCmd->SetGuidance(
"Set particle to be generated.");
88 particleCmd->SetGuidance(
" (geantino is default)");
89 particleCmd->SetGuidance(
" (ion can be specified for shooting ions)");
90 particleCmd->SetParameterName(
"particleName",
true);
91 particleCmd->SetDefaultValue(
"geantino");
93 G4int nPtcl = particleTable->entries();
94 for(
G4int i=0;i<nPtcl;i++)
96 candidateList += particleTable->GetParticleName(i);
99 candidateList +=
"ion ";
100 particleCmd->SetCandidates(candidateList);
105 directionCmd->SetGuidance(
"Set momentum direction.");
106 directionCmd->SetGuidance(
"Direction needs not to be a unit vector.");
107 directionCmd->SetParameterName(
"Px",
"Py",
"Pz",
true,
true);
108 directionCmd->SetRange(
"Px != 0 || Py != 0 || Pz != 0");
112 energyCmd->SetGuidance(
"Set kinetic energy.");
113 energyCmd->SetParameterName(
"Energy",
true,
true);
114 energyCmd->SetDefaultUnit(
"GeV");
119 positionCmd->SetGuidance(
"Set starting position of the particle.");
120 positionCmd->SetParameterName(
"X",
"Y",
"Z",
true,
true);
121 positionCmd->SetDefaultUnit(
"cm");
128 ionCmd->SetGuidance(
"Set properties of ion to be generated.");
129 ionCmd->SetGuidance(
"[usage] /gun/ion Z A Q E");
130 ionCmd->SetGuidance(
" Z:(int) AtomicNumber");
131 ionCmd->SetGuidance(
" A:(int) AtomicMass");
132 ionCmd->SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
133 ionCmd->SetGuidance(
" E:(double) Excitation energy (in keV)");
138 ionCmd->SetParameter(param);
141 ionCmd->SetParameter(param);
144 ionCmd->SetParameter(param);
147 ionCmd->SetParameter(param);
152 typeCmd->SetGuidance(
"Sets source distribution type.");
153 typeCmd->SetGuidance(
"Either Point or Volume");
154 typeCmd->SetParameterName(
"DisType",
true,
true);
155 typeCmd->SetDefaultValue(
"Point");
156 typeCmd->SetCandidates(
"Point Volume");
160 shapeCmd->SetGuidance(
"Sets source shape type.");
161 shapeCmd->SetParameterName(
"Shape",
true,
true);
162 shapeCmd->SetDefaultValue(
"NULL");
163 shapeCmd->SetCandidates(
"Sphere Cylinder");
167 centreCmd->SetGuidance(
"Set centre coordinates of source.");
168 centreCmd->SetParameterName(
"X",
"Y",
"Z",
true,
true);
169 centreCmd->SetDefaultUnit(
"cm");
170 centreCmd->SetUnitCandidates(
"nm um mm cm m km");
174 halfzCmd->SetGuidance(
"Set z half length of source.");
175 halfzCmd->SetParameterName(
"Halfz",
true,
true);
176 halfzCmd->SetDefaultUnit(
"cm");
177 halfzCmd->SetUnitCandidates(
"nm um mm cm m km");
181 radiusCmd->SetGuidance(
"Set radius of source.");
182 radiusCmd->SetParameterName(
"Radius",
true,
true);
183 radiusCmd->SetDefaultUnit(
"cm");
184 radiusCmd->SetUnitCandidates(
"nm um mm cm m km");
188 confineCmd->SetGuidance(
"Confine source to volume (NULL to unset).");
189 confineCmd->SetGuidance(
"usage: confine VolName");
190 confineCmd->SetParameterName(
"VolName",
true,
true);
191 confineCmd->SetDefaultValue(
"NULL");
195 angtypeCmd->SetGuidance(
"Sets angular source distribution type");
196 angtypeCmd->SetGuidance(
"Possible variables are: iso direction");
197 angtypeCmd->SetParameterName(
"AngDis",
true,
true);
198 angtypeCmd->SetDefaultValue(
"iso");
199 angtypeCmd->SetCandidates(
"iso direction");
203 energytypeCmd->SetGuidance(
"Sets energy distribution type");
204 energytypeCmd->SetGuidance(
"Possible variables are: Mono");
205 energytypeCmd->SetParameterName(
"EnergyDis",
true,
true);
206 energytypeCmd->SetDefaultValue(
"Mono");
207 energytypeCmd->SetCandidates(
"Mono");
211 verbosityCmd->SetGuidance(
"Set Verbose level for gun");
212 verbosityCmd->SetGuidance(
" 0 : Silent");
213 verbosityCmd->SetGuidance(
" 1 : Limited information");
214 verbosityCmd->SetGuidance(
" 2 : Detailed information");
215 verbosityCmd->SetParameterName(
"level",
false);
216 verbosityCmd->SetRange(
"level>=0 && level <=2");
245 if(command == typeCmd)
246 fParticleGun->SetPosDisType(newValues);
248 else if(command == shapeCmd)
249 fParticleGun->SetPosDisShape(newValues);
251 else if(command == centreCmd)
252 fParticleGun->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues));
254 else if(command == halfzCmd)
255 fParticleGun->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues));
257 else if(command == radiusCmd)
258 fParticleGun->SetRadius(radiusCmd->GetNewDoubleValue(newValues));
260 else if(command == angtypeCmd)
261 fParticleGun->SetAngDistType(newValues);
263 else if(command == confineCmd)
264 fParticleGun->ConfineSourceToVolume(newValues);
266 else if(command == energytypeCmd)
267 fParticleGun->SetEnergyDisType(newValues);
269 else if(command == verbosityCmd)
270 fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
272 else if( command==particleCmd ) {
273 if (newValues ==
"ion") {
279 { fParticleGun->SetParticleDefinition( pd ); }
283 else if( command==ionCmd ) {
287 fAtomicNumber = StoI(next());
288 fAtomicMass = StoI(next());
291 fIonCharge = fAtomicNumber;
293 fIonCharge = StoI(sQ);
296 fIonExciteEnergy = 0.0;
298 fIonExciteEnergy = StoD(sQ) *
keV;
305 G4cout <<
"Ion with Z=" << fAtomicNumber;
306 G4cout <<
" A=" << fAtomicMass <<
"is not be defined" <<
G4endl;
308 fParticleGun->SetParticleDefinition(ion);
309 fParticleGun->SetParticleCharge(fIonCharge*
eplus);
312 G4cout<<
"Set /dmx/gun/particle to ion before using /dmx/gun/ion command";
317 else if( command==listCmd )
318 particleTable->DumpTable();
320 else if( command==directionCmd ) {
321 fParticleGun->SetAngDistType(
"direction");
322 fParticleGun->SetParticleMomentumDirection
323 (directionCmd->GetNew3VectorValue(newValues));
326 else if( command==energyCmd ) {
327 fParticleGun->SetEnergyDisType(
"Mono");
328 fParticleGun->SetMonoEnergy(energyCmd->GetNewDoubleValue(newValues));
331 else if( command==positionCmd ) {
332 fParticleGun->SetPosDisType(
"Point");
333 fParticleGun->SetCentreCoords(positionCmd->GetNew3VectorValue(newValues));
G4UIcmdWith3VectorAndUnit * centreCmd
static G4ParticleTable * GetParticleTable()
static G4IonTable * GetIonTable()
G4UIcmdWithAString * angtypeCmd
static constexpr double keV
G4UIcmdWithADoubleAndUnit * halfzCmd
G4UIdirectory * gunDirectory
G4UIcmdWith3VectorAndUnit * positionCmd
G4UIcmdWithAString * particleCmd
~DMXParticleSourceMessenger()
G4UIcmdWithAString * shapeCmd
void SetDefaultValue(const char *theDefaultValue)
G4UIcmdWith3Vector * directionCmd
G4UIcmdWithoutParameter * listCmd
G4UIcmdWithAString * confineCmd
void SetNewValue(G4UIcommand *command, G4String newValues)
G4UIcmdWithADoubleAndUnit * radiusCmd
G4UIcmdWithAString * typeCmd
static constexpr double eplus
G4UIcmdWithAnInteger * verbosityCmd
G4GLOB_DLL std::ostream G4cout
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
G4UIcmdWithAString * energytypeCmd
DMXParticleSourceMessenger(DMXParticleSource *fPtclGun)
G4UIcmdWithADoubleAndUnit * energyCmd