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 // << 27 /// \file optical/LXe/src/LXeDetectorMessenger 26 /// \file optical/LXe/src/LXeDetectorMessenger.cc 28 /// \brief Implementation of the LXeDetectorMe 27 /// \brief Implementation of the LXeDetectorMessenger class 29 // 28 // 30 // 29 // 31 #include "LXeDetectorMessenger.hh" 30 #include "LXeDetectorMessenger.hh" 32 << 33 #include "LXeDetectorConstruction.hh" 31 #include "LXeDetectorConstruction.hh" 34 32 35 #include "G4RunManager.hh" << 36 #include "G4Scintillation.hh" << 37 #include "G4UIcmdWith3VectorAndUnit.hh" << 38 #include "G4UIcmdWithABool.hh" << 39 #include "G4UIcmdWithADouble.hh" << 40 #include "G4UIcmdWithADoubleAndUnit.hh" 33 #include "G4UIcmdWithADoubleAndUnit.hh" >> 34 #include "G4UIcmdWith3VectorAndUnit.hh" 41 #include "G4UIcmdWithAnInteger.hh" 35 #include "G4UIcmdWithAnInteger.hh" 42 #include "G4UIcommand.hh" 36 #include "G4UIcommand.hh" 43 #include "G4UIdirectory.hh" 37 #include "G4UIdirectory.hh" >> 38 #include "G4UIcmdWithABool.hh" >> 39 #include "G4UIcmdWithADouble.hh" >> 40 #include "G4Scintillation.hh" 44 41 45 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 43 47 LXeDetectorMessenger::LXeDetectorMessenger(LXe 44 LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* detector) 48 : fLXeDetector(detector) << 45 : fLXeDetector(detector) 49 { 46 { 50 // Setup a command directory for detector co << 47 //Setup a command directory for detector controls with guidance 51 fDetectorDir = new G4UIdirectory("/LXe/detec 48 fDetectorDir = new G4UIdirectory("/LXe/detector/"); 52 fDetectorDir->SetGuidance("Detector geometry 49 fDetectorDir->SetGuidance("Detector geometry control"); 53 50 54 fVolumesDir = new G4UIdirectory("/LXe/detect 51 fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/"); 55 fVolumesDir->SetGuidance("Enable/disable vol 52 fVolumesDir->SetGuidance("Enable/disable volumes"); 56 << 53 57 // Various commands for modifying detector g << 54 //Various commands for modifying detector geometry 58 fDimensionsCmd = new G4UIcmdWith3VectorAndUn << 55 fDimensionsCmd = >> 56 new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions",this); 59 fDimensionsCmd->SetGuidance("Set the dimensi 57 fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume."); 60 fDimensionsCmd->SetParameterName("scint_x", << 58 fDimensionsCmd->SetParameterName("scint_x","scint_y","scint_z",false); 61 fDimensionsCmd->SetDefaultUnit("cm"); 59 fDimensionsCmd->SetDefaultUnit("cm"); 62 fDimensionsCmd->AvailableForStates(G4State_P << 63 fDimensionsCmd->SetToBeBroadcasted(false); << 64 60 65 fHousingThicknessCmd = new G4UIcmdWithADoubl << 61 fHousingThicknessCmd = new G4UIcmdWithADoubleAndUnit >> 62 ("/LXe/detector/housingThickness",this); 66 fHousingThicknessCmd->SetGuidance("Set the t 63 fHousingThicknessCmd->SetGuidance("Set the thickness of the housing."); 67 fHousingThicknessCmd->SetParameterName("d_mt << 64 fHousingThicknessCmd->SetParameterName("d_mtl",false); 68 fHousingThicknessCmd->SetDefaultUnit("cm"); 65 fHousingThicknessCmd->SetDefaultUnit("cm"); 69 fHousingThicknessCmd->AvailableForStates(G4S << 70 fHousingThicknessCmd->SetToBeBroadcasted(fal << 71 66 72 fPmtRadiusCmd = new G4UIcmdWithADoubleAndUni << 67 fPmtRadiusCmd = new G4UIcmdWithADoubleAndUnit >> 68 ("/LXe/detector/pmtRadius",this); 73 fPmtRadiusCmd->SetGuidance("Set the radius o 69 fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs."); 74 fPmtRadiusCmd->SetParameterName("radius", fa << 70 fPmtRadiusCmd->SetParameterName("radius",false); 75 fPmtRadiusCmd->SetDefaultUnit("cm"); 71 fPmtRadiusCmd->SetDefaultUnit("cm"); 76 fPmtRadiusCmd->AvailableForStates(G4State_Pr << 77 fPmtRadiusCmd->SetToBeBroadcasted(false); << 78 72 79 fNxCmd = new G4UIcmdWithAnInteger("/LXe/dete << 73 fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx",this); 80 fNxCmd->SetGuidance("Set the number of PMTs 74 fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension."); 81 fNxCmd->SetParameterName("nx", false); << 75 fNxCmd->SetParameterName("nx",false); 82 fNxCmd->AvailableForStates(G4State_PreInit, << 83 fNxCmd->SetToBeBroadcasted(false); << 84 76 85 fNyCmd = new G4UIcmdWithAnInteger("/LXe/dete << 77 fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny",this); 86 fNyCmd->SetGuidance("Set the number of PMTs 78 fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension."); 87 fNyCmd->SetParameterName("ny", false); << 79 fNyCmd->SetParameterName("ny",false); 88 fNyCmd->AvailableForStates(G4State_PreInit, << 89 fNyCmd->SetToBeBroadcasted(false); << 90 80 91 fNzCmd = new G4UIcmdWithAnInteger("/LXe/dete << 81 fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz",this); 92 fNzCmd->SetGuidance("Set the number of PMTs 82 fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension."); 93 fNzCmd->SetParameterName("nz", false); << 83 fNzCmd->SetParameterName("nz",false); 94 fNzCmd->AvailableForStates(G4State_PreInit, << 95 fNzCmd->SetToBeBroadcasted(false); << 96 84 97 fSphereCmd = new G4UIcmdWithABool("/LXe/dete << 85 fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere",this); 98 fSphereCmd->SetGuidance("Enable/Disable the 86 fSphereCmd->SetGuidance("Enable/Disable the sphere."); 99 fSphereCmd->AvailableForStates(G4State_PreIn << 100 fSphereCmd->SetToBeBroadcasted(false); << 101 87 102 fReflectivityCmd = new G4UIcmdWithADouble("/ << 88 fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity",this); 103 fReflectivityCmd->SetGuidance("Set the refle 89 fReflectivityCmd->SetGuidance("Set the reflectivity of the housing."); 104 fReflectivityCmd->AvailableForStates(G4State << 105 fReflectivityCmd->SetToBeBroadcasted(false); << 106 90 107 fWlsCmd = new G4UIcmdWithABool("/LXe/detecto << 91 fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls",this); 108 fWlsCmd->SetGuidance("Enable/Disable the WLS 92 fWlsCmd->SetGuidance("Enable/Disable the WLS slab"); 109 fWlsCmd->AvailableForStates(G4State_PreInit, << 110 fWlsCmd->SetToBeBroadcasted(false); << 111 93 112 fLxeCmd = new G4UIcmdWithABool("/LXe/detecto << 94 fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe",this); 113 fLxeCmd->SetGuidance("Enable/Disable the mai 95 fLxeCmd->SetGuidance("Enable/Disable the main detector volume."); 114 fLxeCmd->AvailableForStates(G4State_PreInit, << 115 fLxeCmd->SetToBeBroadcasted(false); << 116 96 117 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe << 97 fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers",this); 118 fNFibersCmd->SetGuidance("Set the number of 98 fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab."); 119 fNFibersCmd->AvailableForStates(G4State_PreI << 120 fNFibersCmd->SetToBeBroadcasted(false); << 121 99 122 fMainScintYield = new G4UIcmdWithADouble("/L << 100 fUpdateCmd = new G4UIcommand("/LXe/detector/update",this); >> 101 fUpdateCmd->SetGuidance("Update the detector geometry with changed values."); >> 102 fUpdateCmd->SetGuidance >> 103 ("Must be run before beamOn if detector has been changed."); >> 104 >> 105 fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults",this); >> 106 fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults."); >> 107 fDefaultsCmd->SetGuidance("(Update still required)"); >> 108 >> 109 fMainScintYield=new G4UIcmdWithADouble("/LXe/detector/MainScintYield",this); 123 fMainScintYield->SetGuidance("Set scinitilla 110 fMainScintYield->SetGuidance("Set scinitillation yield of main volume."); 124 fMainScintYield->SetGuidance("Specified in p 111 fMainScintYield->SetGuidance("Specified in photons/MeV"); 125 fMainScintYield->AvailableForStates(G4State_ << 126 fMainScintYield->SetToBeBroadcasted(false); << 127 112 128 fWLSScintYield = new G4UIcmdWithADouble("/LX << 113 fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield",this); 129 fWLSScintYield->SetGuidance("Set scintillati 114 fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab"); 130 fWLSScintYield->SetGuidance("Specified in ph 115 fWLSScintYield->SetGuidance("Specified in photons/MeV"); 131 fWLSScintYield->AvailableForStates(G4State_P << 132 fWLSScintYield->SetToBeBroadcasted(false); << 133 << 134 fSaveThresholdCmd = new G4UIcmdWithAnInteger << 135 fSaveThresholdCmd->SetGuidance( << 136 "Set the photon count threshold for saving << 137 fSaveThresholdCmd->SetParameterName("photons << 138 fSaveThresholdCmd->SetDefaultValue(4500); << 139 fSaveThresholdCmd->AvailableForStates(G4Stat << 140 << 141 fDefaultsCmd = new G4UIcommand("/LXe/detecto << 142 fDefaultsCmd->SetGuidance("Set all detector << 143 fDefaultsCmd->AvailableForStates(G4State_Pre << 144 fDefaultsCmd->SetToBeBroadcasted(false); << 145 } 116 } 146 117 147 //....oooOO0OOooo........oooOO0OOooo........oo 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 119 149 LXeDetectorMessenger::~LXeDetectorMessenger() 120 LXeDetectorMessenger::~LXeDetectorMessenger() 150 { 121 { 151 delete fDimensionsCmd; 122 delete fDimensionsCmd; 152 delete fHousingThicknessCmd; 123 delete fHousingThicknessCmd; 153 delete fPmtRadiusCmd; 124 delete fPmtRadiusCmd; 154 delete fNxCmd; 125 delete fNxCmd; 155 delete fNyCmd; 126 delete fNyCmd; 156 delete fNzCmd; 127 delete fNzCmd; >> 128 delete fUpdateCmd; >> 129 delete fDetectorDir; >> 130 delete fVolumesDir; >> 131 delete fDefaultsCmd; 157 delete fSphereCmd; 132 delete fSphereCmd; 158 delete fWlsCmd; 133 delete fWlsCmd; 159 delete fLxeCmd; 134 delete fLxeCmd; 160 delete fNFibersCmd; 135 delete fNFibersCmd; 161 delete fReflectivityCmd; 136 delete fReflectivityCmd; 162 delete fMainScintYield; 137 delete fMainScintYield; 163 delete fWLSScintYield; 138 delete fWLSScintYield; 164 delete fSaveThresholdCmd; << 165 delete fDefaultsCmd; << 166 delete fDetectorDir; << 167 delete fVolumesDir; << 168 } 139 } 169 140 170 //....oooOO0OOooo........oooOO0OOooo........oo 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 171 142 172 void LXeDetectorMessenger::SetNewValue(G4UIcom 143 void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue) 173 { 144 { 174 if (command == fDimensionsCmd) { << 145 if( command == fDimensionsCmd ){ 175 fLXeDetector->SetDimensions(fDimensionsCmd 146 fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue)); 176 } 147 } 177 else if (command == fHousingThicknessCmd) { << 148 else if (command == fHousingThicknessCmd){ 178 fLXeDetector->SetHousingThickness(fHousing << 149 fLXeDetector->SetHousingThickness(fHousingThicknessCmd >> 150 ->GetNewDoubleValue(newValue)); 179 } 151 } 180 else if (command == fPmtRadiusCmd) { << 152 else if (command == fPmtRadiusCmd){ 181 fLXeDetector->SetPMTRadius(fPmtRadiusCmd-> 153 fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue)); 182 } 154 } 183 else if (command == fNxCmd) { << 155 else if (command == fNxCmd){ 184 fLXeDetector->SetNX(fNxCmd->GetNewIntValue 156 fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue)); 185 } 157 } 186 else if (command == fNyCmd) { << 158 else if (command == fNyCmd){ 187 fLXeDetector->SetNY(fNyCmd->GetNewIntValue 159 fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue)); 188 } 160 } 189 else if (command == fNzCmd) { << 161 else if (command == fNzCmd){ 190 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue 162 fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue)); 191 } 163 } 192 else if (command == fSphereCmd) { << 164 else if (command == fUpdateCmd){ >> 165 fLXeDetector->UpdateGeometry(); >> 166 } >> 167 else if (command == fDefaultsCmd){ >> 168 fLXeDetector->SetDefaults(); >> 169 } >> 170 else if (command == fSphereCmd){ 193 fLXeDetector->SetSphereOn(fSphereCmd->GetN 171 fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue)); 194 } 172 } 195 else if (command == fReflectivityCmd) { << 173 else if (command == fReflectivityCmd){ 196 fLXeDetector->SetHousingReflectivity(fRefl << 174 fLXeDetector >> 175 ->SetHousingReflectivity(fReflectivityCmd->GetNewDoubleValue(newValue)); 197 } 176 } 198 else if (command == fWlsCmd) { << 177 else if (command == fWlsCmd){ 199 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNew 178 fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue)); 200 } 179 } 201 else if (command == fLxeCmd) { << 180 else if (command == fLxeCmd){ 202 fLXeDetector->SetMainVolumeOn(fLxeCmd->Get 181 fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue)); 203 } 182 } 204 else if (command == fNFibersCmd) { << 183 else if (command == fNFibersCmd){ 205 fLXeDetector->SetNFibers(fNFibersCmd->GetN 184 fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue)); 206 } 185 } 207 else if (command == fMainScintYield) { << 186 else if (command == fMainScintYield){ 208 fLXeDetector->SetMainScintYield(fMainScint << 187 fLXeDetector->SetMainScintYield(fMainScintYield->GetNewDoubleValue(newValue)); 209 } 188 } 210 else if (command == fWLSScintYield) { << 189 else if (command == fWLSScintYield){ 211 fLXeDetector->SetWLSScintYield(fWLSScintYi 190 fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue)); 212 } << 213 else if (command == fSaveThresholdCmd) { << 214 fLXeDetector->SetSaveThreshold(fSaveThresh << 215 } << 216 else if (command == fDefaultsCmd) { << 217 fLXeDetector->SetDefaults(); << 218 G4RunManager::GetRunManager()->Reinitializ << 219 } 191 } 220 } 192 } 221 193