Geant4  10.02.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 applying 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->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");
208 
209  energyCmd = new G4UIcmdWithADoubleAndUnit("/gps/energy",this);
210  energyCmd->SetGuidance("Set kinetic energy.");
211  energyCmd->SetParameterName("Energy",false,false);
212  energyCmd->SetDefaultUnit("GeV");
213  //energyCmd->SetUnitCategory("Energy");
214  //energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
215 
216  positionCmd = new G4UIcmdWith3VectorAndUnit("/gps/position",this);
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");
221  //positionCmd->SetUnitCategory("Length");
222  //positionCmd->SetUnitCandidates("microm mm cm m km");
223 
224  ionCmd = new G4UIcommand("/gps/ion",this);
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)");
231 
232  G4UIparameter* param;
233  param = new G4UIparameter("Z",'i',false);
234  param->SetDefaultValue("1");
235  ionCmd->SetParameter(param);
236  param = new G4UIparameter("A",'i',false);
237  param->SetDefaultValue("1");
238  ionCmd->SetParameter(param);
239  param = new G4UIparameter("Q",'i',true);
240  param->SetDefaultValue("0");
241  ionCmd->SetParameter(param);
242  param = new G4UIparameter("E",'d',true);
243  param->SetDefaultValue("0.0");
244  ionCmd->SetParameter(param);
245 
246  ionLvlCmd = new G4UIcommand("/gps/ionLvl",this);
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)");
253 
254  G4UIparameter* paramL;
255  paramL = new G4UIparameter("Z",'i',false);
256  paramL->SetDefaultValue("1");
257  ionLvlCmd->SetParameter(paramL);
258  paramL = new G4UIparameter("A",'i',false);
259  paramL->SetDefaultValue("1");
260  ionLvlCmd->SetParameter(paramL);
261  paramL = new G4UIparameter("Q",'i',true);
262  paramL->SetDefaultValue("0");
263  ionLvlCmd->SetParameter(paramL);
264  paramL = new G4UIparameter("Lvl",'i',true);
265  paramL->SetDefaultValue("0.0");
266  ionLvlCmd->SetParameter(paramL);
267 
268  timeCmd = new G4UIcmdWithADoubleAndUnit("/gps/time",this);
269  timeCmd->SetGuidance("Set initial time of the particle.");
270  timeCmd->SetParameterName("t0",false,false);
271  timeCmd->SetDefaultUnit("ns");
272  //timeCmd->SetUnitCategory("Time");
273  //timeCmd->SetUnitCandidates("ns ms s");
274 
275  polCmd = new G4UIcmdWith3Vector("/gps/polarization",this);
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.");
279 
280  numberCmd = new G4UIcmdWithAnInteger("/gps/number",this);
281  numberCmd->SetGuidance("Set number of particles to be generated per vertex.");
282  numberCmd->SetParameterName("N",false,false);
283  numberCmd->SetRange("N>0");
284 
285  // verbosity
286  verbosityCmd = new G4UIcmdWithAnInteger("/gps/verbose",this);
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");
293 
294  // now extended commands
295  // Positional ones:
296  positionDirectory = new G4UIdirectory("/gps/pos/");
297  positionDirectory->SetGuidance("Positional commands sub-directory");
298 
299  typeCmd1 = new G4UIcmdWithAString("/gps/pos/type",this);
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");
305 
306  shapeCmd1 = new G4UIcmdWithAString("/gps/pos/shape",this);
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 Para");
311 
312  centreCmd1 = new G4UIcmdWith3VectorAndUnit("/gps/pos/centre",this);
313  centreCmd1->SetGuidance("Set centre coordinates of source.");
314  //centreCmd1->SetGuidance(" same effect as the /gps/position command");
315  centreCmd1->SetParameterName("X","Y","Z",false,false);
316  centreCmd1->SetDefaultUnit("cm");
317  // centreCmd1->SetUnitCandidates("micron mm cm m km");
318 
319  posrot1Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot1",this);
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");
324 
325  posrot2Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot2",this);
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");
330 
331  halfxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfx",this);
332  halfxCmd1->SetGuidance("Set x half length of source.");
333  halfxCmd1->SetParameterName("Halfx",false,false);
334  halfxCmd1->SetDefaultUnit("cm");
335  // halfxCmd1->SetUnitCandidates("micron mm cm m km");
336 
337  halfyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfy",this);
338  halfyCmd1->SetGuidance("Set y half length of source.");
339  halfyCmd1->SetParameterName("Halfy",false,false);
340  halfyCmd1->SetDefaultUnit("cm");
341  // halfyCmd1->SetUnitCandidates("micron mm cm m km");
342 
343  halfzCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfz",this);
344  halfzCmd1->SetGuidance("Set z half length of source.");
345  halfzCmd1->SetParameterName("Halfz",false,false);
346  halfzCmd1->SetDefaultUnit("cm");
347  // halfzCmd1->SetUnitCandidates("micron mm cm m km");
348 
349  radiusCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/radius",this);
350  radiusCmd1->SetGuidance("Set radius of source.");
351  radiusCmd1->SetParameterName("Radius",false,false);
352  radiusCmd1->SetDefaultUnit("cm");
353  // radiusCmd1->SetUnitCandidates("micron mm cm m km");
354 
355  radius0Cmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/inner_radius",this);
356  radius0Cmd1->SetGuidance("Set inner radius of source when required.");
357  radius0Cmd1->SetParameterName("Radius0",false,false);
358  radius0Cmd1->SetDefaultUnit("cm");
359  // radius0Cmd1->SetUnitCandidates("micron mm cm m km");
360 
361  possigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_r",this);
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");
366  // possigmarCmd1->SetUnitCandidates("micron mm cm m km");
367 
368  possigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_x",this);
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");
373  // possigmaxCmd1->SetUnitCandidates("micron mm cm m km");
374 
375  possigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_y",this);
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");
380  // possigmayCmd1->SetUnitCandidates("micron mm cm m km");
381 
382  paralpCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/paralp",this);
383  paralpCmd1->SetGuidance("Angle from y-axis of y' in Para");
384  paralpCmd1->SetParameterName("paralp",false,false);
385  paralpCmd1->SetDefaultUnit("rad");
386  // paralpCmd1->SetUnitCandidates("rad deg");
387 
388  partheCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parthe",this);
389  partheCmd1->SetGuidance("Polar angle through centres of z faces");
390  partheCmd1->SetParameterName("parthe",false,false);
391  partheCmd1->SetDefaultUnit("rad");
392  // partheCmd1->SetUnitCandidates("rad deg");
393 
394  parphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parphi",this);
395  parphiCmd1->SetGuidance("Azimuth angle through centres of z faces");
396  parphiCmd1->SetParameterName("parphi",false,false);
397  parphiCmd1->SetDefaultUnit("rad");
398  // parphiCmd1->SetUnitCandidates("rad deg");
399 
400  confineCmd1 = new G4UIcmdWithAString("/gps/pos/confine",this);
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");
405 
406  // old implementations
407 // typeCmd = new G4UIcmdWithAString("/gps/type",this);
408 // typeCmd->SetGuidance("Sets source distribution type. (obsolete!)");
409 // typeCmd->SetGuidance("Either Point, Beam, Plane, Surface or Volume");
410 // typeCmd->SetParameterName("DisType",false,false);
411 // typeCmd->SetDefaultValue("Point");
412 // typeCmd->SetCandidates("Point Beam Plane Surface Volume");
413 
414 // shapeCmd = new G4UIcmdWithAString("/gps/shape",this);
415 // shapeCmd->SetGuidance("Sets source shape type.(obsolete!)");
416 // shapeCmd->SetParameterName("Shape",false,false);
417 // shapeCmd->SetDefaultValue("NULL");
418 // shapeCmd->SetCandidates("Circle Annulus Ellipse Square Rectangle Sphere Ellipsoid Cylinder Para");
419 
420 // centreCmd = new G4UIcmdWith3VectorAndUnit("/gps/centre",this);
421 // centreCmd->SetGuidance("Set centre coordinates of source.(obsolete!)");
422 // centreCmd->SetParameterName("X","Y","Z",false,false);
423 // centreCmd->SetDefaultUnit("cm");
424  // centreCmd->SetUnitCandidates("micron mm cm m km");
425 
426 // posrot1Cmd = new G4UIcmdWith3Vector("/gps/posrot1",this);
427 // posrot1Cmd->SetGuidance("Set rotation matrix of x'.(obsolete!)");
428 // posrot1Cmd->SetGuidance("Posrot1 does not need to be a unit vector.");
429 // posrot1Cmd->SetParameterName("R1x","R1y","R1z",false,false);
430 // posrot1Cmd->SetRange("R1x != 0 || R1y != 0 || R1z != 0");
431 //
432 // posrot2Cmd = new G4UIcmdWith3Vector("/gps/posrot2",this);
433 // posrot2Cmd->SetGuidance("Set rotation matrix of y'.(obsolete!)");
434 // posrot2Cmd->SetGuidance("Posrot2 does not need to be a unit vector.");
435 // posrot2Cmd->SetParameterName("R2x","R2y","R2z",false,false);
436 // posrot2Cmd->SetRange("R2x != 0 || R2y != 0 || R2z != 0");
437 
438 // halfxCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfx",this);
439 // halfxCmd->SetGuidance("Set x half length of source.(obsolete!)");
440 // halfxCmd->SetParameterName("Halfx",false,false);
441 // halfxCmd->SetDefaultUnit("cm");
442  // halfxCmd->SetUnitCandidates("micron mm cm m km");
443 
444 // halfyCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfy",this);
445 // halfyCmd->SetGuidance("Set y half length of source.(obsolete!)");
446 // halfyCmd->SetParameterName("Halfy",false,false);
447 // halfyCmd->SetDefaultUnit("cm");
448  // halfyCmd->SetUnitCandidates("micron mm cm m km");
449 
450 // halfzCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfz",this);
451 // halfzCmd->SetGuidance("Set z half length of source.(obsolete!)");
452 // halfzCmd->SetParameterName("Halfz",false,false);
453 // halfzCmd->SetDefaultUnit("cm");
454  // halfzCmd->SetUnitCandidates("micron mm cm m km");
455 
456 // radiusCmd = new G4UIcmdWithADoubleAndUnit("/gps/radius",this);
457 // radiusCmd->SetGuidance("Set radius of source.(obsolete!)");
458 // radiusCmd->SetParameterName("Radius",false,false);
459 // radiusCmd->SetDefaultUnit("cm");
460  // radiusCmd->SetUnitCandidates("micron mm cm m km");
461 
462 // radius0Cmd = new G4UIcmdWithADoubleAndUnit("/gps/radius0",this);
463 // radius0Cmd->SetGuidance("Set inner radius of source.(obsolete!)");
464 // radius0Cmd->SetParameterName("Radius0",false,false);
465 // radius0Cmd->SetDefaultUnit("cm");
466  // radius0Cmd->SetUnitCandidates("micron mm cm m km");
467 
468 // possigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposr",this);
469 // possigmarCmd->SetGuidance("Set standard deviation of beam position in radial(obsolete!)");
470 // possigmarCmd->SetParameterName("Sigmar",false,false);
471 // possigmarCmd->SetDefaultUnit("cm");
472  // possigmarCmd->SetUnitCandidates("micron mm cm m km");
473 
474 // possigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposx",this);
475 // possigmaxCmd->SetGuidance("Set standard deviation of beam position in x-dir(obsolete!)");
476 // possigmaxCmd->SetParameterName("Sigmax",false,false);
477 // possigmaxCmd->SetDefaultUnit("cm");
478  // possigmaxCmd->SetUnitCandidates("micron mm cm m km");
479 
480 // possigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposy",this);
481 // possigmayCmd->SetGuidance("Set standard deviation of beam position in y-dir(obsolete!)");
482 // possigmayCmd->SetParameterName("Sigmay",false,false);
483 // possigmayCmd->SetDefaultUnit("cm");
484  // possigmayCmd->SetUnitCandidates("micron mm cm m km");
485 
486 // paralpCmd = new G4UIcmdWithADoubleAndUnit("/gps/paralp",this);
487 // paralpCmd->SetGuidance("Angle from y-axis of y' in Para(obsolete!)");
488 // paralpCmd->SetParameterName("paralp",false,false);
489 // paralpCmd->SetDefaultUnit("rad");
490  // paralpCmd->SetUnitCandidates("rad deg");
491 
492 // partheCmd = new G4UIcmdWithADoubleAndUnit("/gps/parthe",this);
493 // partheCmd->SetGuidance("Polar angle through centres of z faces(obsolete!)");
494 // partheCmd->SetParameterName("parthe",false,false);
495 // partheCmd->SetDefaultUnit("rad");
496  // partheCmd->SetUnitCandidates("rad deg");
497 
498 // parphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/parphi",this);
499 // parphiCmd->SetGuidance("Azimuth angle through centres of z faces(obsolete!)");
500 // parphiCmd->SetParameterName("parphi",false,false);
501 // parphiCmd->SetDefaultUnit("rad");
502  // parphiCmd->SetUnitCandidates("rad deg");
503 
504 // confineCmd = new G4UIcmdWithAString("/gps/confine",this);
505 // confineCmd->SetGuidance("Confine source to volume (NULL to unset)(obsolete!) .");
506 // confineCmd->SetGuidance("usage: confine VolName");
507 // confineCmd->SetParameterName("VolName",false,false);
508 // confineCmd->SetDefaultValue("NULL");
509 
510  // Angular distribution commands
511  angularDirectory = new G4UIdirectory("/gps/ang/");
512  angularDirectory->SetGuidance("Angular commands sub-directory");
513 
514  angtypeCmd1 = new G4UIcmdWithAString("/gps/ang/type",this);
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");
520 
521  angrot1Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot1",this);
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");
526 
527  angrot2Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot2",this);
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");
532 
533  minthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/mintheta",this);
534  minthetaCmd1->SetGuidance("Set minimum theta");
535  minthetaCmd1->SetParameterName("MinTheta",false,false);
536  minthetaCmd1->SetDefaultValue(0.);
537  minthetaCmd1->SetDefaultUnit("rad");
538  // minthetaCmd1->SetUnitCandidates("rad deg");
539 
540  maxthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxtheta",this);
541  maxthetaCmd1->SetGuidance("Set maximum theta");
542  maxthetaCmd1->SetParameterName("MaxTheta",false,false);
543  maxthetaCmd1->SetDefaultValue(pi);
544  maxthetaCmd1->SetDefaultUnit("rad");
545  // maxthetaCmd1->SetUnitCandidates("rad deg");
546 
547  minphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/minphi",this);
548  minphiCmd1->SetGuidance("Set minimum phi");
549  minphiCmd1->SetParameterName("MinPhi",false,false);
550  minphiCmd1->SetDefaultUnit("rad");
551  // minphiCmd1->SetUnitCandidates("rad deg");
552 
553  maxphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxphi",this);
554  maxphiCmd1->SetGuidance("Set maximum phi");
555  maxphiCmd1->SetParameterName("MaxPhi",false,false);
556  maxphiCmd1->SetDefaultValue(pi);
557  maxphiCmd1->SetDefaultUnit("rad");
558  // maxphiCmd1->SetUnitCandidates("rad deg");
559 
560  angsigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_r",this);
561  angsigmarCmd1->SetGuidance("Set standard deviation in direction for 1D beam.");
562  angsigmarCmd1->SetParameterName("Sigmara",false,false);
563  angsigmarCmd1->SetDefaultUnit("rad");
564  // angsigmarCmd1->SetUnitCandidates("rad deg");
565 
566  angsigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_x",this);
567  angsigmaxCmd1->SetGuidance("Set standard deviation in direction in x-direc. for 2D beam");
568  angsigmaxCmd1->SetParameterName("Sigmaxa",false,false);
569  angsigmaxCmd1->SetDefaultUnit("rad");
570  // angsigmaxCmd1->SetUnitCandidates("rad deg");
571 
572  angsigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_y",this);
573  angsigmayCmd1->SetGuidance("Set standard deviation in direction in y-direc. for 2D beam");
574  angsigmayCmd1->SetParameterName("Sigmaya",false,false);
575  angsigmayCmd1->SetDefaultUnit("rad");
576  // angsigmayCmd1->SetUnitCandidates("rad deg");
577 
578  angfocusCmd = new G4UIcmdWith3VectorAndUnit("/gps/ang/focuspoint",this);
579  angfocusCmd->SetGuidance("Set the focusing point for the beam");
580  angfocusCmd->SetParameterName("x","y","z",false,false);
581  angfocusCmd->SetDefaultUnit("cm");
582  // angfocusCmd->SetUnitCandidates("micron mm cm m km");
583 
584  useuserangaxisCmd1 = new G4UIcmdWithABool("/gps/ang/user_coor",this);
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);
589 
590  surfnormCmd1 = new G4UIcmdWithABool("/gps/ang/surfnorm",this);
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);
595 
596  // old ones
597 // angtypeCmd = new G4UIcmdWithAString("/gps/angtype",this);
598 // angtypeCmd->SetGuidance("Sets angular source distribution type (obsolete!)");
599 // angtypeCmd->SetGuidance("Possible variables are: iso, cos planar beam1d beam2d or user");
600 // angtypeCmd->SetParameterName("AngDis",false,false);
601 // angtypeCmd->SetDefaultValue("iso");
602 // angtypeCmd->SetCandidates("iso cos planar beam1d beam2d user");
603 
604 // angrot1Cmd = new G4UIcmdWith3Vector("/gps/angrot1",this);
605 // angrot1Cmd->SetGuidance("Sets the x' vector for angular distribution(obsolete!) ");
606 // angrot1Cmd->SetGuidance("Need not be a unit vector");
607 // angrot1Cmd->SetParameterName("AR1x","AR1y","AR1z",false,false);
608 // angrot1Cmd->SetRange("AR1x != 0 || AR1y != 0 || AR1z != 0");
609 
610 // angrot2Cmd = new G4UIcmdWith3Vector("/gps/angrot2",this);
611 // angrot2Cmd->SetGuidance("Sets the y' vector for angular distribution (obsolete!)");
612 // angrot2Cmd->SetGuidance("Need not be a unit vector");
613 // angrot2Cmd->SetParameterName("AR2x","AR2y","AR2z",false,false);
614 // angrot2Cmd->SetRange("AR2x != 0 || AR2y != 0 || AR2z != 0");
615 
616 // minthetaCmd = new G4UIcmdWithADoubleAndUnit("/gps/mintheta",this);
617 // minthetaCmd->SetGuidance("Set minimum theta (obsolete!)");
618 // minthetaCmd->SetParameterName("MinTheta",false,false);
619 // minthetaCmd->SetDefaultUnit("rad");
620  // minthetaCmd->SetUnitCandidates("rad deg");
621 
622 // maxthetaCmd = new G4UIcmdWithADoubleAndUnit("/gps/maxtheta",this);
623 // maxthetaCmd->SetGuidance("Set maximum theta (obsolete!)");
624 // maxthetaCmd->SetParameterName("MaxTheta",false,false);
625 // maxthetaCmd->SetDefaultValue(3.1416);
626 // maxthetaCmd->SetDefaultUnit("rad");
627  // maxthetaCmd->SetUnitCandidates("rad deg");
628 
629 // minphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/minphi",this);
630 // minphiCmd->SetGuidance("Set minimum phi (obsolete!)");
631 // minphiCmd->SetParameterName("MinPhi",false,false);
632 // minphiCmd->SetDefaultUnit("rad");
633  // minphiCmd->SetUnitCandidates("rad deg");
634 
635 // maxphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/maxphi",this);
636 // maxphiCmd->SetGuidance("Set maximum phi(obsolete!)");
637 // maxphiCmd->SetParameterName("MaxPhi",false,false);
638 // maxphiCmd->SetDefaultUnit("rad");
639  // maxphiCmd->SetUnitCandidates("rad deg");
640 
641 // angsigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangr",this);
642 // angsigmarCmd->SetGuidance("Set standard deviation of beam direction in radial(obsolete!).");
643 // angsigmarCmd->SetParameterName("Sigmara",false,false);
644 // angsigmarCmd->SetDefaultUnit("rad");
645  // angsigmarCmd->SetUnitCandidates("rad deg");
646 
647 // angsigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangx",this);
648 // angsigmaxCmd->SetGuidance("Set standard deviation of beam direction in x-direc(obsolete!).");
649 // angsigmaxCmd->SetParameterName("Sigmaxa",false,false);
650 // angsigmaxCmd->SetDefaultUnit("rad");
651  // angsigmaxCmd->SetUnitCandidates("rad deg");
652 
653 // angsigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangy",this);
654 // angsigmayCmd->SetGuidance("Set standard deviation of beam direction in y-direc.(obsolete!)");
655 // angsigmayCmd->SetParameterName("Sigmaya",false,false);
656 // angsigmayCmd->SetDefaultUnit("rad");
657  // angsigmayCmd->SetUnitCandidates("rad deg");
658 
659 // useuserangaxisCmd = new G4UIcmdWithABool("/gps/useuserangaxis",this);
660 // useuserangaxisCmd->SetGuidance("true for using user defined angular co-ordinates(obsolete!)");
661 // useuserangaxisCmd->SetGuidance("Default is false");
662 // useuserangaxisCmd->SetParameterName("useuserangaxis",true);
663 // useuserangaxisCmd->SetDefaultValue(false);
664 
665 // surfnormCmd = new G4UIcmdWithABool("/gps/surfnorm",this);
666 // surfnormCmd->SetGuidance("Makes a user-defined distribution with respect to surface normals rather than x,y,z axes (obsolete!).");
667 // surfnormCmd->SetGuidance("Default is false");
668 // surfnormCmd->SetParameterName("surfnorm",true);
669 // surfnormCmd->SetDefaultValue(false);
670 
671  // Energy commands
672 
673  energyDirectory = new G4UIdirectory("/gps/ene/");
674  energyDirectory->SetGuidance("Spectral commands sub-directory");
675 
676  energytypeCmd1 = new G4UIcmdWithAString("/gps/ene/type",this);
677  energytypeCmd1->SetGuidance("Sets energy distribution type");
678  energytypeCmd1->SetParameterName("EnergyDis",false,false);
679  energytypeCmd1->SetDefaultValue("Mono");
680  energytypeCmd1->SetCandidates("Mono Lin Pow Exp Gauss Brem Bbody Cdg User Arb Epn");
681 
682  eminCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/min",this);
683  eminCmd1->SetGuidance("Sets minimum energy");
684  eminCmd1->SetParameterName("emin",false,false);
685  eminCmd1->SetDefaultUnit("keV");
686  // eminCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
687 
688  emaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/max",this);
689  emaxCmd1->SetGuidance("Sets maximum energy");
690  emaxCmd1->SetParameterName("emax",false,false);
691  emaxCmd1->SetDefaultUnit("keV");
692  // emaxCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
693 
694  monoenergyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/mono",this);
695  monoenergyCmd1->SetGuidance("Sets a monocromatic energy (same as gps/energy)");
696  monoenergyCmd1->SetParameterName("monoenergy",false,false);
697  monoenergyCmd1->SetDefaultUnit("keV");
698  // monoenergyCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
699 
700  engsigmaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/sigma",this);
701  engsigmaCmd1->SetGuidance("Sets the standard deviation for Gaussian energy dist.");
702  engsigmaCmd1->SetParameterName("Sigmae",false,false);
703  engsigmaCmd1->SetDefaultUnit("keV");
704  // engsigmaCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
705 
706  alphaCmd1 = new G4UIcmdWithADouble("/gps/ene/alpha",this);
707  alphaCmd1->SetGuidance("Sets Alpha (index) for power-law energy dist.");
708  alphaCmd1->SetParameterName("alpha",false,false);
709 
710  tempCmd1 = new G4UIcmdWithADouble("/gps/ene/temp",this);
711  tempCmd1->SetGuidance("Sets the temperature for Brem and BBody distributions (in Kelvin)");
712  tempCmd1->SetParameterName("temp",false,false);
713 
714  ezeroCmd1 = new G4UIcmdWithADouble("/gps/ene/ezero",this);
715  ezeroCmd1->SetGuidance("Sets E_0 for exponential distribution (in MeV)");
716  ezeroCmd1->SetParameterName("ezero",false,false);
717 
718  gradientCmd1 = new G4UIcmdWithADouble("/gps/ene/gradient",this);
719  gradientCmd1->SetGuidance("Sets the gradient for Lin distribution (in 1/MeV)");
720  gradientCmd1->SetParameterName("gradient",false,false);
721 
722  interceptCmd1 = new G4UIcmdWithADouble("/gps/ene/intercept",this);
723  interceptCmd1->SetGuidance("Sets the intercept for Lin distributions (in MeV)");
724  interceptCmd1->SetParameterName("intercept",false,false);
725 
726  arbeintCmd1 = new G4UIcmdWithADouble("/gps/ene/biasAlpha",this);
727  arbeintCmd1->SetGuidance("Set the power-law index for the energy sampling distri. )");
728  arbeintCmd1->SetParameterName("arbeint",false,false);
729 
730  calculateCmd1 = new G4UIcmdWithoutParameter("/gps/ene/calculate",this);
731  calculateCmd1->SetGuidance("Calculates the distributions for Cdg and BBody");
732 
733  energyspecCmd1 = new G4UIcmdWithABool("/gps/ene/emspec",this);
734  energyspecCmd1->SetGuidance("True for energy and false for momentum spectra");
735  energyspecCmd1->SetParameterName("energyspec",true);
736  energyspecCmd1->SetDefaultValue(true);
737 
738  diffspecCmd1 = new G4UIcmdWithABool("/gps/ene/diffspec",this);
739  diffspecCmd1->SetGuidance("True for differential and flase for integral spectra");
740  diffspecCmd1->SetParameterName("diffspec",true);
741  diffspecCmd1->SetDefaultValue(true);
742 
743  //old ones
744 // energytypeCmd = new G4UIcmdWithAString("/gps/energytype",this);
745 // energytypeCmd->SetGuidance("Sets energy distribution type (obsolete!)");
746 // energytypeCmd->SetParameterName("EnergyDis",false,false);
747 // energytypeCmd->SetDefaultValue("Mono");
748 // energytypeCmd->SetCandidates("Mono Lin Pow Exp Gauss Brem Bbody Cdg User Arb Epn");
749 
750 // eminCmd = new G4UIcmdWithADoubleAndUnit("/gps/emin",this);
751 // eminCmd->SetGuidance("Sets Emin (obsolete!)");
752 // eminCmd->SetParameterName("emin",false,false);
753 // eminCmd->SetDefaultUnit("keV");
754  // eminCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
755 
756 // emaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/emax",this);
757 // emaxCmd->SetGuidance("Sets Emax (obsolete!)");
758 // emaxCmd->SetParameterName("emax",false,false);
759 // emaxCmd->SetDefaultUnit("keV");
760  // emaxCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
761 
762 // monoenergyCmd = new G4UIcmdWithADoubleAndUnit("/gps/monoenergy",this);
763 // monoenergyCmd->SetGuidance("Sets Monoenergy (obsolete, use gps/energy instead!)");
764 // monoenergyCmd->SetParameterName("monoenergy",false,false);
765 // monoenergyCmd->SetDefaultUnit("keV");
766  // monoenergyCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
767 
768 // engsigmaCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmae",this);
769 // engsigmaCmd->SetGuidance("Sets the standard deviation for Gaussian energy dist.(obsolete!)");
770 // engsigmaCmd->SetParameterName("Sigmae",false,false);
771 // engsigmaCmd->SetDefaultUnit("keV");
772  // engsigmaCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
773 
774 // alphaCmd = new G4UIcmdWithADouble("/gps/alpha",this);
775 // alphaCmd->SetGuidance("Sets Alpha (index) for power-law energy dist(obsolete!).");
776 // alphaCmd->SetParameterName("alpha",false,false);
777 
778 // tempCmd = new G4UIcmdWithADouble("/gps/temp",this);
779 // tempCmd->SetGuidance("Sets the temperature for Brem and BBody (in Kelvin)(obsolete!)");
780 // tempCmd->SetParameterName("temp",false,false);
781 
782 // ezeroCmd = new G4UIcmdWithADouble("/gps/ezero",this);
783 // ezeroCmd->SetGuidance("Sets ezero exponential distributions (in MeV)(obsolete!)");
784 // ezeroCmd->SetParameterName("ezero",false,false);
785 //
786 // gradientCmd = new G4UIcmdWithADouble("/gps/gradient",this);
787 // gradientCmd->SetGuidance("Sets the gradient for Lin distributions (in 1/MeV)(obsolete!)");
788 // gradientCmd->SetParameterName("gradient",false,false);
789 //
790 // interceptCmd = new G4UIcmdWithADouble("/gps/intercept",this);
791 // interceptCmd->SetGuidance("Sets the intercept for Lin distributions (in MeV)(obsolete!)");
792 // interceptCmd->SetParameterName("intercept",false,false);
793 //
794 // calculateCmd = new G4UIcmdWithoutParameter("/gps/calculate",this);
795 // calculateCmd->SetGuidance("Calculates distributions for Cdg and BBody(obsolete!)");
796 //
797 // energyspecCmd = new G4UIcmdWithABool("/gps/energyspec",this);
798 // energyspecCmd->SetGuidance("True for energy and false for momentum spectra(obsolete!)");
799 // energyspecCmd->SetParameterName("energyspec",true);
800 // energyspecCmd->SetDefaultValue(true);
801 //
802 // diffspecCmd = new G4UIcmdWithABool("/gps/diffspec",this);
803 // diffspecCmd->SetGuidance("True for differential and flase for integral spectra(obsolete!)");
804 // diffspecCmd->SetParameterName("diffspec",true);
805 // diffspecCmd->SetDefaultValue(true);
806 
807  // Biasing + histograms in general
808  histDirectory = new G4UIdirectory("/gps/hist/");
809  histDirectory->SetGuidance("Histogram, biasing commands sub-directory");
810 
811  histnameCmd1 = new G4UIcmdWithAString("/gps/hist/type",this);
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");
816 
817  resethistCmd1 = new G4UIcmdWithAString("/gps/hist/reset",this);
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");
822 
823  histpointCmd1 = new G4UIcmdWith3Vector("/gps/hist/point",this);
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.");
828 
829  histfileCmd1 = new G4UIcmdWithAString("/gps/hist/file",this);
830  histfileCmd1->SetGuidance("import the arb energy hist in an ASCII file");
831  histfileCmd1->SetParameterName("HistFile",false,false);
832 
833  arbintCmd1 = new G4UIcmdWithAString("/gps/hist/inter",this);
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");
838 
839  // old ones
840 // histnameCmd = new G4UIcmdWithAString("/gps/histname",this);
841 // histnameCmd->SetGuidance("Sets histogram type (obsolete!)");
842 // histnameCmd->SetParameterName("HistType",false,false);
843 // histnameCmd->SetDefaultValue("biasx");
844 // histnameCmd->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
845 //
846 // // re-set the histograms
847 // resethistCmd = new G4UIcmdWithAString("/gps/resethist",this);
848 // resethistCmd->SetGuidance("Re-Set the histogram (obsolete!)");
849 // resethistCmd->SetParameterName("HistType",false,false);
850 // resethistCmd->SetDefaultValue("energy");
851 // resethistCmd->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
852 //
853 // histpointCmd = new G4UIcmdWith3Vector("/gps/histpoint",this);
854 // histpointCmd->SetGuidance("Allows user to define a histogram (obsolete!)");
855 // histpointCmd->SetGuidance("Enter: Ehi Weight");
856 // histpointCmd->SetParameterName("Ehi","Weight","Junk",false,false);
857 // histpointCmd->SetRange("Ehi >= 0. && Weight >= 0.");
858 //
859 // arbintCmd = new G4UIcmdWithAString("/gps/arbint",this);
860 // arbintCmd->SetGuidance("Sets Arbitrary Interpolation type.(obsolete!) ");
861 // arbintCmd->SetParameterName("int",false,false);
862 // arbintCmd->SetDefaultValue("NULL");
863 // arbintCmd->SetCandidates("Lin Log Exp Spline");
864 
865 }
866 
868 {
869  delete positionDirectory;
870 // delete typeCmd;
871 // delete shapeCmd;
872 // delete centreCmd;
873 // delete posrot1Cmd;
874 // delete posrot2Cmd;
875 // delete halfxCmd;
876 // delete halfyCmd;
877 // delete halfzCmd;
878 // delete radiusCmd;
879 // delete radius0Cmd;
880 // delete possigmarCmd;
881 // delete possigmaxCmd;
882 // delete possigmayCmd;
883 // delete paralpCmd;
884 // delete partheCmd;
885 // delete parphiCmd;
886 // delete confineCmd;
887  delete typeCmd1;
888  delete shapeCmd1;
889  delete centreCmd1;
890  delete posrot1Cmd1;
891  delete posrot2Cmd1;
892  delete halfxCmd1;
893  delete halfyCmd1;
894  delete halfzCmd1;
895  delete radiusCmd1;
896  delete radius0Cmd1;
897  delete possigmarCmd1;
898  delete possigmaxCmd1;
899  delete possigmayCmd1;
900  delete paralpCmd1;
901  delete partheCmd1;
902  delete parphiCmd1;
903  delete confineCmd1;
904 
905  delete angularDirectory;
906 // delete angtypeCmd;
907 // delete angrot1Cmd;
908 // delete angrot2Cmd;
909 // delete minthetaCmd;
910 // delete maxthetaCmd;
911 // delete minphiCmd;
912 // delete maxphiCmd;
913 // delete angsigmarCmd;
914 // delete angsigmaxCmd;
915 // delete angsigmayCmd;
916 // delete useuserangaxisCmd;
917 // delete surfnormCmd;
918  delete angtypeCmd1;
919  delete angrot1Cmd1;
920  delete angrot2Cmd1;
921  delete minthetaCmd1;
922  delete maxthetaCmd1;
923  delete minphiCmd1;
924  delete maxphiCmd1;
925  delete angsigmarCmd1;
926  delete angsigmaxCmd1;
927  delete angsigmayCmd1;
928  delete angfocusCmd;
929  delete useuserangaxisCmd1;
930  delete surfnormCmd1;
931 
932  delete energyDirectory;
933 // delete energytypeCmd;
934 // delete eminCmd;
935 // delete emaxCmd;
936 // delete monoenergyCmd;
937 // delete engsigmaCmd;
938 // delete alphaCmd;
939 // delete tempCmd;
940 // delete ezeroCmd;
941 // delete gradientCmd;
942 // delete interceptCmd;
943 // delete calculateCmd;
944 // delete energyspecCmd;
945 // delete diffspecCmd;
946  delete energytypeCmd1;
947  delete eminCmd1;
948  delete emaxCmd1;
949  delete monoenergyCmd1;
950  delete engsigmaCmd1;
951  delete alphaCmd1;
952  delete tempCmd1;
953  delete ezeroCmd1;
954  delete gradientCmd1;
955  delete interceptCmd1;
956  delete arbeintCmd1;
957  delete calculateCmd1;
958  delete energyspecCmd1;
959  delete diffspecCmd1;
960 
961  delete histDirectory;
962  //delete histnameCmd;
963  //delete resethistCmd;
964  //delete histpointCmd;
965  //delete arbintCmd;
966  delete histnameCmd1;
967  delete resethistCmd1;
968  delete histpointCmd1;
969  delete histfileCmd1;
970  delete arbintCmd1;
971 
972  delete verbosityCmd;
973  delete ionCmd;
974  delete ionLvlCmd;
975  delete particleCmd;
976  delete timeCmd;
977  delete polCmd;
978  delete numberCmd;
979  delete positionCmd;
980  delete directionCmd;
981  delete energyCmd;
982  delete listCmd;
983 
984  delete sourceDirectory;
985  delete addsourceCmd;
986  delete listsourceCmd;
987  delete clearsourceCmd;
988  delete getsourceCmd;
989  delete setsourceCmd;
990  delete setintensityCmd;
991  delete deletesourceCmd;
992  delete multiplevertexCmd;
993  delete flatsamplingCmd;
994 
995  delete gpsDirectory;
996  theInstance = 0;
997 }
998 
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;\
1006  } }
1007 
1009 {
1010 // if(command == typeCmd)
1011 // {
1012 // CHECKPG(); fParticleGun->GetPosDist()->SetPosDisType(newValues);
1013 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1014 // << " The command is obsolete and will be removed soon." << G4endl
1015 // << " Please try to use the new structured commands!" << G4endl;
1016 // }
1017 // else if(command == shapeCmd)
1018 // {
1019 // CHECKPG(); fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1020 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1021 // << " The command is obsolete and will be removed soon." << G4endl
1022 // << " Please try to use the new structured commands!" << G4endl;
1023 // }
1024 // else if(command == centreCmd)
1025 // {
1026 // CHECKPG(); fParticleGun->GetPosDist()->SetCentreCoords(centreCmd->GetNew3VectorValue(newValues));
1027 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1028 // << " The command is obsolete and will be removed soon." << G4endl
1029 // << " Please try to use the new structured commands!" << G4endl;
1030 // }
1031 // else if(command == posrot1Cmd)
1032 // {
1033 // CHECKPG(); fParticleGun->GetPosDist()->SetPosRot1(posrot1Cmd->GetNew3VectorValue(newValues));
1034 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1035 // << " The command is obsolete and will be removed soon." << G4endl
1036 // << " Please try to use the new structured commands!" << G4endl;
1037 // }
1038 // else if(command == posrot2Cmd)
1039 // {
1040 // CHECKPG(); fParticleGun->GetPosDist()->SetPosRot2(posrot2Cmd->GetNew3VectorValue(newValues));
1041 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1042 // << " The command is obsolete and will be removed soon." << G4endl
1043 // << " Please try to use the new structured commands!" << G4endl;
1044 // }
1045 // else if(command == halfxCmd)
1046 // {
1047 // CHECKPG(); fParticleGun->GetPosDist()->SetHalfX(halfxCmd->GetNewDoubleValue(newValues));
1048 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1049 // << " The command is obsolete and will be removed soon." << G4endl
1050 // << " Please try to use the new structured commands!" << G4endl;
1051 // }
1052 // else if(command == halfyCmd)
1053 // {
1054 // CHECKPG(); fParticleGun->GetPosDist()->SetHalfY(halfyCmd->GetNewDoubleValue(newValues));
1055 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1056 // << " The command is obsolete and will be removed soon." << G4endl
1057 // << " Please try to use the new structured commands!" << G4endl;
1058 // }
1059 // else if(command == halfzCmd)
1060 // {
1061 // CHECKPG(); fParticleGun->GetPosDist()->SetHalfZ(halfzCmd->GetNewDoubleValue(newValues));
1062 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1063 // << " The command is obsolete and will be removed soon." << G4endl
1064 // << " Please try to use the new structured commands!" << G4endl;
1065 // }
1066 // else if(command == radiusCmd)
1067 // {
1068 // CHECKPG(); fParticleGun->GetPosDist()->SetRadius(radiusCmd->GetNewDoubleValue(newValues));
1069 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1070 // << " The command is obsolete and will be removed soon." << G4endl
1071 // << " Please try to use the new structured commands!" << G4endl;
1072 // }
1073 // else if(command == radius0Cmd)
1074 // {
1075 // CHECKPG(); fParticleGun->GetPosDist()->SetRadius0(radius0Cmd->GetNewDoubleValue(newValues));
1076 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1077 // << " The command is obsolete and will be removed soon." << G4endl
1078 // << " Please try to use the new structured commands!" << G4endl;
1079 // }
1080 // else if(command == possigmarCmd)
1081 // {
1082 // CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInR(possigmarCmd->GetNewDoubleValue(newValues));
1083 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1084 // << " The command is obsolete and will be removed soon." << G4endl
1085 // << " Please try to use the new structured commands!" << G4endl;
1086 // }
1087 // else if(command == possigmaxCmd)
1088 // {
1089 // CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInX(possigmaxCmd->GetNewDoubleValue(newValues));
1090 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1091 // << " The command is obsolete and will be removed soon." << G4endl
1092 // << " Please try to use the new structured commands!" << G4endl;
1093 // }
1094 // else if(command == possigmayCmd)
1095 // {
1096 // CHECKPG(); fParticleGun->GetPosDist()->SetBeamSigmaInY(possigmayCmd->GetNewDoubleValue(newValues));
1097 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1098 // << " The command is obsolete and will be removed soon." << G4endl
1099 // << " Please try to use the new structured commands!" << G4endl;
1100 // }
1101 // else if(command == paralpCmd)
1102 // {
1103 // CHECKPG(); fParticleGun->GetPosDist()->SetParAlpha(paralpCmd->GetNewDoubleValue(newValues));
1104 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1105 // << " The command is obsolete and will be removed soon." << G4endl
1106 // << " Please try to use the new structured commands!" << G4endl;
1107 // }
1108 // else if(command == partheCmd)
1109 // {
1110 // CHECKPG(); fParticleGun->GetPosDist()->SetParTheta(partheCmd->GetNewDoubleValue(newValues));
1111 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1112 // << " The command is obsolete and will be removed soon." << G4endl
1113 // << " Please try to use the new structured commands!" << G4endl;
1114 // }
1115 // else if(command == parphiCmd)
1116 // {
1117 // CHECKPG(); fParticleGun->GetPosDist()->SetParPhi(parphiCmd->GetNewDoubleValue(newValues));
1118 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1119 // << " The command is obsolete and will be removed soon." << G4endl
1120 // << " Please try to use the new structured commands!" << G4endl;
1121 // }
1122 // else if(command == confineCmd)
1123 // {
1124 // CHECKPG(); fParticleGun->GetPosDist()->ConfineSourceToVolume(newValues);
1125 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1126 // << " The command is obsolete and will be removed soon." << G4endl
1127 // << " Please try to use the new structured commands!" << G4endl;
1128 // }
1129 // else if(command == angtypeCmd)
1130 // {
1131 // CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
1132 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1133 // << " The command is obsolete and will be removed soon." << G4endl
1134 // << " Please try to use the new structured commands!" << G4endl;
1135 // }
1136 // else if(command == angrot1Cmd)
1137 // {
1138 // CHECKPG();
1139 // G4String a = "angref1";
1140 // fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot1Cmd->GetNew3VectorValue(newValues));
1141 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1142 // << " The command is obsolete and will be removed soon." << G4endl
1143 // << " Please try to use the new structured commands!" << G4endl;
1144 // }
1145 // else if(command == angrot2Cmd)
1146 // {
1147 // CHECKPG();
1148 // G4String a = "angref2";
1149 // fParticleGun->GetAngDist()->DefineAngRefAxes(a,angrot2Cmd->GetNew3VectorValue(newValues));
1150 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1151 // << " The command is obsolete and will be removed soon." << G4endl
1152 // << " Please try to use the new structured commands!" << G4endl;
1153 // }
1154 // else if(command == minthetaCmd)
1155 // {
1156 // CHECKPG(); fParticleGun->GetAngDist()->SetMinTheta(minthetaCmd->GetNewDoubleValue(newValues));
1157 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1158 // << " The command is obsolete and will be removed soon." << G4endl
1159 // << " Please try to use the new structured commands!" << G4endl;
1160 // }
1161 // else if(command == minphiCmd)
1162 // {
1163 // CHECKPG(); fParticleGun->GetAngDist()->SetMinPhi(minphiCmd->GetNewDoubleValue(newValues));
1164 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1165 // << " The command is obsolete and will be removed soon." << G4endl
1166 // << " Please try to use the new structured commands!" << G4endl;
1167 // }
1168 // else if(command == maxthetaCmd)
1169 // {
1170 // CHECKPG(); fParticleGun->GetAngDist()->SetMaxTheta(maxthetaCmd->GetNewDoubleValue(newValues));
1171 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1172 // << " The command is obsolete and will be removed soon." << G4endl
1173 // << " Please try to use the new structured commands!" << G4endl;
1174 // }
1175 // else if(command == maxphiCmd)
1176 // {
1177 // CHECKPG(); fParticleGun->GetAngDist()->SetMaxPhi(maxphiCmd->GetNewDoubleValue(newValues));
1178 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1179 // << " The command is obsolete and will be removed soon." << G4endl
1180 // << " Please try to use the new structured commands!" << G4endl;
1181 // }
1182 // else if(command == angsigmarCmd)
1183 // {
1184 // CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngR(angsigmarCmd->GetNewDoubleValue(newValues));
1185 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1186 // << " The command is obsolete and will be removed soon." << G4endl
1187 // << " Please try to use the new structured commands!" << G4endl;
1188 // }
1189 // else if(command == angsigmaxCmd)
1190 // {
1191 // CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngX(angsigmaxCmd->GetNewDoubleValue(newValues));
1192 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1193 // << " The command is obsolete and will be removed soon." << G4endl
1194 // << " Please try to use the new structured commands!" << G4endl;
1195 // }
1196 // else if(command == angsigmayCmd)
1197 // {
1198 // CHECKPG(); fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd->GetNewDoubleValue(newValues));
1199 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1200 // << " The command is obsolete and will be removed soon." << G4endl
1201 // << " Please try to use the new structured commands!" << G4endl;
1202 // }
1203 // else if(command == useuserangaxisCmd)
1204 // {
1205 // CHECKPG(); fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd->GetNewBoolValue(newValues));
1206 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1207 // << " The command is obsolete and will be removed soon." << G4endl
1208 // << " Please try to use the new structured commands!" << G4endl;
1209 // }
1210 // else if(command == surfnormCmd)
1211 // {
1212 // CHECKPG(); fParticleGun->GetAngDist()->SetUserWRTSurface(surfnormCmd->GetNewBoolValue(newValues));
1213 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1214 // << " The command is obsolete and will be removed soon." << G4endl
1215 // << " Please try to use the new structured commands!" << G4endl;
1216 // }
1217 // else if(command == energytypeCmd)
1218 // {
1219 // CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1220 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1221 // << " The command is obsolete and will be removed soon." << G4endl
1222 // << " Please try to use the new structured commands!" << G4endl;
1223 // }
1224 // else if(command == eminCmd)
1225 // {
1226 // CHECKPG(); fParticleGun->GetEneDist()->SetEmin(eminCmd->GetNewDoubleValue(newValues));
1227 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1228 // << " The command is obsolete and will be removed soon." << G4endl
1229 // << " Please try to use the new structured commands!" << G4endl;
1230 // }
1231 // else if(command == emaxCmd)
1232 // {
1233 // CHECKPG(); fParticleGun->GetEneDist()->SetEmax(emaxCmd->GetNewDoubleValue(newValues));
1234 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1235 // << " The command is obsolete and will be removed soon." << G4endl
1236 // << " Please try to use the new structured commands!" << G4endl;
1237 // }
1238 // else if(command == monoenergyCmd)
1239 // {
1240 // CHECKPG(); fParticleGun->GetEneDist()->SetMonoEnergy(monoenergyCmd->GetNewDoubleValue(newValues));
1241 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1242 // << " The command is obsolete and will be removed soon." << G4endl
1243 // << " Please try to use the new structured commands!" << G4endl;
1244 // }
1245 // else if(command == engsigmaCmd)
1246 // {
1247 // CHECKPG(); fParticleGun->GetEneDist()->SetBeamSigmaInE(engsigmaCmd->GetNewDoubleValue(newValues));
1248 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1249 // << " The command is obsolete and will be removed soon." << G4endl
1250 // << " Please try to use the new structured commands!" << G4endl;
1251 // }
1252 // else if(command == alphaCmd)
1253 // {
1254 // CHECKPG(); fParticleGun->GetEneDist()->SetAlpha(alphaCmd->GetNewDoubleValue(newValues));
1255 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1256 // << " The command is obsolete and will be removed soon." << G4endl
1257 // << " Please try to use the new structured commands!" << G4endl;
1258 // }
1259 // else if(command == tempCmd)
1260 // {
1261 // CHECKPG(); fParticleGun->GetEneDist()->SetTemp(tempCmd->GetNewDoubleValue(newValues));
1262 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1263 // << " The command is obsolete and will be removed soon." << G4endl
1264 // << " Please try to use the new structured commands!" << G4endl;
1265 // }
1266 // else if(command == ezeroCmd)
1267 // {
1268 // CHECKPG(); fParticleGun->GetEneDist()->SetEzero(ezeroCmd->GetNewDoubleValue(newValues));
1269 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1270 // << " The command is obsolete and will be removed soon." << G4endl
1271 // << " Please try to use the new structured commands!" << G4endl;
1272 // }
1273 // else if(command == gradientCmd)
1274 // {
1275 // CHECKPG(); fParticleGun->GetEneDist()->SetGradient(gradientCmd->GetNewDoubleValue(newValues));
1276 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1277 // << " The command is obsolete and will be removed soon." << G4endl
1278 // << " Please try to use the new structured commands!" << G4endl;
1279 // }
1280 // else if(command == interceptCmd)
1281 // {
1282 // CHECKPG(); fParticleGun->GetEneDist()->SetInterCept(interceptCmd->GetNewDoubleValue(newValues));
1283 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1284 // << " The command is obsolete and will be removed soon." << G4endl
1285 // << " Please try to use the new structured commands!" << G4endl;
1286 // }
1287 // else if(command == calculateCmd)
1288 // {
1289 // CHECKPG(); fParticleGun->GetEneDist()->Calculate();
1290 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1291 // << " The command is obsolete and will be removed soon." << G4endl
1292 // << " Please try to use the new structured commands!" << G4endl;
1293 // }
1294 // else if(command == energyspecCmd)
1295 // {
1296 // CHECKPG(); fParticleGun->GetEneDist()->InputEnergySpectra(energyspecCmd->GetNewBoolValue(newValues));
1297 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1298 // << " The command is obsolete and will be removed soon." << G4endl
1299 // << " Please try to use the new structured commands!" << G4endl;
1300 // }
1301 // else if(command == diffspecCmd)
1302 // {
1303 // CHECKPG(); fParticleGun->GetEneDist()->InputDifferentialSpectra(diffspecCmd->GetNewBoolValue(newValues));
1304 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1305 // << " The command is obsolete and will be removed soon." << G4endl
1306 // << " Please try to use the new structured commands!" << G4endl;
1307 // }
1308 // else if(command == histnameCmd)
1309 // {
1310 // histtype = newValues;
1311 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1312 // << " The command is obsolete and will be removed soon." << G4endl
1313 // << " Please try to use the new structured commands!" << G4endl;
1314 // }
1315 // else
1316 // if(command == histpointCmd)
1317 // {
1318 // CHECKPG();
1319 // if(histtype == "biasx")
1320 // fParticleGun->GetBiasRndm()->SetXBias(histpointCmd->GetNew3VectorValue(newValues));
1321 // if(histtype == "biasy")
1322 // fParticleGun->GetBiasRndm()->SetYBias(histpointCmd->GetNew3VectorValue(newValues));
1323 // if(histtype == "biasz")
1324 // fParticleGun->GetBiasRndm()->SetZBias(histpointCmd->GetNew3VectorValue(newValues));
1325 // if(histtype == "biast")
1326 // fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd->GetNew3VectorValue(newValues));
1327 // if(histtype == "biasp")
1328 // fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd->GetNew3VectorValue(newValues));
1329 // if(histtype == "biase")
1330 // fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd->GetNew3VectorValue(newValues));
1331 // if(histtype == "theta")
1332 // fParticleGun->GetAngDist()->UserDefAngTheta(histpointCmd->GetNew3VectorValue(newValues));
1333 // if(histtype == "phi")
1334 // fParticleGun->GetAngDist()->UserDefAngPhi(histpointCmd->GetNew3VectorValue(newValues));
1335 // if(histtype == "energy")
1336 // fParticleGun->GetEneDist()->UserEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1337 // if(histtype == "arb")
1338 // fParticleGun->GetEneDist()->ArbEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1339 // if(histtype == "epn")
1340 // fParticleGun->GetEneDist()->EpnEnergyHisto(histpointCmd->GetNew3VectorValue(newValues));
1341 // G4cout << " G4GeneralParticleSourceMessenger - Warning: The command is obsolete and will be removed soon. Please try to use the new structured commands!" << G4endl;
1342 // }
1343 // else if(command == resethistCmd)
1344 // {
1345 // CHECKPG();
1346 // if(newValues == "theta" || newValues == "phi") {
1347 // fParticleGun->GetAngDist()->ReSetHist(newValues);
1348 // } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1349 // fParticleGun->GetEneDist()->ReSetHist(newValues);
1350 // } else {
1351 // fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1352 // }
1353 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1354 // << " The command is obsolete and will be removed soon." << G4endl
1355 // << " Please try to use the new structured commands!" << G4endl;
1356 // }
1357 // else if(command == arbintCmd)
1358 // {
1359 // CHECKPG();
1360 // fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1361 // G4cout << " G4GeneralParticleSourceMessenger - Warning:" << G4endl
1362 // << " The command is obsolete and will be removed soon." << G4endl
1363 // << " Please try to use the new structured commands!" << G4endl;
1364 // }
1365 // else
1366  if( command==directionCmd )
1367  {
1368  CHECKPG();
1369  fParticleGun->GetAngDist()->SetAngDistType("planar");
1371  }
1372  else if( command==energyCmd )
1373  {
1374  CHECKPG();
1377  }
1378  else if( command==positionCmd )
1379  {
1380  CHECKPG();
1381  fParticleGun->GetPosDist()->SetPosDisType("Point");
1383  }
1384  else if(command == verbosityCmd)
1385  {
1387  //CHECKPG();
1388  //fParticleGun->SetVerbosity(verbosityCmd->GetNewIntValue(newValues));
1389  }
1390  else if( command==particleCmd )
1391  {
1392  if (newValues =="ion") {
1393  fShootIon = true;
1394  } else {
1395  fShootIon = false;
1397  if(pd != NULL)
1399  }
1400  }
1401  else if( command==timeCmd )
1403  else if( command==polCmd )
1405  else if( command==numberCmd )
1407  else if( command==ionCmd )
1408  { IonCommand(newValues); }
1409  else if( command==ionLvlCmd )
1410  { IonLvlCommand(newValues); }
1411  else if( command==listCmd ){
1413  }
1414  else if( command==addsourceCmd )
1415  {
1417  }
1418  else if( command==listsourceCmd )
1419  {
1420  fGPS->ListSource();
1421  }
1422  else if( command==clearsourceCmd )
1423  {
1424  fGPS->ClearAll();
1425  fParticleGun = 0;
1426  }
1427  else if( command==getsourceCmd )
1428  {
1429  G4cout << " Current source index:" << fGPS->GetCurrentSourceIndex()
1430  << " ; Intensity:" << fGPS->GetCurrentSourceIntensity() << G4endl;
1431  }
1432  else if( command==setsourceCmd )
1433  {
1434  //NOTE: This will also sets fParticleGun to the courrent source
1435  // Not very clean, the GPS::SetCurrentSourceto will call:
1436  // this::SetParticleSource( G4ParticleSource* )
1437  // The point is that GPS has no public API to get a source by
1438  // index
1439  //TODO: Can we add this API?
1440  const G4int sn = setsourceCmd->GetNewIntValue(newValues);
1441  if ( sn >= fGPS->GetNumberofSource() )
1442  {
1444  msg << "Using command "<<setsourceCmd->GetCommandPath()<<"/"<<setsourceCmd->GetCommandName()<<" "<<sn;
1445  msg << " is invalid "<<fGPS->GetNumberofSource()<<" source(s) are defined.";
1446  G4Exception("G4GeneralParticleSourceMessenger::SetNewValue","G4GPS005",FatalException,msg);
1447  }
1449 
1450  }
1451  else if( command==setintensityCmd )
1452  {
1454  }
1455  else if( command==deletesourceCmd )
1456  {
1458  }
1459  else if(command == multiplevertexCmd)
1460  {
1462  }
1463  else if(command == flatsamplingCmd)
1464  {
1466  }
1467  //
1468  // new implementations
1469  //
1470  //
1471  else if(command == typeCmd1)
1472  {
1473  CHECKPG();
1474  fParticleGun->GetPosDist()->SetPosDisType(newValues);
1475  }
1476  else if(command == shapeCmd1)
1477  {
1478  CHECKPG();
1479  fParticleGun->GetPosDist()->SetPosDisShape(newValues);
1480  }
1481  else if(command == centreCmd1)
1482  {
1483  CHECKPG();
1485  }
1486  else if(command == posrot1Cmd1)
1487  {
1488  CHECKPG();
1490  }
1491  else if(command == posrot2Cmd1)
1492  {
1493  CHECKPG();
1495  }
1496  else if(command == halfxCmd1)
1497  {
1498  CHECKPG();
1500  }
1501  else if(command == halfyCmd1)
1502  {
1503  CHECKPG();
1505  }
1506  else if(command == halfzCmd1)
1507  {
1508  CHECKPG();
1510  }
1511  else if(command == radiusCmd1)
1512  {
1513  CHECKPG();
1515  }
1516  else if(command == radius0Cmd1)
1517  {
1518  CHECKPG();
1520  }
1521  else if(command == possigmarCmd1)
1522  {
1523  CHECKPG();
1525  }
1526  else if(command == possigmaxCmd1)
1527  {
1529  }
1530  else if(command == possigmayCmd1)
1531  {
1533  }
1534  else if(command == paralpCmd1)
1535  {
1537  }
1538  else if(command == partheCmd1)
1539  {
1541  }
1542  else if(command == parphiCmd1)
1543  {
1545  }
1546  else if(command == confineCmd1)
1547  {
1549  }
1550  else if(command == angtypeCmd1)
1551  {
1552  CHECKPG(); fParticleGun->GetAngDist()->SetAngDistType(newValues);
1553  }
1554  else if(command == angrot1Cmd1)
1555  {
1556  CHECKPG();
1557  G4String a = "angref1";
1559  }
1560  else if(command == angrot2Cmd1)
1561  {
1562  CHECKPG();
1563  G4String a = "angref2";
1565  }
1566  else if(command == minthetaCmd1)
1567  {
1568  CHECKPG();
1570  }
1571  else if(command == minphiCmd1)
1572  {
1574  }
1575  else if(command == maxthetaCmd1)
1576  {
1578  }
1579  else if(command == maxphiCmd1)
1580  {
1582  }
1583  else if(command == angsigmarCmd1)
1584  {
1586  }
1587  else if(command == angsigmaxCmd1)
1588  {
1590  }
1591  else if(command == angsigmayCmd1)
1592  {
1594  }
1595  else if(command == angfocusCmd)
1596  {
1598  }
1599  else if(command == useuserangaxisCmd1)
1600  {
1602  }
1603  else if(command == surfnormCmd1)
1604  {
1606  }
1607  else if(command == energytypeCmd1)
1608  {
1609  CHECKPG(); fParticleGun->GetEneDist()->SetEnergyDisType(newValues);
1610  }
1611  else if(command == eminCmd1)
1612  {
1614  }
1615  else if(command == emaxCmd1)
1616  {
1618  }
1619  else if(command == monoenergyCmd1)
1620  {
1622  }
1623  else if(command == engsigmaCmd1)
1624  {
1626  }
1627  else if(command == alphaCmd1)
1628  {
1630  }
1631  else if(command == tempCmd1)
1632  {
1634  }
1635  else if(command == ezeroCmd1)
1636  {
1638  }
1639  else if(command == gradientCmd1)
1640  {
1642  }
1643  else if(command == interceptCmd1)
1644  {
1646  }
1647  else if(command == arbeintCmd1)
1648  {
1650  }
1651  else if(command == calculateCmd1)
1652  {
1654  }
1655  else if(command == energyspecCmd1)
1656  {
1658  }
1659  else if(command == diffspecCmd1)
1660  {
1662  }
1663  else if(command == histnameCmd1)
1664  {
1665  histtype = newValues;
1666  }
1667  else if(command == histfileCmd1)
1668  {
1669  histtype = "arb";
1671  }
1672  else if(command == histpointCmd1)
1673  {
1674  CHECKPG();
1675  if(histtype == "biasx")
1677  if(histtype == "biasy")
1679  if(histtype == "biasz")
1681  if(histtype == "biast")
1683  if(histtype == "biasp")
1685  if(histtype == "biaspt")
1687  if(histtype == "biaspp")
1689  if(histtype == "biase")
1691  if(histtype == "theta")
1693  if(histtype == "phi")
1695  if(histtype == "energy")
1697  if(histtype == "arb")
1699  if(histtype == "epn")
1701  }
1702  else if(command == resethistCmd1)
1703  {
1704  CHECKPG();
1705  if(newValues == "theta" || newValues == "phi") {
1706  fParticleGun->GetAngDist()->ReSetHist(newValues);
1707  } else if (newValues == "energy" || newValues == "arb" || newValues == "epn") {
1708  fParticleGun->GetEneDist()->ReSetHist(newValues);
1709  } else {
1710  fParticleGun->GetBiasRndm()->ReSetHist(newValues);
1711  }
1712  }
1713  else if(command == arbintCmd1)
1714  {
1715  CHECKPG(); fParticleGun->GetEneDist()->ArbInterpolate(newValues);
1716  }
1717  else
1718  {
1719  G4cout << "Error entering command" << G4endl;
1720  }
1721 }
1722 
1724 {
1725  G4String cv;
1726 
1727  // if( command==directionCmd )
1728  // { cv = directionCmd->ConvertToString(fParticleGun->GetParticleMomentumDirection()); }
1729  // else if( command==energyCmd )
1730  // { cv = energyCmd->ConvertToString(fParticleGun->GetParticleEnergy(),"GeV"); }
1731  // else if( command==positionCmd )
1732  // { cv = positionCmd->ConvertToString(fParticleGun->GetParticlePosition(),"cm"); }
1733  // else if( command==timeCmd )
1734  // { cv = timeCmd->ConvertToString(fParticleGun->GetParticleTime(),"ns"); }
1735  // else if( command==polCmd )
1736  // { cv = polCmd->ConvertToString(fParticleGun->GetParticlePolarization()); }
1737  // else if( command==numberCmd )
1738  // { cv = numberCmd->ConvertToString(fParticleGun->GetNumberOfParticles()); }
1739 
1740  cv = "Not implemented yet";
1741 
1742  return cv;
1743 }
1744 
1746 {
1747  fShootIon = true;
1748 
1749  if (fShootIon)
1750  {
1751  G4Tokenizer next( newValues );
1752  // check argument
1753  fAtomicNumber = StoI(next());
1754  fAtomicMass = StoI(next());
1755  G4String sQ = next();
1756  if (sQ.isNull())
1757  {
1759  }
1760  else
1761  {
1762  fIonCharge = StoI(sQ);
1763  sQ = next();
1764  if (sQ.isNull())
1765  {
1766  fIonExciteEnergy = 0.0;
1767  }
1768  else
1769  {
1770  fIonExciteEnergy = StoD(sQ) * keV;
1771  }
1772  }
1775  if (ion==0)
1776  {
1777  G4cout << "Ion with Z=" << fAtomicNumber;
1778  G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
1779  }
1780  else
1781  {
1784  }
1785  }
1786  else
1787  {
1788  G4cout << "Set /gps/particle to ion before using /gps/ion command";
1789  G4cout << G4endl;
1790  }
1791 }
1792 
1794 {
1795  fShootIonL = true;
1796 
1797  if (fShootIonL) {
1798  G4Tokenizer next(newValues);
1799  // check argument
1800  fAtomicNumberL = StoI(next());
1801  fAtomicMassL = StoI(next());
1802  G4String sQ = next();
1803  if (sQ.isNull()) {
1805  } else {
1806  fIonChargeL = StoI(sQ);
1807  sQ = next();
1808  if (sQ.isNull()) {
1809  fIonEnergyLevel = 0;
1810  } else {
1811  fIonEnergyLevel = StoI(sQ);
1812  }
1813  }
1814 
1817  if (ion == 0) {
1818  G4cout << "Ion with Z=" << fAtomicNumberL;
1819  G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
1820  } else {
1823  }
1824 
1825  } else {
1826  G4cout << "Set /gps/particle to ion before using /gps/ionLvl command";
1827  G4cout << G4endl;
1828  }
1829 }
1830 
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.
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
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:491
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:175
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)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4double GetCurrentSourceIntensity() const
G4int StoI(G4String s)
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void EpnEnergyHisto(G4ThreeVector)
const G4String & GetCommandName() const
Definition: G4UIcommand.hh:141
void SetPhiBias(G4ThreeVector)
G4int G4Mutex
Definition: G4Threading.hh:173
Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameter...
static const double pi
Definition: G4SIunits.hh:74
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:213
void ArbEnergyHistoFile(G4String)
void SetParticleCharge(G4double aCharge)
static const double eplus
Definition: G4SIunits.hh:196
void ConfineSourceToVolume(G4String)
G4bool isNull() const
void SetPosPhiBias(G4ThreeVector)
void SetBeamSigmaInAngX(G4double)