Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4DecayTableMessenger Class Reference

#include <G4DecayTableMessenger.hh>

Inheritance diagram for G4DecayTableMessenger:
Collaboration diagram for G4DecayTableMessenger:

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
 
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 67 of file G4DecayTableMessenger.hh.

Constructor & Destructor Documentation

G4DecayTableMessenger::G4DecayTableMessenger ( G4ParticleTable pTable = 0)

Definition at line 58 of file G4DecayTableMessenger.cc.

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

Here is the call graph for this function:

G4DecayTableMessenger::~G4DecayTableMessenger ( )
virtual

Definition at line 92 of file G4DecayTableMessenger.cc.

93 {
94  delete dumpCmd;
95  delete selectCmd;
96  delete brCmd;
97  delete thisDirectory;
98 }

Member Function Documentation

G4String G4DecayTableMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 179 of file G4DecayTableMessenger.cc.

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

Here is the call graph for this function:

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

Reimplemented from G4UImessenger.

Definition at line 100 of file G4DecayTableMessenger.cc.

101 {
102  if (SetCurrentParticle()==0) {
103  G4cout << "Particle is not selected yet !! Command ignored." << G4endl;
104  return;
105  }
106  if (currentDecayTable==0) {
107  G4cout << "The particle has no decay table !! Command ignored." << G4endl;
108  return;
109  }
110 
111  if( command == dumpCmd ){
112  //Commnad /particle/property/decay/dump
113  currentDecayTable->DumpInfo();
114 
115  } else if ( command == selectCmd ){
116  //Commnad /particle/property/decay/select
117  G4int index = selectCmd->GetNewIntValue(newValue) ;
118  currentChannel = currentDecayTable->GetDecayChannel(index);
119  if ( currentChannel == 0 ) {
120  G4cout << "Invalid index. Command ignored." << G4endl;
121  } else {
122  idxCurrentChannel = index;
123  }
124 
125  } else {
126  if ( currentChannel == 0 ) {
127  G4cout << "Select a decay channel. Command ignored." << G4endl;
128  return;
129  }
130  if (command == brCmd) {
131  //Commnad /particle/property/decay/br
132  G4double br = brCmd->GetNewDoubleValue(newValue);
133  if( (br<0.0) || (br>1.0) ) {
134  G4cout << "Invalid brancing ratio. Command ignored." << G4endl;
135  } else {
136  currentChannel->SetBR(br);
137  }
138  }
139  }
140 }
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

Here is the call graph for this function:


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