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4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // ------------------------------------------------------------
 28 //      GEANT 4 class implementation file
 29 //      CERN Geneva Switzerland
 30 //
 31 //
 32 //      ------------ GammaRayTelDetectorMessenger ------
 33 //           by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
 34 //
 35 // ************************************************************
 36 
 37 #include "GammaRayTelDetectorConstruction.hh"
 38 #include "GammaRayTelDetectorMessenger.hh"
 39 
 40 #include "G4UIcmdWithADoubleAndUnit.hh"
 41 #include "G4UIcmdWithAnInteger.hh"
 42 #include "G4UIcmdWithAString.hh"
 43 #include "G4UIcmdWithoutParameter.hh"
 44 #include "G4UIdirectory.hh"
 45 
 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 47 
 48 GammaRayTelDetectorMessenger::GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction *GammaRayTelDet) : detector(GammaRayTelDet) {
 49   directory = new G4UIdirectory("/payload/");
 50   directory->SetGuidance("GammaRayTel payload control.");
 51 
 52   // converter material command
 53 
 54   converterMaterialCmd = new G4UIcmdWithAString("/payload/setConvMat", this);
 55   converterMaterialCmd->SetGuidance("Select the material of the converter.");
 56   converterMaterialCmd->SetParameterName("choice", false);
 57   converterMaterialCmd->AvailableForStates(G4State_Idle);
 58 
 59   // converter thickness command
 60 
 61   converterThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setConvThick", this);
 62   converterThicknessCmd->SetGuidance("Set the thickness of the converter.");
 63   converterThicknessCmd->SetParameterName("Size", false);
 64   converterThicknessCmd->SetRange("Size>=0.");
 65   converterThicknessCmd->SetUnitCategory("Length");
 66   converterThicknessCmd->AvailableForStates(G4State_Idle);
 67 
 68   // tracker silicon thickness command
 69 
 70   siliconThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setSiThick", this);
 71   siliconThicknessCmd->SetGuidance("Set the thickness of the silicon.");
 72   siliconThicknessCmd->SetParameterName("Size", false);
 73   siliconThicknessCmd->SetRange("Size>=0.");
 74   siliconThicknessCmd->SetUnitCategory("Length");
 75   siliconThicknessCmd->AvailableForStates(G4State_Idle);
 76 
 77   // tracker silicon pitch command
 78 
 79   siliconPitchCmd = new G4UIcmdWithADoubleAndUnit("/payload/setSiPitch", this);
 80   siliconPitchCmd->SetGuidance("Set the pitch of silicon strips.");
 81   siliconPitchCmd->SetParameterName("Size", false);
 82   siliconPitchCmd->SetRange("Size>=0.");
 83   siliconPitchCmd->SetUnitCategory("Length");
 84   siliconPitchCmd->AvailableForStates(G4State_Idle);
 85 
 86   // tracker silicon tile size command
 87 
 88   siliconTileXYCmd = new G4UIcmdWithADoubleAndUnit("/payload/setSiTileXY", this);
 89   siliconTileXYCmd->SetGuidance("Set XY dimensions of a silicon tile.");
 90   siliconTileXYCmd->SetParameterName("Size", false);
 91   siliconTileXYCmd->SetRange("Size>=0.");
 92   siliconTileXYCmd->SetUnitCategory("Length");
 93   siliconTileXYCmd->AvailableForStates(G4State_Idle);
 94 
 95   // tracker number of silicon tiles
 96 
 97   numberOfSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles", this);
 98   numberOfSiTilesCmd->SetGuidance("Set the number of silicon tiles.");
 99   numberOfSiTilesCmd->SetParameterName("NbSiTiles", false);
100   numberOfSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
101   numberOfSiTilesCmd->AvailableForStates(G4State_Idle);
102 
103   // tracker number of silicon layers
104 
105   numberOfTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers", this);
106   numberOfTKRLayersCmd->SetGuidance("Set the number of TKR layers.");
107   numberOfTKRLayersCmd->SetParameterName("NbTKRLayers", false);
108   numberOfTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30");
109   numberOfTKRLayersCmd->AvailableForStates(G4State_Idle);
110 
111   // tracker layer distance
112 
113   layerDistanceCmd = new G4UIcmdWithADoubleAndUnit("/payload/setLayerDistance", this);
114   layerDistanceCmd->SetGuidance("Set the distance between two layers.");
115   layerDistanceCmd->SetParameterName("Size", false);
116   layerDistanceCmd->SetRange("Size>=0.");
117   layerDistanceCmd->SetUnitCategory("Length");
118   layerDistanceCmd->AvailableForStates(G4State_Idle);
119 
120   // tracker views distance
121 
122   viewsDistanceCmd = new G4UIcmdWithADoubleAndUnit("/payload/setViewsDistance", this);
123   viewsDistanceCmd->SetGuidance("Set the distance between X and Y views.");
124   viewsDistanceCmd->SetParameterName("Size", false);
125   viewsDistanceCmd->SetRange("Size>=0.");
126   viewsDistanceCmd->SetUnitCategory("Length");
127   viewsDistanceCmd->AvailableForStates(G4State_Idle);
128 
129   // calorimeter detector thickness
130 
131   calThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setCALThick", this);
132   calThicknessCmd->SetGuidance("Set the thickness of CAL detectors.");
133   calThicknessCmd->SetParameterName("Size", false);
134   calThicknessCmd->SetRange("Size>=0.");
135   calThicknessCmd->SetUnitCategory("Length");
136   calThicknessCmd->AvailableForStates(G4State_Idle);
137 
138   // calorimeter, number of detectors
139 
140   numberOfCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars", this);
141   numberOfCALBarsCmd->SetGuidance("Set the number of CsI bars.");
142   numberOfCALBarsCmd->SetParameterName("NbSiTiles", false);
143   numberOfCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
144   numberOfCALBarsCmd->AvailableForStates(G4State_Idle);
145 
146   // calorimeter, number of layers
147 
148   numberOfCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers", this);
149   numberOfCALLayersCmd->SetGuidance("Set the number of CAL layers.");
150   numberOfCALLayersCmd->SetParameterName("NbCALLayers", false);
151   numberOfCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16");
152   numberOfCALLayersCmd->AvailableForStates(G4State_Idle);
153 
154   // anticoincidence detector thickness
155 
156   acdThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setACDThick", this);
157   acdThicknessCmd->SetGuidance("Set the thickness of ACD detectors");
158   acdThicknessCmd->SetParameterName("Size", false);
159   acdThicknessCmd->SetRange("Size>=0.");
160   acdThicknessCmd->SetUnitCategory("Length");
161   acdThicknessCmd->AvailableForStates(G4State_Idle);
162 
163   // update payload geometry
164 
165   updateCmd = new G4UIcmdWithoutParameter("/payload/update", this);
166   updateCmd->SetGuidance("Update the geometry of the payload.");
167   updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
168   updateCmd->SetGuidance("if you changed geometrical value(s).");
169   updateCmd->AvailableForStates(G4State_Idle);
170 
171   // magnetic field
172 
173   magneticFieldCmd = new G4UIcmdWithADoubleAndUnit("/payload/setField", this);
174   magneticFieldCmd->SetGuidance("Define the magnetic field.");
175   magneticFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
176   magneticFieldCmd->SetParameterName("Bz", false);
177   magneticFieldCmd->SetUnitCategory("Magnetic flux density");
178   magneticFieldCmd->AvailableForStates(G4State_Idle);
179 }
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
182 
183 GammaRayTelDetectorMessenger::~GammaRayTelDetectorMessenger() {
184   delete converterMaterialCmd;
185   delete converterThicknessCmd;
186   delete numberOfSiTilesCmd;
187   delete numberOfTKRLayersCmd;
188   delete siliconTileXYCmd;
189   delete siliconPitchCmd;
190   delete siliconThicknessCmd;
191   delete layerDistanceCmd;
192   delete viewsDistanceCmd;
193   delete acdThicknessCmd;
194   delete numberOfCALLayersCmd;
195   delete numberOfCALBarsCmd;
196   delete calThicknessCmd;
197   delete updateCmd;
198   delete magneticFieldCmd;
199   delete directory;
200 }
201 
202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
203 
204 void GammaRayTelDetectorMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
205   // converter
206 
207   if (command == converterMaterialCmd) {
208     detector->SetConverterMaterial(newValue);
209   } else if (command == converterThicknessCmd) {
210     detector->SetConverterThickness(converterThicknessCmd->GetNewDoubleValue(newValue));
211     } else
212 
213     // tracker (TKR)
214 
215     if (command == siliconTileXYCmd) {
216     detector->SetTKRTileSizeXY(siliconTileXYCmd->GetNewDoubleValue(newValue));
217   } else if (command == siliconPitchCmd) {
218     detector->SetTKRSiliconPitch(siliconPitchCmd->GetNewDoubleValue(newValue));
219   } else if (command == siliconThicknessCmd) {
220     detector->SetTKRSiliconThickness(siliconThicknessCmd->GetNewDoubleValue(newValue));
221   } else if (command == numberOfSiTilesCmd) {
222     detector->SetNbOfTKRTiles(numberOfSiTilesCmd->GetNewIntValue(newValue));
223   } else if (command == numberOfTKRLayersCmd) {
224     detector->SetNbOfTKRLayers(numberOfTKRLayersCmd->GetNewIntValue(newValue));
225   } else if (command == layerDistanceCmd) {
226     detector->SetTKRLayerDistance(layerDistanceCmd->GetNewDoubleValue(newValue));
227   } else if (command == viewsDistanceCmd) {
228     detector->SetTKRViewsDistance(viewsDistanceCmd->GetNewDoubleValue(newValue));
229   } else
230 
231   // calorimeter (CAL)
232 
233   if (command == numberOfCALLayersCmd) {
234     detector->SetNbOfCALLayers(numberOfCALLayersCmd->GetNewIntValue(newValue));
235   } else if (command == numberOfCALBarsCmd) {
236     detector->SetNbOfCALBars(numberOfCALBarsCmd->GetNewIntValue(newValue));
237   } else if (command == calThicknessCmd) {
238     detector->SetCALBarThickness(calThicknessCmd->GetNewDoubleValue(newValue));
239   } else
240 
241   // anticoincidence (ACD)
242 
243   if (command == acdThicknessCmd) {
244     detector->SetACDThickness(acdThicknessCmd->GetNewDoubleValue(newValue));
245   } else if (command == updateCmd) {
246     detector->UpdateGeometry();
247   } else if (command == magneticFieldCmd) {
248     detector->SetMagField(magneticFieldCmd->GetNewDoubleValue(newValue));
249   }
250 }
251