File indexing completed on 2026-03-31 07:50:42
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 "LXeDetectorMessenger.hh"
0030
0031 #include "LXeDetectorConstruction.hh"
0032
0033 #include "G4RunManager.hh"
0034 #include "G4Scintillation.hh"
0035 #include "G4UIcmdWith3VectorAndUnit.hh"
0036 #include "G4UIcmdWithABool.hh"
0037 #include "G4UIcmdWithADouble.hh"
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithAnInteger.hh"
0040 #include "G4UIcommand.hh"
0041 #include "G4UIdirectory.hh"
0042
0043
0044
0045 LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* detector)
0046 : fLXeDetector(detector)
0047 {
0048
0049 fDetectorDir = new G4UIdirectory("/LXe/detector/");
0050 fDetectorDir->SetGuidance("Detector geometry control");
0051
0052 fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/");
0053 fVolumesDir->SetGuidance("Enable/disable volumes");
0054
0055
0056 fDimensionsCmd = new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions", this);
0057 fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume.");
0058 fDimensionsCmd->SetParameterName("scint_x", "scint_y", "scint_z", false);
0059 fDimensionsCmd->SetDefaultUnit("cm");
0060 fDimensionsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0061 fDimensionsCmd->SetToBeBroadcasted(false);
0062
0063 fHousingThicknessCmd = new G4UIcmdWithADoubleAndUnit("/LXe/detector/housingThickness", this);
0064 fHousingThicknessCmd->SetGuidance("Set the thickness of the housing.");
0065 fHousingThicknessCmd->SetParameterName("d_mtl", false);
0066 fHousingThicknessCmd->SetDefaultUnit("cm");
0067 fHousingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0068 fHousingThicknessCmd->SetToBeBroadcasted(false);
0069
0070 fPmtRadiusCmd = new G4UIcmdWithADoubleAndUnit("/LXe/detector/pmtRadius", this);
0071 fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs.");
0072 fPmtRadiusCmd->SetParameterName("radius", false);
0073 fPmtRadiusCmd->SetDefaultUnit("cm");
0074 fPmtRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075 fPmtRadiusCmd->SetToBeBroadcasted(false);
0076
0077 fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx", this);
0078 fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension.");
0079 fNxCmd->SetParameterName("nx", false);
0080 fNxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081 fNxCmd->SetToBeBroadcasted(false);
0082
0083 fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny", this);
0084 fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension.");
0085 fNyCmd->SetParameterName("ny", false);
0086 fNyCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0087 fNyCmd->SetToBeBroadcasted(false);
0088
0089 fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz", this);
0090 fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension.");
0091 fNzCmd->SetParameterName("nz", false);
0092 fNzCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0093 fNzCmd->SetToBeBroadcasted(false);
0094
0095 fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere", this);
0096 fSphereCmd->SetGuidance("Enable/Disable the sphere.");
0097 fSphereCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0098 fSphereCmd->SetToBeBroadcasted(false);
0099
0100 fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity", this);
0101 fReflectivityCmd->SetGuidance("Set the reflectivity of the housing.");
0102 fReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0103 fReflectivityCmd->SetToBeBroadcasted(false);
0104
0105 fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls", this);
0106 fWlsCmd->SetGuidance("Enable/Disable the WLS slab");
0107 fWlsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0108 fWlsCmd->SetToBeBroadcasted(false);
0109
0110 fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe", this);
0111 fLxeCmd->SetGuidance("Enable/Disable the main detector volume.");
0112 fLxeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0113 fLxeCmd->SetToBeBroadcasted(false);
0114
0115 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers", this);
0116 fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab.");
0117 fNFibersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0118 fNFibersCmd->SetToBeBroadcasted(false);
0119
0120 fMainScintYield = new G4UIcmdWithADouble("/LXe/detector/MainScintYield", this);
0121 fMainScintYield->SetGuidance("Set scinitillation yield of main volume.");
0122 fMainScintYield->SetGuidance("Specified in photons/MeV");
0123 fMainScintYield->AvailableForStates(G4State_PreInit, G4State_Idle);
0124 fMainScintYield->SetToBeBroadcasted(false);
0125
0126 fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield", this);
0127 fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab");
0128 fWLSScintYield->SetGuidance("Specified in photons/MeV");
0129 fWLSScintYield->AvailableForStates(G4State_PreInit, G4State_Idle);
0130 fWLSScintYield->SetToBeBroadcasted(false);
0131
0132 fSaveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold", this);
0133 fSaveThresholdCmd->SetGuidance(
0134 "Set the photon count threshold for saving the random number seed");
0135 fSaveThresholdCmd->SetParameterName("photons", true);
0136 fSaveThresholdCmd->SetDefaultValue(4500);
0137 fSaveThresholdCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0138
0139 fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults", this);
0140 fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults.");
0141 fDefaultsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0142 fDefaultsCmd->SetToBeBroadcasted(false);
0143 }
0144
0145
0146
0147 LXeDetectorMessenger::~LXeDetectorMessenger()
0148 {
0149 delete fDimensionsCmd;
0150 delete fHousingThicknessCmd;
0151 delete fPmtRadiusCmd;
0152 delete fNxCmd;
0153 delete fNyCmd;
0154 delete fNzCmd;
0155 delete fSphereCmd;
0156 delete fWlsCmd;
0157 delete fLxeCmd;
0158 delete fNFibersCmd;
0159 delete fReflectivityCmd;
0160 delete fMainScintYield;
0161 delete fWLSScintYield;
0162 delete fSaveThresholdCmd;
0163 delete fDefaultsCmd;
0164 delete fDetectorDir;
0165 delete fVolumesDir;
0166 }
0167
0168
0169
0170 void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0171 {
0172 if (command == fDimensionsCmd) {
0173 fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue));
0174 }
0175 else if (command == fHousingThicknessCmd) {
0176 fLXeDetector->SetHousingThickness(fHousingThicknessCmd->GetNewDoubleValue(newValue));
0177 }
0178 else if (command == fPmtRadiusCmd) {
0179 fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue));
0180 }
0181 else if (command == fNxCmd) {
0182 fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue));
0183 }
0184 else if (command == fNyCmd) {
0185 fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue));
0186 }
0187 else if (command == fNzCmd) {
0188 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue));
0189 }
0190 else if (command == fSphereCmd) {
0191 fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue));
0192 }
0193 else if (command == fReflectivityCmd) {
0194 fLXeDetector->SetHousingReflectivity(fReflectivityCmd->GetNewDoubleValue(newValue));
0195 }
0196 else if (command == fWlsCmd) {
0197 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue));
0198 }
0199 else if (command == fLxeCmd) {
0200 fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue));
0201 }
0202 else if (command == fNFibersCmd) {
0203 fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue));
0204 }
0205 else if (command == fMainScintYield) {
0206 fLXeDetector->SetMainScintYield(fMainScintYield->GetNewDoubleValue(newValue));
0207 }
0208 else if (command == fWLSScintYield) {
0209 fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue));
0210 }
0211 else if (command == fSaveThresholdCmd) {
0212 fLXeDetector->SetSaveThreshold(fSaveThresholdCmd->GetNewIntValue(newValue));
0213 }
0214 else if (command == fDefaultsCmd) {
0215 fLXeDetector->SetDefaults();
0216 G4RunManager::GetRunManager()->ReinitializeGeometry();
0217 }
0218 }