File indexing completed on 2025-12-15 09:32:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "RBEMessenger.hh"
0031
0032 #include "RBE.hh"
0033 #include <G4UIcmdWithABool.hh>
0034 #include <G4UIcmdWithADouble.hh>
0035 #include <G4UIcmdWithAString.hh>
0036 #include <G4UIcmdWithAnInteger.hh>
0037 #include <G4UIcmdWithoutParameter.hh>
0038 #include <G4UIdirectory.hh>
0039
0040 namespace RadioBio
0041 {
0042
0043
0044
0045 RBEMessenger::RBEMessenger(RBE* rbe) : G4UImessenger(), fRBE(rbe)
0046 {
0047
0048 fRBEDir = new G4UIdirectory("/rbe/");
0049 fRBEDir->SetGuidance("commands to setup RBE calculation");
0050
0051
0052 fCalculationCmd = new G4UIcmdWithABool("/rbe/calculate", this);
0053 fCalculationCmd->SetGuidance("Whether to enable RBE calculation");
0054 fCalculationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0055 fCalculationCmd->SetToBeBroadcasted(false);
0056
0057
0058 fVerbosityCmd = new G4UIcmdWithAnInteger("/rbe/verbose", this);
0059 fVerbosityCmd->SetGuidance("Set verbosity level of RBE");
0060 fVerbosityCmd->SetGuidance("0 = quiet");
0061 fVerbosityCmd->SetGuidance("1 = important messages (~10 per run)");
0062 fVerbosityCmd->SetGuidance("2 = debug");
0063 fVerbosityCmd->SetToBeBroadcasted(false);
0064
0065
0066 fLemTableCmd = new G4UIcmdWithAString("/rbe/loadLemTable", this);
0067 fLemTableCmd->SetGuidance("Load a LEM table used in calculating alpha&beta");
0068 fLemTableCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0069 fLemTableCmd->SetToBeBroadcasted(false);
0070
0071
0072 fCellLineCmd = new G4UIcmdWithAString("/rbe/cellLine", this);
0073 fCellLineCmd->SetGuidance("Set the cell line for alpha&beta calculation");
0074 fCellLineCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075 fCellLineCmd->SetToBeBroadcasted(false);
0076
0077
0078 fResetCmd = new G4UIcmdWithoutParameter("/rbe/reset", this);
0079 fResetCmd->SetGuidance("Reset accumulated data");
0080 fResetCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081 fResetCmd->SetToBeBroadcasted(false);
0082
0083
0084 fPrintCmd = new G4UIcmdWithoutParameter("/rbe/print", this);
0085 fPrintCmd->SetGuidance("Print RBE parameters");
0086 fPrintCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0087 fPrintCmd->SetToBeBroadcasted(false);
0088 }
0089
0090
0091
0092 RBEMessenger::~RBEMessenger()
0093 {
0094 delete fRBEDir;
0095 delete fCalculationCmd;
0096 delete fVerbosityCmd;
0097 delete fLemTableCmd;
0098 delete fCellLineCmd;
0099 delete fResetCmd;
0100 delete fPrintCmd;
0101 }
0102
0103
0104
0105 void RBEMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0106 {
0107 if (command == fCalculationCmd) {
0108 fRBE->SetCalculationEnabled(fCalculationCmd->GetNewBoolValue(newValue));
0109 }
0110
0111 if (command == fVerbosityCmd) {
0112 fRBE->SetVerboseLevel(fVerbosityCmd->GetNewIntValue(newValue));
0113 }
0114
0115 if (command == fLemTableCmd) {
0116 fRBE->LoadLEMTable(newValue);
0117 }
0118
0119 if (command == fCellLineCmd) {
0120 fRBE->SetCellLine(newValue);
0121 }
0122
0123 if (command == fResetCmd) {
0124 fRBE->Reset();
0125 }
0126
0127 if (command == fPrintCmd) {
0128 fRBE->PrintParameters();
0129 }
0130 }
0131
0132
0133
0134 }