Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DecayTableMessenger Class Reference

#include <G4DecayTableMessenger.hh>

+ Inheritance diagram for G4DecayTableMessenger:

Public Member Functions

 G4DecayTableMessenger (G4ParticleTable *pTable=nullptr)
 
virtual ~G4DecayTableMessenger ()
 
virtual void SetNewValue (G4UIcommand *command, G4String newValues)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
 G4DecayTableMessenger (const G4DecayTableMessenger &)=delete
 
G4DecayTableMessengeroperator= (const G4DecayTableMessenger &)=delete
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
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)
 
G4long StoL (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 = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 57 of file G4DecayTableMessenger.hh.

Constructor & Destructor Documentation

◆ G4DecayTableMessenger() [1/2]

G4DecayTableMessenger::G4DecayTableMessenger ( G4ParticleTable pTable = nullptr)

Definition at line 44 of file G4DecayTableMessenger.cc.

45 : theParticleTable(pTable)
46{
47 if ( theParticleTable == nullptr )
48 {
49 theParticleTable = G4ParticleTable::GetParticleTable();
50 }
51 currentParticle = nullptr;
52
53 // Command /particle/property/decay/
54 thisDirectory = new G4UIdirectory("/particle/property/decay/");
55 thisDirectory->SetGuidance("Decay Table control commands.");
56
57 // Command /particle/property/decay/select
58 selectCmd = new G4UIcmdWithAnInteger("/particle/property/decay/select",this);
59 selectCmd->SetGuidance("Enter index of decay mode.");
60 selectCmd->SetParameterName("mode", true);
61 selectCmd->SetDefaultValue(0);
62 selectCmd->SetRange("mode >=0");
63 currentChannel = nullptr;
64
65 // Command /particle/property/decay/dump
66 dumpCmd = new G4UIcmdWithoutParameter("/particle/property/decay/dump",this);
67 dumpCmd->SetGuidance("Dump decay mode information.");
68
69 // Command /particle/property/decay/br
70 brCmd = new G4UIcmdWithADouble("/particle/property/decay/br",this);
71 brCmd->SetGuidance("Set branching ratio. [0< BR <1.0]");
72 brCmd->SetParameterName("br",false);
73 brCmd->SetRange("(br >=0.0) && (br <=1.0)");
74}
static G4ParticleTable * GetParticleTable()
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120

◆ ~G4DecayTableMessenger()

G4DecayTableMessenger::~G4DecayTableMessenger ( )
virtual

Definition at line 76 of file G4DecayTableMessenger.cc.

77{
78 if (dumpCmd != nullptr) delete dumpCmd;
79 if (selectCmd != nullptr) delete selectCmd;
80 if (brCmd != nullptr) delete brCmd;
81 if (thisDirectory != nullptr) delete thisDirectory;
82}

◆ G4DecayTableMessenger() [2/2]

G4DecayTableMessenger::G4DecayTableMessenger ( const G4DecayTableMessenger )
delete

Member Function Documentation

◆ GetCurrentValue()

G4String G4DecayTableMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 190 of file G4DecayTableMessenger.cc.

191{
192 G4String returnValue('\0');
193
194 if (SetCurrentParticle() == nullptr)
195 {
196 // no particle is selected. return null
197 return returnValue;
198 }
199
200 if( command == selectCmd )
201 {
202 // Command /particle/property/decay/select
203 returnValue = selectCmd->ConvertToString(idxCurrentChannel);
204
205 }
206 else if( command == brCmd )
207 {
208 if ( currentChannel != nullptr)
209 {
210 returnValue = brCmd->ConvertToString(currentChannel->GetBR());
211 }
212 }
213 return returnValue;
214}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:430
G4double GetBR() const

◆ operator=()

G4DecayTableMessenger & G4DecayTableMessenger::operator= ( const G4DecayTableMessenger )
delete

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 84 of file G4DecayTableMessenger.cc.

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

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