File indexing completed on 2026-09-13 08:30:23
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 #include "TrackingMessenger.hh"
0030
0031 #include "TrackingAction.hh"
0032
0033 #include "G4UIcmdWithABool.hh"
0034 #include "G4UIcommand.hh"
0035 #include "G4UIparameter.hh"
0036
0037
0038
0039 TrackingMessenger::TrackingMessenger(TrackingAction* trackA) : fTrackingAction(trackA)
0040 {
0041 fTrackingCmd = new G4UIcmdWithABool("/rdecay01/fullChain", this);
0042 fTrackingCmd->SetGuidance("allow full decay chain");
0043 fTrackingCmd->SetParameterName("flag", true);
0044 fTrackingCmd->SetDefaultValue(true);
0045
0046 fTimeWindowCmd = new G4UIcommand("/rdecay01/timeWindow", this);
0047 fTimeWindowCmd->SetGuidance("set time window to survey activity per nuclide");
0048 fTimeWindowCmd->SetGuidance(" t1, delta_t");
0049
0050 G4UIparameter* t1Prm = new G4UIparameter("t1", 'd', false);
0051 t1Prm->SetGuidance("time_1");
0052 t1Prm->SetParameterRange("t1>=0.");
0053 fTimeWindowCmd->SetParameter(t1Prm);
0054
0055 G4UIparameter* unit1Prm = new G4UIparameter("unit1", 's', false);
0056 unit1Prm->SetGuidance("unit of t1");
0057 G4String unitList = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("second"));
0058 unit1Prm->SetParameterCandidates(unitList);
0059 fTimeWindowCmd->SetParameter(unit1Prm);
0060
0061 G4UIparameter* dtPrm = new G4UIparameter("dt", 'd', false);
0062 dtPrm->SetGuidance("delta_t");
0063 dtPrm->SetParameterRange("dt>0.");
0064 fTimeWindowCmd->SetParameter(dtPrm);
0065
0066 G4UIparameter* unit2Prm = new G4UIparameter("unit2", 's', false);
0067 unit2Prm->SetGuidance("unit of dt");
0068 unit2Prm->SetParameterCandidates(unitList);
0069 fTimeWindowCmd->SetParameter(unit2Prm);
0070
0071 fTimeWindowCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0072 }
0073
0074
0075
0076 TrackingMessenger::~TrackingMessenger()
0077 {
0078 delete fTrackingCmd;
0079 delete fTimeWindowCmd;
0080 }
0081
0082
0083
0084 void TrackingMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0085 {
0086 if (command == fTrackingCmd) {
0087 fTrackingAction->SetFullChain(fTrackingCmd->GetNewBoolValue(newValue));
0088 }
0089
0090 if (command == fTimeWindowCmd) {
0091 G4double t1;
0092 G4double dt;
0093 G4String unt1, unt2;
0094 std::istringstream is(newValue);
0095 is >> t1 >> unt1 >> dt >> unt2;
0096 t1 *= G4UIcommand::ValueOf(unt1);
0097 dt *= G4UIcommand::ValueOf(unt2);
0098 fTrackingAction->SetTimeWindow(t1, dt);
0099 }
0100 }
0101
0102