Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4DecayTableMessenger Class Reference

#include <G4DecayTableMessenger.hh>

Inheritance diagram for G4DecayTableMessenger:
G4UImessenger

Public Member Functions

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

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
 

Detailed Description

Definition at line 67 of file G4DecayTableMessenger.hh.

Constructor & Destructor Documentation

G4DecayTableMessenger::G4DecayTableMessenger ( G4ParticleTable pTable = 0)

Definition at line 58 of file G4DecayTableMessenger.cc.

References G4ParticleTable::GetParticleTable(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithADouble::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), and G4UIcommand::SetRange().

59  :theParticleTable(pTable)
60 {
61  if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
62 
63  currentParticle = 0;
64 
65  //Commnad /particle/property/decay/
66  thisDirectory = new G4UIdirectory("/particle/property/decay/");
67  thisDirectory->SetGuidance("Decay Table control commands.");
68 
69  //Commnad /particle/property/decay/select
70  selectCmd = new G4UIcmdWithAnInteger("/particle/property/decay/select",this);
71  selectCmd->SetGuidance("Enter index of decay mode.");
72  selectCmd->SetParameterName("mode", true);
73  selectCmd->SetDefaultValue(0);
74  selectCmd->SetRange("mode >=0");
75  currentChannel = 0;
76 
77  //Commnad /particle/property/decay/dump
78  dumpCmd = new G4UIcmdWithoutParameter("/particle/property/decay/dump",this);
79  dumpCmd->SetGuidance("Dump decay mode information.");
80 
81  //Command /particle/property/decay/br
82  brCmd = new G4UIcmdWithADouble("/particle/property/decay/br",this);
83  brCmd->SetGuidance("Set branching ratio. [0< BR <1.0]");
84  brCmd->SetParameterName("br",false);
85  brCmd->SetRange("(br >=0.0) && (br <=1.0)");
86 
87 }
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
static G4ParticleTable * GetParticleTable()
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
G4DecayTableMessenger::~G4DecayTableMessenger ( )
virtual

Definition at line 89 of file G4DecayTableMessenger.cc.

90 {
91  delete dumpCmd;
92  delete selectCmd;
93  delete brCmd;
94  delete thisDirectory;
95 }

Member Function Documentation

G4String G4DecayTableMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 176 of file G4DecayTableMessenger.cc.

References G4UIcommand::ConvertToString(), and G4VDecayChannel::GetBR().

177 {
178  G4String returnValue('\0');
179 
180  if (SetCurrentParticle()==0) {
181  // no particle is selected. return null
182  return returnValue;
183  }
184 
185  if( command == selectCmd ){
186  //Commnad /particle/property/decay/select
187  returnValue = selectCmd->ConvertToString(idxCurrentChannel);
188 
189  } else if( command == brCmd ){
190  if ( currentChannel != 0) {
191  returnValue = brCmd->ConvertToString(currentChannel->GetBR());
192  }
193  }
194  return returnValue;
195 }
G4double GetBR() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
void G4DecayTableMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 97 of file G4DecayTableMessenger.cc.

References G4DecayTable::DumpInfo(), G4cout, G4endl, G4DecayTable::GetDecayChannel(), G4UIcmdWithADouble::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), and G4VDecayChannel::SetBR().

98 {
99  if (SetCurrentParticle()==0) {
100  G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
101  return;
102  }
103  if (currentDecayTable==0) {
104  G4cout << "The particle has no decay table !! Command ignored." << G4endl;
105  return;
106  }
107 
108  if( command == dumpCmd ){
109  //Commnad /particle/property/decay/dump
110  currentDecayTable->DumpInfo();
111 
112  } else if ( command == selectCmd ){
113  //Commnad /particle/property/decay/select
114  G4int index = selectCmd->GetNewIntValue(newValue) ;
115  currentChannel = currentDecayTable->GetDecayChannel(index);
116  if ( currentChannel == 0 ) {
117  G4cout << "Invalid index. Command ignored." << G4endl;
118  } else {
119  idxCurrentChannel = index;
120  }
121 
122  } else {
123  if ( currentChannel == 0 ) {
124  G4cout << "Select a decay channel. Command ignored." << G4endl;
125  return;
126  }
127  if (command == brCmd) {
128  //Commnad /particle/property/decay/br
129  G4double br = brCmd->GetNewDoubleValue(newValue);
130  if( (br<0.0) || (br>1.0) ) {
131  G4cout << "Invalid brancing ratio. Command ignored." << G4endl;
132  } else {
133  currentChannel->SetBR(br);
134  }
135  }
136  }
137 }
void SetBR(G4double value)
static G4int GetNewIntValue(const char *paramString)
G4VDecayChannel * GetDecayChannel(G4int index) const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void DumpInfo() const
static G4double GetNewDoubleValue(const char *paramString)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

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