Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/optical/OpNovice2/src/DetectorMessenger.cc
이 파일의 문서화 페이지로 가기
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 //
28 //
29 // $Id: DetectorMessenger.cc 77288 2013-11-22 10:52:58Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "DetectorMessenger.hh"
35 
36 #include <sstream>
37 #include <iostream>
38 
39 #include "G4OpticalSurface.hh"
40 
41 #include "DetectorConstruction.hh"
42 #include "G4UIdirectory.hh"
43 #include "G4UIcommand.hh"
44 #include "G4UIparameter.hh"
45 #include "G4UIcmdWithAString.hh"
46 #include "G4UIcmdWithADouble.hh"
47 #include "G4UIcmdWithAnInteger.hh"
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
54 :G4UImessenger(),fDetector(Det)
55 {
56  fOpticalDir = new G4UIdirectory("/opnovice2/");
57  fOpticalDir->SetGuidance("Parameters for optical simulation.");
58 
59  fSurfaceTypeCmd = new G4UIcmdWithAString("/opnovice2/surfaceType", this);
60  fSurfaceTypeCmd->SetGuidance("Surface type.");
63 
64  fSurfaceFinishCmd = new G4UIcmdWithAString("/opnovice2/surfaceFinish", this);
65  fSurfaceFinishCmd->SetGuidance("Surface finish.");
68 
70  new G4UIcmdWithAString("/opnovice2/surfaceModel", this);
71  fSurfaceModelCmd->SetGuidance("surface model.");
74 
76  new G4UIcmdWithADouble("/opnovice2/surfaceSigmaAlpha", this);
77  fSurfaceSigmaAlphaCmd->SetGuidance("surface sigma alpha");
78  fSurfaceSigmaAlphaCmd->SetGuidance(" parameter.");
81 
83  new G4UIcmdWithAString("/opnovice2/surfaceProperty", this);
84  fSurfaceMatPropVectorCmd->SetGuidance("Set material property vector");
85  fSurfaceMatPropVectorCmd->SetGuidance(" for the surface.");
88 
89  fBoxMatPropVectorCmd = new G4UIcmdWithAString("/opnovice2/boxProperty", this);
90  fBoxMatPropVectorCmd->SetGuidance("Set material property vector for ");
91  fBoxMatPropVectorCmd->SetGuidance("the box.");
94 
96  new G4UIcmdWithAString("/opnovice2/boxConstProperty", this);
97  fBoxMatConstPropVectorCmd->SetGuidance("Set material constant property ");
98  fBoxMatConstPropVectorCmd->SetGuidance("for the box.");
101 
103  new G4UIcmdWithAString("/opnovice2/worldProperty", this);
104  fWorldMatPropVectorCmd->SetGuidance("Set material property vector ");
105  fWorldMatPropVectorCmd->SetGuidance("for the world.");
108 
110  new G4UIcmdWithAString("/opnovice2/worldConstProperty", this);
111  fWorldMatConstPropVectorCmd->SetGuidance("Set material constant property");
112  fWorldMatConstPropVectorCmd->SetGuidance(" for the world.");
114  AvailableForStates(G4State_PreInit, G4State_Idle);
116 
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
122 {
123  delete fSurfaceFinishCmd;
124  delete fSurfaceTypeCmd;
125  delete fSurfaceModelCmd;
126  delete fSurfaceSigmaAlphaCmd;
128  delete fBoxMatPropVectorCmd;
130  delete fWorldMatPropVectorCmd;
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
137 {
138  // FINISH
139  if (command == fSurfaceFinishCmd) {
140  if (newValue == "polished") {
142  }
143  else if (newValue == "polishedfrontpainted") {
145  }
146  else if (newValue == "polishedbackpainted") {
148  }
149  else if (newValue == "ground") {
151  }
152  else if (newValue == "groundfrontpainted") {
154  }
155  else if (newValue == "groundbackpainted") {
157  }
158  else if (newValue == "polishedlumirrorair") {
160  }
161  else if (newValue == "polishedlumirrorglue") {
163  }
164  else if (newValue == "polishedair") {
166  }
167  else if (newValue == "polishedteflonair") {
169  }
170  else if (newValue == "polishedtioair") {
172  }
173  else if (newValue == "polishedtyvekair") {
175  }
176  else if (newValue == "polishedvm2000air") {
178  }
179  else if (newValue == "polishedvm2000glue") {
181  }
182  else if (newValue == "etchedlumirrorair") {
184  }
185  else if (newValue == "etchedlumirrorglue") {
187  }
188  else if (newValue == "etchedair") {
190  }
191  else if (newValue == "etchedteflonair") {
193  }
194  else if (newValue == "etchedtioair") {
196  }
197  else if (newValue == "etchedtyvekair") {
199  }
200  else if (newValue == "etchedvm2000air") {
202  }
203  else if (newValue == "etchedvm2000glue") {
205  }
206  else if (newValue == "groundlumirrorair") {
208  }
209  else if (newValue == "groundlumirrorglue") {
211  }
212  else if (newValue == "groundair") {
214  }
215  else if (newValue == "groundteflonair") {
217  }
218  else if (newValue == "groundtioair") {
220  }
221  else if (newValue == "groundtyvekair") {
223  }
224  else if (newValue == "groundvm2000air") {
226  }
227  else if (newValue == "groundvm2000glue") {
229  }
230  // for Davis model
231  else if (newValue == "Rough_LUT") {
233  }
234  else if (newValue == "RoughTeflon_LUT") {
236  }
237  else if (newValue == "RoughESR_LUT") {
239  }
240  else if (newValue == "RoughESRGrease_LUT") {
242  }
243  else if (newValue == "Polished_LUT") {
245  }
246  else if (newValue == "PolishedTeflon_LUT") {
248  }
249  else if (newValue == "PolishedESR_LUT") {
251  }
252  else if (newValue == "PolishedESRGrease_LUT") {
254  }
255  else if (newValue == "Detector_LUT") {
257  }
258  else {
260  ed << "Invalid surface finish: " << newValue;
261  G4Exception("DetectorMessenger", "OpNovice2_003", FatalException,ed);
262  }
263  }
264 
265  // MODEL
266  else if (command == fSurfaceModelCmd) {
267  if (newValue == "glisur") {
269  }
270  else if (newValue == "unified") {
272  }
273  else if (newValue == "LUT") {
275  }
276  else if (newValue == "DAVIS") {
278  }
279  else if (newValue == "dichroic") {
281  }
282  else {
284  ed << "Invalid surface model: " << newValue;
285  G4Exception("DetectorMessenger", "ONovice2_001",
286  FatalException,ed);
287  }
288  }
289 
290  // TYPE
291  else if (command == fSurfaceTypeCmd) {
292  if (newValue == "dielectric_metal") {
294  }
295  else if (newValue == "dielectric_dielectric") {
297  }
298  else if (newValue == "dielectric_LUT") {
300  }
301  else if (newValue == "dielectric_LUTDAVIS") {
303  }
304  else {
306  ed << "Invalid surface type: " << newValue;
307  G4Exception("DetectorMessenger", "OpNovice2_002", FatalException,ed);
308  }
309  }
310  else if (command == fSurfaceSigmaAlphaCmd) {
313  }
314  else if (command == fBoxMatPropVectorCmd) {
315  // got a string. need to convert it to physics vector.
316  // string format is property name, then pairs of energy, value
317  // specify units for each value, eg 3.0*eV
318  // space delimited
320  mpv->SetSpline(true);
321  std::istringstream instring(newValue);
322  G4String prop;
323  instring >> prop;
324  while (instring) {
325  G4String tmp;
326  instring >> tmp;
327  if (tmp == "") { break; }
329  instring >> tmp;
330  G4double val;
331  val = G4UIcommand::ConvertToDouble(tmp);
332  mpv->InsertValues(en, val);
333  }
334  const char* c = prop.c_str();
335 
336  fDetector->AddBoxMPV(c, mpv);
337  }
338  else if (command == fWorldMatPropVectorCmd) {
339  // Convert string to physics vector
340  // string format is property name, then pairs of energy, value
342  std::istringstream instring(newValue);
343  G4String prop;
344  instring >> prop;
345  while (instring) {
346  G4String tmp;
347  instring >> tmp;
348  if (tmp == "") { break; }
350  instring >> tmp;
351  G4double val;
352  val = G4UIcommand::ConvertToDouble(tmp);
353  mpv->InsertValues(en, val);
354  }
355  const char* c = prop.c_str();
356  fDetector->AddWorldMPV(c, mpv);
357  }
358  else if (command == fSurfaceMatPropVectorCmd) {
359  // Convert string to physics vector
360  // string format is property name, then pairs of energy, value
361  // space delimited
363  G4cout << newValue << G4endl;
364  std::istringstream instring(newValue);
365  G4String prop;
366  instring >> prop;
367  while (instring) {
368  G4String tmp;
369  instring >> tmp;
370  if (tmp == "") { break; }
372  instring >> tmp;
373  G4double val;
374  val = G4UIcommand::ConvertToDouble(tmp);
375  mpv->InsertValues(en, val);
376  }
377  const char* c = prop.c_str();
378  fDetector->AddSurfaceMPV(c, mpv);
379  }
380 
381  else if (command == fBoxMatConstPropVectorCmd) {
382  // Convert string to physics vector
383  // string format is property name, then value
384  // space delimited
385  std::istringstream instring(newValue);
386  G4String prop;
387  G4String tmp;
388  instring >> prop;
389  instring >> tmp;
391  const char* c = prop.c_str();
392  fDetector->AddBoxMPCV(c, val);
393  }
394  else if (command == fWorldMatConstPropVectorCmd) {
395  // Convert string to physics vector
396  // string format is property name, then value
397  // space delimited
398  std::istringstream instring(newValue);
399  G4String prop;
400  G4String tmp;
401  instring >> prop;
402  instring >> tmp;
404  const char* c = prop.c_str();
405  fDetector->AddBoxMPCV(c, val);
406  }
407 }
408 
409 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AddWorldMPV(const char *c, G4MaterialPropertyVector *mpv)
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:457
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
void InsertValues(G4double energy, G4double value)
void AddBoxMPV(const char *c, G4MaterialPropertyVector *mpv)
G4PhysicsOrderedFreeVector G4MaterialPropertyVector
#define G4endl
Definition: G4ios.hh:61
static G4double GetNewDoubleValue(const char *paramString)
Float_t tmp
void AddSurfaceMPV(const char *c, G4MaterialPropertyVector *mpv)
double G4double
Definition: G4Types.hh:76
void SetSpline(G4bool)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
G4GLOB_DLL std::ostream G4cout
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242
Simple detector construction with a box volume placed in a world.
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184