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 | // |
---|
27 | // $Id: Em10DetectorMessenger.cc,v 1.11 2006/06/29 16:38:38 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // |
---|
31 | |
---|
32 | #include "Em10DetectorMessenger.hh" |
---|
33 | |
---|
34 | #include "Em10DetectorConstruction.hh" |
---|
35 | #include "G4UIdirectory.hh" |
---|
36 | #include "G4UIcmdWithAString.hh" |
---|
37 | #include "G4UIcmdWithAnInteger.hh" |
---|
38 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
39 | #include "G4UIcmdWithoutParameter.hh" |
---|
40 | |
---|
41 | ////////////////////////////////////////////////////////////////////////////// |
---|
42 | |
---|
43 | Em10DetectorMessenger::Em10DetectorMessenger(Em10DetectorConstruction * Em10Det) |
---|
44 | :Em10Detector(Em10Det) |
---|
45 | { |
---|
46 | Em10detDir = new G4UIdirectory("/XTRdetector/"); |
---|
47 | Em10detDir->SetGuidance("Em10 detector control."); |
---|
48 | |
---|
49 | AbsMaterCmd = new G4UIcmdWithAString("/XTRdetector/setAbsMat",this); |
---|
50 | AbsMaterCmd->SetGuidance("Select Material of the Absorber."); |
---|
51 | AbsMaterCmd->SetParameterName("choice",true); |
---|
52 | AbsMaterCmd->SetDefaultValue("Xe"); |
---|
53 | AbsMaterCmd->AvailableForStates(G4State_Idle); |
---|
54 | |
---|
55 | RadiatorMaterCmd = new G4UIcmdWithAString("/XTRdetector/setRadMat",this); |
---|
56 | RadiatorMaterCmd->SetGuidance("Select Material of the XTR radiator."); |
---|
57 | RadiatorMaterCmd->SetParameterName("choice",true); |
---|
58 | RadiatorMaterCmd->SetDefaultValue("CH2"); |
---|
59 | RadiatorMaterCmd->AvailableForStates(G4State_Idle); |
---|
60 | |
---|
61 | DetectorSetUpCmd = new G4UIcmdWithAString("/XTRdetector/setup",this); |
---|
62 | DetectorSetUpCmd->SetGuidance("Select setup for comparison with experiment"); |
---|
63 | DetectorSetUpCmd->SetParameterName("choice",true); |
---|
64 | DetectorSetUpCmd->SetDefaultValue("simpleALICE"); |
---|
65 | DetectorSetUpCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
66 | |
---|
67 | ModelCmd = new G4UIcmdWithAnInteger("/XTRdetector/setModel",this); |
---|
68 | ModelCmd->SetGuidance("Select Model for XTR"); |
---|
69 | ModelCmd->SetParameterName("choice",true); |
---|
70 | ModelCmd->SetDefaultValue(0); |
---|
71 | // ModelCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
72 | ModelCmd->AvailableForStates(G4State_Idle); |
---|
73 | |
---|
74 | FoilNumCmd = new G4UIcmdWithAnInteger("/XTRdetector/setFoilNum",this); |
---|
75 | FoilNumCmd->SetGuidance("Select foil number for XTR"); |
---|
76 | FoilNumCmd->SetParameterName("choice",true); |
---|
77 | FoilNumCmd->SetDefaultValue(0); |
---|
78 | FoilNumCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
79 | |
---|
80 | WorldMaterCmd = new G4UIcmdWithAString("/XTRdetector/setWorldMat",this); |
---|
81 | WorldMaterCmd->SetGuidance("Select Material of the World."); |
---|
82 | WorldMaterCmd->SetParameterName("wchoice",true); |
---|
83 | WorldMaterCmd->SetDefaultValue("Air"); |
---|
84 | WorldMaterCmd->AvailableForStates(G4State_Idle); |
---|
85 | |
---|
86 | AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setAbsThick",this); |
---|
87 | AbsThickCmd->SetGuidance("Set Thickness of the Absorber"); |
---|
88 | AbsThickCmd->SetParameterName("SizeZ",false,false); |
---|
89 | AbsThickCmd->SetDefaultUnit("mm"); |
---|
90 | AbsThickCmd->SetRange("SizeZ>0."); |
---|
91 | AbsThickCmd->AvailableForStates(G4State_Idle); |
---|
92 | |
---|
93 | RadiatorThickCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setRadThick",this); |
---|
94 | RadiatorThickCmd->SetGuidance("Set Thickness of XTR radiator"); |
---|
95 | RadiatorThickCmd->SetParameterName("SizeZ",false,false); |
---|
96 | RadiatorThickCmd->SetDefaultUnit("mm"); |
---|
97 | RadiatorThickCmd->SetRange("SizeZ>0."); |
---|
98 | RadiatorThickCmd->AvailableForStates(G4State_Idle); |
---|
99 | |
---|
100 | GasGapThickCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setGasGapThick",this); |
---|
101 | GasGapThickCmd->SetGuidance("Set Thickness of XTR gas gaps"); |
---|
102 | GasGapThickCmd->SetParameterName("SizeZ",false,false); |
---|
103 | GasGapThickCmd->SetDefaultUnit("mm"); |
---|
104 | GasGapThickCmd->SetRange("SizeZ>0."); |
---|
105 | GasGapThickCmd->AvailableForStates(G4State_Idle); |
---|
106 | |
---|
107 | AbsRadCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setAbsRad",this); |
---|
108 | AbsRadCmd->SetGuidance("Set radius of the Absorber"); |
---|
109 | AbsRadCmd->SetParameterName("SizeR",false,false); |
---|
110 | AbsRadCmd->SetDefaultUnit("mm"); |
---|
111 | AbsRadCmd->SetRange("SizeR>0."); |
---|
112 | AbsRadCmd->AvailableForStates(G4State_Idle); |
---|
113 | |
---|
114 | AbsZposCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setAbsZpos",this); |
---|
115 | AbsZposCmd->SetGuidance("Set Z pos. of the Absorber"); |
---|
116 | AbsZposCmd->SetParameterName("Zpos",false,false); |
---|
117 | AbsZposCmd->SetDefaultUnit("mm"); |
---|
118 | AbsZposCmd->AvailableForStates(G4State_Idle); |
---|
119 | |
---|
120 | WorldZCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setWorldZ",this); |
---|
121 | WorldZCmd->SetGuidance("Set Z size of the World"); |
---|
122 | WorldZCmd->SetParameterName("WSizeZ",false,false); |
---|
123 | WorldZCmd->SetDefaultUnit("mm"); |
---|
124 | WorldZCmd->SetRange("WSizeZ>0."); |
---|
125 | WorldZCmd->AvailableForStates(G4State_Idle); |
---|
126 | |
---|
127 | WorldRCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setWorldR",this); |
---|
128 | WorldRCmd->SetGuidance("Set R size of the World"); |
---|
129 | WorldRCmd->SetParameterName("WSizeR",false,false); |
---|
130 | WorldRCmd->SetDefaultUnit("mm"); |
---|
131 | WorldRCmd->SetRange("WSizeR>0."); |
---|
132 | WorldRCmd->AvailableForStates(G4State_Idle); |
---|
133 | |
---|
134 | UpdateCmd = new G4UIcmdWithoutParameter("/XTRdetector/update",this); |
---|
135 | UpdateCmd->SetGuidance("Update calorimeter geometry."); |
---|
136 | UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); |
---|
137 | UpdateCmd->SetGuidance("if you changed geometrical value(s)."); |
---|
138 | UpdateCmd->AvailableForStates(G4State_Idle); |
---|
139 | |
---|
140 | MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setField",this); |
---|
141 | MagFieldCmd->SetGuidance("Define magnetic field."); |
---|
142 | MagFieldCmd->SetGuidance("Magnetic field will be in Z direction."); |
---|
143 | MagFieldCmd->SetParameterName("Bz",false,false); |
---|
144 | MagFieldCmd->SetDefaultUnit("tesla"); |
---|
145 | MagFieldCmd->AvailableForStates(G4State_Idle); |
---|
146 | /* |
---|
147 | ElectronCutCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setElectronCut",this); |
---|
148 | ElectronCutCmd->SetGuidance("Set electron cut in mm for vertex region"); |
---|
149 | ElectronCutCmd->SetParameterName("ElectronCut",false,false); |
---|
150 | ElectronCutCmd->SetDefaultUnit("mm"); |
---|
151 | ElectronCutCmd->SetRange("ElectronCut>0."); |
---|
152 | ElectronCutCmd->AvailableForStates(G4State_Idle); |
---|
153 | |
---|
154 | |
---|
155 | PositronCutCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setPositronCut",this); |
---|
156 | PositronCutCmd->SetGuidance("Set positron cut in mm for vertex region"); |
---|
157 | PositronCutCmd->SetParameterName("PositronCut",false,false); |
---|
158 | PositronCutCmd->SetDefaultUnit("mm"); |
---|
159 | PositronCutCmd->SetRange("PositronCut>0."); |
---|
160 | PositronCutCmd->AvailableForStates(G4State_Idle); |
---|
161 | |
---|
162 | |
---|
163 | GammaCutCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setGammaCut",this); |
---|
164 | GammaCutCmd->SetGuidance("Set gamma cut in mm for vertex region"); |
---|
165 | GammaCutCmd->SetParameterName("GammaCut",false,false); |
---|
166 | GammaCutCmd->SetDefaultUnit("mm"); |
---|
167 | GammaCutCmd->SetRange("GammaCut>0."); |
---|
168 | GammaCutCmd->AvailableForStates(G4State_Idle); |
---|
169 | */ |
---|
170 | |
---|
171 | } |
---|
172 | |
---|
173 | /////////////////////////////////////////////////////////////////////////////// |
---|
174 | |
---|
175 | Em10DetectorMessenger::~Em10DetectorMessenger() |
---|
176 | { |
---|
177 | delete AbsMaterCmd; |
---|
178 | delete ModelCmd; |
---|
179 | delete FoilNumCmd; |
---|
180 | delete AbsThickCmd; |
---|
181 | delete RadiatorThickCmd; |
---|
182 | delete GasGapThickCmd; |
---|
183 | delete AbsRadCmd; |
---|
184 | delete AbsZposCmd; |
---|
185 | delete WorldMaterCmd; |
---|
186 | delete RadiatorMaterCmd; |
---|
187 | delete WorldZCmd; |
---|
188 | delete WorldRCmd; |
---|
189 | delete UpdateCmd; |
---|
190 | delete MagFieldCmd; |
---|
191 | delete Em10detDir; |
---|
192 | } |
---|
193 | |
---|
194 | ///////////////////////////////////////////////////////////////////////////// |
---|
195 | |
---|
196 | void Em10DetectorMessenger::SetNewValue(G4UIcommand* command,G4int newValue) |
---|
197 | { |
---|
198 | if( command == ModelCmd && newValue == 0 ) |
---|
199 | { |
---|
200 | // Em10Detector->SetParametrisationModel(newValue); |
---|
201 | Em10Detector->Construct(); |
---|
202 | } |
---|
203 | } |
---|
204 | //////////////////////////////////////////////////////////////////////////// |
---|
205 | // |
---|
206 | // |
---|
207 | |
---|
208 | void Em10DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) |
---|
209 | { |
---|
210 | if( command == ModelCmd ) |
---|
211 | { |
---|
212 | // Em10Detector->SetParametrisationModel(ModelCmd->GetNewIntValue(newValue)); |
---|
213 | // Em10Detector->ParametrisationModel(); |
---|
214 | } |
---|
215 | if( command == FoilNumCmd ) |
---|
216 | { |
---|
217 | Em10Detector->SetFoilNumber(FoilNumCmd->GetNewIntValue(newValue)); |
---|
218 | } |
---|
219 | if( command == AbsMaterCmd ) |
---|
220 | { Em10Detector->SetAbsorberMaterial(newValue);} |
---|
221 | |
---|
222 | if( command == DetectorSetUpCmd ) |
---|
223 | { Em10Detector->SetDetectorSetUp(newValue);} |
---|
224 | |
---|
225 | if( command == RadiatorMaterCmd ) |
---|
226 | { Em10Detector->SetRadiatorMaterial(newValue);} |
---|
227 | |
---|
228 | if( command == WorldMaterCmd ) |
---|
229 | { Em10Detector->SetWorldMaterial(newValue);} |
---|
230 | |
---|
231 | if( command == AbsThickCmd ) |
---|
232 | { Em10Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));} |
---|
233 | |
---|
234 | if( command == RadiatorThickCmd ) |
---|
235 | { Em10Detector->SetRadiatorThickness(RadiatorThickCmd-> |
---|
236 | GetNewDoubleValue(newValue));} |
---|
237 | |
---|
238 | if( command == GasGapThickCmd ) |
---|
239 | { Em10Detector->SetGasGapThickness(GasGapThickCmd-> |
---|
240 | GetNewDoubleValue(newValue));} |
---|
241 | |
---|
242 | if( command == AbsRadCmd ) |
---|
243 | { Em10Detector->SetAbsorberRadius(AbsRadCmd->GetNewDoubleValue(newValue));} |
---|
244 | |
---|
245 | if( command == AbsZposCmd ) |
---|
246 | { Em10Detector->SetAbsorberZpos(AbsZposCmd->GetNewDoubleValue(newValue));} |
---|
247 | |
---|
248 | if( command == WorldZCmd ) |
---|
249 | { Em10Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));} |
---|
250 | |
---|
251 | if( command == WorldRCmd ) |
---|
252 | { Em10Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));} |
---|
253 | |
---|
254 | if( command == UpdateCmd ) |
---|
255 | { Em10Detector->UpdateGeometry(); } |
---|
256 | |
---|
257 | if( command == MagFieldCmd ) |
---|
258 | { Em10Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));} |
---|
259 | /* |
---|
260 | if( command == ElectronCutCmd ) |
---|
261 | { |
---|
262 | Em10Detector->SetElectronCut(WorldRCmd->GetNewDoubleValue(newValue)); |
---|
263 | } |
---|
264 | if( command == PositronCutCmd ) |
---|
265 | { |
---|
266 | Em10Detector->SetPositronCut(WorldRCmd->GetNewDoubleValue(newValue)); |
---|
267 | } |
---|
268 | if( command == GammaCutCmd ) |
---|
269 | { |
---|
270 | Em10Detector->SetGammaCut(WorldRCmd->GetNewDoubleValue(newValue)); |
---|
271 | } |
---|
272 | */ |
---|
273 | } |
---|
274 | |
---|
275 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|