Geant4  10.02.p03
DMXParticleSourceMessenger Class Reference

#include <DMXParticleSourceMessenger.hh>

Inheritance diagram for DMXParticleSourceMessenger:
Collaboration diagram for DMXParticleSourceMessenger:

Public Member Functions

 DMXParticleSourceMessenger (DMXParticleSource *fPtclGun)
 
 ~DMXParticleSourceMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Attributes

DMXParticleSourcefParticleGun
 
G4ParticleTableparticleTable
 
G4UIdirectorygunDirectory
 
G4UIcmdWithAStringtypeCmd
 
G4UIcmdWithAStringshapeCmd
 
G4UIcmdWith3VectorAndUnitcentreCmd
 
G4UIcmdWithADoubleAndUnithalfzCmd
 
G4UIcmdWithADoubleAndUnitradiusCmd
 
G4UIcmdWithAStringconfineCmd
 
G4UIcmdWithAStringangtypeCmd
 
G4UIcmdWithAStringenergytypeCmd
 
G4UIcmdWithAnIntegerverbosityCmd
 
G4UIcommandionCmd
 
G4UIcmdWithAStringparticleCmd
 
G4UIcmdWith3VectorAndUnitpositionCmd
 
G4UIcmdWith3VectordirectionCmd
 
G4UIcmdWithADoubleAndUnitenergyCmd
 
G4UIcmdWithoutParameterlistCmd
 
G4bool fShootIon
 
G4int fAtomicNumber
 
G4int fAtomicMass
 
G4int fIonCharge
 
G4double fIonExciteEnergy
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 69 of file DMXParticleSourceMessenger.hh.

Constructor & Destructor Documentation

◆ DMXParticleSourceMessenger()

DMXParticleSourceMessenger::DMXParticleSourceMessenger ( DMXParticleSource fPtclGun)

Definition at line 72 of file DMXParticleSourceMessenger.cc.

72  : fParticleGun(fPtclGun),fShootIon(false) {
73 
75 
76  // create directory
77  gunDirectory = new G4UIdirectory("/dmx/gun/");
78  gunDirectory->SetGuidance("Particle Source control commands.");
79 
80  // list available particles
81  listCmd = new G4UIcmdWithoutParameter("/dmx/gun/List",this);
82  listCmd->SetGuidance("List available particles.");
83  listCmd->SetGuidance(" Invoke G4ParticleTable.");
84 
85  // set particle
86  particleCmd = new G4UIcmdWithAString("/dmx/gun/particle",this);
87  particleCmd->SetGuidance("Set particle to be generated.");
88  particleCmd->SetGuidance(" (geantino is default)");
89  particleCmd->SetGuidance(" (ion can be specified for shooting ions)");
90  particleCmd->SetParameterName("particleName",true);
91  particleCmd->SetDefaultValue("geantino");
92  G4String candidateList;
93  G4int nPtcl = particleTable->entries();
94  for(G4int i=0;i<nPtcl;i++)
95  {
96  candidateList += particleTable->GetParticleName(i);
97  candidateList += " ";
98  }
99  candidateList += "ion ";
100  particleCmd->SetCandidates(candidateList);
101 
102 
103  // particle direction
104  directionCmd = new G4UIcmdWith3Vector("/dmx/gun/direction",this);
105  directionCmd->SetGuidance("Set momentum direction.");
106  directionCmd->SetGuidance("Direction needs not to be a unit vector.");
107  directionCmd->SetParameterName("Px","Py","Pz",true,true);
108  directionCmd->SetRange("Px != 0 || Py != 0 || Pz != 0");
109 
110  // particle energy
111  energyCmd = new G4UIcmdWithADoubleAndUnit("/dmx/gun/energy",this);
112  energyCmd->SetGuidance("Set kinetic energy.");
113  energyCmd->SetParameterName("Energy",true,true);
114  energyCmd->SetDefaultUnit("GeV");
115  //energyCmd->SetUnitCategory("Energy");
116  //energyCmd->SetUnitCandidates("eV keV MeV GeV TeV");
117 
118  positionCmd = new G4UIcmdWith3VectorAndUnit("/dmx/gun/position",this);
119  positionCmd->SetGuidance("Set starting position of the particle.");
120  positionCmd->SetParameterName("X","Y","Z",true,true);
122  //positionCmd->SetUnitCategory("Length");
123  //positionCmd->SetUnitCandidates("microm mm cm m km");
124 
125 
126  // ion
127  ionCmd = new G4UIcommand("/dmx/gun/ion",this);
128  ionCmd->SetGuidance("Set properties of ion to be generated.");
129  ionCmd->SetGuidance("[usage] /gun/ion Z A Q E");
130  ionCmd->SetGuidance(" Z:(int) AtomicNumber");
131  ionCmd->SetGuidance(" A:(int) AtomicMass");
132  ionCmd->SetGuidance(" Q:(int) Charge of Ion (in unit of e)");
133  ionCmd->SetGuidance(" E:(double) Excitation energy (in keV)");
134 
135  G4UIparameter* param;
136  param = new G4UIparameter("Z",'i',false);
137  param->SetDefaultValue("1");
138  ionCmd->SetParameter(param);
139  param = new G4UIparameter("A",'i',false);
140  param->SetDefaultValue("1");
141  ionCmd->SetParameter(param);
142  param = new G4UIparameter("Q",'i',true);
143  param->SetDefaultValue("0");
144  ionCmd->SetParameter(param);
145  param = new G4UIparameter("E",'d',true);
146  param->SetDefaultValue("0.0");
147  ionCmd->SetParameter(param);
148 
149 
150  // source distribution type
151  typeCmd = new G4UIcmdWithAString("/dmx/gun/type",this);
152  typeCmd->SetGuidance("Sets source distribution type.");
153  typeCmd->SetGuidance("Either Point or Volume");
154  typeCmd->SetParameterName("DisType",true,true);
155  typeCmd->SetDefaultValue("Point");
156  typeCmd->SetCandidates("Point Volume");
157 
158  // source shape
159  shapeCmd = new G4UIcmdWithAString("/dmx/gun/shape",this);
160  shapeCmd->SetGuidance("Sets source shape type.");
161  shapeCmd->SetParameterName("Shape",true,true);
162  shapeCmd->SetDefaultValue("NULL");
163  shapeCmd->SetCandidates("Sphere Cylinder");
164 
165  // centre coordinates
166  centreCmd = new G4UIcmdWith3VectorAndUnit("/dmx/gun/centre",this);
167  centreCmd->SetGuidance("Set centre coordinates of source.");
168  centreCmd->SetParameterName("X","Y","Z",true,true);
169  centreCmd->SetDefaultUnit("cm");
170  centreCmd->SetUnitCandidates("nm um mm cm m km");
171 
172  // half height of source
173  halfzCmd = new G4UIcmdWithADoubleAndUnit("/dmx/gun/halfz",this);
174  halfzCmd->SetGuidance("Set z half length of source.");
175  halfzCmd->SetParameterName("Halfz",true,true);
176  halfzCmd->SetDefaultUnit("cm");
177  halfzCmd->SetUnitCandidates("nm um mm cm m km");
178 
179  // radius of source
180  radiusCmd = new G4UIcmdWithADoubleAndUnit("/dmx/gun/radius",this);
181  radiusCmd->SetGuidance("Set radius of source.");
182  radiusCmd->SetParameterName("Radius",true,true);
183  radiusCmd->SetDefaultUnit("cm");
184  radiusCmd->SetUnitCandidates("nm um mm cm m km");
185 
186  // confine to volume
187  confineCmd = new G4UIcmdWithAString("/dmx/gun/confine",this);
188  confineCmd->SetGuidance("Confine source to volume (NULL to unset).");
189  confineCmd->SetGuidance("usage: confine VolName");
190  confineCmd->SetParameterName("VolName",true,true);
191  confineCmd->SetDefaultValue("NULL");
192 
193  // angular distribution
194  angtypeCmd = new G4UIcmdWithAString("/dmx/gun/angtype",this);
195  angtypeCmd->SetGuidance("Sets angular source distribution type");
196  angtypeCmd->SetGuidance("Possible variables are: iso direction");
197  angtypeCmd->SetParameterName("AngDis",true,true);
198  angtypeCmd->SetDefaultValue("iso");
199  angtypeCmd->SetCandidates("iso direction");
200 
201  // energy distribution
202  energytypeCmd = new G4UIcmdWithAString("/dmx/gun/energytype",this);
203  energytypeCmd->SetGuidance("Sets energy distribution type");
204  energytypeCmd->SetGuidance("Possible variables are: Mono");
205  energytypeCmd->SetParameterName("EnergyDis",true,true);
207  energytypeCmd->SetCandidates("Mono");
208 
209  // verbosity
210  verbosityCmd = new G4UIcmdWithAnInteger("/dmx/gun/verbose",this);
211  verbosityCmd->SetGuidance("Set Verbose level for gun");
212  verbosityCmd->SetGuidance(" 0 : Silent");
213  verbosityCmd->SetGuidance(" 1 : Limited information");
214  verbosityCmd->SetGuidance(" 2 : Detailed information");
215  verbosityCmd->SetParameterName("level",false);
216  verbosityCmd->SetRange("level>=0 && level <=2");
217 
218 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWith3VectorAndUnit * positionCmd
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
G4UIcmdWithADoubleAndUnit * halfzCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *theDefaultValue)
G4UIcmdWithADoubleAndUnit * radiusCmd
int G4int
Definition: G4Types.hh:78
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWith3VectorAndUnit * centreCmd
G4UIcmdWithADoubleAndUnit * energyCmd
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4UIcmdWithoutParameter * listCmd
static G4ParticleTable * GetParticleTable()
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
const G4String & GetParticleName(G4int index) const
void SetCandidates(const char *candidateList)
void SetUnitCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4int entries() const
void SetUnitCandidates(const char *candidateList)
Here is the call graph for this function:

◆ ~DMXParticleSourceMessenger()

DMXParticleSourceMessenger::~DMXParticleSourceMessenger ( )

Definition at line 221 of file DMXParticleSourceMessenger.cc.

221  {
222 
223  delete typeCmd;
224  delete shapeCmd;
225  delete centreCmd;
226  delete halfzCmd;
227  delete radiusCmd;
228  delete confineCmd;
229  delete angtypeCmd;
230  delete energytypeCmd;
231  delete verbosityCmd;
232  delete ionCmd;
233  delete particleCmd;
234  delete positionCmd;
235  delete directionCmd;
236  delete energyCmd;
237  delete listCmd;
238 
239  delete gunDirectory;
240 }
G4UIcmdWith3VectorAndUnit * positionCmd
G4UIcmdWithADoubleAndUnit * halfzCmd
G4UIcmdWithADoubleAndUnit * radiusCmd
G4UIcmdWith3VectorAndUnit * centreCmd
G4UIcmdWithADoubleAndUnit * energyCmd
G4UIcmdWithoutParameter * listCmd
Here is the call graph for this function:

Member Function Documentation

◆ SetNewValue()

void DMXParticleSourceMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 243 of file DMXParticleSourceMessenger.cc.

243  {
244 
245  if(command == typeCmd)
246  fParticleGun->SetPosDisType(newValues);
247 
248  else if(command == shapeCmd)
249  fParticleGun->SetPosDisShape(newValues);
250 
251  else if(command == centreCmd)
253 
254  else if(command == halfzCmd)
256 
257  else if(command == radiusCmd)
259 
260  else if(command == angtypeCmd)
261  fParticleGun->SetAngDistType(newValues);
262 
263  else if(command == confineCmd)
265 
266  else if(command == energytypeCmd)
267  fParticleGun->SetEnergyDisType(newValues);
268 
269  else if(command == verbosityCmd)
271 
272  else if( command==particleCmd ) {
273  if (newValues =="ion") {
274  fShootIon = true;
275  } else {
276  fShootIon = false;
278  if(pd != NULL)
280  }
281  }
282 
283  else if( command==ionCmd ) {
284  if (fShootIon) {
285  G4Tokenizer next( newValues );
286  // check argument
287  fAtomicNumber = StoI(next());
288  fAtomicMass = StoI(next());
289  G4String sQ = next();
290  if (sQ.isNull()) {
292  } else {
293  fIonCharge = StoI(sQ);
294  sQ = next();
295  if (sQ.isNull()) {
296  fIonExciteEnergy = 0.0;
297  } else {
298  fIonExciteEnergy = StoD(sQ) * keV;
299  }
300  }
301 
304  if (ion==0) {
305  G4cout << "Ion with Z=" << fAtomicNumber;
306  G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
307  } else {
310  }
311  } else {
312  G4cout<<"Set /dmx/gun/particle to ion before using /dmx/gun/ion command";
313  G4cout<<G4endl;
314  }
315  }
316 
317  else if( command==listCmd )
319 
320  else if( command==directionCmd ) {
321  fParticleGun->SetAngDistType("direction");
323  (directionCmd->GetNew3VectorValue(newValues));
324  }
325 
326  else if( command==energyCmd ) {
329  }
330 
331  else if( command==positionCmd ) {
332  fParticleGun->SetPosDisType("Point");
334  }
335  else
336  G4cout << "Error entering command" << G4endl;
337 }
G4UIcmdWith3VectorAndUnit * positionCmd
void SetCentreCoords(G4ThreeVector)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4UIcmdWithADoubleAndUnit * halfzCmd
void DumpTable(const G4String &particle_name="ALL")
void SetAngDistType(G4String)
static G4int GetNewIntValue(const char *paramString)
void SetHalfZ(G4double)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:491
static G4ThreeVector GetNew3VectorValue(const char *paramString)
G4UIcmdWithADoubleAndUnit * radiusCmd
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWith3VectorAndUnit * centreCmd
void SetParticleMomentumDirection(G4ParticleMomentum)
G4GLOB_DLL std::ostream G4cout
void SetPosDisType(G4String)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
G4UIcmdWithADoubleAndUnit * energyCmd
void SetParticleCharge(G4double aCharge)
G4UIcmdWithoutParameter * listCmd
G4int StoI(G4String s)
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
void SetRadius(G4double)
void SetPosDisShape(G4String)
G4double StoD(G4String s)
#define G4endl
Definition: G4ios.hh:61
void SetEnergyDisType(G4String)
static const double keV
Definition: G4SIunits.hh:213
static const double eplus
Definition: G4SIunits.hh:196
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void ConfineSourceToVolume(G4String)
G4bool isNull() const
void SetMonoEnergy(G4double)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ angtypeCmd

G4UIcmdWithAString* DMXParticleSourceMessenger::angtypeCmd
private

Definition at line 91 of file DMXParticleSourceMessenger.hh.

◆ centreCmd

G4UIcmdWith3VectorAndUnit* DMXParticleSourceMessenger::centreCmd
private

Definition at line 87 of file DMXParticleSourceMessenger.hh.

◆ confineCmd

G4UIcmdWithAString* DMXParticleSourceMessenger::confineCmd
private

Definition at line 90 of file DMXParticleSourceMessenger.hh.

◆ directionCmd

G4UIcmdWith3Vector* DMXParticleSourceMessenger::directionCmd
private

Definition at line 97 of file DMXParticleSourceMessenger.hh.

◆ energyCmd

G4UIcmdWithADoubleAndUnit* DMXParticleSourceMessenger::energyCmd
private

Definition at line 98 of file DMXParticleSourceMessenger.hh.

◆ energytypeCmd

G4UIcmdWithAString* DMXParticleSourceMessenger::energytypeCmd
private

Definition at line 92 of file DMXParticleSourceMessenger.hh.

◆ fAtomicMass

G4int DMXParticleSourceMessenger::fAtomicMass
private

Definition at line 105 of file DMXParticleSourceMessenger.hh.

◆ fAtomicNumber

G4int DMXParticleSourceMessenger::fAtomicNumber
private

Definition at line 104 of file DMXParticleSourceMessenger.hh.

◆ fIonCharge

G4int DMXParticleSourceMessenger::fIonCharge
private

Definition at line 106 of file DMXParticleSourceMessenger.hh.

◆ fIonExciteEnergy

G4double DMXParticleSourceMessenger::fIonExciteEnergy
private

Definition at line 107 of file DMXParticleSourceMessenger.hh.

◆ fParticleGun

DMXParticleSource* DMXParticleSourceMessenger::fParticleGun
private

Definition at line 79 of file DMXParticleSourceMessenger.hh.

◆ fShootIon

G4bool DMXParticleSourceMessenger::fShootIon
private

Definition at line 103 of file DMXParticleSourceMessenger.hh.

◆ gunDirectory

G4UIdirectory* DMXParticleSourceMessenger::gunDirectory
private

Definition at line 83 of file DMXParticleSourceMessenger.hh.

◆ halfzCmd

G4UIcmdWithADoubleAndUnit* DMXParticleSourceMessenger::halfzCmd
private

Definition at line 88 of file DMXParticleSourceMessenger.hh.

◆ ionCmd

G4UIcommand* DMXParticleSourceMessenger::ionCmd
private

Definition at line 94 of file DMXParticleSourceMessenger.hh.

◆ listCmd

G4UIcmdWithoutParameter* DMXParticleSourceMessenger::listCmd
private

Definition at line 99 of file DMXParticleSourceMessenger.hh.

◆ particleCmd

G4UIcmdWithAString* DMXParticleSourceMessenger::particleCmd
private

Definition at line 95 of file DMXParticleSourceMessenger.hh.

◆ particleTable

G4ParticleTable* DMXParticleSourceMessenger::particleTable
private

Definition at line 80 of file DMXParticleSourceMessenger.hh.

◆ positionCmd

G4UIcmdWith3VectorAndUnit* DMXParticleSourceMessenger::positionCmd
private

Definition at line 96 of file DMXParticleSourceMessenger.hh.

◆ radiusCmd

G4UIcmdWithADoubleAndUnit* DMXParticleSourceMessenger::radiusCmd
private

Definition at line 89 of file DMXParticleSourceMessenger.hh.

◆ shapeCmd

G4UIcmdWithAString* DMXParticleSourceMessenger::shapeCmd
private

Definition at line 86 of file DMXParticleSourceMessenger.hh.

◆ typeCmd

G4UIcmdWithAString* DMXParticleSourceMessenger::typeCmd
private

Definition at line 85 of file DMXParticleSourceMessenger.hh.

◆ verbosityCmd

G4UIcmdWithAnInteger* DMXParticleSourceMessenger::verbosityCmd
private

Definition at line 93 of file DMXParticleSourceMessenger.hh.


The documentation for this class was generated from the following files: