File indexing completed on 2025-12-16 09:31:10
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 #include "DetectorMessenger.hh"
0035
0036 #include "DetectorConstruction.hh"
0037
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithAString.hh"
0040 #include "G4UIcmdWithAnInteger.hh"
0041 #include "G4UIdirectory.hh"
0042
0043
0044
0045 DetectorMessenger::DetectorMessenger(DetectorConstruction* Det)
0046 : G4UImessenger(),
0047 fDetector(Det),
0048 fTestemDir(0),
0049 fDetDir(0),
0050 fNPMaterCmd(0),
0051 fNReplicaRCmd(0),
0052 fNReplicaAzmCmd(0),
0053 fAbsRadiusCmd(0),
0054 fNPRadiusCmd(0),
0055 fTrackingCutCmd(0)
0056 {
0057 fTestemDir = new G4UIdirectory("/AuNP/");
0058 fTestemDir->SetGuidance("Detector control.");
0059
0060 fDetDir = new G4UIdirectory("/AuNP/det/");
0061 fDetDir->SetGuidance("Detector construction commands");
0062
0063 fNPMaterCmd = new G4UIcmdWithAString("/AuNP/det/setNPMat", this);
0064 fNPMaterCmd->SetGuidance("Select material of the sphere.");
0065 fNPMaterCmd->SetParameterName("choice", false);
0066 fNPMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067 fNPMaterCmd->SetToBeBroadcasted(false);
0068
0069 fNReplicaRCmd = new G4UIcmdWithAnInteger("/AuNP/det/setNReplicaR", this);
0070 fNReplicaRCmd->SetGuidance("Set Number of Replica in R direction");
0071 fNReplicaRCmd->SetParameterName("NR", false);
0072 fNReplicaRCmd->SetRange("NR>0");
0073 fNReplicaRCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0074 fNReplicaRCmd->SetToBeBroadcasted(false);
0075
0076 fNReplicaAzmCmd = new G4UIcmdWithAnInteger("/AuNP/det/setNReplicaAzm", this);
0077 fNReplicaAzmCmd->SetGuidance("Set Number of Replica in Azimuthal direction");
0078 fNReplicaAzmCmd->SetParameterName("NAzm", false);
0079 fNReplicaAzmCmd->SetRange("NAzm>0");
0080 fNReplicaAzmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081 fNReplicaAzmCmd->SetToBeBroadcasted(false);
0082
0083 fAbsRadiusCmd = new G4UIcmdWithADoubleAndUnit("/AuNP/det/setAbsRadius", this);
0084 fAbsRadiusCmd->SetGuidance("Set radius of the absorber");
0085 fAbsRadiusCmd->SetParameterName("Radius", false);
0086 fAbsRadiusCmd->SetRange("Radius>0.");
0087 fAbsRadiusCmd->SetUnitCategory("Length");
0088 fAbsRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0089 fAbsRadiusCmd->SetToBeBroadcasted(false);
0090
0091 fNPRadiusCmd = new G4UIcmdWithADoubleAndUnit("/AuNP/det/setNPRadius", this);
0092 fNPRadiusCmd->SetGuidance("Set radius of the nano particle");
0093 fNPRadiusCmd->SetParameterName("Radius", false);
0094 fNPRadiusCmd->SetRange("Radius>0.");
0095 fNPRadiusCmd->SetUnitCategory("Length");
0096 fNPRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0097 fNPRadiusCmd->SetToBeBroadcasted(false);
0098
0099 fTrackingCutCmd = new G4UIcmdWithADoubleAndUnit("/AuNP/det/setTrackingCut", this);
0100 fTrackingCutCmd->SetGuidance("Set tracking cut in the absorber");
0101 fTrackingCutCmd->SetParameterName("Cut", false);
0102 fTrackingCutCmd->SetRange("Cut>0.");
0103 fTrackingCutCmd->SetUnitCategory("Energy");
0104 fTrackingCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0105 fTrackingCutCmd->SetToBeBroadcasted(false);
0106 }
0107
0108
0109
0110 DetectorMessenger::~DetectorMessenger()
0111 {
0112 delete fNPMaterCmd;
0113 delete fNReplicaRCmd;
0114 delete fNReplicaAzmCmd;
0115 delete fAbsRadiusCmd;
0116 delete fNPRadiusCmd;
0117 delete fTrackingCutCmd;
0118 delete fDetDir;
0119 delete fTestemDir;
0120 }
0121
0122
0123
0124 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0125 {
0126 if (command == fNPMaterCmd) {
0127 fDetector->SetNPMaterial(newValue);
0128 }
0129
0130 if (command == fNReplicaRCmd) {
0131 fDetector->SetNReplicaR(fNReplicaRCmd->GetNewIntValue(newValue));
0132 }
0133
0134 if (command == fNReplicaAzmCmd) {
0135 fDetector->SetNReplicaAzm(fNReplicaAzmCmd->GetNewIntValue(newValue));
0136 }
0137
0138 if (command == fAbsRadiusCmd) {
0139 fDetector->SetAbsRadius(fAbsRadiusCmd->GetNewDoubleValue(newValue));
0140 }
0141
0142 if (command == fNPRadiusCmd) {
0143 fDetector->SetNPRadius(fNPRadiusCmd->GetNewDoubleValue(newValue));
0144 }
0145
0146 if (command == fTrackingCutCmd) {
0147 fDetector->SetTrackingCut(fTrackingCutCmd->GetNewDoubleValue(newValue));
0148 }
0149 }
0150
0151