Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LXeDetectorMessenger.cc
Go to the documentation of this file.
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 // $Id: LXeDetectorMessenger.cc 105201 2017-07-14 12:21:13Z gcosmo $
27 //
30 //
31 //
32 #include "LXeDetectorMessenger.hh"
34 
37 #include "G4UIcmdWithAnInteger.hh"
38 #include "G4UIcommand.hh"
39 #include "G4UIdirectory.hh"
40 #include "G4UIcmdWithABool.hh"
41 #include "G4UIcmdWithADouble.hh"
42 #include "G4Scintillation.hh"
43 
44 #include "G4RunManager.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49  : fLXeDetector(detector)
50 {
51  //Setup a command directory for detector controls with guidance
52  fDetectorDir = new G4UIdirectory("/LXe/detector/");
53  fDetectorDir->SetGuidance("Detector geometry control");
54 
55  fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/");
56  fVolumesDir->SetGuidance("Enable/disable volumes");
57 
58  //Various commands for modifying detector geometry
59  fDimensionsCmd =
60  new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions",this);
61  fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume.");
62  fDimensionsCmd->SetParameterName("scint_x","scint_y","scint_z",false);
63  fDimensionsCmd->SetDefaultUnit("cm");
65  fDimensionsCmd->SetToBeBroadcasted(false);
66 
67  fHousingThicknessCmd = new G4UIcmdWithADoubleAndUnit
68  ("/LXe/detector/housingThickness",this);
69  fHousingThicknessCmd->SetGuidance("Set the thickness of the housing.");
70  fHousingThicknessCmd->SetParameterName("d_mtl",false);
71  fHousingThicknessCmd->SetDefaultUnit("cm");
72  fHousingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
73  fHousingThicknessCmd->SetToBeBroadcasted(false);
74 
75  fPmtRadiusCmd = new G4UIcmdWithADoubleAndUnit
76  ("/LXe/detector/pmtRadius",this);
77  fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs.");
78  fPmtRadiusCmd->SetParameterName("radius",false);
79  fPmtRadiusCmd->SetDefaultUnit("cm");
81  fPmtRadiusCmd->SetToBeBroadcasted(false);
82 
83  fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx",this);
84  fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension.");
85  fNxCmd->SetParameterName("nx",false);
87  fNxCmd->SetToBeBroadcasted(false);
88 
89  fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny",this);
90  fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension.");
91  fNyCmd->SetParameterName("ny",false);
93  fNyCmd->SetToBeBroadcasted(false);
94 
95  fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz",this);
96  fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension.");
97  fNzCmd->SetParameterName("nz",false);
99  fNzCmd->SetToBeBroadcasted(false);
100 
101  fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere",this);
102  fSphereCmd->SetGuidance("Enable/Disable the sphere.");
104  fSphereCmd->SetToBeBroadcasted(false);
105 
106  fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity",this);
107  fReflectivityCmd->SetGuidance("Set the reflectivity of the housing.");
109  fReflectivityCmd->SetToBeBroadcasted(false);
110 
111  fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls",this);
112  fWlsCmd->SetGuidance("Enable/Disable the WLS slab");
114  fWlsCmd->SetToBeBroadcasted(false);
115 
116  fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe",this);
117  fLxeCmd->SetGuidance("Enable/Disable the main detector volume.");
119  fLxeCmd->SetToBeBroadcasted(false);
120 
121  fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers",this);
122  fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab.");
124  fNFibersCmd->SetToBeBroadcasted(false);
125 
126  fMainScintYield=new G4UIcmdWithADouble("/LXe/detector/MainScintYield",this);
127  fMainScintYield->SetGuidance("Set scinitillation yield of main volume.");
128  fMainScintYield->SetGuidance("Specified in photons/MeV");
130  fMainScintYield->SetToBeBroadcasted(false);
131 
132  fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield",this);
133  fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab");
134  fWLSScintYield->SetGuidance("Specified in photons/MeV");
136  fWLSScintYield->SetToBeBroadcasted(false);
137 
138  fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults",this);
139  fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults.");
141  fDefaultsCmd->SetToBeBroadcasted(false);
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
147 {
148  delete fDimensionsCmd;
149  delete fHousingThicknessCmd;
150  delete fPmtRadiusCmd;
151  delete fNxCmd;
152  delete fNyCmd;
153  delete fNzCmd;
154  delete fDetectorDir;
155  delete fVolumesDir;
156  delete fSphereCmd;
157  delete fWlsCmd;
158  delete fLxeCmd;
159  delete fNFibersCmd;
160  delete fReflectivityCmd;
161  delete fMainScintYield;
162  delete fWLSScintYield;
163  delete fDefaultsCmd;
164 }
165 
166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
167 
169 {
170  if( command == fDimensionsCmd ){
171  fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue));
172  }
173  else if (command == fHousingThicknessCmd){
174  fLXeDetector->SetHousingThickness(fHousingThicknessCmd
175  ->GetNewDoubleValue(newValue));
176  }
177  else if (command == fPmtRadiusCmd){
178  fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue));
179  }
180  else if (command == fNxCmd){
181  fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue));
182  }
183  else if (command == fNyCmd){
184  fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue));
185  }
186  else if (command == fNzCmd){
187  fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue));
188  }
189  else if (command == fSphereCmd){
190  fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue));
191  }
192  else if (command == fReflectivityCmd){
193  fLXeDetector
194  ->SetHousingReflectivity(fReflectivityCmd->GetNewDoubleValue(newValue));
195  }
196  else if (command == fWlsCmd){
197  fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue));
198  }
199  else if (command == fLxeCmd){
200  fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue));
201  }
202  else if (command == fNFibersCmd){
203  fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue));
204  }
205  else if (command == fMainScintYield){
206  fLXeDetector->
207  SetMainScintYield(fMainScintYield->GetNewDoubleValue(newValue));
208  }
209  else if (command == fWLSScintYield){
210  fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue));
211  }
212  else if (command == fDefaultsCmd){
213  fLXeDetector->SetDefaults();
214 
215  G4RunManager::GetRunManager()->ReinitializeGeometry(); //Add here this line
216  }
217 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetDefaultUnit(const char *defUnit)
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
static G4ThreeVector GetNew3VectorValue(const char *paramString)
Definition of the LXeDetectorConstruction class.
static G4double GetNewDoubleValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
static G4bool GetNewBoolValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
void SetDefaultUnit(const char *defUnit)
LXeDetectorMessenger(LXeDetectorConstruction *)
Definition of the LXeDetectorMessenger class.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void SetNewValue(G4UIcommand *, G4String)