48 if (theParticleTable ==
nullptr) {
51 currentParticle =
nullptr;
54 thisDirectory =
new G4UIdirectory(
"/particle/property/decay/");
55 thisDirectory->SetGuidance(
"Decay Table control commands.");
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;
67 dumpCmd->SetGuidance(
"Dump decay mode information.");
71 brCmd->SetGuidance(
"Set branching ratio. [0< BR <1.0]");
72 brCmd->SetParameterName(
"br",
false);
73 brCmd->SetRange(
"(br >=0.0) && (br <=1.0)");
86 if (SetCurrentParticle() ==
nullptr) {
87 G4cout <<
"Particle is not selected yet !! Command ignored." <<
G4endl;
90 if (currentDecayTable ==
nullptr) {
91 G4cout <<
"The particle has no decay table !! Command ignored." <<
G4endl;
95 if (command == dumpCmd) {
97 currentDecayTable->DumpInfo();
99 else if (command == selectCmd) {
101 G4int index = selectCmd->GetNewIntValue(newValue);
102 currentChannel = currentDecayTable->GetDecayChannel(index);
103 if (currentChannel ==
nullptr) {
107 idxCurrentChannel = index;
111 if (currentChannel ==
nullptr) {
112 G4cout <<
"Select a decay channel. Command ignored." <<
G4endl;
115 if (command == brCmd) {
117 G4double br = brCmd->GetNewDoubleValue(newValue);
118 if ((br < 0.0) || (br > 1.0)) {
119 G4cout <<
"Invalid brancing ratio. Command ignored." <<
G4endl;
122 currentChannel->SetBR(br);
135 if (currentParticle !=
nullptr) {
138 currentParticle = theParticleTable->
FindParticle(particleName);
139 idxCurrentChannel = -1;
140 currentDecayTable =
nullptr;
144 return currentParticle;
148 currentParticle = theParticleTable->FindParticle(particleName);
149 idxCurrentChannel = -1;
150 currentDecayTable =
nullptr;
153 if (currentParticle !=
nullptr) {
154 currentDecayTable = currentParticle->GetDecayTable();
155 if ((currentDecayTable !=
nullptr) && (idxCurrentChannel > 0)) {
156 currentChannel = currentDecayTable->GetDecayChannel(idxCurrentChannel);
159 idxCurrentChannel = -1;
160 currentChannel =
nullptr;
164 return currentParticle;
171 if (SetCurrentParticle() ==
nullptr) {
176 if (command == selectCmd) {
178 returnValue = selectCmd->ConvertToString(idxCurrentChannel);
180 else if (command == brCmd) {
181 if (currentChannel !=
nullptr) {
182 returnValue = brCmd->ConvertToString(currentChannel->GetBR());
G4GLOB_DLL std::ostream G4cout
G4String GetCurrentValue(G4UIcommand *command) override
~G4DecayTableMessenger() override
G4DecayTableMessenger(G4ParticleTable *pTable=nullptr)
void SetNewValue(G4UIcommand *command, G4String newValues) override
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
static G4UImanager * GetUIpointer()