Geant4_10
GammaRayTelDetectorMessenger.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 //
27 // $Id: GammaRayTelDetectorMessenger.cc 66508 2012-12-19 10:16:45Z gcosmo $
28 //
29 // ------------------------------------------------------------
30 // GEANT 4 class implementation file
31 // CERN Geneva Switzerland
32 //
33 //
34 // ------------ GammaRayTelDetectorMessenger ------
35 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
36 //
37 // ************************************************************
38 
40 
42 #include "G4UIdirectory.hh"
43 #include "G4UIcmdWithAString.hh"
44 #include "G4UIcmdWithAnInteger.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
51  :GammaRayTelDetector(GammaRayTelDet)
52 
53 {
54  GammaRayTeldetDir = new G4UIdirectory("/payload/");
55  GammaRayTeldetDir->SetGuidance("GammaRayTel payload control.");
56 
57  // converter material command
58 
59  ConverterMaterCmd = new G4UIcmdWithAString("/payload/setConvMat",this);
60  ConverterMaterCmd->SetGuidance("Select Material of the Converter.");
61  ConverterMaterCmd->SetParameterName("choice",false);
62  ConverterMaterCmd->AvailableForStates(G4State_Idle);
63 
64  // converter thickness command
65 
66  ConverterThickCmd = new G4UIcmdWithADoubleAndUnit
67  ("/payload/setConvThick",this);
68  ConverterThickCmd->SetGuidance("Set Thickness of the Converter");
69  ConverterThickCmd->SetParameterName("Size",false);
70  ConverterThickCmd->SetRange("Size>=0.");
71  ConverterThickCmd->SetUnitCategory("Length");
72  ConverterThickCmd->AvailableForStates(G4State_Idle);
73 
74  // tracker silicon thickness command
75 
76  SiliconThickCmd = new G4UIcmdWithADoubleAndUnit
77  ("/payload/setSiThick",this);
78  SiliconThickCmd->SetGuidance("Set Thickness of the Silicon");
79  SiliconThickCmd->SetParameterName("Size",false);
80  SiliconThickCmd->SetRange("Size>=0.");
81  SiliconThickCmd->SetUnitCategory("Length");
82  SiliconThickCmd->AvailableForStates(G4State_Idle);
83 
84  // tracker silicon pitch command
85 
86  SiliconPitchCmd = new G4UIcmdWithADoubleAndUnit
87  ("/payload/setSiPitch",this);
88  SiliconPitchCmd->SetGuidance("Set Pitch of the Silicon Strips");
89  SiliconPitchCmd->SetParameterName("Size",false);
90  SiliconPitchCmd->SetRange("Size>=0.");
91  SiliconPitchCmd->SetUnitCategory("Length");
92  SiliconPitchCmd->AvailableForStates(G4State_Idle);
93 
94  // tracker silicon tile size command
95 
96  SiliconTileXYCmd = new G4UIcmdWithADoubleAndUnit
97  ("/payload/setSiTileXY",this);
98  SiliconTileXYCmd->SetGuidance("Set XY dimensions of Si Tile");
99  SiliconTileXYCmd->SetParameterName("Size",false);
100  SiliconTileXYCmd->SetRange("Size>=0.");
101  SiliconTileXYCmd->SetUnitCategory("Length");
102  SiliconTileXYCmd->AvailableForStates(G4State_Idle);
103 
104  // tracker number of silicon tiles
105 
106  NbSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles",this);
107  NbSiTilesCmd->SetGuidance("Set number of Si Tiles.");
108  NbSiTilesCmd->SetParameterName("NbSiTiles",false);
109  NbSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
110  NbSiTilesCmd->AvailableForStates(G4State_Idle);
111 
112  // tracker number of silicon layers
113 
114  NbTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers",this);
115  NbTKRLayersCmd->SetGuidance("Set number of TKR Layers.");
116  NbTKRLayersCmd->SetParameterName("NbTKRLayers",false);
117  NbTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30");
118  NbTKRLayersCmd->AvailableForStates(G4State_Idle);
119 
120  // tracker layer distance
121 
122  LayerDistanceCmd = new G4UIcmdWithADoubleAndUnit
123  ("/payload/setLayerDistance",this);
124  LayerDistanceCmd->SetGuidance("Set distance between two layers");
125  LayerDistanceCmd->SetParameterName("Size",false);
126  LayerDistanceCmd->SetRange("Size>=0.");
127  LayerDistanceCmd->SetUnitCategory("Length");
128  LayerDistanceCmd->AvailableForStates(G4State_Idle);
129 
130  // tracker views distance
131 
132  ViewsDistanceCmd = new G4UIcmdWithADoubleAndUnit
133  ("/payload/setViewsDistance",this);
134  ViewsDistanceCmd->SetGuidance("Set distance between X and Y views");
135  ViewsDistanceCmd->SetParameterName("Size",false);
136  ViewsDistanceCmd->SetRange("Size>=0.");
137  ViewsDistanceCmd->SetUnitCategory("Length");
138  ViewsDistanceCmd->AvailableForStates(G4State_Idle);
139 
140  // calorimeter detector thickness
141 
142  CALThickCmd = new G4UIcmdWithADoubleAndUnit
143  ("/payload/setCALThick",this);
144  CALThickCmd->SetGuidance("Set thickness of CAL detectors");
145  CALThickCmd->SetParameterName("Size",false);
146  CALThickCmd->SetRange("Size>=0.");
147  CALThickCmd->SetUnitCategory("Length");
148  CALThickCmd->AvailableForStates(G4State_Idle);
149 
150  // number calorimeter detectors
151 
152  NbCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars",this);
153  NbCALBarsCmd->SetGuidance("Set number of CsI Bars.");
154  NbCALBarsCmd->SetParameterName("NbSiTiles",false);
155  NbCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
156  NbCALBarsCmd->AvailableForStates(G4State_Idle);
157 
158  // number calorimeter layers
159 
160  NbCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers",this);
161  NbCALLayersCmd->SetGuidance("Set number of CAL Layers.");
162  NbCALLayersCmd->SetParameterName("NbCALLayers",false);
163  NbCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16");
164  NbCALLayersCmd->AvailableForStates(G4State_Idle);
165 
166  // calorimeter detector thickness
167 
168  ACDThickCmd = new G4UIcmdWithADoubleAndUnit
169  ("/payload/setACDThick",this);
170  ACDThickCmd->SetGuidance("Set thickness of ACD detectors");
171  ACDThickCmd->SetParameterName("Size",false);
172  ACDThickCmd->SetRange("Size>=0.");
173  ACDThickCmd->SetUnitCategory("Length");
174  ACDThickCmd->AvailableForStates(G4State_Idle);
175 
176  // update Payload
177 
178  UpdateCmd = new G4UIcmdWithoutParameter("/payload/update",this);
179  UpdateCmd->SetGuidance("Update payload geometry.");
180  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
181  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
182  UpdateCmd->AvailableForStates(G4State_Idle);
183 
184  // magnetic field
185 
186  MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/payload/setField",this);
187  MagFieldCmd->SetGuidance("Define magnetic field.");
188  MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
189  MagFieldCmd->SetParameterName("Bz",false);
190  MagFieldCmd->SetUnitCategory("Magnetic flux density");
191  MagFieldCmd->AvailableForStates(G4State_Idle);
192 }
193 
194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
195 
197 {
198  delete ConverterMaterCmd; delete ConverterThickCmd;
199  delete NbSiTilesCmd; delete NbTKRLayersCmd;
200  delete SiliconTileXYCmd; delete SiliconPitchCmd;
201  delete SiliconThickCmd; delete LayerDistanceCmd;
202  delete ViewsDistanceCmd; delete ACDThickCmd;
203  delete NbCALLayersCmd; delete NbCALBarsCmd;
204  delete CALThickCmd; delete UpdateCmd;
205  delete MagFieldCmd; delete GammaRayTeldetDir;
206 }
207 
208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
209 
211 {
212 
213  // converter
214 
215  if( command == ConverterMaterCmd )
216  { GammaRayTelDetector->SetConverterMaterial(newValue);}
217 
218  if( command == ConverterThickCmd )
219  { GammaRayTelDetector->SetConverterThickness(ConverterThickCmd->GetNewDoubleValue(newValue));}
220 
221  // tracker
222 
223  if( command == SiliconTileXYCmd )
224  { GammaRayTelDetector->SetTKRTileSizeXY(SiliconTileXYCmd->GetNewDoubleValue(newValue));}
225 
226  if( command == SiliconPitchCmd )
227  { GammaRayTelDetector->SetTKRSiliconPitch(SiliconPitchCmd->GetNewDoubleValue(newValue));}
228 
229  if( command == SiliconThickCmd )
230  { GammaRayTelDetector->SetTKRSiliconThickness(SiliconThickCmd->GetNewDoubleValue(newValue));}
231 
232  if( command == NbSiTilesCmd )
233  { GammaRayTelDetector->SetNbOfTKRTiles(NbSiTilesCmd->GetNewIntValue(newValue));}
234 
235  if( command == NbTKRLayersCmd )
236  { GammaRayTelDetector->SetNbOfTKRLayers(NbTKRLayersCmd->GetNewIntValue(newValue));}
237 
238  if( command == LayerDistanceCmd )
239  { GammaRayTelDetector->SetTKRLayerDistance(LayerDistanceCmd->GetNewDoubleValue(newValue));}
240 
241  if( command == ViewsDistanceCmd )
242  { GammaRayTelDetector->SetTKRViewsDistance(ViewsDistanceCmd->GetNewDoubleValue(newValue));}
243 
244  // calorimeter
245 
246  if( command == NbCALLayersCmd )
247  { GammaRayTelDetector->SetNbOfCALLayers(NbCALLayersCmd->GetNewIntValue(newValue));}
248 
249  if( command == NbCALBarsCmd )
250  { GammaRayTelDetector->SetNbOfCALBars(NbCALBarsCmd->GetNewIntValue(newValue));}
251 
252  if( command == CALThickCmd )
253  { GammaRayTelDetector->SetCALBarThickness(CALThickCmd->GetNewDoubleValue(newValue));}
254 
255  // anticoincidence
256 
257  if( command == ACDThickCmd )
258  { GammaRayTelDetector->SetACDThickness(ACDThickCmd->GetNewDoubleValue(newValue));}
259 
260  if( command == UpdateCmd )
261  { GammaRayTelDetector->UpdateGeometry(); }
262 
263  if( command == MagFieldCmd )
264  { GammaRayTelDetector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
265 }
266 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
267 
268 
269 
270 
271 
272 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetNewValue(G4UIcommand *, G4String)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)