Geant4  10.01.p01
G4GeneralParticleSourceMessenger.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
27 //
28 // MODULE: G4GeneralParticleSourceMessenger.cc
29 //
30 // Version: 2.0
31 // Date: 5/02/04
32 // Author: Fan Lei
33 // Organisation: QinetiQ ltd.
34 // Customer: ESA/ESTEC
35 //
37 //
38 // CHANGE HISTORY
39 // --------------
40 //
41 // Version 2.0, 05/02/2004, Fan Lei, Created.
42 // After changes to version 1.1 as in Geant4 v6.0
43 // - Mutilple particle source definition
44 // - Re-structured commands
45 // - old commands have been retained for backward compatibility, will be
46 // removed in the future.
47 //
48 //
49 // 20/03/2014, Andrew Green - Modifications for MT
50 // - Added a check to force only one thread to parse the macro file
51 // This information is fed into the GPS which now has a split mechanism for the large data (hence need to only read in 1 thread)
52 // - Thread ID used is 0, so *should* work under interactive mode as well - may need checking, or the may be another way...
54 //
55 
57 
58 #include "G4PhysicalConstants.hh"
59 #include "G4SystemOfUnits.hh"
60 #include "G4Geantino.hh"
61 #include "G4ThreeVector.hh"
62 #include "G4ParticleTable.hh"
63 #include "G4IonTable.hh"
64 #include "G4UIdirectory.hh"
66 #include "G4UIcmdWithAString.hh"
68 #include "G4UIcmdWith3Vector.hh"
70 #include "G4UIcmdWithAnInteger.hh"
71 #include "G4UIcmdWithADouble.hh"
72 #include "G4UIcmdWithABool.hh"
73 #include "G4ios.hh"
74 
75 #include "G4Tokenizer.hh"
78 
79 #include "G4AutoLock.hh"
80 
81 namespace {
82  G4Mutex creationM = G4MUTEX_INITIALIZER;
83  G4GeneralParticleSourceMessenger* theInstance = 0;
84 }
85 
87 {
88  G4AutoLock l(&creationM);
89  if ( theInstance == 0 ) theInstance = new G4GeneralParticleSourceMessenger(ps);
90  return theInstance;
91 }
92 
94  G4AutoLock l(&creationM);
95  if ( theInstance != 0 ) {
96  delete theInstance;
97  theInstance = 0;
98  }
99 }
101 //
104  : fGPS(fPtclGun),fParticleGun(0),fShootIon(false),
105  fAtomicNumber(0),fAtomicMass(0),fIonCharge(0),fIonExciteEnergy(0.),
106  fShootIonL(0),fAtomicNumberL(0),fAtomicMassL(0),fIonChargeL(0),fIonEnergyLevel(0)
107 
108 {
109  //A.Dotti - 10th October 2014
110  //This messenger is special: it is instantiated in a user action but (e.g. in
111  // a thread).
112  //the UI commands it defines should be executed by the *master* thread because
113  //they operate on shared resources and we want the UI commands to take
114  //effect BEFORE the threads do some work (so all data are properly initialized)
115  //To achieve this behavior we set to true a base calss protected
116  //data member. Since it makes no sense to have more than one instance
117  //of the messenger we check that we actually have only one.
118  //Note that the logic of implementing, in a given worker thread only one
119  //messenger is deletefated to the creator
120  commandsShouldBeInMaster = true;
121 
122 
123 
124  particleTable = G4ParticleTable::GetParticleTable();
125  histtype = "biasx";
126 
127  //UI Commands only for master
128  G4bool broadcast = false;
129  gpsDirectory = new G4UIdirectory("/gps/",broadcast);
130 
131  gpsDirectory->SetGuidance("General Paricle Source control commands.");
132  // gpsDirectory->SetGuidance(" The first 9 commands are the same as in G4ParticleGun ");
133 
134  // now the commands for mutiple sources
135  sourceDirectory = new G4UIdirectory("/gps/source/");
136  sourceDirectory->SetGuidance("Multiple source control sub-directory");
137 
138  addsourceCmd = new G4UIcmdWithADouble("/gps/source/add",this);
139  addsourceCmd->SetGuidance("add a new source defintion to the particle gun with the specified intensity");
140  addsourceCmd->SetParameterName("addsource",false,false);
141  addsourceCmd->SetRange("addsource > 0.");
142 
143  listsourceCmd = new G4UIcmdWithoutParameter("/gps/source/list",this);
144  listsourceCmd->SetGuidance("List the defined particle sources");
145 
146  clearsourceCmd = new G4UIcmdWithoutParameter("/gps/source/clear",this);
147  clearsourceCmd->SetGuidance("Remove all the defined particle sources");
148 
149  getsourceCmd = new G4UIcmdWithoutParameter("/gps/source/show",this);
150  getsourceCmd->SetGuidance("Show the current source index and intensity");
151 
152  setsourceCmd = new G4UIcmdWithAnInteger("/gps/source/set",this);
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");
157 
158  deletesourceCmd = new G4UIcmdWithAnInteger("/gps/source/delete",this);
159  deletesourceCmd->SetGuidance("delete the indexed source from the list");
160  deletesourceCmd->SetParameterName("deletesource",false,false);
161  deletesourceCmd->SetRange("deletesource > 0");
162 
163  setintensityCmd = new G4UIcmdWithADouble("/gps/source/intensity",this);
164  setintensityCmd->SetGuidance("reset the current source to the specified intensity");
165  setintensityCmd->SetParameterName("setintensity",false,false);
166  setintensityCmd->SetRange("setintensity > 0.");
167 
168  multiplevertexCmd = new G4UIcmdWithABool("/gps/source/multiplevertex",this);
169  multiplevertexCmd->SetGuidance("true for simulaneous generation mutiple vertex");
170  multiplevertexCmd->SetGuidance("Default is false");
171  multiplevertexCmd->SetParameterName("multiplevertex",true);
172  multiplevertexCmd->SetDefaultValue(false);
173 
174  flatsamplingCmd = new G4UIcmdWithABool("/gps/source/flatsampling",this);
175  flatsamplingCmd->SetGuidance("true for appling flat (biased) sampling among the sources");
176  flatsamplingCmd->SetGuidance("Default is false");
177  flatsamplingCmd->SetParameterName("flatsampling",true);
178  flatsamplingCmd->SetDefaultValue(false);
179 
180  // below we reproduce commands awailable in G4Particle Gun
181 
182  listCmd = new G4UIcmdWithoutParameter("/gps/List",this);
183  listCmd->SetGuidance("List available particles.");
184  listCmd->SetGuidance(" Invoke G4ParticleTable.");
185 
186  particleCmd = new G4UIcmdWithAString("/gps/particle",this);
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");
192  G4String candidateList;
193  G4int nPtcl = particleTable->entries();
194  for(G4int i=0;i<nPtcl;i++)
195  {
196  candidateList += particleTable->GetParticleName(i);
197  candidateList += " ";
198  }
199  candidateList += "ion ";
200  particleCmd->SetCandidates(candidateList);
201 
202  directionCmd = new G4UIcmdWith3Vector("/gps/direction",this);
203  directionCmd->SetGuidance("Set momentum direction.");
204  directionCmd->SetGuidance("Direction needs not to be a unit vector.");
205  directionCmd->SetParameterName("Px","Py","Pz",false,false);
206  directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
207 
208  energyCmd = new G4UIcmdWithADoubleAndUnit("/gps/energy",this);
209  energyCmd->SetGuidance("Set kinetic energy.");
210  energyCmd->SetParameterName("Energy",false,false);
211  energyCmd->SetDefaultUnit("GeV");
212  //energyCmd->SetUnitCategory("Energy");
213  //energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
214 
215  positionCmd = new G4UIcmdWith3VectorAndUnit("/gps/position",this);
216  positionCmd->SetGuidance("Set starting position of the particle.");
217  positionCmd->SetParameterName("X","Y","Z",false,false);
218  positionCmd->SetDefaultUnit("cm");
219  //positionCmd->SetUnitCategory("Length");
220  //positionCmd->SetUnitCandidates("microm mm cm m km");
221 
222  ionCmd = new G4UIcommand("/gps/ion",this);
223  ionCmd->SetGuidance("Set properties of ion to be generated.");
224  ionCmd->SetGuidance("[usage] /gps/ion Z A Q E");
225  ionCmd->SetGuidance(" Z:(int) AtomicNumber");
226  ionCmd->SetGuidance(" A:(int) AtomicMass");
227  ionCmd->SetGuidance(" Q:(int) Charge of Ion (in unit of e)");
228  ionCmd->SetGuidance(" E:(double) Excitation energy (in keV)");
229 
230  G4UIparameter* param;
231  param = new G4UIparameter("Z",'i',false);
232  param->SetDefaultValue("1");
233  ionCmd->SetParameter(param);
234  param = new G4UIparameter("A",'i',false);
235  param->SetDefaultValue("1");
236  ionCmd->SetParameter(param);
237  param = new G4UIparameter("Q",'i',true);
238  param->SetDefaultValue("0");
239  ionCmd->SetParameter(param);
240  param = new G4UIparameter("E",'d',true);
241  param->SetDefaultValue("0.0");
242  ionCmd->SetParameter(param);
243 
244  ionLvlCmd = new G4UIcommand("/gps/ionLvl",this);
245  ionLvlCmd->SetGuidance("Set properties of ion to be generated.");
246  ionLvlCmd->SetGuidance("[usage] /gps/ion Z A Q Lvl");
247  ionLvlCmd->SetGuidance(" Z:(int) AtomicNumber");
248  ionLvlCmd->SetGuidance(" A:(int) AtomicMass");
249  ionLvlCmd->SetGuidance(" Q:(int) Charge of Ion (in unit of e)");
250  ionLvlCmd->SetGuidance(" Lvl:(int) Number of metastable state excitation level (0-9)");
251 
252  G4UIparameter* paramL;
253  paramL = new G4UIparameter("Z",'i',false);
254  paramL->SetDefaultValue("1");
255  ionLvlCmd->SetParameter(paramL);
256  paramL = new G4UIparameter("A",'i',false);
257  paramL->SetDefaultValue("1");
258  ionLvlCmd->SetParameter(paramL);
259  paramL = new G4UIparameter("Q",'i',true);
260  paramL->SetDefaultValue("0");
261  ionLvlCmd->SetParameter(paramL);
262  paramL = new G4UIparameter("Lvl",'i',true);
263  paramL->SetDefaultValue("0.0");
264  ionLvlCmd->SetParameter(paramL);
265 
266  timeCmd = new G4UIcmdWithADoubleAndUnit("/gps/time",this);
267  timeCmd->SetGuidance("Set initial time of the particle.");
268  timeCmd->SetParameterName("t0",false,false);
269  timeCmd->SetDefaultUnit("ns");
270  //timeCmd->SetUnitCategory("Time");
271  //timeCmd->SetUnitCandidates("ns ms s");
272 
273  polCmd = new G4UIcmdWith3Vector("/gps/polarization",this);
274  polCmd->SetGuidance("Set polarization.");
275  polCmd->SetParameterName("Px","Py","Pz",false,false);
276  polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
277 
278  numberCmd = new G4UIcmdWithAnInteger("/gps/number",this);
279  numberCmd->SetGuidance("Set number of particles to be generated per vertex.");
280  numberCmd->SetParameterName("N",false,false);
281  numberCmd->SetRange("N>0");
282 
283  // verbosity
284  verbosityCmd = new G4UIcmdWithAnInteger("/gps/verbose",this);
285  verbosityCmd->SetGuidance("Set Verbose level for GPS");
286  verbosityCmd->SetGuidance(" 0 : Silent");
287  verbosityCmd->SetGuidance(" 1 : Limited information");
288  verbosityCmd->SetGuidance(" 2 : Detailed information");
289  verbosityCmd->SetParameterName("level",false);
290  verbosityCmd->SetRange("level>=0 && level <=2");
291 
292  // now extended commands
293  // Positional ones:
294  positionDirectory = new G4UIdirectory("/gps/pos/");
295  positionDirectory->SetGuidance("Positional commands sub-directory");
296 
297  typeCmd1 = new G4UIcmdWithAString("/gps/pos/type",this);
298  typeCmd1->SetGuidance("Sets source distribution type.");
299  typeCmd1->SetGuidance("Either Point, Beam, Plane, Surface or Volume");
300  typeCmd1->SetParameterName("DisType",false,false);
301  typeCmd1->SetDefaultValue("Point");
302  typeCmd1->SetCandidates("Point Beam Plane Surface Volume");
303 
304  shapeCmd1 = new G4UIcmdWithAString("/gps/pos/shape",this);
305  shapeCmd1->SetGuidance("Sets source shape for Plan, Surface or Volume type source.");
306  shapeCmd1->SetParameterName("Shape",false,false);
307  shapeCmd1->SetDefaultValue("NULL");
308  shapeCmd1->SetCandidates("Circle Annulus Ellipse Square Rectangle Sphere Ellipsoid Cylinder Para");
309 
310  centreCmd1 = new G4UIcmdWith3VectorAndUnit("/gps/pos/centre",this);
311  centreCmd1->SetGuidance("Set centre coordinates of source.");
312  centreCmd1->SetGuidance(" same effect as the /gps/position command");
313  centreCmd1->SetParameterName("X","Y","Z",false,false);
314  centreCmd1->SetDefaultUnit("cm");
315  // centreCmd1->SetUnitCandidates("micron mm cm m km");
316 
317  posrot1Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot1",this);
318  posrot1Cmd1->SetGuidance("Set the 1st vector defining the rotation matrix'.");
319  posrot1Cmd1->SetGuidance("It does not need to be a unit vector.");
320  posrot1Cmd1->SetParameterName("R1x","R1y","R1z",false,false);
321  posrot1Cmd1->SetRange("R1x != 0 || R1y != 0 || R1z != 0");
322 
323  posrot2Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot2",this);
324  posrot2Cmd1->SetGuidance("Set the 2nd vector defining the rotation matrix'.");
325  posrot2Cmd1->SetGuidance("It does not need to be a unit vector.");
326  posrot2Cmd1->SetParameterName("R2x","R2y","R2z",false,false);
327  posrot2Cmd1->SetRange("R2x != 0 || R2y != 0 || R2z != 0");
328 
329  halfxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfx",this);
330  halfxCmd1->SetGuidance("Set x half length of source.");
331  halfxCmd1->SetParameterName("Halfx",false,false);
332  halfxCmd1->SetDefaultUnit("cm");
333  // halfxCmd1->SetUnitCandidates("micron mm cm m km");
334 
335  halfyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfy",this);
336  halfyCmd1->SetGuidance("Set y half length of source.");
337  halfyCmd1->SetParameterName("Halfy",false,false);
338  halfyCmd1->SetDefaultUnit("cm");
339  // halfyCmd1->SetUnitCandidates("micron mm cm m km");
340 
341  halfzCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfz",this);
342  halfzCmd1->SetGuidance("Set z half length of source.");
343  halfzCmd1->SetParameterName("Halfz",false,false);
344  halfzCmd1->SetDefaultUnit("cm");
345  // halfzCmd1->SetUnitCandidates("micron mm cm m km");
346 
347  radiusCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/radius",this);
348  radiusCmd1->SetGuidance("Set radius of source.");
349  radiusCmd1->SetParameterName("Radius",false,false);
350  radiusCmd1->SetDefaultUnit("cm");
351  // radiusCmd1->SetUnitCandidates("micron mm cm m km");
352 
353  radius0Cmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/inner_radius",this);
354  radius0Cmd1->SetGuidance("Set inner radius of source when required.");
355  radius0Cmd1->SetParameterName("Radius0",false,false);
356  radius0Cmd1->SetDefaultUnit("cm");
357  // radius0Cmd1->SetUnitCandidates("micron mm cm m km");
358 
359  possigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_r",this);
360  possigmarCmd1->SetGuidance("Set standard deviation in radial of the beam positional profile");
361  possigmarCmd1->SetGuidance(" applicable to Beam type source only");
362  possigmarCmd1->SetParameterName("Sigmar",false,false);
363  possigmarCmd1->SetDefaultUnit("cm");
364  // possigmarCmd1->SetUnitCandidates("micron mm cm m km");
365 
366  possigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_x",this);
367  possigmaxCmd1->SetGuidance("Set standard deviation of beam positional profile in x-dir");
368  possigmaxCmd1->SetGuidance(" applicable to Beam type source only");
369  possigmaxCmd1->SetParameterName("Sigmax",false,false);
370  possigmaxCmd1->SetDefaultUnit("cm");
371  // possigmaxCmd1->SetUnitCandidates("micron mm cm m km");
372 
373  possigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_y",this);
374  possigmayCmd1->SetGuidance("Set standard deviation of beam positional profile in y-dir");
375  possigmayCmd1->SetGuidance(" applicable to Beam type source only");
376  possigmayCmd1->SetParameterName("Sigmay",false,false);
377  possigmayCmd1->SetDefaultUnit("cm");
378  // possigmayCmd1->SetUnitCandidates("micron mm cm m km");
379 
380  paralpCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/paralp",this);
381  paralpCmd1->SetGuidance("Angle from y-axis of y' in Para");
382  paralpCmd1->SetParameterName("paralp",false,false);
383  paralpCmd1->SetDefaultUnit("rad");
384  // paralpCmd1->SetUnitCandidates("rad deg");
385 
386  partheCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parthe",this);
387  partheCmd1->SetGuidance("Polar angle through centres of z faces");
388  partheCmd1->SetParameterName("parthe",false,false);
389  partheCmd1->SetDefaultUnit("rad");
390  // partheCmd1->SetUnitCandidates("rad deg");
391 
392  parphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parphi",this);
393  parphiCmd1->SetGuidance("Azimuth angle through centres of z faces");
394  parphiCmd1->SetParameterName("parphi",false,false);
395  parphiCmd1->SetDefaultUnit("rad");
396  // parphiCmd1->SetUnitCandidates("rad deg");
397 
398  confineCmd1 = new G4UIcmdWithAString("/gps/pos/confine",this);
399  confineCmd1->SetGuidance("Confine source to volume (NULL to unset).");
400  confineCmd1->SetGuidance("usage: confine VolName");
401  confineCmd1->SetParameterName("VolName",false,false);
402  confineCmd1->SetDefaultValue("NULL");
403 
404  // old implementations
405  typeCmd = new G4UIcmdWithAString("/gps/type",this);
406  typeCmd->SetGuidance("Sets source distribution type. (obsolete!)");
407  typeCmd->SetGuidance("Either Point, Beam, Plane, Surface or Volume");
408  typeCmd->SetParameterName("DisType",false,false);
409  typeCmd->SetDefaultValue("Point");
410  typeCmd->SetCandidates("Point Beam Plane Surface Volume");
411 
412  shapeCmd = new G4UIcmdWithAString("/gps/shape",this);
413  shapeCmd->SetGuidance("Sets source shape type.(obsolete!)");
414  shapeCmd->SetParameterName("Shape",false,false);
415  shapeCmd->SetDefaultValue("NULL");
416  shapeCmd->SetCandidates("Circle Annulus Ellipse Square Rectangle Sphere Ellipsoid Cylinder Para");
417 
418  centreCmd = new G4UIcmdWith3VectorAndUnit("/gps/centre",this);
419  centreCmd->SetGuidance("Set centre coordinates of source.(obsolete!)");
420  centreCmd->SetParameterName("X","Y","Z",false,false);
421  centreCmd->SetDefaultUnit("cm");
422  // centreCmd->SetUnitCandidates("micron mm cm m km");
423 
424  posrot1Cmd = new G4UIcmdWith3Vector("/gps/posrot1",this);
425  posrot1Cmd->SetGuidance("Set rotation matrix of x'.(obsolete!)");
426  posrot1Cmd->SetGuidance("Posrot1 does not need to be a unit vector.");
427  posrot1Cmd->SetParameterName("R1x","R1y","R1z",false,false);
428  posrot1Cmd->SetRange("R1x != 0 || R1y != 0 || R1z != 0");
429 
430  posrot2Cmd = new G4UIcmdWith3Vector("/gps/posrot2",this);
431  posrot2Cmd->SetGuidance("Set rotation matrix of y'.(obsolete!)");
432  posrot2Cmd->SetGuidance("Posrot2 does not need to be a unit vector.");
433  posrot2Cmd->SetParameterName("R2x","R2y","R2z",false,false);
434  posrot2Cmd->SetRange("R2x != 0 || R2y != 0 || R2z != 0");
435 
436  halfxCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfx",this);
437  halfxCmd->SetGuidance("Set x half length of source.(obsolete!)");
438  halfxCmd->SetParameterName("Halfx",false,false);
439  halfxCmd->SetDefaultUnit("cm");
440  // halfxCmd->SetUnitCandidates("micron mm cm m km");
441 
442  halfyCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfy",this);
443  halfyCmd->SetGuidance("Set y half length of source.(obsolete!)");
444  halfyCmd->SetParameterName("Halfy",false,false);
445  halfyCmd->SetDefaultUnit("cm");
446  // halfyCmd->SetUnitCandidates("micron mm cm m km");
447 
448  halfzCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfz",this);
449  halfzCmd->SetGuidance("Set z half length of source.(obsolete!)");
450  halfzCmd->SetParameterName("Halfz",false,false);
451  halfzCmd->SetDefaultUnit("cm");
452  // halfzCmd->SetUnitCandidates("micron mm cm m km");
453 
454  radiusCmd = new G4UIcmdWithADoubleAndUnit("/gps/radius",this);
455  radiusCmd->SetGuidance("Set radius of source.(obsolete!)");
456  radiusCmd->SetParameterName("Radius",false,false);
457  radiusCmd->SetDefaultUnit("cm");
458  // radiusCmd->SetUnitCandidates("micron mm cm m km");
459 
460  radius0Cmd = new G4UIcmdWithADoubleAndUnit("/gps/radius0",this);
461  radius0Cmd->SetGuidance("Set inner radius of source.(obsolete!)");
462  radius0Cmd->SetParameterName("Radius0",false,false);
463  radius0Cmd->SetDefaultUnit("cm");
464  // radius0Cmd->SetUnitCandidates("micron mm cm m km");
465 
466  possigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposr",this);
467  possigmarCmd->SetGuidance("Set standard deviation of beam position in radial(obsolete!)");
468  possigmarCmd->SetParameterName("Sigmar",false,false);
469  possigmarCmd->SetDefaultUnit("cm");
470  // possigmarCmd->SetUnitCandidates("micron mm cm m km");
471 
472  possigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposx",this);
473  possigmaxCmd->SetGuidance("Set standard deviation of beam position in x-dir(obsolete!)");
474  possigmaxCmd->SetParameterName("Sigmax",false,false);
475  possigmaxCmd->SetDefaultUnit("cm");
476  // possigmaxCmd->SetUnitCandidates("micron mm cm m km");
477 
478  possigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposy",this);
479  possigmayCmd->SetGuidance("Set standard deviation of beam position in y-dir(obsolete!)");
480  possigmayCmd->SetParameterName("Sigmay",false,false);
481  possigmayCmd->SetDefaultUnit("cm");
482  // possigmayCmd->SetUnitCandidates("micron mm cm m km");
483 
484  paralpCmd = new G4UIcmdWithADoubleAndUnit("/gps/paralp",this);
485  paralpCmd->SetGuidance("Angle from y-axis of y' in Para(obsolete!)");
486  paralpCmd->SetParameterName("paralp",false,false);
487  paralpCmd->SetDefaultUnit("rad");
488  // paralpCmd->SetUnitCandidates("rad deg");
489 
490  partheCmd = new G4UIcmdWithADoubleAndUnit("/gps/parthe",this);
491  partheCmd->SetGuidance("Polar angle through centres of z faces(obsolete!)");
492  partheCmd->SetParameterName("parthe",false,false);
493  partheCmd->SetDefaultUnit("rad");
494  // partheCmd->SetUnitCandidates("rad deg");
495 
496  parphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/parphi",this);
497  parphiCmd->SetGuidance("Azimuth angle through centres of z faces(obsolete!)");
498  parphiCmd->SetParameterName("parphi",false,false);
499  parphiCmd->SetDefaultUnit("rad");
500  // parphiCmd->SetUnitCandidates("rad deg");
501 
502  confineCmd = new G4UIcmdWithAString("/gps/confine",this);
503  confineCmd->SetGuidance("Confine source to volume (NULL to unset)(obsolete!) .");
504  confineCmd->SetGuidance("usage: confine VolName");
505  confineCmd->SetParameterName("VolName",false,false);
506  confineCmd->SetDefaultValue("NULL");
507 
508  // Angular distribution commands
509  angularDirectory = new G4UIdirectory("/gps/ang/");
510  angularDirectory->SetGuidance("Angular commands sub-directory");
511 
512  angtypeCmd1 = new G4UIcmdWithAString("/gps/ang/type",this);
513  angtypeCmd1->SetGuidance("Sets angular source distribution type");
514  angtypeCmd1->SetGuidance("Possible variables are: iso, cos, planar, beam1d, beam2d, focused or user");
515  angtypeCmd1->SetParameterName("AngDis",false,false);
516  angtypeCmd1->SetDefaultValue("iso");
517  angtypeCmd1->SetCandidates("iso cos planar beam1d beam2d focused user");
518 
519  angrot1Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot1",this);
520  angrot1Cmd1->SetGuidance("Sets the 1st vector for angular distribution rotation matrix");
521  angrot1Cmd1->SetGuidance("Need not be a unit vector");
522  angrot1Cmd1->SetParameterName("AR1x","AR1y","AR1z",false,false);
523  angrot1Cmd1->SetRange("AR1x != 0 || AR1y != 0 || AR1z != 0");
524 
525  angrot2Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot2",this);
526  angrot2Cmd1->SetGuidance("Sets the 2nd vector for angular distribution rotation matrix");
527  angrot2Cmd1->SetGuidance("Need not be a unit vector");
528  angrot2Cmd1->SetParameterName("AR2x","AR2y","AR2z",false,false);
529  angrot2Cmd1->SetRange("AR2x != 0 || AR2y != 0 || AR2z != 0");
530 
531  minthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/mintheta",this);
532  minthetaCmd1->SetGuidance("Set minimum theta");
533  minthetaCmd1->SetParameterName("MinTheta",false,false);
534  minthetaCmd1->SetDefaultValue(0.);
535  minthetaCmd1->SetDefaultUnit("rad");
536  // minthetaCmd1->SetUnitCandidates("rad deg");
537 
538  maxthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxtheta",this);
539  maxthetaCmd1->SetGuidance("Set maximum theta");
540  maxthetaCmd1->SetParameterName("MaxTheta",false,false);
541  maxthetaCmd1->SetDefaultValue(pi);
542  maxthetaCmd1->SetDefaultUnit("rad");
543  // maxthetaCmd1->SetUnitCandidates("rad deg");
544 
545  minphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/minphi",this);
546  minphiCmd1->SetGuidance("Set minimum phi");
547  minphiCmd1->SetParameterName("MinPhi",false,false);
548  minphiCmd1->SetDefaultUnit("rad");
549  // minphiCmd1->SetUnitCandidates("rad deg");
550 
551  maxphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxphi",this);
552  maxphiCmd1->SetGuidance("Set maximum phi");
553  maxphiCmd1->SetParameterName("MaxPhi",false,false);
554  maxphiCmd1->SetDefaultValue(pi);
555  maxphiCmd1->SetDefaultUnit("rad");
556  // maxphiCmd1->SetUnitCandidates("rad deg");
557 
558  angsigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_r",this);
559  angsigmarCmd1->SetGuidance("Set standard deviation in direction for 1D beam.");
560  angsigmarCmd1->SetParameterName("Sigmara",false,false);
561  angsigmarCmd1->SetDefaultUnit("rad");
562  // angsigmarCmd1->SetUnitCandidates("rad deg");
563 
564  angsigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_x",this);
565  angsigmaxCmd1->SetGuidance("Set standard deviation in direction in x-direc. for 2D beam");
566  angsigmaxCmd1->SetParameterName("Sigmaxa",false,false);
567  angsigmaxCmd1->SetDefaultUnit("rad");
568  // angsigmaxCmd1->SetUnitCandidates("rad deg");
569 
570  angsigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_y",this);
571  angsigmayCmd1->SetGuidance("Set standard deviation in direction in y-direc. for 2D beam");
572  angsigmayCmd1->SetParameterName("Sigmaya",false,false);
573  angsigmayCmd1->SetDefaultUnit("rad");
574  // angsigmayCmd1->SetUnitCandidates("rad deg");
575 
576  angfocusCmd = new G4UIcmdWith3VectorAndUnit("/gps/ang/focuspoint",this);
577  angfocusCmd->SetGuidance("Set the focusing point for the beam");
578  angfocusCmd->SetParameterName("x","y","z",false,false);
579  angfocusCmd->SetDefaultUnit("cm");
580  // angfocusCmd->SetUnitCandidates("micron mm cm m km");
581 
582  useuserangaxisCmd1 = new G4UIcmdWithABool("/gps/ang/user_coor",this);
583  useuserangaxisCmd1->SetGuidance("true for using user defined angular co-ordinates");
584  useuserangaxisCmd1->SetGuidance("Default is false");
585  useuserangaxisCmd1->SetParameterName("useuserangaxis",true);
586  useuserangaxisCmd1->SetDefaultValue(false);
587 
588  surfnormCmd1 = new G4UIcmdWithABool("/gps/ang/surfnorm",this);
589  surfnormCmd1->SetGuidance("Makes a user-defined distribution with respect to surface normals rather than x,y,z axes.");
590  surfnormCmd1->SetGuidance("Default is false");
591  surfnormCmd1->SetParameterName("surfnorm",true);
592  surfnormCmd1->SetDefaultValue(false);
593 
594  // old ones
595  angtypeCmd = new G4UIcmdWithAString("/gps/angtype",this);
596  angtypeCmd->SetGuidance("Sets angular source distribution type (obsolete!)");
597  angtypeCmd->SetGuidance("Possible variables are: iso, cos planar beam1d beam2d or user");
598  angtypeCmd->SetParameterName("AngDis",false,false);
599  angtypeCmd->SetDefaultValue("iso");
600  angtypeCmd->SetCandidates("iso cos planar beam1d beam2d user");
601 
602  angrot1Cmd = new G4UIcmdWith3Vector("/gps/angrot1",this);
603  angrot1Cmd->SetGuidance("Sets the x' vector for angular distribution(obsolete!) ");
604  angrot1Cmd->SetGuidance("Need not be a unit vector");
605  angrot1Cmd->SetParameterName("AR1x","AR1y","AR1z",false,false);
606  angrot1Cmd->SetRange("AR1x != 0 || AR1y != 0 || AR1z != 0");
607 
608  angrot2Cmd = new G4UIcmdWith3Vector("/gps/angrot2",this);
609  angrot2Cmd->SetGuidance("Sets the y' vector for angular distribution (obsolete!)");
610  angrot2Cmd->SetGuidance("Need not be a unit vector");
611  angrot2Cmd->SetParameterName("AR2x","AR2y","AR2z",false,false);
612  angrot2Cmd->SetRange("AR2x != 0 || AR2y != 0 || AR2z != 0");
613 
614  minthetaCmd = new G4UIcmdWithADoubleAndUnit("/gps/mintheta",this);
615  minthetaCmd->SetGuidance("Set minimum theta (obsolete!)");
616  minthetaCmd->SetParameterName("MinTheta",false,false);
617  minthetaCmd->SetDefaultUnit("rad");
618  // minthetaCmd->SetUnitCandidates("rad deg");
619 
620  maxthetaCmd = new G4UIcmdWithADoubleAndUnit("/gps/maxtheta",this);
621  maxthetaCmd->SetGuidance("Set maximum theta (obsolete!)");
622  maxthetaCmd->SetParameterName("MaxTheta",false,false);
623  maxthetaCmd->SetDefaultValue(3.1416);
624  maxthetaCmd->SetDefaultUnit("rad");
625  // maxthetaCmd->SetUnitCandidates("rad deg");
626 
627  minphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/minphi",this);
628  minphiCmd->SetGuidance("Set minimum phi (obsolete!)");
629  minphiCmd->SetParameterName("MinPhi",false,false);
630  minphiCmd->SetDefaultUnit("rad");
631  // minphiCmd->SetUnitCandidates("rad deg");
632 
633  maxphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/maxphi",this);
634  maxphiCmd->SetGuidance("Set maximum phi(obsolete!)");
635  maxphiCmd->SetParameterName("MaxPhi",false,false);
636  maxphiCmd->SetDefaultUnit("rad");
637  // maxphiCmd->SetUnitCandidates("rad deg");
638 
639  angsigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangr",this);
640  angsigmarCmd->SetGuidance("Set standard deviation of beam direction in radial(obsolete!).");
641  angsigmarCmd->SetParameterName("Sigmara",false,false);
642  angsigmarCmd->SetDefaultUnit("rad");
643  // angsigmarCmd->SetUnitCandidates("rad deg");
644 
645  angsigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangx",this);
646  angsigmaxCmd->SetGuidance("Set standard deviation of beam direction in x-direc(obsolete!).");
647  angsigmaxCmd->SetParameterName("Sigmaxa",false,false);
648  angsigmaxCmd->SetDefaultUnit("rad");
649  // angsigmaxCmd->SetUnitCandidates("rad deg");
650 
651  angsigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangy",this);
652  angsigmayCmd->SetGuidance("Set standard deviation of beam direction in y-direc.(obsolete!)");
653  angsigmayCmd->SetParameterName("Sigmaya",false,false);
654  angsigmayCmd->SetDefaultUnit("rad");
655  // angsigmayCmd->SetUnitCandidates("rad deg");
656 
657  useuserangaxisCmd = new G4UIcmdWithABool("/gps/useuserangaxis",this);
658  useuserangaxisCmd->SetGuidance("true for using user defined angular co-ordinates(obsolete!)");
659  useuserangaxisCmd->SetGuidance("Default is false");
660  useuserangaxisCmd->SetParameterName("useuserangaxis",true);
661  useuserangaxisCmd->SetDefaultValue(false);
662 
663  surfnormCmd = new G4UIcmdWithABool("/gps/surfnorm",this);
664  surfnormCmd->SetGuidance("Makes a user-defined distribution with respect to surface normals rather than x,y,z axes (obsolete!).");
665  surfnormCmd->SetGuidance("Default is false");
666  surfnormCmd->SetParameterName("surfnorm",true);
667  surfnormCmd->SetDefaultValue(false);
668 
669  // Energy commands
670 
671  energyDirectory = new G4UIdirectory("/gps/ene/");
672  energyDirectory->SetGuidance("Spectral commands sub-directory");
673 
674  energytypeCmd1 = new G4UIcmdWithAString("/gps/ene/type",this);
675  energytypeCmd1->SetGuidance("Sets energy distribution type");
676  energytypeCmd1->SetParameterName("EnergyDis",false,false);
677  energytypeCmd1->SetDefaultValue("Mono");
678  energytypeCmd1->SetCandidates("Mono Lin Pow Exp Gauss Brem Bbody Cdg User Arb Epn");
679 
680  eminCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/min",this);
681  eminCmd1->SetGuidance("Sets minimum energy");
682  eminCmd1->SetParameterName("emin",false,false);
683  eminCmd1->SetDefaultUnit("keV");
684  // eminCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
685 
686  emaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/max",this);
687  emaxCmd1->SetGuidance("Sets maximum energy");
688  emaxCmd1->SetParameterName("emax",false,false);
689  emaxCmd1->SetDefaultUnit("keV");
690  // emaxCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
691 
692  monoenergyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/mono",this);
693  monoenergyCmd1->SetGuidance("Sets a monocromatic energy (same as gps/energy)");
694  monoenergyCmd1->SetParameterName("monoenergy",false,false);
695  monoenergyCmd1->SetDefaultUnit("keV");
696  // monoenergyCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
697 
698  engsigmaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/sigma",this);
699  engsigmaCmd1->SetGuidance("Sets the standard deviation for Gaussian energy dist.");
700  engsigmaCmd1->SetParameterName("Sigmae",false,false);
701  engsigmaCmd1->SetDefaultUnit("keV");
702  // engsigmaCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
703 
704  alphaCmd1 = new G4UIcmdWithADouble("/gps/ene/alpha",this);
705  alphaCmd1->SetGuidance("Sets Alpha (index) for power-law energy dist.");
706  alphaCmd1->SetParameterName("alpha",false,false);
707 
708  tempCmd1 = new G4UIcmdWithADouble("/gps/ene/temp",this);
709  tempCmd1->SetGuidance("Sets the temperature for Brem and BBody distributions (in Kelvin)");
710  tempCmd1->SetParameterName("temp",false,false);
711 
712  ezeroCmd1 = new G4UIcmdWithADouble("/gps/ene/ezero",this);
713  ezeroCmd1->SetGuidance("Sets E_0 for exponential distribution (in MeV)");
714  ezeroCmd1->SetParameterName("ezero",false,false);
715 
716  gradientCmd1 = new G4UIcmdWithADouble("/gps/ene/gradient",this);
717  gradientCmd1->SetGuidance("Sets the gradient for Lin distribution (in 1/MeV)");
718  gradientCmd1->SetParameterName("gradient",false,false);
719 
720  interceptCmd1 = new G4UIcmdWithADouble("/gps/ene/intercept",this);
721  interceptCmd1->SetGuidance("Sets the intercept for Lin distributions (in MeV)");
722  interceptCmd1->SetParameterName("intercept",false,false);
723 
724  arbeintCmd1 = new G4UIcmdWithADouble("/gps/ene/biasAlpha",this);
725  arbeintCmd1->SetGuidance("Set the power-law index for the energy sampling distri. )");
726  arbeintCmd1->SetParameterName("arbeint",false,false);
727 
728  calculateCmd1 = new G4UIcmdWithoutParameter("/gps/ene/calculate",this);
729  calculateCmd1->SetGuidance("Calculates the distributions for Cdg and BBody");
730 
731  energyspecCmd1 = new G4UIcmdWithABool("/gps/ene/emspec",this);
732  energyspecCmd1->SetGuidance("True for energy and false for momentum spectra");
733  energyspecCmd1->SetParameterName("energyspec",true);
734  energyspecCmd1->SetDefaultValue(true);
735 
736  diffspecCmd1 = new G4UIcmdWithABool("/gps/ene/diffspec",this);
737  diffspecCmd1->SetGuidance("True for differential and flase for integral spectra");
738  diffspecCmd1->SetParameterName("diffspec",true);
739  diffspecCmd1->SetDefaultValue(true);
740 
741  //old ones
742  energytypeCmd = new G4UIcmdWithAString("/gps/energytype",this);
743  energytypeCmd->SetGuidance("Sets energy distribution type (obsolete!)");
744  energytypeCmd->SetParameterName("EnergyDis",false,false);
745  energytypeCmd->SetDefaultValue("Mono");
746  energytypeCmd->SetCandidates("Mono Lin Pow Exp Gauss Brem Bbody Cdg User Arb Epn");
747 
748  eminCmd = new G4UIcmdWithADoubleAndUnit("/gps/emin",this);
749  eminCmd->SetGuidance("Sets Emin (obsolete!)");
750  eminCmd->SetParameterName("emin",false,false);
751  eminCmd->SetDefaultUnit("keV");
752  // eminCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
753 
754  emaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/emax",this);
755  emaxCmd->SetGuidance("Sets Emax (obsolete!)");
756  emaxCmd->SetParameterName("emax",false,false);
757  emaxCmd->SetDefaultUnit("keV");
758  // emaxCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
759 
760  monoenergyCmd = new G4UIcmdWithADoubleAndUnit("/gps/monoenergy",this);
761  monoenergyCmd->SetGuidance("Sets Monoenergy (obsolete, use gps/energy instead!)");
762  monoenergyCmd->SetParameterName("monoenergy",false,false);
763  monoenergyCmd->SetDefaultUnit("keV");
764  // monoenergyCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
765 
766  engsigmaCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmae",this);
767  engsigmaCmd->SetGuidance("Sets the standard deviation for Gaussian energy dist.(obsolete!)");
768  engsigmaCmd->SetParameterName("Sigmae",false,false);
769  engsigmaCmd->SetDefaultUnit("keV");
770  // engsigmaCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
771 
772  alphaCmd = new G4UIcmdWithADouble("/gps/alpha",this);
773  alphaCmd->SetGuidance("Sets Alpha (index) for power-law energy dist(obsolete!).");
774  alphaCmd->SetParameterName("alpha",false,false);
775 
776  tempCmd = new G4UIcmdWithADouble("/gps/temp",this);
777  tempCmd->SetGuidance("Sets the temperature for Brem and BBody (in Kelvin)(obsolete!)");
778  tempCmd->SetParameterName("temp",false,false);
779 
780  ezeroCmd = new G4UIcmdWithADouble("/gps/ezero",this);
781  ezeroCmd->SetGuidance("Sets ezero exponential distributions (in MeV)(obsolete!)");
782  ezeroCmd->SetParameterName("ezero",false,false);
783 
784  gradientCmd = new G4UIcmdWithADouble("/gps/gradient",this);
785  gradientCmd->SetGuidance("Sets the gradient for Lin distributions (in 1/MeV)(obsolete!)");
786  gradientCmd->SetParameterName("gradient",false,false);
787 
788  interceptCmd = new G4UIcmdWithADouble("/gps/intercept",this);
789  interceptCmd->SetGuidance("Sets the intercept for Lin distributions (in MeV)(obsolete!)");
790  interceptCmd->SetParameterName("intercept",false,false);
791 
792  calculateCmd = new G4UIcmdWithoutParameter("/gps/calculate",this);
793  calculateCmd->SetGuidance("Calculates distributions for Cdg and BBody(obsolete!)");
794 
795  energyspecCmd = new G4UIcmdWithABool("/gps/energyspec",this);
796  energyspecCmd->SetGuidance("True for energy and false for momentum spectra(obsolete!)");
797  energyspecCmd->SetParameterName("energyspec",true);
798  energyspecCmd->SetDefaultValue(true);
799 
800  diffspecCmd = new G4UIcmdWithABool("/gps/diffspec",this);
801  diffspecCmd->SetGuidance("True for differential and flase for integral spectra(obsolete!)");
802  diffspecCmd->SetParameterName("diffspec",true);
803  diffspecCmd->SetDefaultValue(true);
804 
805  // Biasing + histograms in general
806  histDirectory = new G4UIdirectory("/gps/hist/");
807  histDirectory->SetGuidance("Histogram, biasing commands sub-directory");
808 
809  histnameCmd1 = new G4UIcmdWithAString("/gps/hist/type",this);
810  histnameCmd1->SetGuidance("Sets histogram type");
811  histnameCmd1->SetParameterName("HistType",false,false);
812  histnameCmd1->SetDefaultValue("biasx");
813  histnameCmd1->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
814 
815  resethistCmd1 = new G4UIcmdWithAString("/gps/hist/reset",this);
816  resethistCmd1->SetGuidance("Reset (clean) the histogram ");
817  resethistCmd1->SetParameterName("HistType",false,false);
818  resethistCmd1->SetDefaultValue("energy");
819  resethistCmd1->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
820 
821  histpointCmd1 = new G4UIcmdWith3Vector("/gps/hist/point",this);
822  histpointCmd1->SetGuidance("Allows user to define a histogram");
823  histpointCmd1->SetGuidance("Enter: Ehi Weight");
824  histpointCmd1->SetParameterName("Ehi","Weight","Junk",true,true);
825  histpointCmd1->SetRange("Ehi >= 0. && Weight >= 0.");
826 
827  histfileCmd1 = new G4UIcmdWithAString("/gps/hist/file",this);
828  histfileCmd1->SetGuidance("import the arb energy hist in an ASCII file");
829  histfileCmd1->SetParameterName("HistFile",false,false);
830 
831  arbintCmd1 = new G4UIcmdWithAString("/gps/hist/inter",this);
832  arbintCmd1->SetGuidance("Sets the interpolation method for arbitrary distribution.");
833  arbintCmd1->SetParameterName("int",false,false);
834  arbintCmd1->SetDefaultValue("Lin");
835  arbintCmd1->SetCandidates("Lin Log Exp Spline");
836 
837  // old ones
838  histnameCmd = new G4UIcmdWithAString("/gps/histname",this);
839  histnameCmd->SetGuidance("Sets histogram type (obsolete!)");
840  histnameCmd->SetParameterName("HistType",false,false);
841  histnameCmd->SetDefaultValue("biasx");
842  histnameCmd->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
843 
844  // re-set the histograms
845  resethistCmd = new G4UIcmdWithAString("/gps/resethist",this);
846  resethistCmd->SetGuidance("Re-Set the histogram (obsolete!)");
847  resethistCmd->SetParameterName("HistType",false,false);
848  resethistCmd->SetDefaultValue("energy");
849  resethistCmd->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
850 
851  histpointCmd = new G4UIcmdWith3Vector("/gps/histpoint",this);
852  histpointCmd->SetGuidance("Allows user to define a histogram (obsolete!)");
853  histpointCmd->SetGuidance("Enter: Ehi Weight");
854  histpointCmd->SetParameterName("Ehi","Weight","Junk",false,false);
855  histpointCmd->SetRange("Ehi >= 0. && Weight >= 0.");
856 
857  arbintCmd = new G4UIcmdWithAString("/gps/arbint",this);
858  arbintCmd->SetGuidance("Sets Arbitrary Interpolation type.(obsolete!) ");
859  arbintCmd->SetParameterName("int",false,false);
860  arbintCmd->SetDefaultValue("NULL");
861  arbintCmd->SetCandidates("Lin Log Exp Spline");
862 
863 }
864 
866 {
867  delete positionDirectory;
868  delete typeCmd;
869  delete shapeCmd;
870  delete centreCmd;
871  delete posrot1Cmd;
872  delete posrot2Cmd;
873  delete halfxCmd;
874  delete halfyCmd;
875  delete halfzCmd;
876  delete radiusCmd;
877  delete radius0Cmd;
878  delete possigmarCmd;
879  delete possigmaxCmd;
880  delete possigmayCmd;
881  delete paralpCmd;
882  delete partheCmd;
883  delete parphiCmd;
884  delete confineCmd;
885  delete typeCmd1;
886  delete shapeCmd1;
887  delete centreCmd1;
888  delete posrot1Cmd1;
889  delete posrot2Cmd1;
890  delete halfxCmd1;
891  delete halfyCmd1;
892  delete halfzCmd1;
893  delete radiusCmd1;
894  delete radius0Cmd1;
895  delete possigmarCmd1;
896  delete possigmaxCmd1;
897  delete possigmayCmd1;
898  delete paralpCmd1;
899  delete partheCmd1;
900  delete parphiCmd1;
901  delete confineCmd1;
902 
903  delete angularDirectory;
904  delete angtypeCmd;
905  delete angrot1Cmd;
906  delete angrot2Cmd;
907  delete minthetaCmd;
908  delete maxthetaCmd;
909  delete minphiCmd;
910  delete maxphiCmd;
911  delete angsigmarCmd;
912  delete angsigmaxCmd;
913  delete angsigmayCmd;
914  delete useuserangaxisCmd;
915  delete surfnormCmd;
916  delete angtypeCmd1;
917  delete angrot1Cmd1;
918  delete angrot2Cmd1;
919  delete minthetaCmd1;
920  delete maxthetaCmd1;
921  delete minphiCmd1;
922  delete maxphiCmd1;
923  delete angsigmarCmd1;
924  delete angsigmaxCmd1;
925  delete angsigmayCmd1;
926  delete angfocusCmd;
927  delete useuserangaxisCmd1;
928  delete surfnormCmd1;
929 
930  delete energyDirectory;
931  delete energytypeCmd;
932  delete eminCmd;
933  delete emaxCmd;
934  delete monoenergyCmd;
935  delete engsigmaCmd;
936  delete alphaCmd;
937  delete tempCmd;
938  delete ezeroCmd;
939  delete gradientCmd;
940  delete interceptCmd;
941  delete calculateCmd;
942  delete energyspecCmd;
943  delete diffspecCmd;
944  delete energytypeCmd1;
945  delete eminCmd1;
946  delete emaxCmd1;
947  delete monoenergyCmd1;
948  delete engsigmaCmd1;
949  delete alphaCmd1;
950  delete tempCmd1;
951  delete ezeroCmd1;
952  delete gradientCmd1;
953  delete interceptCmd1;
954  delete arbeintCmd1;
955  delete calculateCmd1;
956  delete energyspecCmd1;
957  delete diffspecCmd1;
958 
959  delete histDirectory;
960  delete histnameCmd;
961  delete resethistCmd;
962  delete histpointCmd;
963  delete arbintCmd;
964  delete histnameCmd1;
965  delete resethistCmd1;
966  delete histpointCmd1;
967  delete histfileCmd1;
968  delete arbintCmd1;
969 
970  delete verbosityCmd;
971  delete ionCmd;
972  delete ionLvlCmd;
973  delete particleCmd;
974  delete timeCmd;
975  delete polCmd;
976  delete numberCmd;
977  delete positionCmd;
978  delete directionCmd;
979  delete energyCmd;
980  delete listCmd;
981 
982  delete sourceDirectory;
983  delete addsourceCmd;
984  delete listsourceCmd;
985  delete clearsourceCmd;
986  delete getsourceCmd;
987  delete setsourceCmd;
988  delete setintensityCmd;
989  delete deletesourceCmd;
990  delete multiplevertexCmd;
991  delete flatsamplingCmd;
992 
993  delete gpsDirectory;
994  theInstance = 0;
995 }
996 
997 
998 #define CHECKPG() { if (fParticleGun==NULL) { \
999  G4Exception("G4GeneralParticleSourceMessenger::SetNewValue","G4GPS003",\
1000  FatalException,"Before using this command set a partilce gun"); return;\
1001  } }
1002 
1003 
1005 {
1006  if(command == typeCmd)
1007  {
1008  CHECKPG(); fParticleGun->GetPosDist()->SetPosDisType(newValues);
1009  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1010  << " The command is obsolete and will be removed soon." << G4endl
1011  << " Please try to use the new structured commands!" << G4endl;
1012  }
1013  else if(command == shapeCmd)
1014  {
1015  CHECKPG(); fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1016  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1017  << " The command is obsolete and will be removed soon." << G4endl
1018  << " Please try to use the new structured commands!" << G4endl;
1019  }
1020  else if(command == centreCmd)
1021  {
1023  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1024  << " The command is obsolete and will be removed soon." << G4endl
1025  << " Please try to use the new structured commands!" << G4endl;
1026  }
1027  else if(command == posrot1Cmd)
1028  {
1030  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1031  << " The command is obsolete and will be removed soon." << G4endl
1032  << " Please try to use the new structured commands!" << G4endl;
1033  }
1034  else if(command == posrot2Cmd)
1035  {
1037  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1038  << " The command is obsolete and will be removed soon." << G4endl
1039  << " Please try to use the new structured commands!" << G4endl;
1040  }
1041  else if(command == halfxCmd)
1042  {
1044  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1045  << " The command is obsolete and will be removed soon." << G4endl
1046  << " Please try to use the new structured commands!" << G4endl;
1047  }
1048  else if(command == halfyCmd)
1049  {
1051  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1052  << " The command is obsolete and will be removed soon." << G4endl
1053  << " Please try to use the new structured commands!" << G4endl;
1054  }
1055  else if(command == halfzCmd)
1056  {
1058  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1059  << " The command is obsolete and will be removed soon." << G4endl
1060  << " Please try to use the new structured commands!" << G4endl;
1061  }
1062  else if(command == radiusCmd)
1063  {
1065  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1066  << " The command is obsolete and will be removed soon." << G4endl
1067  << " Please try to use the new structured commands!" << G4endl;
1068  }
1069  else if(command == radius0Cmd)
1070  {
1072  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1073  << " The command is obsolete and will be removed soon." << G4endl
1074  << " Please try to use the new structured commands!" << G4endl;
1075  }
1076  else if(command == possigmarCmd)
1077  {
1079  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1080  << " The command is obsolete and will be removed soon." << G4endl
1081  << " Please try to use the new structured commands!" << G4endl;
1082  }
1083  else if(command == possigmaxCmd)
1084  {
1086  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1087  << " The command is obsolete and will be removed soon." << G4endl
1088  << " Please try to use the new structured commands!" << G4endl;
1089  }
1090  else if(command == possigmayCmd)
1091  {
1093  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1094  << " The command is obsolete and will be removed soon." << G4endl
1095  << " Please try to use the new structured commands!" << G4endl;
1096  }
1097  else if(command == paralpCmd)
1098  {
1100  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1101  << " The command is obsolete and will be removed soon." << G4endl
1102  << " Please try to use the new structured commands!" << G4endl;
1103  }
1104  else if(command == partheCmd)
1105  {
1107  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1108  << " The command is obsolete and will be removed soon." << G4endl
1109  << " Please try to use the new structured commands!" << G4endl;
1110  }
1111  else if(command == parphiCmd)
1112  {
1114  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1115  << " The command is obsolete and will be removed soon." << G4endl
1116  << " Please try to use the new structured commands!" << G4endl;
1117  }
1118  else if(command == confineCmd)
1119  {
1121  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1122  << " The command is obsolete and will be removed soon." << G4endl
1123  << " Please try to use the new structured commands!" << G4endl;
1124  }
1125  else if(command == angtypeCmd)
1126  {
1127  CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
1128  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1129  << " The command is obsolete and will be removed soon." << G4endl
1130  << " Please try to use the new structured commands!" << G4endl;
1131  }
1132  else if(command == angrot1Cmd)
1133  {
1134  CHECKPG();
1135  G4String a = "angref1";
1137  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1138  << " The command is obsolete and will be removed soon." << G4endl
1139  << " Please try to use the new structured commands!" << G4endl;
1140  }
1141  else if(command == angrot2Cmd)
1142  {
1143  CHECKPG();
1144  G4String a = "angref2";
1146  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1147  << " The command is obsolete and will be removed soon." << G4endl
1148  << " Please try to use the new structured commands!" << G4endl;
1149  }
1150  else if(command == minthetaCmd)
1151  {
1153  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1154  << " The command is obsolete and will be removed soon." << G4endl
1155  << " Please try to use the new structured commands!" << G4endl;
1156  }
1157  else if(command == minphiCmd)
1158  {
1160  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1161  << " The command is obsolete and will be removed soon." << G4endl
1162  << " Please try to use the new structured commands!" << G4endl;
1163  }
1164  else if(command == maxthetaCmd)
1165  {
1167  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1168  << " The command is obsolete and will be removed soon." << G4endl
1169  << " Please try to use the new structured commands!" << G4endl;
1170  }
1171  else if(command == maxphiCmd)
1172  {
1174  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1175  << " The command is obsolete and will be removed soon." << G4endl
1176  << " Please try to use the new structured commands!" << G4endl;
1177  }
1178  else if(command == angsigmarCmd)
1179  {
1181  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1182  << " The command is obsolete and will be removed soon." << G4endl
1183  << " Please try to use the new structured commands!" << G4endl;
1184  }
1185  else if(command == angsigmaxCmd)
1186  {
1188  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1189  << " The command is obsolete and will be removed soon." << G4endl
1190  << " Please try to use the new structured commands!" << G4endl;
1191  }
1192  else if(command == angsigmayCmd)
1193  {
1195  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1196  << " The command is obsolete and will be removed soon." << G4endl
1197  << " Please try to use the new structured commands!" << G4endl;
1198  }
1199  else if(command == useuserangaxisCmd)
1200  {
1202  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1203  << " The command is obsolete and will be removed soon." << G4endl
1204  << " Please try to use the new structured commands!" << G4endl;
1205  }
1206  else if(command == surfnormCmd)
1207  {
1209  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1210  << " The command is obsolete and will be removed soon." << G4endl
1211  << " Please try to use the new structured commands!" << G4endl;
1212  }
1213  else if(command == energytypeCmd)
1214  {
1215  CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1216  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1217  << " The command is obsolete and will be removed soon." << G4endl
1218  << " Please try to use the new structured commands!" << G4endl;
1219  }
1220  else if(command == eminCmd)
1221  {
1223  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1224  << " The command is obsolete and will be removed soon." << G4endl
1225  << " Please try to use the new structured commands!" << G4endl;
1226  }
1227  else if(command == emaxCmd)
1228  {
1230  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1231  << " The command is obsolete and will be removed soon." << G4endl
1232  << " Please try to use the new structured commands!" << G4endl;
1233  }
1234  else if(command == monoenergyCmd)
1235  {
1237  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1238  << " The command is obsolete and will be removed soon." << G4endl
1239  << " Please try to use the new structured commands!" << G4endl;
1240  }
1241  else if(command == engsigmaCmd)
1242  {
1244  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1245  << " The command is obsolete and will be removed soon." << G4endl
1246  << " Please try to use the new structured commands!" << G4endl;
1247  }
1248  else if(command == alphaCmd)
1249  {
1251  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1252  << " The command is obsolete and will be removed soon." << G4endl
1253  << " Please try to use the new structured commands!" << G4endl;
1254  }
1255  else if(command == tempCmd)
1256  {
1258  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1259  << " The command is obsolete and will be removed soon." << G4endl
1260  << " Please try to use the new structured commands!" << G4endl;
1261  }
1262  else if(command == ezeroCmd)
1263  {
1265  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1266  << " The command is obsolete and will be removed soon." << G4endl
1267  << " Please try to use the new structured commands!" << G4endl;
1268  }
1269  else if(command == gradientCmd)
1270  {
1272  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1273  << " The command is obsolete and will be removed soon." << G4endl
1274  << " Please try to use the new structured commands!" << G4endl;
1275  }
1276  else if(command == interceptCmd)
1277  {
1279  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1280  << " The command is obsolete and will be removed soon." << G4endl
1281  << " Please try to use the new structured commands!" << G4endl;
1282  }
1283  else if(command == calculateCmd)
1284  {
1286  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1287  << " The command is obsolete and will be removed soon." << G4endl
1288  << " Please try to use the new structured commands!" << G4endl;
1289  }
1290  else if(command == energyspecCmd)
1291  {
1293  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1294  << " The command is obsolete and will be removed soon." << G4endl
1295  << " Please try to use the new structured commands!" << G4endl;
1296  }
1297  else if(command == diffspecCmd)
1298  {
1300  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1301  << " The command is obsolete and will be removed soon." << G4endl
1302  << " Please try to use the new structured commands!" << G4endl;
1303  }
1304  else if(command == histnameCmd)
1305  {
1306  histtype = newValues;
1307  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1308  << " The command is obsolete and will be removed soon." << G4endl
1309  << " Please try to use the new structured commands!" << G4endl;
1310  }
1311  else if(command == histpointCmd)
1312  {
1313  CHECKPG();
1314  if(histtype == "biasx")
1316  if(histtype == "biasy")
1318  if(histtype == "biasz")
1320  if(histtype == "biast")
1322  if(histtype == "biasp")
1324  if(histtype == "biase")
1326  if(histtype == "theta")
1328  if(histtype == "phi")
1330  if(histtype == "energy")
1332  if(histtype == "arb")
1334  if(histtype == "epn")
1336  G4cout << " G4GeneralParticleSourceMessenger - Warning: The command is obsolete and will be removed soon. Please try to use the new structured commands!" << G4endl;
1337  }
1338  else if(command == resethistCmd)
1339  {
1340  CHECKPG();
1341  if(newValues == "theta" || newValues == "phi") {
1342  fParticleGun->GetAngDist()->ReSetHist(newValues);
1343  } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1344  fParticleGun->GetEneDist()->ReSetHist(newValues);
1345  } else {
1346  fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1347  }
1348  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1349  << " The command is obsolete and will be removed soon." << G4endl
1350  << " Please try to use the new structured commands!" << G4endl;
1351  }
1352  else if(command == arbintCmd)
1353  {
1354  CHECKPG();
1355  fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1356  G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1357  << " The command is obsolete and will be removed soon." << G4endl
1358  << " Please try to use the new structured commands!" << G4endl;
1359  }
1360  else if( command==directionCmd )
1361  {
1362  CHECKPG();
1363  fParticleGun->GetAngDist()->SetAngDistType("planar");
1365  }
1366  else if( command==energyCmd )
1367  {
1368  CHECKPG();
1371  }
1372  else if( command==positionCmd )
1373  {
1374  CHECKPG();
1375  fParticleGun->GetPosDist()->SetPosDisType("Point");
1377  }
1378  else if(command == verbosityCmd)
1379  {
1380  CHECKPG();
1382  }
1383  else if( command==particleCmd )
1384  {
1385  if (newValues =="ion") {
1386  fShootIon = true;
1387  } else {
1388  fShootIon = false;
1390  if(pd != NULL)
1392  }
1393  }
1394  else if( command==timeCmd )
1396  else if( command==polCmd )
1398  else if( command==numberCmd )
1400  else if( command==ionCmd )
1401  { IonCommand(newValues); }
1402  else if( command==ionLvlCmd )
1403  { IonLvlCommand(newValues); }
1404  else if( command==listCmd ){
1406  }
1407  else if( command==addsourceCmd )
1408  {
1410  }
1411  else if( command==listsourceCmd )
1412  {
1413  fGPS->ListSource();
1414  }
1415  else if( command==clearsourceCmd )
1416  {
1417  fGPS->ClearAll();
1418  }
1419  else if( command==getsourceCmd )
1420  {
1421  G4cout << " Current source index:" << fGPS->GetCurrentSourceIndex()
1422  << " ; Intensity:" << fGPS->GetCurrentSourceIntensity() << G4endl;
1423  }
1424  else if( command==setsourceCmd )
1425  {
1427  }
1428  else if( command==setintensityCmd )
1429  {
1431  }
1432  else if( command==deletesourceCmd )
1433  {
1435  }
1436  else if(command == multiplevertexCmd)
1437  {
1439  }
1440  else if(command == flatsamplingCmd)
1441  {
1443  }
1444  //
1445  // new implementations
1446  //
1447  //
1448  else if(command == typeCmd1)
1449  {
1450  CHECKPG();
1451  fParticleGun->GetPosDist()->SetPosDisType(newValues);
1452  }
1453  else if(command == shapeCmd1)
1454  {
1455  CHECKPG();
1456  fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1457  }
1458  else if(command == centreCmd1)
1459  {
1460  CHECKPG();
1462  }
1463  else if(command == posrot1Cmd1)
1464  {
1465  CHECKPG();
1467  }
1468  else if(command == posrot2Cmd1)
1469  {
1470  CHECKPG();
1472  }
1473  else if(command == halfxCmd1)
1474  {
1475  CHECKPG();
1477  }
1478  else if(command == halfyCmd1)
1479  {
1480  CHECKPG();
1482  }
1483  else if(command == halfzCmd1)
1484  {
1485  CHECKPG();
1487  }
1488  else if(command == radiusCmd1)
1489  {
1490  CHECKPG();
1492  }
1493  else if(command == radius0Cmd1)
1494  {
1495  CHECKPG();
1497  }
1498  else if(command == possigmarCmd1)
1499  {
1500  CHECKPG();
1502  }
1503  else if(command == possigmaxCmd1)
1504  {
1506  }
1507  else if(command == possigmayCmd1)
1508  {
1510  }
1511  else if(command == paralpCmd1)
1512  {
1514  }
1515  else if(command == partheCmd1)
1516  {
1518  }
1519  else if(command == parphiCmd1)
1520  {
1522  }
1523  else if(command == confineCmd1)
1524  {
1526  }
1527  else if(command == angtypeCmd1)
1528  {
1529  CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
1530  }
1531  else if(command == angrot1Cmd1)
1532  {
1533  CHECKPG();
1534  G4String a = "angref1";
1536  }
1537  else if(command == angrot2Cmd1)
1538  {
1539  CHECKPG();
1540  G4String a = "angref2";
1542  }
1543  else if(command == minthetaCmd1)
1544  {
1545  CHECKPG();
1547  }
1548  else if(command == minphiCmd1)
1549  {
1551  }
1552  else if(command == maxthetaCmd1)
1553  {
1555  }
1556  else if(command == maxphiCmd1)
1557  {
1559  }
1560  else if(command == angsigmarCmd1)
1561  {
1563  }
1564  else if(command == angsigmaxCmd1)
1565  {
1567  }
1568  else if(command == angsigmayCmd1)
1569  {
1571  }
1572  else if(command == angfocusCmd)
1573  {
1575  }
1576  else if(command == useuserangaxisCmd1)
1577  {
1579  }
1580  else if(command == surfnormCmd1)
1581  {
1583  }
1584  else if(command == energytypeCmd1)
1585  {
1586  CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1587  }
1588  else if(command == eminCmd1)
1589  {
1591  }
1592  else if(command == emaxCmd1)
1593  {
1595  }
1596  else if(command == monoenergyCmd1)
1597  {
1599  }
1600  else if(command == engsigmaCmd1)
1601  {
1603  }
1604  else if(command == alphaCmd1)
1605  {
1607  }
1608  else if(command == tempCmd1)
1609  {
1611  }
1612  else if(command == ezeroCmd1)
1613  {
1615  }
1616  else if(command == gradientCmd1)
1617  {
1619  }
1620  else if(command == interceptCmd1)
1621  {
1623  }
1624  else if(command == arbeintCmd1)
1625  {
1627  }
1628  else if(command == calculateCmd1)
1629  {
1631  }
1632  else if(command == energyspecCmd1)
1633  {
1635  }
1636  else if(command == diffspecCmd1)
1637  {
1639  }
1640  else if(command == histnameCmd1)
1641  {
1642  histtype = newValues;
1643  }
1644  else if(command == histfileCmd1)
1645  {
1646  histtype = "arb";
1648  }
1649  else if(command == histpointCmd1)
1650  {
1651  CHECKPG();
1652  if(histtype == "biasx")
1654  if(histtype == "biasy")
1656  if(histtype == "biasz")
1658  if(histtype == "biast")
1660  if(histtype == "biasp")
1662  if(histtype == "biaspt")
1664  if(histtype == "biaspp")
1666  if(histtype == "biase")
1668  if(histtype == "theta")
1670  if(histtype == "phi")
1672  if(histtype == "energy")
1674  if(histtype == "arb")
1676  if(histtype == "epn")
1678  }
1679  else if(command == resethistCmd1)
1680  {
1681  CHECKPG();
1682  if(newValues == "theta" || newValues == "phi") {
1683  fParticleGun->GetAngDist()->ReSetHist(newValues);
1684  } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1685  fParticleGun->GetEneDist()->ReSetHist(newValues);
1686  } else {
1687  fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1688  }
1689  }
1690  else if(command == arbintCmd1)
1691  {
1692  CHECKPG(); fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1693  }
1694  else
1695  {
1696  G4cout << "Error entering command" << G4endl;
1697  }
1698 }
1699 
1701 {
1702  G4String cv;
1703 
1704  // if( command==directionCmd )
1705  // { cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
1706  // else if( command==energyCmd )
1707  // { cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
1708  // else if( command==positionCmd )
1709  // { cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
1710  // else if( command==timeCmd )
1711  // { cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
1712  // else if( command==polCmd )
1713  // { cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
1714  // else if( command==numberCmd )
1715  // { cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
1716 
1717  cv = "Not implemented yet";
1718 
1719  return cv;
1720 }
1721 
1723 {
1724  fShootIon = true;
1725 
1726  if (fShootIon)
1727  {
1728  G4Tokenizer next( newValues );
1729  // check argument
1730  fAtomicNumber = StoI(next());
1731  fAtomicMass = StoI(next());
1732  G4String sQ = next();
1733  if (sQ.isNull())
1734  {
1736  }
1737  else
1738  {
1739  fIonCharge = StoI(sQ);
1740  sQ = next();
1741  if (sQ.isNull())
1742  {
1743  fIonExciteEnergy = 0.0;
1744  }
1745  else
1746  {
1747  fIonExciteEnergy = StoD(sQ) * keV;
1748  }
1749  }
1752  if (ion==0)
1753  {
1754  G4cout << "Ion with Z=" << fAtomicNumber;
1755  G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
1756  }
1757  else
1758  {
1761  }
1762  }
1763  else
1764  {
1765  G4cout << "Set /gps/particle to ion before using /gps/ion command";
1766  G4cout << G4endl;
1767  }
1768 }
1769 
1771 {
1772  fShootIonL = true;
1773 
1774  if (fShootIonL) {
1775  G4Tokenizer next(newValues);
1776  // check argument
1777  fAtomicNumberL = StoI(next());
1778  fAtomicMassL = StoI(next());
1779  G4String sQ = next();
1780  if (sQ.isNull()) {
1782  } else {
1783  fIonChargeL = StoI(sQ);
1784  sQ = next();
1785  if (sQ.isNull()) {
1786  fIonEnergyLevel = 0;
1787  } else {
1788  fIonEnergyLevel = StoI(sQ);
1789  }
1790  }
1791 
1794  if (ion == 0) {
1795  G4cout << "Ion with Z=" << fAtomicNumberL;
1796  G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
1797  } else {
1800  }
1801 
1802  } else {
1803  G4cout << "Set /gps/particle to ion before using /gps/ionLvl command";
1804  G4cout << G4endl;
1805  }
1806 }
1807 
static G4GeneralParticleSourceMessenger * GetInstance(G4GeneralParticleSource *)
G4SPSAngDistribution * GetAngDist() const
G4SPSEneDistribution * GetEneDist() const
void SetParticleTime(G4double aTime)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4SPSPosDistribution * GetPosDist() const
void DumpTable(const G4String &particle_name="ALL")
void SetPosDisType(G4String)
Important: This is a shared class between threads.
void ArbEnergyHisto(G4ThreeVector)
static G4int GetNewIntValue(const char *paramString)
void SetBeamSigmaInAngR(G4double)
Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameter...
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:463
const G4double pi
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetDefaultValue(const char *theDefaultValue)
void SetBeamSigmaInAngY(G4double)
void SetEnergyBias(G4ThreeVector)
void SetNewValue(G4UIcommand *command, G4String newValues)
G4double a
Definition: TRTMaterials.hh:39
void SetYBias(G4ThreeVector)
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetPosThetaBias(G4ThreeVector)
static G4bool GetNewBoolValue(const char *paramString)
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:171
void SetThetaBias(G4ThreeVector)
void SetZBias(G4ThreeVector)
void SetXBias(G4ThreeVector)
void UserDefAngPhi(G4ThreeVector)
void UserDefAngTheta(G4ThreeVector)
G4GLOB_DLL std::ostream G4cout
void SetCentreCoords(G4ThreeVector)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
G4SPSRandomGenerator * GetBiasRndm() const
G4GeneralParticleSourceMessenger(G4GeneralParticleSource *)
bool G4bool
Definition: G4Types.hh:79
static G4double GetNewDoubleValue(const char *paramString)
void DefineAngRefAxes(G4String, G4ThreeVector)
void SetParticlePolarization(G4ThreeVector aVal)
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void SetPosRot1(G4ThreeVector)
G4int StoI(G4String s)
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
void EpnEnergyHisto(G4ThreeVector)
void SetPhiBias(G4ThreeVector)
G4int G4Mutex
Definition: G4Threading.hh:169
Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameter...
static G4ParticleTable * GetParticleTable()
void UserEnergyHisto(G4ThreeVector)
G4double StoD(G4String s)
void SetPosRot2(G4ThreeVector)
void InputDifferentialSpectra(G4bool)
void SetFocusPoint(G4ThreeVector)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
#define G4endl
Definition: G4ios.hh:61
static const double keV
Definition: G4SIunits.hh:195
void ArbEnergyHistoFile(G4String)
void SetParticleCharge(G4double aCharge)
static const double eplus
Definition: G4SIunits.hh:178
void ConfineSourceToVolume(G4String)
G4bool isNull() const
void SetPosPhiBias(G4ThreeVector)
void SetBeamSigmaInAngX(G4double)