File indexing completed on 2025-10-13 08:28:02
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
0034
0035
0036
0037
0038
0039
0040 #include "DetectorMessenger.hh"
0041 #include "DetectorConstruction.hh"
0042 #include "PhysicsList.hh"
0043
0044 #include "G4UIcmdWithABool.hh"
0045 #include "G4UIcmdWithAString.hh"
0046 #include "G4UIcmdWithADoubleAndUnit.hh"
0047
0048
0049
0050 DetectorMessenger::DetectorMessenger(DetectorConstruction* det, PhysicsList* pl)
0051 :fDetector(det), fPhysList(pl)
0052 {
0053 fDetDir = new G4UIdirectory("/radial/");
0054 fDetDir->SetGuidance("radial commands");
0055
0056 fMatCmd = new G4UIcmdWithAString("/radial/setMat", this);
0057 fMatCmd->SetGuidance("Select material of the world.");
0058 fMatCmd->SetParameterName("Material", false);
0059 fMatCmd->AvailableForStates(G4State_PreInit);
0060 fMatCmd->SetToBeBroadcasted(false);
0061
0062 fPhysCmd = new G4UIcmdWithAString("/radial/addPhysics", this);
0063 fPhysCmd->SetGuidance("Added Physics List");
0064 fPhysCmd->SetParameterName("Physics", false);
0065 fPhysCmd->AvailableForStates(G4State_PreInit);
0066 fPhysCmd->SetToBeBroadcasted(false);
0067
0068 fTrackingCutCmd = new G4UIcmdWithABool("/radial/addIonsTrackingCut", this);
0069 fTrackingCutCmd->SetGuidance("Added Ions Tracking Cut");
0070 fTrackingCutCmd->SetDefaultValue(false);
0071 fTrackingCutCmd->AvailableForStates(G4State_PreInit);
0072 fTrackingCutCmd->SetToBeBroadcasted(false);
0073
0074 fWorldRadiusCmd = new G4UIcmdWithADoubleAndUnit("/radial/setWorldRadius",this);
0075 fWorldRadiusCmd->SetGuidance("Set size of the World");
0076 fWorldRadiusCmd->SetParameterName("Size",false);
0077 fWorldRadiusCmd->SetRange("Size>0.");
0078 fWorldRadiusCmd->SetUnitCategory("Length");
0079 fWorldRadiusCmd->AvailableForStates(G4State_PreInit);
0080
0081 fWorldLengthCmd = new G4UIcmdWithADoubleAndUnit("/radial/setWorldLength",this);
0082 fWorldLengthCmd->SetGuidance("Set size of the World");
0083 fWorldLengthCmd->SetParameterName("Size",false);
0084 fWorldLengthCmd->SetRange("Size>0.");
0085 fWorldLengthCmd->SetUnitCategory("Length");
0086 fWorldLengthCmd->AvailableForStates(G4State_PreInit);
0087
0088 fThicknessCylindersCmd = new G4UIcmdWithADoubleAndUnit("/radial/setThicknessCylinders",this);
0089 fThicknessCylindersCmd->SetGuidance("Set thickness of cylinders");
0090 fThicknessCylindersCmd->SetParameterName("Size",false);
0091 fThicknessCylindersCmd->SetRange("Size>0.");
0092 fThicknessCylindersCmd->SetUnitCategory("Length");
0093 fThicknessCylindersCmd->AvailableForStates(G4State_PreInit);
0094
0095 fMinRadiusCylindersCmd = new G4UIcmdWithADoubleAndUnit("/radial/setMinRadiusCylinders",this);
0096 fMinRadiusCylindersCmd->SetGuidance("Set minimum radius of the cylinders");
0097 fMinRadiusCylindersCmd->SetParameterName("Size",false);
0098 fMinRadiusCylindersCmd->SetRange("Size>0.");
0099 fMinRadiusCylindersCmd->SetUnitCategory("Length");
0100 fMinRadiusCylindersCmd->AvailableForStates(G4State_PreInit);
0101 }
0102
0103
0104
0105 DetectorMessenger::~DetectorMessenger()
0106 {
0107 delete fDetDir;
0108
0109 delete fMatCmd;
0110 delete fPhysCmd;
0111 delete fTrackingCutCmd;
0112 delete fWorldRadiusCmd;
0113 delete fWorldLengthCmd;
0114 delete fThicknessCylindersCmd;
0115 delete fMinRadiusCylindersCmd;
0116 }
0117
0118
0119
0120 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0121 {
0122 if (command == fMatCmd) fDetector->SetMaterial(newValue);
0123
0124 if (command == fPhysCmd) fPhysList->AddPhysics(newValue);
0125
0126 if (command == fTrackingCutCmd)
0127 fPhysList->SetTrackingCut(fTrackingCutCmd->GetNewBoolValue(newValue));
0128
0129 if (command == fWorldRadiusCmd)
0130 fDetector->SetWorldRadius(fWorldRadiusCmd->GetNewDoubleValue(newValue));
0131
0132 if (command == fWorldLengthCmd)
0133 fDetector->SetWorldLength(fWorldLengthCmd->GetNewDoubleValue(newValue));
0134
0135 if (command == fThicknessCylindersCmd)
0136 fDetector->SetThicknessCylinders(fThicknessCylindersCmd->GetNewDoubleValue(newValue));
0137
0138 if (command == fMinRadiusCylindersCmd)
0139 fDetector->SetMinRadiusCylinders(fMinRadiusCylindersCmd->GetNewDoubleValue(newValue));
0140 }