Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: GammaRayTelDetectorMessenger.cc,v 1.8 2006/06/29 15:56:25 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-01 $ >> 29 // 27 // ------------------------------------------- 30 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file 31 // GEANT 4 class implementation file 29 // CERN Geneva Switzerland 32 // CERN Geneva Switzerland 30 // 33 // 31 // 34 // 32 // ------------ GammaRayTelDetectorMessen 35 // ------------ GammaRayTelDetectorMessenger ------ 33 // by F.Longo, R.Giannitrapani & G.S 36 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000) 34 // 37 // 35 // ******************************************* 38 // ************************************************************ 36 39 37 #include "GammaRayTelDetectorConstruction.hh" << 38 #include "GammaRayTelDetectorMessenger.hh" 40 #include "GammaRayTelDetectorMessenger.hh" 39 41 40 #include "G4UIcmdWithADoubleAndUnit.hh" << 42 #include "GammaRayTelDetectorConstruction.hh" 41 #include "G4UIcmdWithAnInteger.hh" << 43 #include "G4UIdirectory.hh" 42 #include "G4UIcmdWithAString.hh" 44 #include "G4UIcmdWithAString.hh" >> 45 #include "G4UIcmdWithAnInteger.hh" >> 46 #include "G4UIcmdWithADoubleAndUnit.hh" 43 #include "G4UIcmdWithoutParameter.hh" 47 #include "G4UIcmdWithoutParameter.hh" 44 #include "G4UIdirectory.hh" << 45 48 46 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 47 50 48 GammaRayTelDetectorMessenger::GammaRayTelDetec << 51 GammaRayTelDetectorMessenger::GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction * GammaRayTelDet) 49 directory = new G4UIdirectory("/payload/"); << 52 :GammaRayTelDetector(GammaRayTelDet) 50 directory->SetGuidance("GammaRayTel payload << 53 51 << 54 { 52 // converter material command << 55 GammaRayTeldetDir = new G4UIdirectory("/payload/"); 53 << 56 GammaRayTeldetDir->SetGuidance("GammaRayTel payload control."); 54 converterMaterialCmd = new G4UIcmdWithAStrin << 57 55 converterMaterialCmd->SetGuidance("Select th << 58 // converter material command 56 converterMaterialCmd->SetParameterName("choi << 59 57 converterMaterialCmd->AvailableForStates(G4S << 60 ConverterMaterCmd = new G4UIcmdWithAString("/payload/setConvMat",this); 58 << 61 ConverterMaterCmd->SetGuidance("Select Material of the Converter."); 59 // converter thickness command << 62 ConverterMaterCmd->SetParameterName("choice",false); 60 << 63 ConverterMaterCmd->AvailableForStates(G4State_Idle); 61 converterThicknessCmd = new G4UIcmdWithADoub << 64 62 converterThicknessCmd->SetGuidance("Set the << 65 // converter thickness command 63 converterThicknessCmd->SetParameterName("Siz << 66 64 converterThicknessCmd->SetRange("Size>=0."); << 67 ConverterThickCmd = new G4UIcmdWithADoubleAndUnit 65 converterThicknessCmd->SetUnitCategory("Leng << 68 ("/payload/setConvThick",this); 66 converterThicknessCmd->AvailableForStates(G4 << 69 ConverterThickCmd->SetGuidance("Set Thickness of the Converter"); 67 << 70 ConverterThickCmd->SetParameterName("Size",false); 68 // tracker silicon thickness command << 71 ConverterThickCmd->SetRange("Size>=0."); 69 << 72 ConverterThickCmd->SetUnitCategory("Length"); 70 siliconThicknessCmd = new G4UIcmdWithADouble << 73 ConverterThickCmd->AvailableForStates(G4State_Idle); 71 siliconThicknessCmd->SetGuidance("Set the th << 74 72 siliconThicknessCmd->SetParameterName("Size" << 75 // tracker silicon thickness command 73 siliconThicknessCmd->SetRange("Size>=0."); << 76 74 siliconThicknessCmd->SetUnitCategory("Length << 77 SiliconThickCmd = new G4UIcmdWithADoubleAndUnit 75 siliconThicknessCmd->AvailableForStates(G4St << 78 ("/payload/setSiThick",this); 76 << 79 SiliconThickCmd->SetGuidance("Set Thickness of the Silicon"); 77 // tracker silicon pitch command << 80 SiliconThickCmd->SetParameterName("Size",false); 78 << 81 SiliconThickCmd->SetRange("Size>=0."); 79 siliconPitchCmd = new G4UIcmdWithADoubleAndU << 82 SiliconThickCmd->SetUnitCategory("Length"); 80 siliconPitchCmd->SetGuidance("Set the pitch << 83 SiliconThickCmd->AvailableForStates(G4State_Idle); 81 siliconPitchCmd->SetParameterName("Size", fa << 84 82 siliconPitchCmd->SetRange("Size>=0."); << 85 // tracker silicon pitch command 83 siliconPitchCmd->SetUnitCategory("Length"); << 86 84 siliconPitchCmd->AvailableForStates(G4State_ << 87 SiliconPitchCmd = new G4UIcmdWithADoubleAndUnit 85 << 88 ("/payload/setSiPitch",this); 86 // tracker silicon tile size command << 89 SiliconPitchCmd->SetGuidance("Set Pitch of the Silicon Strips"); 87 << 90 SiliconPitchCmd->SetParameterName("Size",false); 88 siliconTileXYCmd = new G4UIcmdWithADoubleAnd << 91 SiliconPitchCmd->SetRange("Size>=0."); 89 siliconTileXYCmd->SetGuidance("Set XY dimens << 92 SiliconPitchCmd->SetUnitCategory("Length"); 90 siliconTileXYCmd->SetParameterName("Size", f << 93 SiliconPitchCmd->AvailableForStates(G4State_Idle); 91 siliconTileXYCmd->SetRange("Size>=0."); << 94 92 siliconTileXYCmd->SetUnitCategory("Length"); << 95 // tracker silicon tile size command 93 siliconTileXYCmd->AvailableForStates(G4State << 96 94 << 97 SiliconTileXYCmd = new G4UIcmdWithADoubleAndUnit 95 // tracker number of silicon tiles << 98 ("/payload/setSiTileXY",this); 96 << 99 SiliconTileXYCmd->SetGuidance("Set XY dimensions of Si Tile"); 97 numberOfSiTilesCmd = new G4UIcmdWithAnIntege << 100 SiliconTileXYCmd->SetParameterName("Size",false); 98 numberOfSiTilesCmd->SetGuidance("Set the num << 101 SiliconTileXYCmd->SetRange("Size>=0."); 99 numberOfSiTilesCmd->SetParameterName("NbSiTi << 102 SiliconTileXYCmd->SetUnitCategory("Length"); 100 numberOfSiTilesCmd->SetRange("NbSiTiles>0 && << 103 SiliconTileXYCmd->AvailableForStates(G4State_Idle); 101 numberOfSiTilesCmd->AvailableForStates(G4Sta << 104 102 << 105 // tracker number of silicon tiles 103 // tracker number of silicon layers << 106 104 << 107 NbSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles",this); 105 numberOfTKRLayersCmd = new G4UIcmdWithAnInte << 108 NbSiTilesCmd->SetGuidance("Set number of Si Tiles."); 106 numberOfTKRLayersCmd->SetGuidance("Set the n << 109 NbSiTilesCmd->SetParameterName("NbSiTiles",false); 107 numberOfTKRLayersCmd->SetParameterName("NbTK << 110 NbSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100"); 108 numberOfTKRLayersCmd->SetRange("NbTKRLayers> << 111 NbSiTilesCmd->AvailableForStates(G4State_Idle); 109 numberOfTKRLayersCmd->AvailableForStates(G4S << 112 110 << 113 // tracker number of silicon layers 111 // tracker layer distance << 114 112 << 115 NbTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers",this); 113 layerDistanceCmd = new G4UIcmdWithADoubleAnd << 116 NbTKRLayersCmd->SetGuidance("Set number of TKR Layers."); 114 layerDistanceCmd->SetGuidance("Set the dista << 117 NbTKRLayersCmd->SetParameterName("NbTKRLayers",false); 115 layerDistanceCmd->SetParameterName("Size", f << 118 NbTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30"); 116 layerDistanceCmd->SetRange("Size>=0."); << 119 NbTKRLayersCmd->AvailableForStates(G4State_Idle); 117 layerDistanceCmd->SetUnitCategory("Length"); << 120 118 layerDistanceCmd->AvailableForStates(G4State << 121 // tracker layer distance 119 << 122 120 // tracker views distance << 123 LayerDistanceCmd = new G4UIcmdWithADoubleAndUnit 121 << 124 ("/payload/setLayerDistance",this); 122 viewsDistanceCmd = new G4UIcmdWithADoubleAnd << 125 LayerDistanceCmd->SetGuidance("Set distance between two layers"); 123 viewsDistanceCmd->SetGuidance("Set the dista << 126 LayerDistanceCmd->SetParameterName("Size",false); 124 viewsDistanceCmd->SetParameterName("Size", f << 127 LayerDistanceCmd->SetRange("Size>=0."); 125 viewsDistanceCmd->SetRange("Size>=0."); << 128 LayerDistanceCmd->SetUnitCategory("Length"); 126 viewsDistanceCmd->SetUnitCategory("Length"); << 129 LayerDistanceCmd->AvailableForStates(G4State_Idle); 127 viewsDistanceCmd->AvailableForStates(G4State << 130 128 << 131 // tracker views distance 129 // calorimeter detector thickness << 132 130 << 133 ViewsDistanceCmd = new G4UIcmdWithADoubleAndUnit 131 calThicknessCmd = new G4UIcmdWithADoubleAndU << 134 ("/payload/setViewsDistance",this); 132 calThicknessCmd->SetGuidance("Set the thickn << 135 ViewsDistanceCmd->SetGuidance("Set distance between X and Y views"); 133 calThicknessCmd->SetParameterName("Size", fa << 136 ViewsDistanceCmd->SetParameterName("Size",false); 134 calThicknessCmd->SetRange("Size>=0."); << 137 ViewsDistanceCmd->SetRange("Size>=0."); 135 calThicknessCmd->SetUnitCategory("Length"); << 138 ViewsDistanceCmd->SetUnitCategory("Length"); 136 calThicknessCmd->AvailableForStates(G4State_ << 139 ViewsDistanceCmd->AvailableForStates(G4State_Idle); 137 << 140 138 // calorimeter, number of detectors << 141 // calorimeter detector thickness 139 << 142 140 numberOfCALBarsCmd = new G4UIcmdWithAnIntege << 143 CALThickCmd = new G4UIcmdWithADoubleAndUnit 141 numberOfCALBarsCmd->SetGuidance("Set the num << 144 ("/payload/setCALThick",this); 142 numberOfCALBarsCmd->SetParameterName("NbSiTi << 145 CALThickCmd->SetGuidance("Set thickness of CAL detectors"); 143 numberOfCALBarsCmd->SetRange("NbSiTiles>0 && << 146 CALThickCmd->SetParameterName("Size",false); 144 numberOfCALBarsCmd->AvailableForStates(G4Sta << 147 CALThickCmd->SetRange("Size>=0."); 145 << 148 CALThickCmd->SetUnitCategory("Length"); 146 // calorimeter, number of layers << 149 CALThickCmd->AvailableForStates(G4State_Idle); 147 << 150 148 numberOfCALLayersCmd = new G4UIcmdWithAnInte << 151 // number calorimeter detectors 149 numberOfCALLayersCmd->SetGuidance("Set the n << 152 150 numberOfCALLayersCmd->SetParameterName("NbCA << 153 NbCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars",this); 151 numberOfCALLayersCmd->SetRange("NbCALLayers> << 154 NbCALBarsCmd->SetGuidance("Set number of CsI Bars."); 152 numberOfCALLayersCmd->AvailableForStates(G4S << 155 NbCALBarsCmd->SetParameterName("NbSiTiles",false); 153 << 156 NbCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100"); 154 // anticoincidence detector thickness << 157 NbCALBarsCmd->AvailableForStates(G4State_Idle); 155 << 158 156 acdThicknessCmd = new G4UIcmdWithADoubleAndU << 159 // number calorimeter layers 157 acdThicknessCmd->SetGuidance("Set the thickn << 160 158 acdThicknessCmd->SetParameterName("Size", fa << 161 NbCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers",this); 159 acdThicknessCmd->SetRange("Size>=0."); << 162 NbCALLayersCmd->SetGuidance("Set number of CAL Layers."); 160 acdThicknessCmd->SetUnitCategory("Length"); << 163 NbCALLayersCmd->SetParameterName("NbCALLayers",false); 161 acdThicknessCmd->AvailableForStates(G4State_ << 164 NbCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16"); 162 << 165 NbCALLayersCmd->AvailableForStates(G4State_Idle); 163 // update payload geometry << 166 164 << 167 // calorimeter detector thickness 165 updateCmd = new G4UIcmdWithoutParameter("/pa << 168 166 updateCmd->SetGuidance("Update the geometry << 169 ACDThickCmd = new G4UIcmdWithADoubleAndUnit 167 updateCmd->SetGuidance("This command MUST be << 170 ("/payload/setACDThick",this); 168 updateCmd->SetGuidance("if you changed geome << 171 ACDThickCmd->SetGuidance("Set thickness of ACD detectors"); 169 updateCmd->AvailableForStates(G4State_Idle); << 172 ACDThickCmd->SetParameterName("Size",false); 170 << 173 ACDThickCmd->SetRange("Size>=0."); 171 // magnetic field << 174 ACDThickCmd->SetUnitCategory("Length"); 172 << 175 ACDThickCmd->AvailableForStates(G4State_Idle); 173 magneticFieldCmd = new G4UIcmdWithADoubleAnd << 176 174 magneticFieldCmd->SetGuidance("Define the ma << 177 // update Payload 175 magneticFieldCmd->SetGuidance("Magnetic fiel << 178 176 magneticFieldCmd->SetParameterName("Bz", fal << 179 UpdateCmd = new G4UIcmdWithoutParameter("/payload/update",this); 177 magneticFieldCmd->SetUnitCategory("Magnetic << 180 UpdateCmd->SetGuidance("Update payload geometry."); 178 magneticFieldCmd->AvailableForStates(G4State << 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); 179 } 193 } 180 194 181 //....oooOO0OOooo........oooOO0OOooo........oo 195 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 182 196 183 GammaRayTelDetectorMessenger::~GammaRayTelDete << 197 GammaRayTelDetectorMessenger::~GammaRayTelDetectorMessenger() 184 delete converterMaterialCmd; << 198 { 185 delete converterThicknessCmd; << 199 delete ConverterMaterCmd; delete ConverterThickCmd; 186 delete numberOfSiTilesCmd; << 200 delete NbSiTilesCmd; delete NbTKRLayersCmd; 187 delete numberOfTKRLayersCmd; << 201 delete SiliconTileXYCmd; delete SiliconPitchCmd; 188 delete siliconTileXYCmd; << 202 delete SiliconThickCmd; delete LayerDistanceCmd; 189 delete siliconPitchCmd; << 203 delete ViewsDistanceCmd; delete ACDThickCmd; 190 delete siliconThicknessCmd; << 204 delete NbCALLayersCmd; delete NbCALBarsCmd; 191 delete layerDistanceCmd; << 205 delete CALThickCmd; delete UpdateCmd; 192 delete viewsDistanceCmd; << 206 delete MagFieldCmd; delete GammaRayTeldetDir; 193 delete acdThicknessCmd; << 194 delete numberOfCALLayersCmd; << 195 delete numberOfCALBarsCmd; << 196 delete calThicknessCmd; << 197 delete updateCmd; << 198 delete magneticFieldCmd; << 199 delete directory; << 200 } 207 } 201 208 202 //....oooOO0OOooo........oooOO0OOooo........oo 209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 203 210 204 void GammaRayTelDetectorMessenger::SetNewValue << 211 void GammaRayTelDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 205 // converter << 212 { >> 213 >> 214 // converter 206 215 207 if (command == converterMaterialCmd) { << 216 if( command == ConverterMaterCmd ) 208 detector->SetConverterMaterial(newValue); << 217 { GammaRayTelDetector->SetConverterMaterial(newValue);} 209 } else if (command == converterThicknessCmd) << 218 210 detector->SetConverterThickness(converterT << 219 if( command == ConverterThickCmd ) 211 } else << 220 { GammaRayTelDetector->SetConverterThickness(ConverterThickCmd->GetNewDoubleValue(newValue));} 212 << 221 213 // tracker (TKR) << 222 // tracker 214 << 223 215 if (command == siliconTileXYCmd) { << 224 if( command == SiliconTileXYCmd ) 216 detector->SetTKRTileSizeXY(siliconTileXYCm << 225 { GammaRayTelDetector->SetTKRTileSizeXY(SiliconTileXYCmd->GetNewDoubleValue(newValue));} 217 } else if (command == siliconPitchCmd) { << 226 218 detector->SetTKRSiliconPitch(siliconPitchC << 227 if( command == SiliconPitchCmd ) 219 } else if (command == siliconThicknessCmd) { << 228 { GammaRayTelDetector->SetTKRSiliconPitch(SiliconPitchCmd->GetNewDoubleValue(newValue));} 220 detector->SetTKRSiliconThickness(siliconTh << 229 221 } else if (command == numberOfSiTilesCmd) { << 230 if( command == SiliconThickCmd ) 222 detector->SetNbOfTKRTiles(numberOfSiTilesC << 231 { GammaRayTelDetector->SetTKRSiliconThickness(SiliconThickCmd->GetNewDoubleValue(newValue));} 223 } else if (command == numberOfTKRLayersCmd) << 232 224 detector->SetNbOfTKRLayers(numberOfTKRLaye << 233 if( command == NbSiTilesCmd ) 225 } else if (command == layerDistanceCmd) { << 234 { GammaRayTelDetector->SetNbOfTKRTiles(NbSiTilesCmd->GetNewIntValue(newValue));} 226 detector->SetTKRLayerDistance(layerDistanc << 235 227 } else if (command == viewsDistanceCmd) { << 236 if( command == NbTKRLayersCmd ) 228 detector->SetTKRViewsDistance(viewsDistanc << 237 { GammaRayTelDetector->SetNbOfTKRLayers(NbTKRLayersCmd->GetNewIntValue(newValue));} 229 } else << 238 230 << 239 if( command == LayerDistanceCmd ) 231 // calorimeter (CAL) << 240 { GammaRayTelDetector->SetTKRLayerDistance(LayerDistanceCmd->GetNewDoubleValue(newValue));} 232 << 241 233 if (command == numberOfCALLayersCmd) { << 242 if( command == ViewsDistanceCmd ) 234 detector->SetNbOfCALLayers(numberOfCALLaye << 243 { GammaRayTelDetector->SetTKRViewsDistance(ViewsDistanceCmd->GetNewDoubleValue(newValue));} 235 } else if (command == numberOfCALBarsCmd) { << 244 236 detector->SetNbOfCALBars(numberOfCALBarsCm << 245 // calorimeter 237 } else if (command == calThicknessCmd) { << 246 238 detector->SetCALBarThickness(calThicknessC << 247 if( command == NbCALLayersCmd ) 239 } else << 248 { GammaRayTelDetector->SetNbOfCALLayers(NbCALLayersCmd->GetNewIntValue(newValue));} 240 << 249 241 // anticoincidence (ACD) << 250 if( command == NbCALBarsCmd ) 242 << 251 { GammaRayTelDetector->SetNbOfCALBars(NbCALBarsCmd->GetNewIntValue(newValue));} 243 if (command == acdThicknessCmd) { << 252 244 detector->SetACDThickness(acdThicknessCmd- << 253 if( command == CALThickCmd ) 245 } else if (command == updateCmd) { << 254 { GammaRayTelDetector->SetCALBarThickness(CALThickCmd->GetNewDoubleValue(newValue));} 246 detector->UpdateGeometry(); << 255 247 } else if (command == magneticFieldCmd) { << 256 // anticoincidence 248 detector->SetMagField(magneticFieldCmd->Ge << 257 249 } << 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));} 250 } 266 } >> 267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 268 >> 269 >> 270 >> 271 >> 272 >> 273 251 274