Geant4 11.4.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)
 ~G4DecayTableMessenger () override
void SetNewValue (G4UIcommand *command, G4String newValues) override
G4String GetCurrentValue (G4UIcommand *command) override
 G4DecayTableMessenger (const G4DecayTableMessenger &)=delete
G4DecayTableMessengeroperator= (const G4DecayTableMessenger &)=delete
Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
virtual ~G4UImessenger ()
G4bool CommandsShouldBeInMaster () const

Additional Inherited Members

Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
G4String LtoS (G4long l)
G4String DtoS (G4double a)
G4String BtoS (G4bool b)
G4int StoI (const G4String &s)
G4long StoL (const G4String &s)
G4double StoD (const G4String &s)
G4bool StoB (const 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 46 of file G4DecayTableMessenger.cc.

46 : theParticleTable(pTable)
47{
48 if (theParticleTable == nullptr) {
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()

Referenced by G4DecayTableMessenger(), and operator=().

◆ ~G4DecayTableMessenger()

G4DecayTableMessenger::~G4DecayTableMessenger ( )
override

Definition at line 76 of file G4DecayTableMessenger.cc.

77{
78 delete dumpCmd;
79 delete selectCmd;
80 delete brCmd;
81 delete thisDirectory;
82}

◆ G4DecayTableMessenger() [2/2]

G4DecayTableMessenger::G4DecayTableMessenger ( const G4DecayTableMessenger & )
delete

Member Function Documentation

◆ GetCurrentValue()

G4String G4DecayTableMessenger::GetCurrentValue ( G4UIcommand * command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 167 of file G4DecayTableMessenger.cc.

168{
169 G4String returnValue(1, '\0');
170
171 if (SetCurrentParticle() == nullptr) {
172 // no particle is selected. return null
173 return returnValue;
174 }
175
176 if (command == selectCmd) {
177 // Command /particle/property/decay/select
178 returnValue = selectCmd->ConvertToString(idxCurrentChannel);
179 }
180 else if (command == brCmd) {
181 if (currentChannel != nullptr) {
182 returnValue = brCmd->ConvertToString(currentChannel->GetBR());
183 }
184 }
185 return returnValue;
186}

◆ operator=()

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

◆ SetNewValue()

void G4DecayTableMessenger::SetNewValue ( G4UIcommand * command,
G4String newValues )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 84 of file G4DecayTableMessenger.cc.

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

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