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