Geant4  10.02.p03
G4ParticlePropertyMessenger Class Reference

#include <G4ParticlePropertyMessenger.hh>

Inheritance diagram for G4ParticlePropertyMessenger:
Collaboration diagram for G4ParticlePropertyMessenger:

Public Member Functions

 G4ParticlePropertyMessenger (G4ParticleTable *pTable=0)
 
virtual ~G4ParticlePropertyMessenger ()
 
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
 

Private Member Functions

 G4ParticlePropertyMessenger (const G4ParticlePropertyMessenger &)
 
G4ParticleDefinitionSetCurrentParticle ()
 

Private Attributes

G4ParticleTabletheParticleTable
 
G4ParticleDefinitioncurrentParticle
 
G4UIdirectorythisDirectory
 
G4UIcmdWithoutParameterdumpCmd
 
G4UIcmdWithABoolstableCmd
 
G4UIcmdWithAnIntegerverboseCmd
 
G4UIcmdWithADoubleAndUnitlifetimeCmd
 
G4DecayTableMessengerfDecayTableMessenger
 

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 G4ParticlePropertyMessenger.hh.

Constructor & Destructor Documentation

◆ G4ParticlePropertyMessenger() [1/2]

G4ParticlePropertyMessenger::G4ParticlePropertyMessenger ( G4ParticleTable pTable = 0)

Definition at line 59 of file G4ParticlePropertyMessenger.cc.

60  :theParticleTable(pTable),
61  currentParticle(0),
63 {
65  //Commnad /particle/property/
66  thisDirectory = new G4UIdirectory("/particle/property/");
67  thisDirectory->SetGuidance("Paricle Table control commands.");
68 
69  //Commnad /particle/property/dump
70  dumpCmd = new G4UIcmdWithoutParameter("/particle/property/dump",this);
71  dumpCmd->SetGuidance("dump particle properties.");
72 
73  //Command /particle/property/stable
74  stableCmd = new G4UIcmdWithABool("/particle/property/stable",this);
75  stableCmd->SetGuidance("Set stable flag.");
76  stableCmd->SetGuidance(" false: Unstable true: Stable");
77  stableCmd->SetParameterName("stable",false);
79 
80  //particle/property/lifetime
81  lifetimeCmd = new G4UIcmdWithADoubleAndUnit("/particle/property/lifetime",this);
82  lifetimeCmd->SetGuidance("Set life time.");
83  lifetimeCmd->SetGuidance("Unit of the time can be :");
84  lifetimeCmd->SetGuidance(" s, ms, ns (default)");
85  lifetimeCmd->SetParameterName("life",false);
87  lifetimeCmd->SetRange("life >0.0");
88  //lifetimeCmd->SetUnitCategory("Time");
89  //lifetimeCmd->SetUnitCandidates("s ms ns");
92 
93  // -- particle/property/Verbose ---
94  verboseCmd = new G4UIcmdWithAnInteger("/particle/property/verbose",this);
95  verboseCmd->SetGuidance("Set Verbose level of particle property.");
96  verboseCmd->SetGuidance(" 0 : Silent (default)");
97  verboseCmd->SetGuidance(" 1 : Display warning messages");
98  verboseCmd->SetGuidance(" 2 : Display more");
99  verboseCmd->SetParameterName("verbose_level",true);
101  verboseCmd->SetRange("verbose_level >=0");
102 
103  //UI messenger for Decay Table
105 
106 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4DecayTableMessenger * fDecayTableMessenger
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
static G4ParticleTable * GetParticleTable()
void SetDefaultUnit(const char *defUnit)
void SetDefaultValue(G4int defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithADoubleAndUnit * lifetimeCmd
Here is the call graph for this function:

◆ ~G4ParticlePropertyMessenger()

G4ParticlePropertyMessenger::~G4ParticlePropertyMessenger ( )
virtual

Definition at line 108 of file G4ParticlePropertyMessenger.cc.

109 {
112 
113  delete stableCmd;
114  delete verboseCmd;
115  delete lifetimeCmd;
116  delete dumpCmd;
117  delete thisDirectory;
118 }
G4DecayTableMessenger * fDecayTableMessenger
G4UIcmdWithADoubleAndUnit * lifetimeCmd

◆ G4ParticlePropertyMessenger() [2/2]

G4ParticlePropertyMessenger::G4ParticlePropertyMessenger ( const G4ParticlePropertyMessenger )
inlineprivate

Definition at line 80 of file G4ParticlePropertyMessenger.hh.

Here is the call graph for this function:

Member Function Documentation

◆ GetCurrentValue()

G4String G4ParticlePropertyMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 170 of file G4ParticlePropertyMessenger.cc.

171 {
172  G4String returnValue('\0');
173 
174  if (SetCurrentParticle()==0) {
175  // no particle is selected. return null
176  return returnValue;
177  }
178 
179  if( command == stableCmd ){
180  //Commnad /particle/property/stable
182 
183  } else if( command == lifetimeCmd ){
184  //Commnad /particle/property/lifetime
185  returnValue = lifetimeCmd->ConvertToString( currentParticle->GetPDGLifeTime() , "ns" );
186 
187  } else if( command==verboseCmd ){
188  //Commnad /particle/property/Verbose
189  returnValue= verboseCmd->ConvertToString(currentParticle ->GetVerboseLevel());
190 
191  }
192 
193  return returnValue;
194 }
G4ParticleDefinition * SetCurrentParticle()
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4double GetPDGLifeTime() const
G4bool GetPDGStable() const
G4UIcmdWithADoubleAndUnit * lifetimeCmd
Here is the call graph for this function:

◆ SetCurrentParticle()

G4ParticleDefinition * G4ParticlePropertyMessenger::SetCurrentParticle ( )
private

Definition at line 151 of file G4ParticlePropertyMessenger.cc.

152 {
153  // set currentParticle pointer
154 
155  // get particle name by asking G4ParticleMessenger via UImanager
156 
157  G4String particleName = G4UImanager::GetUIpointer()->GetCurrentStringValue("/particle/select");
158 
159  if (currentParticle != 0 ){
160  // check whether selection is changed
161  if (currentParticle->GetParticleName() != particleName) {
163  }
164  } else {
166  }
167  return currentParticle;
168 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:182
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
const G4String & GetParticleName() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 120 of file G4ParticlePropertyMessenger.cc.

121 {
122  if (SetCurrentParticle()==0) {
123  G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
124  return;
125  }
126 
127  if( command == dumpCmd ){
128  //Commnad /particle/property/dump
130 
131  } else if (command == lifetimeCmd ) {
132  //Commnad /particle/property/lifetime
134 
135  } else if (command == stableCmd ) {
136  //Commnad /particle/property/stable
137  if (currentParticle->GetPDGLifeTime()<0.0) {
138  G4cout << "Life time is negative! Command ignored." << G4endl;
139  } else if (currentParticle->GetPDGMass()<=0.0) {
140  G4cout << "Zero Mass! Command ignored." << G4endl;
141  } else {
143  }
144 
145  } else if( command==verboseCmd ) {
146  //Commnad /particle/property/Verbose
148  }
149 }
void SetPDGStable(const G4bool aFlag)
static G4int GetNewIntValue(const char *paramString)
G4ParticleDefinition * SetCurrentParticle()
void SetPDGLifeTime(G4double aLifeTime)
G4double GetPDGLifeTime() const
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
#define G4endl
Definition: G4ios.hh:61
G4UIcmdWithADoubleAndUnit * lifetimeCmd
Here is the call graph for this function:

Member Data Documentation

◆ currentParticle

G4ParticleDefinition* G4ParticlePropertyMessenger::currentParticle
private

Definition at line 85 of file G4ParticlePropertyMessenger.hh.

◆ dumpCmd

G4UIcmdWithoutParameter* G4ParticlePropertyMessenger::dumpCmd
private

Definition at line 88 of file G4ParticlePropertyMessenger.hh.

◆ fDecayTableMessenger

G4DecayTableMessenger* G4ParticlePropertyMessenger::fDecayTableMessenger
private

Definition at line 93 of file G4ParticlePropertyMessenger.hh.

◆ lifetimeCmd

G4UIcmdWithADoubleAndUnit* G4ParticlePropertyMessenger::lifetimeCmd
private

Definition at line 91 of file G4ParticlePropertyMessenger.hh.

◆ stableCmd

G4UIcmdWithABool* G4ParticlePropertyMessenger::stableCmd
private

Definition at line 89 of file G4ParticlePropertyMessenger.hh.

◆ theParticleTable

G4ParticleTable* G4ParticlePropertyMessenger::theParticleTable
private

Definition at line 84 of file G4ParticlePropertyMessenger.hh.

◆ thisDirectory

G4UIdirectory* G4ParticlePropertyMessenger::thisDirectory
private

Definition at line 87 of file G4ParticlePropertyMessenger.hh.

◆ verboseCmd

G4UIcmdWithAnInteger* G4ParticlePropertyMessenger::verboseCmd
private

Definition at line 90 of file G4ParticlePropertyMessenger.hh.


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