source: trunk/examples/advanced/gammaray_telescope/src/GammaRayTelDetectorMessenger.cc @ 1317

Last change on this file since 1317 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

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