Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file optical/LXe/src/LXeDetectorMessenger 27 /// \file optical/LXe/src/LXeDetectorMessenger.cc 28 /// \brief Implementation of the LXeDetectorMe 28 /// \brief Implementation of the LXeDetectorMessenger class 29 // 29 // 30 // 30 // 31 #include "LXeDetectorMessenger.hh" 31 #include "LXeDetectorMessenger.hh" 32 32 33 #include "LXeDetectorConstruction.hh" 33 #include "LXeDetectorConstruction.hh" 34 34 35 #include "G4RunManager.hh" 35 #include "G4RunManager.hh" 36 #include "G4Scintillation.hh" 36 #include "G4Scintillation.hh" 37 #include "G4UIcmdWith3VectorAndUnit.hh" << 38 #include "G4UIcmdWithABool.hh" 37 #include "G4UIcmdWithABool.hh" 39 #include "G4UIcmdWithADouble.hh" 38 #include "G4UIcmdWithADouble.hh" 40 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithADoubleAndUnit.hh" 41 #include "G4UIcmdWithAnInteger.hh" 40 #include "G4UIcmdWithAnInteger.hh" >> 41 #include "G4UIcmdWith3VectorAndUnit.hh" 42 #include "G4UIcommand.hh" 42 #include "G4UIcommand.hh" 43 #include "G4UIdirectory.hh" 43 #include "G4UIdirectory.hh" 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 46 47 LXeDetectorMessenger::LXeDetectorMessenger(LXe 47 LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* detector) 48 : fLXeDetector(detector) 48 : fLXeDetector(detector) 49 { 49 { 50 // Setup a command directory for detector co 50 // Setup a command directory for detector controls with guidance 51 fDetectorDir = new G4UIdirectory("/LXe/detec 51 fDetectorDir = new G4UIdirectory("/LXe/detector/"); 52 fDetectorDir->SetGuidance("Detector geometry 52 fDetectorDir->SetGuidance("Detector geometry control"); 53 53 54 fVolumesDir = new G4UIdirectory("/LXe/detect 54 fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/"); 55 fVolumesDir->SetGuidance("Enable/disable vol 55 fVolumesDir->SetGuidance("Enable/disable volumes"); 56 56 57 // Various commands for modifying detector g 57 // Various commands for modifying detector geometry 58 fDimensionsCmd = new G4UIcmdWith3VectorAndUn << 58 fDimensionsCmd = >> 59 new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions", this); 59 fDimensionsCmd->SetGuidance("Set the dimensi 60 fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume."); 60 fDimensionsCmd->SetParameterName("scint_x", 61 fDimensionsCmd->SetParameterName("scint_x", "scint_y", "scint_z", false); 61 fDimensionsCmd->SetDefaultUnit("cm"); 62 fDimensionsCmd->SetDefaultUnit("cm"); 62 fDimensionsCmd->AvailableForStates(G4State_P 63 fDimensionsCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 63 fDimensionsCmd->SetToBeBroadcasted(false); 64 fDimensionsCmd->SetToBeBroadcasted(false); 64 65 65 fHousingThicknessCmd = new G4UIcmdWithADoubl << 66 fHousingThicknessCmd = >> 67 new G4UIcmdWithADoubleAndUnit("/LXe/detector/housingThickness", this); 66 fHousingThicknessCmd->SetGuidance("Set the t 68 fHousingThicknessCmd->SetGuidance("Set the thickness of the housing."); 67 fHousingThicknessCmd->SetParameterName("d_mt 69 fHousingThicknessCmd->SetParameterName("d_mtl", false); 68 fHousingThicknessCmd->SetDefaultUnit("cm"); 70 fHousingThicknessCmd->SetDefaultUnit("cm"); 69 fHousingThicknessCmd->AvailableForStates(G4S 71 fHousingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 70 fHousingThicknessCmd->SetToBeBroadcasted(fal 72 fHousingThicknessCmd->SetToBeBroadcasted(false); 71 73 72 fPmtRadiusCmd = new G4UIcmdWithADoubleAndUni << 74 fPmtRadiusCmd = >> 75 new G4UIcmdWithADoubleAndUnit("/LXe/detector/pmtRadius", this); 73 fPmtRadiusCmd->SetGuidance("Set the radius o 76 fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs."); 74 fPmtRadiusCmd->SetParameterName("radius", fa 77 fPmtRadiusCmd->SetParameterName("radius", false); 75 fPmtRadiusCmd->SetDefaultUnit("cm"); 78 fPmtRadiusCmd->SetDefaultUnit("cm"); 76 fPmtRadiusCmd->AvailableForStates(G4State_Pr 79 fPmtRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 77 fPmtRadiusCmd->SetToBeBroadcasted(false); 80 fPmtRadiusCmd->SetToBeBroadcasted(false); 78 81 79 fNxCmd = new G4UIcmdWithAnInteger("/LXe/dete 82 fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx", this); 80 fNxCmd->SetGuidance("Set the number of PMTs 83 fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension."); 81 fNxCmd->SetParameterName("nx", false); 84 fNxCmd->SetParameterName("nx", false); 82 fNxCmd->AvailableForStates(G4State_PreInit, 85 fNxCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 83 fNxCmd->SetToBeBroadcasted(false); 86 fNxCmd->SetToBeBroadcasted(false); 84 87 85 fNyCmd = new G4UIcmdWithAnInteger("/LXe/dete 88 fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny", this); 86 fNyCmd->SetGuidance("Set the number of PMTs 89 fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension."); 87 fNyCmd->SetParameterName("ny", false); 90 fNyCmd->SetParameterName("ny", false); 88 fNyCmd->AvailableForStates(G4State_PreInit, 91 fNyCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 89 fNyCmd->SetToBeBroadcasted(false); 92 fNyCmd->SetToBeBroadcasted(false); 90 93 91 fNzCmd = new G4UIcmdWithAnInteger("/LXe/dete 94 fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz", this); 92 fNzCmd->SetGuidance("Set the number of PMTs 95 fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension."); 93 fNzCmd->SetParameterName("nz", false); 96 fNzCmd->SetParameterName("nz", false); 94 fNzCmd->AvailableForStates(G4State_PreInit, 97 fNzCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 95 fNzCmd->SetToBeBroadcasted(false); 98 fNzCmd->SetToBeBroadcasted(false); 96 99 97 fSphereCmd = new G4UIcmdWithABool("/LXe/dete 100 fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere", this); 98 fSphereCmd->SetGuidance("Enable/Disable the 101 fSphereCmd->SetGuidance("Enable/Disable the sphere."); 99 fSphereCmd->AvailableForStates(G4State_PreIn 102 fSphereCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 100 fSphereCmd->SetToBeBroadcasted(false); 103 fSphereCmd->SetToBeBroadcasted(false); 101 104 102 fReflectivityCmd = new G4UIcmdWithADouble("/ 105 fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity", this); 103 fReflectivityCmd->SetGuidance("Set the refle 106 fReflectivityCmd->SetGuidance("Set the reflectivity of the housing."); 104 fReflectivityCmd->AvailableForStates(G4State 107 fReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 105 fReflectivityCmd->SetToBeBroadcasted(false); 108 fReflectivityCmd->SetToBeBroadcasted(false); 106 109 107 fWlsCmd = new G4UIcmdWithABool("/LXe/detecto 110 fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls", this); 108 fWlsCmd->SetGuidance("Enable/Disable the WLS 111 fWlsCmd->SetGuidance("Enable/Disable the WLS slab"); 109 fWlsCmd->AvailableForStates(G4State_PreInit, 112 fWlsCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 110 fWlsCmd->SetToBeBroadcasted(false); 113 fWlsCmd->SetToBeBroadcasted(false); 111 114 112 fLxeCmd = new G4UIcmdWithABool("/LXe/detecto 115 fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe", this); 113 fLxeCmd->SetGuidance("Enable/Disable the mai 116 fLxeCmd->SetGuidance("Enable/Disable the main detector volume."); 114 fLxeCmd->AvailableForStates(G4State_PreInit, 117 fLxeCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 115 fLxeCmd->SetToBeBroadcasted(false); 118 fLxeCmd->SetToBeBroadcasted(false); 116 119 117 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe 120 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers", this); 118 fNFibersCmd->SetGuidance("Set the number of 121 fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab."); 119 fNFibersCmd->AvailableForStates(G4State_PreI 122 fNFibersCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 120 fNFibersCmd->SetToBeBroadcasted(false); 123 fNFibersCmd->SetToBeBroadcasted(false); 121 124 122 fMainScintYield = new G4UIcmdWithADouble("/L << 125 fMainScintYield = >> 126 new G4UIcmdWithADouble("/LXe/detector/MainScintYield", this); 123 fMainScintYield->SetGuidance("Set scinitilla 127 fMainScintYield->SetGuidance("Set scinitillation yield of main volume."); 124 fMainScintYield->SetGuidance("Specified in p 128 fMainScintYield->SetGuidance("Specified in photons/MeV"); 125 fMainScintYield->AvailableForStates(G4State_ 129 fMainScintYield->AvailableForStates(G4State_PreInit, G4State_Idle); 126 fMainScintYield->SetToBeBroadcasted(false); 130 fMainScintYield->SetToBeBroadcasted(false); 127 131 128 fWLSScintYield = new G4UIcmdWithADouble("/LX 132 fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield", this); 129 fWLSScintYield->SetGuidance("Set scintillati 133 fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab"); 130 fWLSScintYield->SetGuidance("Specified in ph 134 fWLSScintYield->SetGuidance("Specified in photons/MeV"); 131 fWLSScintYield->AvailableForStates(G4State_P 135 fWLSScintYield->AvailableForStates(G4State_PreInit, G4State_Idle); 132 fWLSScintYield->SetToBeBroadcasted(false); 136 fWLSScintYield->SetToBeBroadcasted(false); 133 137 134 fSaveThresholdCmd = new G4UIcmdWithAnInteger 138 fSaveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold", this); 135 fSaveThresholdCmd->SetGuidance( 139 fSaveThresholdCmd->SetGuidance( 136 "Set the photon count threshold for saving 140 "Set the photon count threshold for saving the random number seed"); 137 fSaveThresholdCmd->SetParameterName("photons 141 fSaveThresholdCmd->SetParameterName("photons", true); 138 fSaveThresholdCmd->SetDefaultValue(4500); 142 fSaveThresholdCmd->SetDefaultValue(4500); 139 fSaveThresholdCmd->AvailableForStates(G4Stat 143 fSaveThresholdCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 140 144 141 fDefaultsCmd = new G4UIcommand("/LXe/detecto 145 fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults", this); 142 fDefaultsCmd->SetGuidance("Set all detector 146 fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults."); 143 fDefaultsCmd->AvailableForStates(G4State_Pre 147 fDefaultsCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 144 fDefaultsCmd->SetToBeBroadcasted(false); 148 fDefaultsCmd->SetToBeBroadcasted(false); 145 } 149 } 146 150 147 //....oooOO0OOooo........oooOO0OOooo........oo 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 152 149 LXeDetectorMessenger::~LXeDetectorMessenger() 153 LXeDetectorMessenger::~LXeDetectorMessenger() 150 { 154 { 151 delete fDimensionsCmd; 155 delete fDimensionsCmd; 152 delete fHousingThicknessCmd; 156 delete fHousingThicknessCmd; 153 delete fPmtRadiusCmd; 157 delete fPmtRadiusCmd; 154 delete fNxCmd; 158 delete fNxCmd; 155 delete fNyCmd; 159 delete fNyCmd; 156 delete fNzCmd; 160 delete fNzCmd; 157 delete fSphereCmd; 161 delete fSphereCmd; 158 delete fWlsCmd; 162 delete fWlsCmd; 159 delete fLxeCmd; 163 delete fLxeCmd; 160 delete fNFibersCmd; 164 delete fNFibersCmd; 161 delete fReflectivityCmd; 165 delete fReflectivityCmd; 162 delete fMainScintYield; 166 delete fMainScintYield; 163 delete fWLSScintYield; 167 delete fWLSScintYield; 164 delete fSaveThresholdCmd; 168 delete fSaveThresholdCmd; 165 delete fDefaultsCmd; 169 delete fDefaultsCmd; 166 delete fDetectorDir; 170 delete fDetectorDir; 167 delete fVolumesDir; 171 delete fVolumesDir; 168 } 172 } 169 173 170 //....oooOO0OOooo........oooOO0OOooo........oo 174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 171 175 172 void LXeDetectorMessenger::SetNewValue(G4UIcom 176 void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue) 173 { 177 { 174 if (command == fDimensionsCmd) { << 178 if(command == fDimensionsCmd) >> 179 { 175 fLXeDetector->SetDimensions(fDimensionsCmd 180 fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue)); 176 } 181 } 177 else if (command == fHousingThicknessCmd) { << 182 else if(command == fHousingThicknessCmd) 178 fLXeDetector->SetHousingThickness(fHousing << 183 { >> 184 fLXeDetector->SetHousingThickness( >> 185 fHousingThicknessCmd->GetNewDoubleValue(newValue)); 179 } 186 } 180 else if (command == fPmtRadiusCmd) { << 187 else if(command == fPmtRadiusCmd) >> 188 { 181 fLXeDetector->SetPMTRadius(fPmtRadiusCmd-> 189 fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue)); 182 } 190 } 183 else if (command == fNxCmd) { << 191 else if(command == fNxCmd) >> 192 { 184 fLXeDetector->SetNX(fNxCmd->GetNewIntValue 193 fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue)); 185 } 194 } 186 else if (command == fNyCmd) { << 195 else if(command == fNyCmd) >> 196 { 187 fLXeDetector->SetNY(fNyCmd->GetNewIntValue 197 fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue)); 188 } 198 } 189 else if (command == fNzCmd) { << 199 else if(command == fNzCmd) >> 200 { 190 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue 201 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue)); 191 } 202 } 192 else if (command == fSphereCmd) { << 203 else if(command == fSphereCmd) >> 204 { 193 fLXeDetector->SetSphereOn(fSphereCmd->GetN 205 fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue)); 194 } 206 } 195 else if (command == fReflectivityCmd) { << 207 else if(command == fReflectivityCmd) 196 fLXeDetector->SetHousingReflectivity(fRefl << 208 { >> 209 fLXeDetector->SetHousingReflectivity( >> 210 fReflectivityCmd->GetNewDoubleValue(newValue)); 197 } 211 } 198 else if (command == fWlsCmd) { << 212 else if(command == fWlsCmd) >> 213 { 199 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNew 214 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue)); 200 } 215 } 201 else if (command == fLxeCmd) { << 216 else if(command == fLxeCmd) >> 217 { 202 fLXeDetector->SetMainVolumeOn(fLxeCmd->Get 218 fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue)); 203 } 219 } 204 else if (command == fNFibersCmd) { << 220 else if(command == fNFibersCmd) >> 221 { 205 fLXeDetector->SetNFibers(fNFibersCmd->GetN 222 fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue)); 206 } 223 } 207 else if (command == fMainScintYield) { << 224 else if(command == fMainScintYield) 208 fLXeDetector->SetMainScintYield(fMainScint << 225 { >> 226 fLXeDetector->SetMainScintYield( >> 227 fMainScintYield->GetNewDoubleValue(newValue)); 209 } 228 } 210 else if (command == fWLSScintYield) { << 229 else if(command == fWLSScintYield) >> 230 { 211 fLXeDetector->SetWLSScintYield(fWLSScintYi 231 fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue)); 212 } 232 } 213 else if (command == fSaveThresholdCmd) { << 233 else if(command == fSaveThresholdCmd) >> 234 { 214 fLXeDetector->SetSaveThreshold(fSaveThresh 235 fLXeDetector->SetSaveThreshold(fSaveThresholdCmd->GetNewIntValue(newValue)); 215 } 236 } 216 else if (command == fDefaultsCmd) { << 237 else if(command == fDefaultsCmd) >> 238 { 217 fLXeDetector->SetDefaults(); 239 fLXeDetector->SetDefaults(); 218 G4RunManager::GetRunManager()->Reinitializ 240 G4RunManager::GetRunManager()->ReinitializeGeometry(); 219 } 241 } 220 } 242 } 221 243