Geant4  10.02.p03
G4ParticleMessenger Class Reference

#include <G4ParticleMessenger.hh>

Inheritance diagram for G4ParticleMessenger:
Collaboration diagram for G4ParticleMessenger:

Public Member Functions

 G4ParticleMessenger (G4ParticleTable *pTable=0)
 
virtual ~G4ParticleMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
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
 

Private Member Functions

 G4ParticleMessenger (const G4ParticleMessenger &)
 

Private Attributes

G4UIdirectorythisDirectory
 
G4UIcmdWithAStringlistCmd
 
G4UIcmdWithAStringselectCmd
 
G4UIcmdWithAnIntegerfindCmd
 
G4UIcmdWithoutParametercreateAllIonCmd
 
G4UIcmdWithoutParametercreateAllIsomerCmd
 
G4UIcmdWithAnIntegerverboseCmd
 
G4ParticleTabletheParticleTable
 
G4ParticleDefinitioncurrentParticle
 
G4ParticlePropertyMessengerfParticlePropertyMessenger
 

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 93 of file G4ParticleMessenger.hh.

Constructor & Destructor Documentation

◆ G4ParticleMessenger() [1/2]

G4ParticleMessenger::G4ParticleMessenger ( G4ParticleTable pTable = 0)

Definition at line 60 of file G4ParticleMessenger.cc.

61 {
62  // get the pointer to ParticleTable
63  if ( pTable == 0) {
65  } else {
66  theParticleTable = pTable;
67  }
68 
69  //Directory /particle/
70  thisDirectory = new G4UIdirectory("/particle/");
71  thisDirectory->SetGuidance("Particle control commands.");
72 
73  //Commnad /particle/select
74  selectCmd = new G4UIcmdWithAString("/particle/select",this);
75  selectCmd->SetGuidance("Select particle ");
76  selectCmd->SetDefaultValue("none");
77  selectCmd->SetParameterName("particle name", false);
79 
80  //Commnad /particle/list
81  listCmd = new G4UIcmdWithAString("/particle/list",this);
82  listCmd->SetGuidance("List name of particles.");
83  listCmd->SetGuidance(" all(default)/lepton/baryon/meson/nucleus/quarks");
84  listCmd->SetParameterName("particle type", true);
85  listCmd->SetDefaultValue("all");
86  listCmd->SetCandidates("all lepton baryon meson nucleus quarks");
88 
89  //Commnad /particle/find
90  findCmd = new G4UIcmdWithAnInteger("/particle/find",this);
91  findCmd->SetGuidance("Find particle by encoding");
93  findCmd->SetParameterName("encoding", false);
95 
96  //Commnad /particle/createAllIon
97  createAllIonCmd = new G4UIcmdWithoutParameter("/particle/createAllIon",this);
98  createAllIonCmd->SetGuidance("Create All ions (ground state)");
101 
102  //Commnad /particle/createAllIsomer
103  createAllIsomerCmd = new G4UIcmdWithoutParameter("/particle/createAllIsomer",this);
104  createAllIsomerCmd->SetGuidance("Create All isomers");
107 
108  // -- particle/property/Verbose ---
109  verboseCmd = new G4UIcmdWithAnInteger("/particle/verbose",this);
110  verboseCmd->SetGuidance("Set Verbose level of particle table.");
111  verboseCmd->SetGuidance(" 0 : Silent (default)");
112  verboseCmd->SetGuidance(" 1 : Display warning messages");
113  verboseCmd->SetGuidance(" 2 : Display more");
114  verboseCmd->SetParameterName("verbose_level",true);
116  verboseCmd->SetRange("verbose_level >=0");
117 
118  currentParticle = 0;
119 
120  //UI messenger for Particle Properties
122 
123 }
G4UIcmdWithoutParameter * createAllIonCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithoutParameter * createAllIsomerCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4UIdirectory * thisDirectory
G4UIcmdWithAString * listCmd
G4UIcmdWithAnInteger * findCmd
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
static G4ParticleTable * GetParticleTable()
void SetDefaultValue(const char *defVal)
G4ParticleTable * theParticleTable
G4UIcmdWithAString * selectCmd
void SetCandidates(const char *candidateList)
void SetDefaultValue(G4int defVal)
G4ParticleDefinition * currentParticle
G4ParticlePropertyMessenger * fParticlePropertyMessenger
G4UIcmdWithAnInteger * verboseCmd
Here is the call graph for this function:

◆ ~G4ParticleMessenger()

G4ParticleMessenger::~G4ParticleMessenger ( )
virtual

Definition at line 125 of file G4ParticleMessenger.cc.

126 {
128 
129  delete listCmd;
130  delete selectCmd;
131  delete findCmd;
132  delete createAllIonCmd;
133  delete createAllIsomerCmd;
134  delete verboseCmd;
135 
136  delete thisDirectory;
137 }
G4UIcmdWithoutParameter * createAllIonCmd
G4UIcmdWithoutParameter * createAllIsomerCmd
G4UIdirectory * thisDirectory
G4UIcmdWithAString * listCmd
G4UIcmdWithAnInteger * findCmd
G4UIcmdWithAString * selectCmd
G4ParticlePropertyMessenger * fParticlePropertyMessenger
G4UIcmdWithAnInteger * verboseCmd

◆ G4ParticleMessenger() [2/2]

G4ParticleMessenger::G4ParticleMessenger ( const G4ParticleMessenger )
inlineprivate

Definition at line 105 of file G4ParticleMessenger.hh.

105 :G4UImessenger(){};

Member Function Documentation

◆ GetCurrentValue()

G4String G4ParticleMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 203 of file G4ParticleMessenger.cc.

204 {
205  if( command==selectCmd ){
206  //Command /particle/select
207  // set candidate List
208  G4String candidates("none");
210  piter -> reset();
211  while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
212  G4ParticleDefinition *particle = piter->value();
213  candidates += " " + particle->GetParticleName();
214  }
215  selectCmd->SetCandidates((const char *)(candidates));
216 
217  static const G4String noName("none");
218  // current value
219  if(currentParticle == 0) {
220  // no particle is selected. return null
221  return noName;
222  } else {
224  }
225  } else if( command==verboseCmd ){
226  //Commnad /particle/verbose
228  }
229  return "";
230 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4int GetVerboseLevel() const
const G4String & GetParticleName() const
G4ParticleTable * theParticleTable
G4UIcmdWithAString * selectCmd
void SetCandidates(const char *candidateList)
G4ParticleDefinition * currentParticle
G4UIcmdWithAnInteger * verboseCmd
G4PTblDicIterator * GetIterator() const
Here is the call graph for this function:

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 140 of file G4ParticleMessenger.cc.

141 {
142  if( command==listCmd ){
143  //Commnad /particle/List
144  G4int counter = 0;
146  piter -> reset();
147 
148  while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
149  G4ParticleDefinition *particle = piter->value();
150  if ((newValues=="all") || (newValues==particle->GetParticleType())) {
151  G4cout << std::setw(19) << particle->GetParticleName();
152  if ((counter++)%4 == 3) {
153  G4cout << G4endl;
154  } else {
155  G4cout << ",";
156  }
157  }
158  }
159  G4cout << G4endl;
160  if (counter == 0) G4cout << newValues << " is not found " << G4endl;
161 
162  //Command /particle/select
163  // set candidate List
164  G4String candidates("none");
165  piter -> reset();
166  while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
167  G4ParticleDefinition *particle = piter->value();
168  candidates += " " + particle->GetParticleName();
169  }
170  selectCmd->SetCandidates((const char *)(candidates));
171 
172  } else if( command==selectCmd ){
173  //Commnad /particle/select
175  if(currentParticle == 0) {
176  G4cout << "Unknown particle [" << newValues << "]. Command ignored." << G4endl;
177  }
178 
179  } else if( command==findCmd ){
180  //Commnad /particle/find
182  if(tmp == 0) {
183  G4cout << "Unknown particle [" << newValues << "]. Command ignored." << G4endl;
184  } else {
185  G4cout << tmp->GetParticleName() << G4endl;
186  tmp->DumpTable();
187  }
188 
189  } else if( command==createAllIonCmd ) {
190  //Commnad /particle/createAllIon
192 
193  } else if( command==createAllIsomerCmd ) {
194  //Commnad /particle/createAllIsomer
196 
197  } else if( command==verboseCmd ) {
198  //Commnad /particle/verbose
200  }
201 }
G4UIcmdWithoutParameter * createAllIonCmd
Float_t tmp
G4UIcmdWithoutParameter * createAllIsomerCmd
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4int GetNewIntValue(const char *paramString)
void SetVerboseLevel(G4int value)
const G4String & GetParticleType() const
int G4int
Definition: G4Types.hh:78
void CreateAllIsomer()
Definition: G4IonTable.cc:1555
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
G4IonTable * GetIonTable() const
G4UIcmdWithAString * listCmd
G4UIcmdWithAnInteger * findCmd
G4ParticleTable * theParticleTable
G4UIcmdWithAString * selectCmd
void CreateAllIon()
Definition: G4IonTable.cc:1549
void SetCandidates(const char *candidateList)
#define G4endl
Definition: G4ios.hh:61
G4ParticleDefinition * currentParticle
G4UIcmdWithAnInteger * verboseCmd
G4PTblDicIterator * GetIterator() const
Here is the call graph for this function:

Member Data Documentation

◆ createAllIonCmd

G4UIcmdWithoutParameter* G4ParticleMessenger::createAllIonCmd
private

Definition at line 112 of file G4ParticleMessenger.hh.

◆ createAllIsomerCmd

G4UIcmdWithoutParameter* G4ParticleMessenger::createAllIsomerCmd
private

Definition at line 113 of file G4ParticleMessenger.hh.

◆ currentParticle

G4ParticleDefinition* G4ParticleMessenger::currentParticle
private

Definition at line 117 of file G4ParticleMessenger.hh.

◆ findCmd

G4UIcmdWithAnInteger* G4ParticleMessenger::findCmd
private

Definition at line 111 of file G4ParticleMessenger.hh.

◆ fParticlePropertyMessenger

G4ParticlePropertyMessenger* G4ParticleMessenger::fParticlePropertyMessenger
private

Definition at line 119 of file G4ParticleMessenger.hh.

◆ listCmd

G4UIcmdWithAString* G4ParticleMessenger::listCmd
private

Definition at line 109 of file G4ParticleMessenger.hh.

◆ selectCmd

G4UIcmdWithAString* G4ParticleMessenger::selectCmd
private

Definition at line 110 of file G4ParticleMessenger.hh.

◆ theParticleTable

G4ParticleTable* G4ParticleMessenger::theParticleTable
private

Definition at line 116 of file G4ParticleMessenger.hh.

◆ thisDirectory

G4UIdirectory* G4ParticleMessenger::thisDirectory
private

Definition at line 105 of file G4ParticleMessenger.hh.

◆ verboseCmd

G4UIcmdWithAnInteger* G4ParticleMessenger::verboseCmd
private

Definition at line 114 of file G4ParticleMessenger.hh.


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