95 if ( theInstance != 0 ) {
104 : fGPS(fPtclGun),fParticleGun(0),fShootIon(
false),
105 fAtomicNumber(0),fAtomicMass(0),fIonCharge(0),fIonExciteEnergy(0.),
106 fAtomicNumberL(0),fAtomicMassL(0),fIonChargeL(0),fIonEnergyLevel(0)
120 commandsShouldBeInMaster =
true;
131 gpsDirectory->SetGuidance(
"General Paricle Source control commands.");
136 sourceDirectory->SetGuidance(
"Multiple source control sub-directory");
139 addsourceCmd->SetGuidance(
"add a new source definition to the particle gun with the specified intensity");
140 addsourceCmd->SetParameterName(
"addsource",
false,
false);
141 addsourceCmd->SetRange(
"addsource > 0.");
144 listsourceCmd->SetGuidance(
"List the defined particle sources");
147 clearsourceCmd->SetGuidance(
"Remove all the defined particle sources");
150 getsourceCmd->SetGuidance(
"Show the current source index and intensity");
153 setsourceCmd->SetGuidance(
"set the indexed source as the current one");
154 setsourceCmd->SetGuidance(
" so one can change its source definition");
155 setsourceCmd->SetParameterName(
"setsource",
false,
false);
156 setsourceCmd->SetRange(
"setsource >= 0");
159 deletesourceCmd->SetGuidance(
"delete the indexed source from the list");
160 deletesourceCmd->SetParameterName(
"deletesource",
false,
false);
161 deletesourceCmd->SetRange(
"deletesource > 0");
164 setintensityCmd->SetGuidance(
"reset the current source to the specified intensity");
165 setintensityCmd->SetParameterName(
"setintensity",
false,
false);
166 setintensityCmd->SetRange(
"setintensity > 0.");
168 multiplevertexCmd =
new G4UIcmdWithABool(
"/gps/source/multiplevertex",
this);
169 multiplevertexCmd->SetGuidance(
"true for simultaneous generation multiple vertex");
170 multiplevertexCmd->SetGuidance(
"Default is false");
171 multiplevertexCmd->SetParameterName(
"multiplevertex",
true);
172 multiplevertexCmd->SetDefaultValue(
false);
175 flatsamplingCmd->SetGuidance(
"true for applying flat (biased) sampling among the sources");
176 flatsamplingCmd->SetGuidance(
"Default is false");
177 flatsamplingCmd->SetParameterName(
"flatsampling",
true);
178 flatsamplingCmd->SetDefaultValue(
false);
183 listCmd->SetGuidance(
"List available particles.");
184 listCmd->SetGuidance(
" Invoke G4ParticleTable.");
187 particleCmd->SetGuidance(
"Set particle to be generated.");
188 particleCmd->SetGuidance(
" (geantino is default)");
189 particleCmd->SetGuidance(
" (ion can be specified for shooting ions)");
190 particleCmd->SetParameterName(
"particleName",
true);
191 particleCmd->SetDefaultValue(
"geantino");
193 G4int nPtcl = particleTable->entries();
194 for(
G4int i=0;i<nPtcl;i++)
196 candidateList += particleTable->GetParticleName(i);
197 candidateList +=
" ";
199 candidateList +=
"ion ";
200 particleCmd->SetCandidates(candidateList);
203 directionCmd->SetGuidance(
"Set momentum direction.");
204 directionCmd->SetGuidance(
"Direction needs not to be a unit vector.");
205 directionCmd->SetGuidance(
"Angular distribution type is set to planar.");
206 directionCmd->SetParameterName(
"Px",
"Py",
"Pz",
false,
false);
207 directionCmd->SetRange(
"Px != 0 || Py != 0 || Pz != 0");
210 energyCmd->SetGuidance(
"Set kinetic energy.");
211 energyCmd->SetParameterName(
"Energy",
false,
false);
212 energyCmd->SetDefaultUnit(
"GeV");
217 positionCmd->SetGuidance(
"Set starting position of the particle for a Point like source.");
218 positionCmd->SetGuidance(
"Same effect as the two /gps/pos/type Point /gps/pos/centre commands.");
219 positionCmd->SetParameterName(
"X",
"Y",
"Z",
false,
false);
220 positionCmd->SetDefaultUnit(
"cm");
225 ionCmd->SetGuidance(
"Set properties of ion to be generated.");
226 ionCmd->SetGuidance(
"[usage] /gps/ion Z A Q E");
227 ionCmd->SetGuidance(
" Z:(int) AtomicNumber");
228 ionCmd->SetGuidance(
" A:(int) AtomicMass");
229 ionCmd->SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
230 ionCmd->SetGuidance(
" E:(double) Excitation energy (in keV)");
235 ionCmd->SetParameter(param);
238 ionCmd->SetParameter(param);
241 ionCmd->SetParameter(param);
244 ionCmd->SetParameter(param);
247 ionLvlCmd->SetGuidance(
"Set properties of ion to be generated.");
248 ionLvlCmd->SetGuidance(
"[usage] /gps/ion Z A Q Lvl");
249 ionLvlCmd->SetGuidance(
" Z:(int) AtomicNumber");
250 ionLvlCmd->SetGuidance(
" A:(int) AtomicMass");
251 ionLvlCmd->SetGuidance(
" Q:(int) Charge of Ion (in unit of e)");
252 ionLvlCmd->SetGuidance(
" Lvl:(int) Number of metastable state excitation level (0-9)");
257 ionLvlCmd->SetParameter(paramL);
260 ionLvlCmd->SetParameter(paramL);
263 ionLvlCmd->SetParameter(paramL);
266 ionLvlCmd->SetParameter(paramL);
269 timeCmd->SetGuidance(
"Set initial time of the particle.");
270 timeCmd->SetParameterName(
"t0",
false,
false);
271 timeCmd->SetDefaultUnit(
"ns");
276 polCmd->SetGuidance(
"Set polarization.");
277 polCmd->SetParameterName(
"Px",
"Py",
"Pz",
false,
false);
278 polCmd->SetRange(
"Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
281 numberCmd->SetGuidance(
"Set number of particles to be generated per vertex.");
282 numberCmd->SetParameterName(
"N",
false,
false);
283 numberCmd->SetRange(
"N>0");
287 verbosityCmd->SetGuidance(
"Set Verbose level for GPS");
288 verbosityCmd->SetGuidance(
" 0 : Silent");
289 verbosityCmd->SetGuidance(
" 1 : Limited information");
290 verbosityCmd->SetGuidance(
" 2 : Detailed information");
291 verbosityCmd->SetParameterName(
"level",
false);
292 verbosityCmd->SetRange(
"level>=0 && level <=2");
297 positionDirectory->SetGuidance(
"Positional commands sub-directory");
300 typeCmd1->SetGuidance(
"Sets source distribution type.");
301 typeCmd1->SetGuidance(
"Either Point, Beam, Plane, Surface or Volume");
302 typeCmd1->SetParameterName(
"DisType",
false,
false);
303 typeCmd1->SetDefaultValue(
"Point");
304 typeCmd1->SetCandidates(
"Point Beam Plane Surface Volume");
307 shapeCmd1->SetGuidance(
"Sets source shape for Plan, Surface or Volume type source.");
308 shapeCmd1->SetParameterName(
"Shape",
false,
false);
309 shapeCmd1->SetDefaultValue(
"NULL");
310 shapeCmd1->SetCandidates(
"Circle Annulus Ellipse Square Rectangle Sphere Ellipsoid Cylinder EllipticCylinder Para");
313 centreCmd1->SetGuidance(
"Set centre coordinates of source.");
315 centreCmd1->SetParameterName(
"X",
"Y",
"Z",
false,
false);
316 centreCmd1->SetDefaultUnit(
"cm");
320 posrot1Cmd1->SetGuidance(
"Set the 1st vector defining the rotation matrix'.");
321 posrot1Cmd1->SetGuidance(
"It does not need to be a unit vector.");
322 posrot1Cmd1->SetParameterName(
"R1x",
"R1y",
"R1z",
false,
false);
323 posrot1Cmd1->SetRange(
"R1x != 0 || R1y != 0 || R1z != 0");
326 posrot2Cmd1->SetGuidance(
"Set the 2nd vector defining the rotation matrix'.");
327 posrot2Cmd1->SetGuidance(
"It does not need to be a unit vector.");
328 posrot2Cmd1->SetParameterName(
"R2x",
"R2y",
"R2z",
false,
false);
329 posrot2Cmd1->SetRange(
"R2x != 0 || R2y != 0 || R2z != 0");
332 halfxCmd1->SetGuidance(
"Set x half length of source.");
333 halfxCmd1->SetParameterName(
"Halfx",
false,
false);
334 halfxCmd1->SetDefaultUnit(
"cm");
338 halfyCmd1->SetGuidance(
"Set y half length of source.");
339 halfyCmd1->SetParameterName(
"Halfy",
false,
false);
340 halfyCmd1->SetDefaultUnit(
"cm");
344 halfzCmd1->SetGuidance(
"Set z half length of source.");
345 halfzCmd1->SetParameterName(
"Halfz",
false,
false);
346 halfzCmd1->SetDefaultUnit(
"cm");
350 radiusCmd1->SetGuidance(
"Set radius of source.");
351 radiusCmd1->SetParameterName(
"Radius",
false,
false);
352 radiusCmd1->SetDefaultUnit(
"cm");
356 radius0Cmd1->SetGuidance(
"Set inner radius of source when required.");
357 radius0Cmd1->SetParameterName(
"Radius0",
false,
false);
358 radius0Cmd1->SetDefaultUnit(
"cm");
362 possigmarCmd1->SetGuidance(
"Set standard deviation in radial of the beam positional profile");
363 possigmarCmd1->SetGuidance(
" applicable to Beam type source only");
364 possigmarCmd1->SetParameterName(
"Sigmar",
false,
false);
365 possigmarCmd1->SetDefaultUnit(
"cm");
369 possigmaxCmd1->SetGuidance(
"Set standard deviation of beam positional profile in x-dir");
370 possigmaxCmd1->SetGuidance(
" applicable to Beam type source only");
371 possigmaxCmd1->SetParameterName(
"Sigmax",
false,
false);
372 possigmaxCmd1->SetDefaultUnit(
"cm");
376 possigmayCmd1->SetGuidance(
"Set standard deviation of beam positional profile in y-dir");
377 possigmayCmd1->SetGuidance(
" applicable to Beam type source only");
378 possigmayCmd1->SetParameterName(
"Sigmay",
false,
false);
379 possigmayCmd1->SetDefaultUnit(
"cm");
383 paralpCmd1->SetGuidance(
"Angle from y-axis of y' in Para");
384 paralpCmd1->SetParameterName(
"paralp",
false,
false);
385 paralpCmd1->SetDefaultUnit(
"rad");
389 partheCmd1->SetGuidance(
"Polar angle through centres of z faces");
390 partheCmd1->SetParameterName(
"parthe",
false,
false);
391 partheCmd1->SetDefaultUnit(
"rad");
395 parphiCmd1->SetGuidance(
"Azimuth angle through centres of z faces");
396 parphiCmd1->SetParameterName(
"parphi",
false,
false);
397 parphiCmd1->SetDefaultUnit(
"rad");
401 confineCmd1->SetGuidance(
"Confine source to volume (NULL to unset).");
402 confineCmd1->SetGuidance(
"usage: confine VolName");
403 confineCmd1->SetParameterName(
"VolName",
false,
false);
404 confineCmd1->SetDefaultValue(
"NULL");
512 angularDirectory->SetGuidance(
"Angular commands sub-directory");
515 angtypeCmd1->SetGuidance(
"Sets angular source distribution type");
516 angtypeCmd1->SetGuidance(
"Possible variables are: iso, cos, planar, beam1d, beam2d, focused or user");
517 angtypeCmd1->SetParameterName(
"AngDis",
false,
false);
518 angtypeCmd1->SetDefaultValue(
"iso");
519 angtypeCmd1->SetCandidates(
"iso cos planar beam1d beam2d focused user");
522 angrot1Cmd1->SetGuidance(
"Sets the 1st vector for angular distribution rotation matrix");
523 angrot1Cmd1->SetGuidance(
"Need not be a unit vector");
524 angrot1Cmd1->SetParameterName(
"AR1x",
"AR1y",
"AR1z",
false,
false);
525 angrot1Cmd1->SetRange(
"AR1x != 0 || AR1y != 0 || AR1z != 0");
528 angrot2Cmd1->SetGuidance(
"Sets the 2nd vector for angular distribution rotation matrix");
529 angrot2Cmd1->SetGuidance(
"Need not be a unit vector");
530 angrot2Cmd1->SetParameterName(
"AR2x",
"AR2y",
"AR2z",
false,
false);
531 angrot2Cmd1->SetRange(
"AR2x != 0 || AR2y != 0 || AR2z != 0");
534 minthetaCmd1->SetGuidance(
"Set minimum theta");
535 minthetaCmd1->SetParameterName(
"MinTheta",
false,
false);
536 minthetaCmd1->SetDefaultValue(0.);
537 minthetaCmd1->SetDefaultUnit(
"rad");
541 maxthetaCmd1->SetGuidance(
"Set maximum theta");
542 maxthetaCmd1->SetParameterName(
"MaxTheta",
false,
false);
543 maxthetaCmd1->SetDefaultValue(
pi);
544 maxthetaCmd1->SetDefaultUnit(
"rad");
548 minphiCmd1->SetGuidance(
"Set minimum phi");
549 minphiCmd1->SetParameterName(
"MinPhi",
false,
false);
550 minphiCmd1->SetDefaultUnit(
"rad");
554 maxphiCmd1->SetGuidance(
"Set maximum phi");
555 maxphiCmd1->SetParameterName(
"MaxPhi",
false,
false);
556 maxphiCmd1->SetDefaultValue(
pi);
557 maxphiCmd1->SetDefaultUnit(
"rad");
561 angsigmarCmd1->SetGuidance(
"Set standard deviation in direction for 1D beam.");
562 angsigmarCmd1->SetParameterName(
"Sigmara",
false,
false);
563 angsigmarCmd1->SetDefaultUnit(
"rad");
567 angsigmaxCmd1->SetGuidance(
"Set standard deviation in direction in x-direc. for 2D beam");
568 angsigmaxCmd1->SetParameterName(
"Sigmaxa",
false,
false);
569 angsigmaxCmd1->SetDefaultUnit(
"rad");
573 angsigmayCmd1->SetGuidance(
"Set standard deviation in direction in y-direc. for 2D beam");
574 angsigmayCmd1->SetParameterName(
"Sigmaya",
false,
false);
575 angsigmayCmd1->SetDefaultUnit(
"rad");
579 angfocusCmd->SetGuidance(
"Set the focusing point for the beam");
580 angfocusCmd->SetParameterName(
"x",
"y",
"z",
false,
false);
581 angfocusCmd->SetDefaultUnit(
"cm");
585 useuserangaxisCmd1->SetGuidance(
"true for using user defined angular co-ordinates");
586 useuserangaxisCmd1->SetGuidance(
"Default is false");
587 useuserangaxisCmd1->SetParameterName(
"useuserangaxis",
true);
588 useuserangaxisCmd1->SetDefaultValue(
false);
591 surfnormCmd1->SetGuidance(
"Makes a user-defined distribution with respect to surface normals rather than x,y,z axes.");
592 surfnormCmd1->SetGuidance(
"Default is false");
593 surfnormCmd1->SetParameterName(
"surfnorm",
true);
594 surfnormCmd1->SetDefaultValue(
false);
674 energyDirectory->SetGuidance(
"Spectral commands sub-directory");
677 energytypeCmd1->SetGuidance(
"Sets energy distribution type");
678 energytypeCmd1->SetParameterName(
"EnergyDis",
false,
false);
679 energytypeCmd1->SetDefaultValue(
"Mono");
680 energytypeCmd1->SetCandidates(
"Mono Lin Pow Exp CPow Gauss Brem Bbody Cdg User Arb Epn");
683 eminCmd1->SetGuidance(
"Sets minimum energy");
684 eminCmd1->SetParameterName(
"emin",
false,
false);
685 eminCmd1->SetDefaultUnit(
"keV");
689 emaxCmd1->SetGuidance(
"Sets maximum energy");
690 emaxCmd1->SetParameterName(
"emax",
false,
false);
691 emaxCmd1->SetDefaultUnit(
"keV");
695 monoenergyCmd1->SetGuidance(
"Sets a monocromatic energy (same as gps/energy)");
696 monoenergyCmd1->SetParameterName(
"monoenergy",
false,
false);
697 monoenergyCmd1->SetDefaultUnit(
"keV");
701 engsigmaCmd1->SetGuidance(
"Sets the standard deviation for Gaussian energy dist.");
702 engsigmaCmd1->SetParameterName(
"Sigmae",
false,
false);
703 engsigmaCmd1->SetDefaultUnit(
"keV");
707 alphaCmd1->SetGuidance(
"Sets Alpha (index) for power-law energy dist.");
708 alphaCmd1->SetParameterName(
"alpha",
false,
false);
711 tempCmd1->SetGuidance(
"Sets the temperature for Brem and BBody distributions (in Kelvin)");
712 tempCmd1->SetParameterName(
"temp",
false,
false);
715 ezeroCmd1->SetGuidance(
"Sets E_0 for exponential distribution (in MeV)");
716 ezeroCmd1->SetParameterName(
"ezero",
false,
false);
719 gradientCmd1->SetGuidance(
"Sets the gradient for Lin distribution (in 1/MeV)");
720 gradientCmd1->SetParameterName(
"gradient",
false,
false);
723 interceptCmd1->SetGuidance(
"Sets the intercept for Lin distributions (in MeV)");
724 interceptCmd1->SetParameterName(
"intercept",
false,
false);
727 arbeintCmd1->SetGuidance(
"Set the power-law index for the energy sampling distri. )");
728 arbeintCmd1->SetParameterName(
"arbeint",
false,
false);
731 calculateCmd1->SetGuidance(
"Calculates the distributions for Cdg and BBody");
734 energyspecCmd1->SetGuidance(
"True for energy and false for momentum spectra");
735 energyspecCmd1->SetParameterName(
"energyspec",
true);
736 energyspecCmd1->SetDefaultValue(
true);
739 diffspecCmd1->SetGuidance(
"True for differential and flase for integral spectra");
740 diffspecCmd1->SetParameterName(
"diffspec",
true);
741 diffspecCmd1->SetDefaultValue(
true);
809 histDirectory->SetGuidance(
"Histogram, biasing commands sub-directory");
812 histnameCmd1->SetGuidance(
"Sets histogram type");
813 histnameCmd1->SetParameterName(
"HistType",
false,
false);
814 histnameCmd1->SetDefaultValue(
"biasx");
815 histnameCmd1->SetCandidates(
"biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
818 resethistCmd1->SetGuidance(
"Reset (clean) the histogram ");
819 resethistCmd1->SetParameterName(
"HistType",
false,
false);
820 resethistCmd1->SetDefaultValue(
"energy");
821 resethistCmd1->SetCandidates(
"biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
824 histpointCmd1->SetGuidance(
"Allows user to define a histogram");
825 histpointCmd1->SetGuidance(
"Enter: Ehi Weight");
826 histpointCmd1->SetParameterName(
"Ehi",
"Weight",
"Junk",
true,
true);
827 histpointCmd1->SetRange(
"Ehi >= 0. && Weight >= 0.");
830 histfileCmd1->SetGuidance(
"import the arb energy hist in an ASCII file");
831 histfileCmd1->SetParameterName(
"HistFile",
false,
false);
834 arbintCmd1->SetGuidance(
"Sets the interpolation method for arbitrary distribution.");
835 arbintCmd1->SetParameterName(
"int",
false,
false);
836 arbintCmd1->SetDefaultValue(
"Lin");
837 arbintCmd1->SetCandidates(
"Lin Log Exp Spline");
999 #define CHECKPG() { if (fParticleGun==NULL) { \
1000 G4ExceptionDescription msg; \
1001 msg << "Command "<< command->GetCommandPath()<<"/";\
1002 msg<<command->GetCommandName() << " used but no particle sources are set.";\
1003 msg <<" Add at least a source with: /gps/source/add.";\
1004 G4Exception("G4GeneralParticleSourceMessenger::SetNewValue","G4GPS003",\
1005 FatalException,msg); return;\
1392 if (newValues ==
"ion") {
1403 else if( command==
polCmd )
1407 else if( command==
ionCmd )
1705 if(newValues ==
"theta" || newValues ==
"phi") {
1707 }
else if (newValues ==
"energy" || newValues ==
"arb" || newValues ==
"epn") {
1740 cv =
"Not implemented yet";
1789 ed <<
"Set /gps/particle to ion before using /gps/ion command";
1829 ed <<
"Set /gps/particle to ion before using /gps/ionLvl command";