Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/electromagnetic/TestEm8/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 106960 2017-10-31 08:35:19Z gcosmo $
30 //
32 //
33 // TestEm8: Gaseous detector
34 //
35 // Created: 31.08.2010 V.Ivanchenko
36 //
37 // Modified:
38 //
40 //
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
44 #include "DetectorMessenger.hh"
45 
46 #include "DetectorConstruction.hh"
47 #include "G4UIdirectory.hh"
48 #include "G4UIcmdWithAString.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55  : G4UImessenger(),fDetector(det)
56 {
57  fDetDir = new G4UIdirectory("/testem/");
58  fDetDir->SetGuidance("Detector control.");
59 
60  fGasMaterCmd = new G4UIcmdWithAString("/testem/setGasMat",this);
61  fGasMaterCmd->SetGuidance("Select material of the detector.");
62  fGasMaterCmd->SetParameterName("gmat",true);
63  fGasMaterCmd->SetDefaultValue("Argon");
65 
66  fWindowMaterCmd = new G4UIcmdWithAString("/testem/setWindowMat",this);
67  fWindowMaterCmd->SetGuidance("Select material of the window.");
68  fWindowMaterCmd->SetParameterName("wmat",true);
71 
72  fWorldMaterCmd = new G4UIcmdWithAString("/testem/setWorldMat",this);
73  fWorldMaterCmd->SetGuidance("Select material of the world.");
74  fWorldMaterCmd->SetParameterName("worldmat",true);
77 
78  fGasThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasThick",this);
79  fGasThickCmd->SetGuidance("Set thickness of the detector");
80  fGasThickCmd->SetParameterName("SizeZ",false,false);
81  fGasThickCmd->SetUnitCategory("Length");
83  fGasThickCmd->SetRange("SizeZ>0.");
85 
86  fGasRadCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasRad",this);
87  fGasRadCmd->SetGuidance("Set radius of the detector");
88  fGasRadCmd->SetParameterName("SizeR",false,false);
89  fGasRadCmd->SetUnitCategory("Length");
91  fGasRadCmd->SetRange("SizeR>0.");
93 
94  fWinThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setWindowThick",this);
95  fWinThickCmd->SetGuidance("Set thickness of the window");
96  fWinThickCmd->SetParameterName("delta",false,false);
97  fWinThickCmd->SetUnitCategory("Length");
99  fWinThickCmd->SetRange("delta>0.");
101 
102  fIonCmd = new G4UIcmdWithADoubleAndUnit("/testem/setPairEnergy",this);
103  fIonCmd->SetGuidance("Set energy per electron-ion pair for detector");
104  fIonCmd->SetParameterName("en",false,false);
105  fIonCmd->SetUnitCategory("Energy");
106  fIonCmd->SetDefaultUnit("MeV");
107  fIonCmd->SetRange("en>0.");
109 
110  fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
111  fStepMaxCmd->SetGuidance("Set max allowed step length for charged particles");
112  fStepMaxCmd->SetParameterName("mxStep",false);
113  fStepMaxCmd->SetRange("mxStep>0.");
114  fStepMaxCmd->SetUnitCategory("Length");
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  delete fGasMaterCmd;
123  delete fGasThickCmd;
124  delete fGasRadCmd;
125  delete fWinThickCmd;
126  delete fWindowMaterCmd;
127  delete fWorldMaterCmd;
128  delete fIonCmd;
129  delete fStepMaxCmd;
130  delete fDetDir;
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
136 {
137  if( command == fGasMaterCmd ) {
138  fDetector->SetGasMaterial(newValue);
139  } else if( command == fWindowMaterCmd ) {
140  fDetector->SetContainerMaterial(newValue);
141  } else if( command == fWorldMaterCmd ) {
142  fDetector->SetWorldMaterial(newValue);
143  } else if( command == fGasThickCmd ) {
145  } else if( command == fGasRadCmd ) {
147  } else if( command == fWinThickCmd ) {
149  } else if( command == fStepMaxCmd ) {
151  } else if( command == fIonCmd ) {
153  }
154 }
155 
156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetDefaultValue(const char *defVal)
void SetWorldMaterial(const G4String &materialName)
static G4double GetNewDoubleValue(const char *paramString)
void SetUnitCategory(const char *unitCategory)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242
Simple detector construction with a box volume placed in a world.
void SetDefaultUnit(const char *defUnit)