WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimDetectorMessenger.cc
Go to the documentation of this file.
2 
4 #include "G4UIdirectory.hh"
5 #include "G4UIcommand.hh"
6 #include "G4UIparameter.hh"
7 #include "G4UIcmdWithAString.hh"
8 #include "G4UIcmdWithADoubleAndUnit.hh"
9 
11 :WCSimDetector(WCSimDet)
12 {
13  WCSimDir = new G4UIdirectory("/WCSim/");
14  WCSimDir->SetGuidance("Commands to change the geometry of the simulation");
15 
16 
17  PMTConfig = new G4UIcmdWithAString("/WCSim/WCgeom",this);
18  PMTConfig->SetGuidance("Set the geometry configuration for the WC.");
19  PMTConfig->SetGuidance("Available options are:\n"
20  "SuperK\n"
21  "SuperK_20inchPMT_20perCent\n"
22  "SuperK_20inchBandL_20perCent\n"
23  "SuperK_12inchBandL_15perCent\n"
24  "SuperK_20inchBandL_14perCent\n"
25  "Cylinder_60x74_20inchBandL_14perCent\n"
26  "Cylinder_60x74_20inchBandL_40perCent\n"
27  "Cylinder_12inchHPD_15perCent\n"
28  "HyperK\n"
29  "HyperK_20perCent\n"
30  "HyperKWithOD\n"
31  "EggShapedHyperK\n"
32  "EggShapedHyperK_withHPD\n"
33  );
34  PMTConfig->SetParameterName("PMTConfig", false);
35  PMTConfig->SetCandidates("SuperK "
36  "SuperK_20inchPMT_20perCent "
37  "SuperK_20inchBandL_20perCent "
38  "SuperK_12inchBandL_15perCent "
39  "SuperK_20inchBandL_14perCent "
40  "Cylinder_60x74_20inchBandL_14perCent "
41  "Cylinder_60x74_20inchBandL_40perCent "
42  "Cylinder_12inchHPD_15perCent "
43  "HyperK "
44  "HyperK_20perCent "
45  "HyperKWithOD "
46  "EggShapedHyperK "
47  "EggShapedHyperK_withHPD "
48  );
49  PMTConfig->AvailableForStates(G4State_PreInit, G4State_Idle);
50 
51  WCVisChoice = new G4UIcmdWithAString("/WCSim/WCVisChoice",this);
52  WCVisChoice->SetGuidance("Set the visualization style for the WC.");
53  WCVisChoice->SetGuidance("Available options are:\n"
54  "OGLSX\n"
55  "RayTracer\n"
56  );
57  WCVisChoice->SetParameterName("WCVisChoice", false);
58  WCVisChoice->SetCandidates("OGLSX "
59  "RayTracer "
60  );
61  WCVisChoice->AvailableForStates(G4State_PreInit, G4State_Idle);
62 
63 
64  PMTSize = new G4UIcmdWithAString("/WCSim/WCPMTsize",this);
65  PMTSize->SetGuidance("Set alternate PMT size for the WC (Must be entered after geometry details are set).");
66  PMTSize->SetGuidance("Available options 20inch 10inch");
67  PMTSize->SetParameterName("PMTSize", false);
68  PMTSize->SetCandidates("20inch 10inch");
69  PMTSize->AvailableForStates(G4State_PreInit, G4State_Idle);
70 
71  SavePi0 = new G4UIcmdWithAString("/WCSim/SavePi0", this);
72  SavePi0->SetGuidance("true or false");
73  SavePi0->SetParameterName("SavePi0",false);
74  SavePi0->SetCandidates("true false");
75  SavePi0->AvailableForStates(G4State_PreInit, G4State_Idle);
76 
77 
78  PMTQEMethod = new G4UIcmdWithAString("/WCSim/PMTQEMethod", this);
79  PMTQEMethod->SetGuidance("Set the PMT configuration.");
80  PMTQEMethod->SetGuidance("Available options are:\n"
81  "Stacking_Only\n"
82  "Stacking_And_SensitiveDetector\n"
83  "SensitiveDetector_Only\n"
84  "DoNotApplyQE");
85  PMTQEMethod->SetParameterName("PMTQEMethod", false);
86  PMTQEMethod->SetCandidates("Stacking_Only "
87  "Stacking_And_SensitiveDetector "
88  "SensitiveDetector_Only "
89  "DoNotApplyQE");
90  PMTQEMethod->AvailableForStates(G4State_PreInit, G4State_Idle);
91 
92  PMTCollEff = new G4UIcmdWithAString("/WCSim/PMTCollEff", this);
93  PMTCollEff->SetGuidance("Set the PMT configuration.");
94  PMTCollEff->SetGuidance("Available options are:\n"
95  "on\n"
96  "off\n");
97  PMTCollEff->SetParameterName("PMTCollEff", false);
98  PMTCollEff->SetCandidates("on "
99  "off ");
100  PMTCollEff->AvailableForStates(G4State_PreInit, G4State_Idle);
101 
102  waterTank_Length = new G4UIcmdWithADoubleAndUnit("/WCSim/EggShapedHyperK/waterTank_Length", this);
103  waterTank_Length->SetGuidance("Set the Length of the egg-shaped HyperK detector (unit: mm cm m).");
104  waterTank_Length->SetParameterName("waterTank_length", true);
105  waterTank_Length->SetDefaultValue(49500.);
106  waterTank_Length->SetUnitCategory("Length");
107  waterTank_Length->SetDefaultUnit("mm");
108  waterTank_Length->SetUnitCandidates("mm cm m");
109 
110  LCConfig = new G4UIcmdWithAString("/WCSim/LCConfig",this);
111  LCConfig->SetGuidance("Set the geometry configuration for the light collecting mirror.");
112  LCConfig->SetGuidance("**For 20 inch PMT Only**");
113  LCConfig->SetGuidance("Available options are:\n"
114  "No_Mirror\n"
115  "Mirror_OldLC\n"
116  "Mirror_2018Oct\n"
117  );
118  LCConfig->SetParameterName("LCConfig", true);
119  LCConfig->SetCandidates("No_Mirror "
120  "Mirror_OldLC "
121  "Mirror_2018Oct "
122  );
123  LCConfig->SetDefaultValue("No_Mirror");
124  LCConfig->AvailableForStates(G4State_PreInit, G4State_Idle);
125 
126  WCConstruct = new G4UIcmdWithoutParameter("/WCSim/Construct", this);
127  WCConstruct->SetGuidance("Update detector construction with new settings.");
128 }
129 
131 {
132  delete PMTConfig;
133  delete LCConfig;
134  delete SavePi0;
135  delete PMTQEMethod;
136  delete PMTCollEff;
137  delete waterTank_Length;
138  delete WCVisChoice;
139 
140  delete tubeCmd;
141  delete distortionCmd;
142  delete WCSimDir;
143 }
144 
145 void WCSimDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
146 {
147  if( command == PMTConfig ) {
148  WCSimDetector->SetIsUpright(false);
150  if ( newValue == "SuperK") {
152  } else if ( newValue == "SuperK_20inchPMT_20perCent" ){
154  } else if ( newValue == "SuperK_20inchBandL_20perCent" ){
156  } else if ( newValue == "SuperK_12inchBandL_15perCent" ) {
158  } else if ( newValue == "SuperK_20inchBandL_14perCent" ) {
160  } else if ( newValue == "Cylinder_60x74_20inchBandL_14perCent" ) {
162  } else if ( newValue == "Cylinder_60x74_20inchBandL_40perCent" ) {
164  } else if ( newValue == "Cylinder_12inchHPD_15perCent" ){
166  } else if ( newValue == "HyperK" ){
168  } else if ( newValue == "HyperK_20perCent" ){
170  } else if ( newValue == "HyperKWithOD" ){
172  } else if ( newValue == "EggShapedHyperK") {
175  } else if ( newValue == "EggShapedHyperK_withHPD") {
178  } else
179  G4cout << "That geometry choice is not defined!" << G4endl;
180  }
181 
182  if (command == SavePi0){
183  G4cout << "Set the flag for saving pi0 info " << newValue << G4endl;
184  if (newValue=="true"){
185  WCSimDetector->SavePi0Info(true);
186  }else if (newValue == "false"){
187  WCSimDetector->SavePi0Info(false);
188  }else{
189 
190  }
191  }
192 
193  if (command == PMTQEMethod){
194  G4cout << "Set PMT QE Method " << newValue << " ";
195  if (newValue == "Stacking_Only"){
197  G4cout << "1";
198  }else if (newValue == "Stacking_And_SensitiveDetector"){
200  G4cout << "2";
201  }else if (newValue == "SensitiveDetector_Only"){
203  G4cout << "3";
204  }else if (newValue == "DoNotApplyQE"){
206  G4cout << "4";
207  }else{
208 
209  }
210  G4cout << G4endl;
211  }
212 
213  if (command == PMTCollEff){
214  G4cout << "Set PMT Collection Efficiency " << newValue << " ";
215  if (newValue == "on"){
217  G4cout << "1";
218  }else if (newValue == "off"){
220  G4cout << "0";
221  }
222  G4cout << G4endl;
223  }
224 
225  if (command == WCVisChoice){
226  G4cout << "Set Vis Choice " << newValue << " ";
227  if (newValue == "OGLSX"){
228  WCSimDetector->SetVis_Choice("OGLSX");
229  }else if (newValue == "RayTracer"){
230  WCSimDetector->SetVis_Choice("RayTracer");
231  }
232  G4cout << G4endl;
233  }
234 
235  if (command == waterTank_Length){
236  bool isEggShapedHyperK = WCSimDetector->GetIsEggShapedHyperK();
237  if(isEggShapedHyperK == true){
238  G4cout << "Set Partition Length in a cylinder " << newValue << " " << G4endl;
239  WCSimDetector->SetwaterTank_Length(waterTank_Length->GetNewDoubleValue(newValue));
240  WCSimDetector->SetWaterTubeLength(waterTank_Length->GetNewDoubleValue(newValue));
241  // WCSimDetector->SetIsEggShapedHyperK(true);
242  }
243  else {
244  G4cout << "Not egg-shaped HyperK Geometry. Detector length unchanged." << G4endl;
245  }
246  }
247 
248 
249  if(command == PMTSize) {
250  G4cout << "SET PMT SIZE" << G4endl;
251  if ( newValue == "20inch"){
252 // WCSimDetector->Set20inchPMTs();
253  }else if (newValue == "10inch"){
254 // WCSimDetector->Set10inchPMTs();
255  }else
256  G4cout << "That PMT size is not defined!" << G4endl;
257  }
258 
259  if( command == LCConfig ) {
260  // LC Type is defined in WCSimDetectorConstruction.hh
261  if ( newValue == "No_Mirror") {
263  } else if ( newValue == "Mirror_OldLC" ){
265  } else if ( newValue == "Mirror_2018Oct" ){
267  }
268  }
269 
270  if(command == WCConstruct) {
272  }
273 
274 }
G4UIcmdWithAString * PMTCollEff
G4UIcmdWithAString * WCVisChoice
G4UIcmdWithAString * PMTConfig
G4UIcmdWithAString * PMTSize
void SetwaterTank_Length(G4double length)
void SetLCType(G4int LightCollectorType)
G4UIcmdWithAString * LCConfig
G4UIcmdWithAString * SavePi0
G4UIcmdWithAString * tubeCmd
WCSimDetectorMessenger(WCSimDetectorConstruction *mpga)
void SetWaterTubeLength(G4double length)
WCSimDetectorConstruction * WCSimDetector
void SetNewValue(G4UIcommand *command, G4String newValues)
G4UIcmdWithAString * distortionCmd
G4UIcmdWithAString * PMTQEMethod
G4UIcmdWithoutParameter * WCConstruct
G4UIcmdWithADoubleAndUnit * waterTank_Length