Geant4  10.02.p03
G4UserPhysicsListMessenger Class Reference

#include <G4UserPhysicsListMessenger.hh>

Inheritance diagram for G4UserPhysicsListMessenger:
Collaboration diagram for G4UserPhysicsListMessenger:

Public Member Functions

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

Protected Attributes

G4VUserPhysicsListthePhysicsList
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Private Member Functions

 G4UserPhysicsListMessenger ()
 

Private Attributes

G4UIdirectorytheDirectory
 
G4UIcmdWithADoubleAndUnitsetCutCmd
 
G4UIcommandsetCutRCmd
 
G4UIcommandsetCutForAGivenParticleCmd
 
G4UIcmdWithAStringgetCutForAGivenParticleCmd
 
G4UIcmdWithAnIntegerverboseCmd
 
G4UIcmdWithoutParameterdumpListCmd
 
G4UIcmdWithAStringaddProcManCmd
 
G4UIcmdWithAStringbuildPTCmd
 
G4UIcmdWithAStringstoreCmd
 
G4UIcmdWithAStringretrieveCmd
 
G4UIcmdWithAnIntegerasciiCmd
 
G4UIcommandapplyCutsCmd
 
G4UIcmdWithAStringdumpCutValuesCmd
 
G4UIcmdWithAnIntegerdumpOrdParamCmd
 

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)
 

Detailed Description

Definition at line 78 of file G4UserPhysicsListMessenger.hh.

Constructor & Destructor Documentation

◆ G4UserPhysicsListMessenger() [1/2]

G4UserPhysicsListMessenger::G4UserPhysicsListMessenger ( )
inlineprivate

Definition at line 82 of file G4UserPhysicsListMessenger.hh.

82 {}
Here is the call graph for this function:

◆ G4UserPhysicsListMessenger() [2/2]

G4UserPhysicsListMessenger::G4UserPhysicsListMessenger ( G4VUserPhysicsList pParticleList)

Definition at line 57 of file G4UserPhysicsListMessenger.cc.

57  :thePhysicsList(pParticleList)
58 {
59  G4UIparameter* param = 0;
60  // /run/particle directory
61  theDirectory = new G4UIdirectory("/run/particle/");
62  theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
63 
64  // /run/particle/Verbose command
65  verboseCmd = new G4UIcmdWithAnInteger("/run/particle/verbose",this);
66  verboseCmd->SetGuidance("Set the Verbose level of G4VUserPhysicsList.");
67  verboseCmd->SetGuidance(" 0 : Silent (default)");
68  verboseCmd->SetGuidance(" 1 : Display warning messages");
69  verboseCmd->SetGuidance(" 2 : Display more");
70  verboseCmd->SetParameterName("level",true);
72  verboseCmd->SetRange("level >=0 && level <=3");
73 
74  // /run/setCut command
75  setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/setCut",this);
76  setCutCmd->SetGuidance("Set default cut value ");
77  setCutCmd->SetParameterName("cut",false);
79  setCutCmd->SetRange("cut >=0.0");
82 
83  // /run/setCutForAGivenParticle command
84  setCutForAGivenParticleCmd = new G4UIcommand("/run/setCutForAGivenParticle",this) ;
85  setCutForAGivenParticleCmd->SetGuidance("Set a cut value to a specific particle ") ;
86  setCutForAGivenParticleCmd->SetGuidance("Usage: /run/setCutForAGivenParticle gamma 1. mm") ;
87  param = new G4UIparameter("particleName",'s',false) ;
88  param->SetParameterCandidates("e- e+ gamma proton");
90  param = new G4UIparameter("cut",'d',false) ;
91  param->SetDefaultValue("1.") ;
92  param->SetParameterRange("cut>=0.0") ;
94  param = new G4UIparameter("unit",'s',false) ;
95  param->SetDefaultValue("mm") ;
98 
99  // /run/getCutForAGivenParticle command
100  getCutForAGivenParticleCmd = new G4UIcmdWithAString("/run/getCutForAGivenParticle",this) ;
101  getCutForAGivenParticleCmd->SetGuidance("Get a cut value to a specific particle ") ;
102  getCutForAGivenParticleCmd->SetGuidance("Usage: /run/getCutForAGivenParticle gamma ") ;
103  getCutForAGivenParticleCmd->SetParameterName("particleName",false,false) ;
104  getCutForAGivenParticleCmd->SetCandidates("e- e+ gamma proton");
106 
107  // /run/setCutForRegion command
108  setCutRCmd = new G4UIcommand("/run/setCutForRegion",this);
109  setCutRCmd->SetGuidance("Set cut value for a region");
110  param = new G4UIparameter("Region",'s',false);
111  setCutRCmd->SetParameter(param);
112  param = new G4UIparameter("cut",'d',false);
113  param->SetParameterRange("cut >=0.0");
114  setCutRCmd->SetParameter(param);
115  param = new G4UIparameter("Unit",'s',true);
116  param->SetDefaultValue("mm");
118  setCutRCmd->SetParameter(param);
120 
121  // /run/particle/DumpList command
122  dumpListCmd = new G4UIcmdWithoutParameter("/run/particle/dumpList",this);
123  dumpListCmd->SetGuidance("Dump List of particles in G4VUserPhysicsList. ");
124 
125  // /run/particle/addProcManager command
126  addProcManCmd = new G4UIcmdWithAString("/run/particle/addProcManager", this);
128  addProcManCmd->SetGuidance("add process manager to specified particle type");
129  addProcManCmd->SetParameterName("particleType", true);
132 
133  // /run/particle/buildPhysicsTable command
134  buildPTCmd = new G4UIcmdWithAString("/run/particle/buildPhysicsTable", this);
135  buildPTCmd->SetGuidance("build physics table of specified particle type");
136  buildPTCmd->SetParameterName("particleType", true);
139 
140  // /run/particle/storePhysicsTable command
141  storeCmd = new G4UIcmdWithAString("/run/particle/storePhysicsTable",this);
142  storeCmd->SetGuidance("Store Physics Table");
143  storeCmd->SetGuidance(" Enter directory name");
144  storeCmd->SetParameterName("dirName",true);
147 
148  // /run/particle/retrievePhysicsTable command
149  retrieveCmd = new G4UIcmdWithAString("/run/particle/retrievePhysicsTable",this);
150  retrieveCmd->SetGuidance("Retrieve Physics Table");
151  retrieveCmd->SetGuidance(" Enter directory name or OFF to switch off");
152  retrieveCmd->SetParameterName("dirName",true);
155 
156  // /run/particle/setStoredInAscii command
157  asciiCmd = new G4UIcmdWithAnInteger("/run/particle/setStoredInAscii",this);
158  asciiCmd->SetGuidance("Switch on/off ascii mode in store/retreive Physics Table");
159  asciiCmd->SetGuidance(" Enter 0(binary) or 1(ascii)");
160  asciiCmd->SetParameterName("ascii",true);
163  asciiCmd->SetRange("ascii ==0 || ascii ==1");
164 
165  //Commnad /run/particle/applyCuts command
166  applyCutsCmd = new G4UIcommand("/run/particle/applyCuts",this);
167  applyCutsCmd->SetGuidance("Set applyCuts flag for a particle.");
168  applyCutsCmd->SetGuidance(" Some EM processes which do not have infrared divergence");
169  applyCutsCmd->SetGuidance("may generate gamma, e- and/or e+ with kinetic energies");
170  applyCutsCmd->SetGuidance("below the production threshold. By setting this flag,");
171  applyCutsCmd->SetGuidance("such secondaries below threshold are eliminated and");
172  applyCutsCmd->SetGuidance("kinetic energies of such secondaries are accumulated");
173  applyCutsCmd->SetGuidance("to the energy deposition of their mother.");
174  applyCutsCmd->SetGuidance(" Note that 'applyCuts' makes sense only for gamma,");
175  applyCutsCmd->SetGuidance("e- and e+. If this command is issued for other particle,");
176  applyCutsCmd->SetGuidance("a warning message is displayed and the command is");
177  applyCutsCmd->SetGuidance("ignored.");
178  applyCutsCmd->SetGuidance(" If particle name is 'all', this command affects on");
179  applyCutsCmd->SetGuidance("gamma, e- and e+.");
180  param = new G4UIparameter("Flag",'s',true);
181  param->SetDefaultValue("true");
182  applyCutsCmd->SetParameter(param);
183  param = new G4UIparameter("Particle",'s',true);
184  param->SetDefaultValue("all");
185  applyCutsCmd->SetParameter(param);
187 
188  // /run/particle/dumpCutValues command
189  dumpCutValuesCmd = new G4UIcmdWithAString("/run/particle/dumpCutValues",this);
190  dumpCutValuesCmd->SetGuidance("Dump a list of production threshold values in range and energy");
191  dumpCutValuesCmd->SetGuidance("for all registered material-cuts-couples.");
192  dumpCutValuesCmd->SetGuidance("Dumping a list takes place when you issue 'beamOn' and");
193  dumpCutValuesCmd->SetGuidance("actual conversion tables from range to energy are available.");
194  dumpCutValuesCmd->SetGuidance("If you want a list 'immediately', use '/run/dumpRegion' for threshold");
195  dumpCutValuesCmd->SetGuidance("list given in gange only. Also, '/run/dumpCouples' gives you the");
196  dumpCutValuesCmd->SetGuidance("current list if you have already issued 'run/beamOn' at least once.");
197  dumpCutValuesCmd->SetParameterName("particle",true);
200 
201  // /run/particle/dumpCutValues command
202  dumpOrdParamCmd = new G4UIcmdWithAnInteger("/run/particle/dumpOrderingParam",this);
203  dumpOrdParamCmd->SetGuidance("Dump a list of ordering parameter ");
204  dumpOrdParamCmd->SetParameterName("subtype",true);
207 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterRange(const char *theRange)
void SetParameterCandidates(const char *theString)
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
void SetDefaultValue(const char *theDefaultValue)
static G4String UnitsList(const char *unitCategory)
Definition: G4UIcommand.cc:320
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4UIcmdWithADoubleAndUnit * setCutCmd
G4UIcmdWithoutParameter * dumpListCmd
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetCandidates(const char *candidateList)
void SetDefaultValue(G4int defVal)
static G4String CategoryOf(const char *unitName)
Definition: G4UIcommand.cc:315
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithAString * getCutForAGivenParticleCmd
Here is the call graph for this function:

◆ ~G4UserPhysicsListMessenger()

G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger ( )
virtual

Definition at line 209 of file G4UserPhysicsListMessenger.cc.

210 {
211  delete setCutCmd;
212  delete setCutRCmd;
215  delete verboseCmd;
216  delete dumpListCmd;
217  delete addProcManCmd;
218  delete buildPTCmd;
219  delete storeCmd;
220  delete retrieveCmd;
221  delete asciiCmd;
222  delete applyCutsCmd;
223  delete dumpCutValuesCmd;
224  delete dumpOrdParamCmd;
225  delete theDirectory;
226 }
G4UIcmdWithADoubleAndUnit * setCutCmd
G4UIcmdWithoutParameter * dumpListCmd
G4UIcmdWithAString * getCutForAGivenParticleCmd
Here is the caller graph for this function:

Member Function Documentation

◆ GetCurrentValue()

G4String G4UserPhysicsListMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 313 of file G4UserPhysicsListMessenger.cc.

314 {
315  G4String cv;
316  G4String candidates("none");
318 
319  if( command==setCutCmd ) {
321 
322  } else if( command==verboseCmd ){
324 
325  } else if( command== addProcManCmd ){
326  // set candidate list
327  piter -> reset();
328  while( (*piter)() ){
329  G4ParticleDefinition *particle = piter->value();
330  candidates += " " + particle->GetParticleName();
331  }
332  addProcManCmd->SetCandidates(candidates);
333  cv = "";
334 
335  } else if( command== buildPTCmd ){
336  // set candidate list
337  piter -> reset();
338  while( (*piter)() ){
339  G4ParticleDefinition *particle = piter->value();
340  candidates += " " + particle->GetParticleName();
341  }
342  addProcManCmd->SetCandidates(candidates);
343  cv = "";
344 
345  } else if ( command == storeCmd ){
347 
348  }else if( command == retrieveCmd ) {
351  } else {
352  cv = "OFF";
353  }
354 
355  } else if( command==asciiCmd ){
357  cv = "1";
358  } else {
359  cv = "0";
360  }
361 
362 // } else if( command == applyCutsCmd ) {
363 // if (thePhysicsList->GetApplyCuts("gamma")){
364 // cv = "true";
365 // } else {
366 // cv = "false";
367 // }
368  }
369 
370  return cv;
371 }
G4bool IsPhysicsTableRetrieved() const
G4bool IsStoredInAscii() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4int GetVerboseLevel() const
const G4String & GetParticleName() const
G4UIcmdWithADoubleAndUnit * setCutCmd
const G4String & GetPhysicsTableDirectory() const
static G4ParticleTable * GetParticleTable()
void SetCandidates(const char *candidateList)
G4double GetDefaultCutValue() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 228 of file G4UserPhysicsListMessenger.cc.

229 {
230  if( command==setCutCmd ){
231  G4double newCut = setCutCmd->GetNewDoubleValue(newValue);
234 
235  } else if( command==setCutForAGivenParticleCmd ){
236  G4String particleName, unit ; G4double cut ;
237  std::istringstream str (newValue) ;
238  str >> particleName >> cut >> unit ;
239  thePhysicsList->SetCutValue(cut*G4UIcommand::ValueOf(unit), particleName) ;
240 
241  } else if( command==getCutForAGivenParticleCmd ){
242  G4cout << thePhysicsList->GetCutValue(newValue)/mm <<"[mm]" << G4endl ;
243 
244  } else if( command==setCutRCmd ){
245  std::istringstream is(newValue);
246  G4String regName;
247  G4String uniName;
248  G4double cVal = -1.0;
249  is >> regName >> cVal >> uniName;
250  if (is.fail()) {
251  G4cout << "illegal arguments : try again " << G4endl;
252  return;
253  }
254  thePhysicsList->SetCutsForRegion(cVal*(setCutRCmd->ValueOf(uniName)),regName);
255 
256  } else if( command==verboseCmd ) {
258 
259  } else if( command==dumpListCmd ){
261 
262  } else if( command==dumpOrdParamCmd ){
263  G4int stype = dumpOrdParamCmd->GetNewIntValue(newValue);
265 
266  } else if( command == addProcManCmd ){
267  G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue);
268  if (particle == 0) return;
269  if (particle->GetProcessManager() != 0) return;
271 
272  } else if( command == buildPTCmd ){
273  G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue);
274  if (particle == 0) return;
277 
278  } else if ( command == storeCmd ){
280 
281  } else if( command == retrieveCmd ) {
282  if ((newValue == "OFF") || (newValue == "off") ){
284  } else {
286  }
287 
288  } else if( command == asciiCmd ) {
289  if (asciiCmd->GetNewIntValue(newValue) == 0) {
291  } else {
293  }
294 
295  } else if( command == applyCutsCmd ) {
296  G4Tokenizer next( newValue );
297 
298  // check 1st argument
299  G4String temp = G4String(next());
300  G4bool flag = (temp =="true" || temp=="TRUE");
301 
302  // check 2nd argument
303  G4String name = G4String(next());
304 
305  thePhysicsList->SetApplyCuts(flag, name);
306 
307  } else if( command == dumpCutValuesCmd ) {
309 
310  }
311 }
void SetDefaultCutValue(G4double newCutValue)
void SetApplyCuts(G4bool value, const G4String &name)
void SetCutValue(G4double aCut, const G4String &pname)
static G4int GetNewIntValue(const char *paramString)
void PreparePhysicsTable(G4ParticleDefinition *)
G4String name
Definition: TRTMaterials.hh:40
G4double GetCutValue(const G4String &pname) const
void SetCutsForRegion(G4double aCut, const G4String &rname)
G4ProcessManager * GetProcessManager() const
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetPhysicsTableRetrieved(const G4String &directory="")
void DumpCutValuesTable(G4int flag=1)
void AddProcessManager(G4ParticleDefinition *newParticle, G4ProcessManager *newManager=0)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4UIcmdWithADoubleAndUnit * setCutCmd
void SetVerboseLevel(G4int value)
G4UIcmdWithoutParameter * dumpListCmd
G4bool StorePhysicsTable(const G4String &directory=".")
static G4ParticleTable * GetParticleTable()
void DumpOrdingParameterTable(G4int subType=-1) const
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:308
static G4PhysicsListHelper * GetPhysicsListHelper()
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const double mm
Definition: G4SIunits.hh:114
G4UIcmdWithAString * getCutForAGivenParticleCmd
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ addProcManCmd

G4UIcmdWithAString* G4UserPhysicsListMessenger::addProcManCmd
private

Definition at line 103 of file G4UserPhysicsListMessenger.hh.

◆ applyCutsCmd

G4UIcommand* G4UserPhysicsListMessenger::applyCutsCmd
private

Definition at line 108 of file G4UserPhysicsListMessenger.hh.

◆ asciiCmd

G4UIcmdWithAnInteger* G4UserPhysicsListMessenger::asciiCmd
private

Definition at line 107 of file G4UserPhysicsListMessenger.hh.

◆ buildPTCmd

G4UIcmdWithAString* G4UserPhysicsListMessenger::buildPTCmd
private

Definition at line 104 of file G4UserPhysicsListMessenger.hh.

◆ dumpCutValuesCmd

G4UIcmdWithAString* G4UserPhysicsListMessenger::dumpCutValuesCmd
private

Definition at line 109 of file G4UserPhysicsListMessenger.hh.

◆ dumpListCmd

G4UIcmdWithoutParameter* G4UserPhysicsListMessenger::dumpListCmd
private

Definition at line 102 of file G4UserPhysicsListMessenger.hh.

◆ dumpOrdParamCmd

G4UIcmdWithAnInteger* G4UserPhysicsListMessenger::dumpOrdParamCmd
private

Definition at line 110 of file G4UserPhysicsListMessenger.hh.

◆ getCutForAGivenParticleCmd

G4UIcmdWithAString* G4UserPhysicsListMessenger::getCutForAGivenParticleCmd
private

Definition at line 100 of file G4UserPhysicsListMessenger.hh.

◆ retrieveCmd

G4UIcmdWithAString* G4UserPhysicsListMessenger::retrieveCmd
private

Definition at line 106 of file G4UserPhysicsListMessenger.hh.

◆ setCutCmd

G4UIcmdWithADoubleAndUnit* G4UserPhysicsListMessenger::setCutCmd
private

Definition at line 97 of file G4UserPhysicsListMessenger.hh.

◆ setCutForAGivenParticleCmd

G4UIcommand* G4UserPhysicsListMessenger::setCutForAGivenParticleCmd
private

Definition at line 99 of file G4UserPhysicsListMessenger.hh.

◆ setCutRCmd

G4UIcommand* G4UserPhysicsListMessenger::setCutRCmd
private

Definition at line 98 of file G4UserPhysicsListMessenger.hh.

◆ storeCmd

G4UIcmdWithAString* G4UserPhysicsListMessenger::storeCmd
private

Definition at line 105 of file G4UserPhysicsListMessenger.hh.

◆ theDirectory

G4UIdirectory* G4UserPhysicsListMessenger::theDirectory
private

Definition at line 96 of file G4UserPhysicsListMessenger.hh.

◆ thePhysicsList

G4VUserPhysicsList* G4UserPhysicsListMessenger::thePhysicsList
protected

Definition at line 93 of file G4UserPhysicsListMessenger.hh.

◆ verboseCmd

G4UIcmdWithAnInteger* G4UserPhysicsListMessenger::verboseCmd
private

Definition at line 101 of file G4UserPhysicsListMessenger.hh.


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