[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | #include "LXeDetectorMessenger.hh" |
---|
| 27 | #include "LXeDetectorConstruction.hh" |
---|
| 28 | |
---|
| 29 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 30 | #include "G4UIcmdWith3VectorAndUnit.hh" |
---|
| 31 | #include "G4UIcmdWithAnInteger.hh" |
---|
| 32 | #include "G4UIcommand.hh" |
---|
| 33 | #include "G4UIdirectory.hh" |
---|
| 34 | #include "G4UIcmdWithABool.hh" |
---|
| 35 | #include "G4UIcmdWithADouble.hh" |
---|
| 36 | #include "G4Scintillation.hh" |
---|
| 37 | |
---|
| 38 | //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
---|
| 39 | LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* LXeDetect) |
---|
| 40 | :LXeDetector(LXeDetect) |
---|
| 41 | { |
---|
| 42 | //Setup a command directory for detector controls with guidance |
---|
| 43 | detectorDir = new G4UIdirectory("/LXe/detector/"); |
---|
| 44 | detectorDir->SetGuidance("Detector geometry control"); |
---|
| 45 | |
---|
| 46 | volumesDir = new G4UIdirectory("/LXe/detector/volumes/"); |
---|
| 47 | volumesDir->SetGuidance("Enable/disable volumes"); |
---|
| 48 | |
---|
| 49 | //Various commands for modifying detector geometry |
---|
| 50 | dimensionsCmd = |
---|
| 51 | new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions",this); |
---|
| 52 | dimensionsCmd->SetGuidance("Set the dimensions of the detector volume."); |
---|
| 53 | dimensionsCmd->SetParameterName("scint_x","scint_y","scint_z",false); |
---|
| 54 | dimensionsCmd->SetDefaultUnit("cm"); |
---|
| 55 | |
---|
| 56 | housingThicknessCmd = new G4UIcmdWithADoubleAndUnit |
---|
| 57 | ("/LXe/detector/housingThickness",this); |
---|
| 58 | housingThicknessCmd->SetGuidance("Set the thickness of the housing."); |
---|
| 59 | housingThicknessCmd->SetParameterName("d_mtl",false); |
---|
| 60 | housingThicknessCmd->SetDefaultUnit("cm"); |
---|
| 61 | |
---|
| 62 | pmtRadiusCmd = new G4UIcmdWithADoubleAndUnit |
---|
| 63 | ("/LXe/detector/pmtRadius",this); |
---|
| 64 | pmtRadiusCmd->SetGuidance("Set the radius of the PMTs."); |
---|
| 65 | pmtRadiusCmd->SetParameterName("radius",false); |
---|
| 66 | pmtRadiusCmd->SetDefaultUnit("cm"); |
---|
| 67 | |
---|
| 68 | nxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx",this); |
---|
| 69 | nxCmd->SetGuidance("Set the number of PMTs along the x-dimension."); |
---|
| 70 | nxCmd->SetParameterName("nx",false); |
---|
| 71 | |
---|
| 72 | nyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny",this); |
---|
| 73 | nyCmd->SetGuidance("Set the number of PMTs along the y-dimension."); |
---|
| 74 | nyCmd->SetParameterName("ny",false); |
---|
| 75 | |
---|
| 76 | nzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz",this); |
---|
| 77 | nzCmd->SetGuidance("Set the number of PMTs along the z-dimension."); |
---|
| 78 | nzCmd->SetParameterName("nz",false); |
---|
| 79 | |
---|
| 80 | sphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere",this); |
---|
| 81 | sphereCmd->SetGuidance("Enable/Disable the sphere."); |
---|
| 82 | |
---|
| 83 | reflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity",this); |
---|
| 84 | reflectivityCmd->SetGuidance("Set the reflectivity of the housing."); |
---|
| 85 | |
---|
| 86 | wlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls",this); |
---|
| 87 | wlsCmd->SetGuidance("Enable/Disable the WLS slab"); |
---|
| 88 | |
---|
| 89 | lxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe",this); |
---|
| 90 | wlsCmd->SetGuidance("Enable/Disable the main detector volume."); |
---|
| 91 | |
---|
| 92 | nFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers",this); |
---|
| 93 | nFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab."); |
---|
| 94 | |
---|
| 95 | updateCmd = new G4UIcommand("/LXe/detector/update",this); |
---|
| 96 | updateCmd->SetGuidance("Update the detector geometry with changed values."); |
---|
| 97 | updateCmd->SetGuidance |
---|
| 98 | ("Must be run before beamOn if detector has been changed."); |
---|
| 99 | |
---|
| 100 | defaultsCmd = new G4UIcommand("/LXe/detector/defaults",this); |
---|
| 101 | defaultsCmd->SetGuidance("Set all detector geometry values to defaults."); |
---|
| 102 | defaultsCmd->SetGuidance("(Update still required)"); |
---|
| 103 | |
---|
| 104 | MainScintYield=new G4UIcmdWithADouble("/LXe/detector/MainScintYield",this); |
---|
| 105 | MainScintYield->SetGuidance("Set scinitillation yield of main volume."); |
---|
| 106 | MainScintYield->SetGuidance("Specified in photons/MeV"); |
---|
| 107 | |
---|
| 108 | WLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield",this); |
---|
| 109 | WLSScintYield->SetGuidance("Set scintillation yield of WLS Slab"); |
---|
| 110 | WLSScintYield->SetGuidance("Specified in photons/MeV"); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
---|
| 114 | LXeDetectorMessenger::~LXeDetectorMessenger() |
---|
| 115 | { |
---|
| 116 | delete dimensionsCmd; |
---|
| 117 | delete housingThicknessCmd; |
---|
| 118 | delete pmtRadiusCmd; |
---|
| 119 | delete nxCmd; |
---|
| 120 | delete nyCmd; |
---|
| 121 | delete nzCmd; |
---|
| 122 | delete updateCmd; |
---|
| 123 | delete detectorDir; |
---|
| 124 | delete volumesDir; |
---|
| 125 | delete defaultsCmd; |
---|
| 126 | delete sphereCmd; |
---|
| 127 | delete wlsCmd; |
---|
| 128 | delete lxeCmd; |
---|
| 129 | delete nFibersCmd; |
---|
| 130 | delete reflectivityCmd; |
---|
| 131 | delete MainScintYield; |
---|
| 132 | delete WLSScintYield; |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
---|
| 136 | void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue) |
---|
| 137 | { |
---|
| 138 | if( command == dimensionsCmd ){ |
---|
| 139 | LXeDetector->SetDimensions(dimensionsCmd->GetNew3VectorValue(newValue)); |
---|
| 140 | } |
---|
| 141 | else if (command == housingThicknessCmd){ |
---|
| 142 | LXeDetector->SetHousingThickness(housingThicknessCmd |
---|
| 143 | ->GetNewDoubleValue(newValue)); |
---|
| 144 | } |
---|
| 145 | else if (command == pmtRadiusCmd){ |
---|
| 146 | LXeDetector->SetPMTRadius(pmtRadiusCmd->GetNewDoubleValue(newValue)); |
---|
| 147 | } |
---|
| 148 | else if (command == nxCmd){ |
---|
| 149 | LXeDetector->SetNX(nxCmd->GetNewIntValue(newValue)); |
---|
| 150 | } |
---|
| 151 | else if (command == nyCmd){ |
---|
| 152 | LXeDetector->SetNY(nyCmd->GetNewIntValue(newValue)); |
---|
| 153 | } |
---|
| 154 | else if (command == nzCmd){ |
---|
| 155 | LXeDetector->SetNZ(nzCmd->GetNewIntValue(newValue)); |
---|
| 156 | } |
---|
| 157 | else if (command == updateCmd){ |
---|
| 158 | LXeDetector->UpdateGeometry(); |
---|
| 159 | } |
---|
| 160 | else if (command == defaultsCmd){ |
---|
| 161 | LXeDetector->SetDefaults(); |
---|
| 162 | } |
---|
| 163 | else if (command == sphereCmd){ |
---|
| 164 | LXeDetector->SetSphereOn(sphereCmd->GetNewBoolValue(newValue)); |
---|
| 165 | } |
---|
| 166 | else if (command == reflectivityCmd){ |
---|
| 167 | LXeDetector |
---|
| 168 | ->SetHousingReflectivity(reflectivityCmd->GetNewDoubleValue(newValue)); |
---|
| 169 | } |
---|
| 170 | else if (command == wlsCmd){ |
---|
| 171 | LXeDetector->SetWLSSlabOn(wlsCmd->GetNewBoolValue(newValue)); |
---|
| 172 | } |
---|
| 173 | else if (command == lxeCmd){ |
---|
| 174 | LXeDetector->SetMainVolumeOn(lxeCmd->GetNewBoolValue(newValue)); |
---|
| 175 | } |
---|
| 176 | else if (command == nFibersCmd){ |
---|
| 177 | LXeDetector->SetNFibers(nFibersCmd->GetNewIntValue(newValue)); |
---|
| 178 | } |
---|
| 179 | else if (command == MainScintYield){ |
---|
| 180 | LXeDetector->SetMainScintYield(MainScintYield->GetNewDoubleValue(newValue)); |
---|
| 181 | } |
---|
| 182 | else if (command == WLSScintYield){ |
---|
| 183 | LXeDetector->SetWLSScintYield(WLSScintYield->GetNewDoubleValue(newValue)); |
---|
| 184 | } |
---|
| 185 | } |
---|
| 186 | |
---|
| 187 | |
---|
| 188 | |
---|