Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
 

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::G4ParticlePropertyMessenger ( G4ParticleTable pTable = 0)

Definition at line 59 of file G4ParticlePropertyMessenger.cc.

60  :theParticleTable(pTable),
61  currentParticle(0),
62  fDecayTableMessenger(0)
63 {
64  if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
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);
86  lifetimeCmd->SetDefaultValue(0.0);
87  lifetimeCmd->SetRange("life >0.0");
88  //lifetimeCmd->SetUnitCategory("Time");
89  //lifetimeCmd->SetUnitCandidates("s ms ns");
90  lifetimeCmd->SetDefaultUnit("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);
100  verboseCmd->SetDefaultValue(0);
101  verboseCmd->SetRange("verbose_level >=0");
102 
103  //UI messenger for Decay Table
104  fDecayTableMessenger = new G4DecayTableMessenger(theParticleTable);
105 
106 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
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:240
static G4ParticleTable * GetParticleTable()
void SetDefaultUnit(const char *defUnit)
void SetDefaultValue(G4int defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)

Here is the call graph for this function:

G4ParticlePropertyMessenger::~G4ParticlePropertyMessenger ( )
virtual

Definition at line 108 of file G4ParticlePropertyMessenger.cc.

109 {
110  if (fDecayTableMessenger !=0) delete fDecayTableMessenger;
111  fDecayTableMessenger = 0;
112 
113  delete stableCmd;
114  delete verboseCmd;
115  delete lifetimeCmd;
116  delete dumpCmd;
117  delete thisDirectory;
118 }

Member Function Documentation

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
181  returnValue = stableCmd->ConvertToString( currentParticle->GetPDGStable());
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 }
G4bool GetPDGStable() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
G4double GetPDGLifeTime() const

Here is the call graph for this function:

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
129  currentParticle->DumpTable();
130 
131  } else if (command == lifetimeCmd ) {
132  //Commnad /particle/property/lifetime
133  currentParticle->SetPDGLifeTime(lifetimeCmd->GetNewDoubleValue(newValue));
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 {
142  currentParticle->SetPDGStable(stableCmd->GetNewBoolValue(newValue));
143  }
144 
145  } else if( command==verboseCmd ) {
146  //Commnad /particle/property/Verbose
147  currentParticle->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
148  }
149 }
void SetPDGStable(const G4bool aFlag)
static G4int GetNewIntValue(const char *paramString)
void SetPDGLifeTime(G4double aLifeTime)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
G4double GetPDGMass() const
G4double GetPDGLifeTime() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:


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