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$ >> 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file 30 // GEANT 4 class implementation file 29 // CERN Geneva Switzerland 31 // CERN Geneva Switzerland 30 // 32 // 31 // 33 // 32 // ------------ GammaRayTelDetectorMessen 34 // ------------ GammaRayTelDetectorMessenger ------ 33 // by F.Longo, R.Giannitrapani & G.S 35 // by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000) 34 // 36 // 35 // ******************************************* 37 // ************************************************************ 36 38 37 #include "GammaRayTelDetectorConstruction.hh" << 38 #include "GammaRayTelDetectorMessenger.hh" 39 #include "GammaRayTelDetectorMessenger.hh" 39 40 40 #include "G4UIcmdWithADoubleAndUnit.hh" << 41 #include "GammaRayTelDetectorConstruction.hh" 41 #include "G4UIcmdWithAnInteger.hh" << 42 #include "G4UIdirectory.hh" 42 #include "G4UIcmdWithAString.hh" 43 #include "G4UIcmdWithAString.hh" >> 44 #include "G4UIcmdWithAnInteger.hh" >> 45 #include "G4UIcmdWithADoubleAndUnit.hh" 43 #include "G4UIcmdWithoutParameter.hh" 46 #include "G4UIcmdWithoutParameter.hh" 44 #include "G4UIdirectory.hh" << 45 47 46 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 47 49 48 GammaRayTelDetectorMessenger::GammaRayTelDetec << 50 GammaRayTelDetectorMessenger::GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction * GammaRayTelDet) 49 directory = new G4UIdirectory("/payload/"); << 51 :GammaRayTelDetector(GammaRayTelDet) 50 directory->SetGuidance("GammaRayTel payload << 52 51 << 53 { 52 // converter material command << 54 GammaRayTeldetDir = new G4UIdirectory("/payload/"); 53 << 55 GammaRayTeldetDir->SetGuidance("GammaRayTel payload control."); 54 converterMaterialCmd = new G4UIcmdWithAStrin << 56 55 converterMaterialCmd->SetGuidance("Select th << 57 // converter material command 56 converterMaterialCmd->SetParameterName("choi << 58 57 converterMaterialCmd->AvailableForStates(G4S << 59 ConverterMaterCmd = new G4UIcmdWithAString("/payload/setConvMat",this); 58 << 60 ConverterMaterCmd->SetGuidance("Select Material of the Converter."); 59 // converter thickness command << 61 ConverterMaterCmd->SetParameterName("choice",false); 60 << 62 ConverterMaterCmd->AvailableForStates(G4State_Idle); 61 converterThicknessCmd = new G4UIcmdWithADoub << 63 62 converterThicknessCmd->SetGuidance("Set the << 64 // converter thickness command 63 converterThicknessCmd->SetParameterName("Siz << 65 64 converterThicknessCmd->SetRange("Size>=0."); << 66 ConverterThickCmd = new G4UIcmdWithADoubleAndUnit 65 converterThicknessCmd->SetUnitCategory("Leng << 67 ("/payload/setConvThick",this); 66 converterThicknessCmd->AvailableForStates(G4 << 68 ConverterThickCmd->SetGuidance("Set Thickness of the Converter"); 67 << 69 ConverterThickCmd->SetParameterName("Size",false); 68 // tracker silicon thickness command << 70 ConverterThickCmd->SetRange("Size>=0."); 69 << 71 ConverterThickCmd->SetUnitCategory("Length"); 70 siliconThicknessCmd = new G4UIcmdWithADouble << 72 ConverterThickCmd->AvailableForStates(G4State_Idle); 71 siliconThicknessCmd->SetGuidance("Set the th << 73 72 siliconThicknessCmd->SetParameterName("Size" << 74 // tracker silicon thickness command 73 siliconThicknessCmd->SetRange("Size>=0."); << 75 74 siliconThicknessCmd->SetUnitCategory("Length << 76 SiliconThickCmd = new G4UIcmdWithADoubleAndUnit 75 siliconThicknessCmd->AvailableForStates(G4St << 77 ("/payload/setSiThick",this); 76 << 78 SiliconThickCmd->SetGuidance("Set Thickness of the Silicon"); 77 // tracker silicon pitch command << 79 SiliconThickCmd->SetParameterName("Size",false); 78 << 80 SiliconThickCmd->SetRange("Size>=0."); 79 siliconPitchCmd = new G4UIcmdWithADoubleAndU << 81 SiliconThickCmd->SetUnitCategory("Length"); 80 siliconPitchCmd->SetGuidance("Set the pitch << 82 SiliconThickCmd->AvailableForStates(G4State_Idle); 81 siliconPitchCmd->SetParameterName("Size", fa << 83 82 siliconPitchCmd->SetRange("Size>=0."); << 84 // tracker silicon pitch command 83 siliconPitchCmd->SetUnitCategory("Length"); << 85 84 siliconPitchCmd->AvailableForStates(G4State_ << 86 SiliconPitchCmd = new G4UIcmdWithADoubleAndUnit 85 << 87 ("/payload/setSiPitch",this); 86 // tracker silicon tile size command << 88 SiliconPitchCmd->SetGuidance("Set Pitch of the Silicon Strips"); 87 << 89 SiliconPitchCmd->SetParameterName("Size",false); 88 siliconTileXYCmd = new G4UIcmdWithADoubleAnd << 90 SiliconPitchCmd->SetRange("Size>=0."); 89 siliconTileXYCmd->SetGuidance("Set XY dimens << 91 SiliconPitchCmd->SetUnitCategory("Length"); 90 siliconTileXYCmd->SetParameterName("Size", f << 92 SiliconPitchCmd->AvailableForStates(G4State_Idle); 91 siliconTileXYCmd->SetRange("Size>=0."); << 93 92 siliconTileXYCmd->SetUnitCategory("Length"); << 94 // tracker silicon tile size command 93 siliconTileXYCmd->AvailableForStates(G4State << 95 94 << 96 SiliconTileXYCmd = new G4UIcmdWithADoubleAndUnit 95 // tracker number of silicon tiles << 97 ("/payload/setSiTileXY",this); 96 << 98 SiliconTileXYCmd->SetGuidance("Set XY dimensions of Si Tile"); 97 numberOfSiTilesCmd = new G4UIcmdWithAnIntege << 99 SiliconTileXYCmd->SetParameterName("Size",false); 98 numberOfSiTilesCmd->SetGuidance("Set the num << 100 SiliconTileXYCmd->SetRange("Size>=0."); 99 numberOfSiTilesCmd->SetParameterName("NbSiTi << 101 SiliconTileXYCmd->SetUnitCategory("Length"); 100 numberOfSiTilesCmd->SetRange("NbSiTiles>0 && << 102 SiliconTileXYCmd->AvailableForStates(G4State_Idle); 101 numberOfSiTilesCmd->AvailableForStates(G4Sta << 103 102 << 104 // tracker number of silicon tiles 103 // tracker number of silicon layers << 105 104 << 106 NbSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles",this); 105 numberOfTKRLayersCmd = new G4UIcmdWithAnInte << 107 NbSiTilesCmd->SetGuidance("Set number of Si Tiles."); 106 numberOfTKRLayersCmd->SetGuidance("Set the n << 108 NbSiTilesCmd->SetParameterName("NbSiTiles",false); 107 numberOfTKRLayersCmd->SetParameterName("NbTK << 109 NbSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100"); 108 numberOfTKRLayersCmd->SetRange("NbTKRLayers> << 110 NbSiTilesCmd->AvailableForStates(G4State_Idle); 109 numberOfTKRLayersCmd->AvailableForStates(G4S << 111 110 << 112 // tracker number of silicon layers 111 // tracker layer distance << 113 112 << 114 NbTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers",this); 113 layerDistanceCmd = new G4UIcmdWithADoubleAnd << 115 NbTKRLayersCmd->SetGuidance("Set number of TKR Layers."); 114 layerDistanceCmd->SetGuidance("Set the dista << 116 NbTKRLayersCmd->SetParameterName("NbTKRLayers",false); 115 layerDistanceCmd->SetParameterName("Size", f << 117 NbTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30"); 116 layerDistanceCmd->SetRange("Size>=0."); << 118 NbTKRLayersCmd->AvailableForStates(G4State_Idle); 117 layerDistanceCmd->SetUnitCategory("Length"); << 119 118 layerDistanceCmd->AvailableForStates(G4State << 120 // tracker layer distance 119 << 121 120 // tracker views distance << 122 LayerDistanceCmd = new G4UIcmdWithADoubleAndUnit 121 << 123 ("/payload/setLayerDistance",this); 122 viewsDistanceCmd = new G4UIcmdWithADoubleAnd << 124 LayerDistanceCmd->SetGuidance("Set distance between two layers"); 123 viewsDistanceCmd->SetGuidance("Set the dista << 125 LayerDistanceCmd->SetParameterName("Size",false); 124 viewsDistanceCmd->SetParameterName("Size", f << 126 LayerDistanceCmd->SetRange("Size>=0."); 125 viewsDistanceCmd->SetRange("Size>=0."); << 127 LayerDistanceCmd->SetUnitCategory("Length"); 126 viewsDistanceCmd->SetUnitCategory("Length"); << 128 LayerDistanceCmd->AvailableForStates(G4State_Idle); 127 viewsDistanceCmd->AvailableForStates(G4State << 129 128 << 130 // tracker views distance 129 // calorimeter detector thickness << 131 130 << 132 ViewsDistanceCmd = new G4UIcmdWithADoubleAndUnit 131 calThicknessCmd = new G4UIcmdWithADoubleAndU << 133 ("/payload/setViewsDistance",this); 132 calThicknessCmd->SetGuidance("Set the thickn << 134 ViewsDistanceCmd->SetGuidance("Set distance between X and Y views"); 133 calThicknessCmd->SetParameterName("Size", fa << 135 ViewsDistanceCmd->SetParameterName("Size",false); 134 calThicknessCmd->SetRange("Size>=0."); << 136 ViewsDistanceCmd->SetRange("Size>=0."); 135 calThicknessCmd->SetUnitCategory("Length"); << 137 ViewsDistanceCmd->SetUnitCategory("Length"); 136 calThicknessCmd->AvailableForStates(G4State_ << 138 ViewsDistanceCmd->AvailableForStates(G4State_Idle); 137 << 139 138 // calorimeter, number of detectors << 140 // calorimeter detector thickness 139 << 141 140 numberOfCALBarsCmd = new G4UIcmdWithAnIntege << 142 CALThickCmd = new G4UIcmdWithADoubleAndUnit 141 numberOfCALBarsCmd->SetGuidance("Set the num << 143 ("/payload/setCALThick",this); 142 numberOfCALBarsCmd->SetParameterName("NbSiTi << 144 CALThickCmd->SetGuidance("Set thickness of CAL detectors"); 143 numberOfCALBarsCmd->SetRange("NbSiTiles>0 && << 145 CALThickCmd->SetParameterName("Size",false); 144 numberOfCALBarsCmd->AvailableForStates(G4Sta << 146 CALThickCmd->SetRange("Size>=0."); 145 << 147 CALThickCmd->SetUnitCategory("Length"); 146 // calorimeter, number of layers << 148 CALThickCmd->AvailableForStates(G4State_Idle); 147 << 149 148 numberOfCALLayersCmd = new G4UIcmdWithAnInte << 150 // number calorimeter detectors 149 numberOfCALLayersCmd->SetGuidance("Set the n << 151 150 numberOfCALLayersCmd->SetParameterName("NbCA << 152 NbCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars",this); 151 numberOfCALLayersCmd->SetRange("NbCALLayers> << 153 NbCALBarsCmd->SetGuidance("Set number of CsI Bars."); 152 numberOfCALLayersCmd->AvailableForStates(G4S << 154 NbCALBarsCmd->SetParameterName("NbSiTiles",false); 153 << 155 NbCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100"); 154 // anticoincidence detector thickness << 156 NbCALBarsCmd->AvailableForStates(G4State_Idle); 155 << 157 156 acdThicknessCmd = new G4UIcmdWithADoubleAndU << 158 // number calorimeter layers 157 acdThicknessCmd->SetGuidance("Set the thickn << 159 158 acdThicknessCmd->SetParameterName("Size", fa << 160 NbCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers",this); 159 acdThicknessCmd->SetRange("Size>=0."); << 161 NbCALLayersCmd->SetGuidance("Set number of CAL Layers."); 160 acdThicknessCmd->SetUnitCategory("Length"); << 162 NbCALLayersCmd->SetParameterName("NbCALLayers",false); 161 acdThicknessCmd->AvailableForStates(G4State_ << 163 NbCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16"); 162 << 164 NbCALLayersCmd->AvailableForStates(G4State_Idle); 163 // update payload geometry << 165 164 << 166 // calorimeter detector thickness 165 updateCmd = new G4UIcmdWithoutParameter("/pa << 167 166 updateCmd->SetGuidance("Update the geometry << 168 ACDThickCmd = new G4UIcmdWithADoubleAndUnit 167 updateCmd->SetGuidance("This command MUST be << 169 ("/payload/setACDThick",this); 168 updateCmd->SetGuidance("if you changed geome << 170 ACDThickCmd->SetGuidance("Set thickness of ACD detectors"); 169 updateCmd->AvailableForStates(G4State_Idle); << 171 ACDThickCmd->SetParameterName("Size",false); 170 << 172 ACDThickCmd->SetRange("Size>=0."); 171 // magnetic field << 173 ACDThickCmd->SetUnitCategory("Length"); 172 << 174 ACDThickCmd->AvailableForStates(G4State_Idle); 173 magneticFieldCmd = new G4UIcmdWithADoubleAnd << 175 174 magneticFieldCmd->SetGuidance("Define the ma << 176 // update Payload 175 magneticFieldCmd->SetGuidance("Magnetic fiel << 177 176 magneticFieldCmd->SetParameterName("Bz", fal << 178 UpdateCmd = new G4UIcmdWithoutParameter("/payload/update",this); 177 magneticFieldCmd->SetUnitCategory("Magnetic << 179 UpdateCmd->SetGuidance("Update payload geometry."); 178 magneticFieldCmd->AvailableForStates(G4State << 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); 179 } 192 } 180 193 181 //....oooOO0OOooo........oooOO0OOooo........oo 194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 182 195 183 GammaRayTelDetectorMessenger::~GammaRayTelDete << 196 GammaRayTelDetectorMessenger::~GammaRayTelDetectorMessenger() 184 delete converterMaterialCmd; << 197 { 185 delete converterThicknessCmd; << 198 delete ConverterMaterCmd; delete ConverterThickCmd; 186 delete numberOfSiTilesCmd; << 199 delete NbSiTilesCmd; delete NbTKRLayersCmd; 187 delete numberOfTKRLayersCmd; << 200 delete SiliconTileXYCmd; delete SiliconPitchCmd; 188 delete siliconTileXYCmd; << 201 delete SiliconThickCmd; delete LayerDistanceCmd; 189 delete siliconPitchCmd; << 202 delete ViewsDistanceCmd; delete ACDThickCmd; 190 delete siliconThicknessCmd; << 203 delete NbCALLayersCmd; delete NbCALBarsCmd; 191 delete layerDistanceCmd; << 204 delete CALThickCmd; delete UpdateCmd; 192 delete viewsDistanceCmd; << 205 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 } 206 } 201 207 202 //....oooOO0OOooo........oooOO0OOooo........oo 208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 203 209 204 void GammaRayTelDetectorMessenger::SetNewValue << 210 void GammaRayTelDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 205 // converter << 211 { >> 212 >> 213 // converter 206 214 207 if (command == converterMaterialCmd) { << 215 if( command == ConverterMaterCmd ) 208 detector->SetConverterMaterial(newValue); << 216 { GammaRayTelDetector->SetConverterMaterial(newValue);} 209 } else if (command == converterThicknessCmd) << 217 210 detector->SetConverterThickness(converterT << 218 if( command == ConverterThickCmd ) 211 } else << 219 { GammaRayTelDetector->SetConverterThickness(ConverterThickCmd->GetNewDoubleValue(newValue));} 212 << 220 213 // tracker (TKR) << 221 // tracker 214 << 222 215 if (command == siliconTileXYCmd) { << 223 if( command == SiliconTileXYCmd ) 216 detector->SetTKRTileSizeXY(siliconTileXYCm << 224 { GammaRayTelDetector->SetTKRTileSizeXY(SiliconTileXYCmd->GetNewDoubleValue(newValue));} 217 } else if (command == siliconPitchCmd) { << 225 218 detector->SetTKRSiliconPitch(siliconPitchC << 226 if( command == SiliconPitchCmd ) 219 } else if (command == siliconThicknessCmd) { << 227 { GammaRayTelDetector->SetTKRSiliconPitch(SiliconPitchCmd->GetNewDoubleValue(newValue));} 220 detector->SetTKRSiliconThickness(siliconTh << 228 221 } else if (command == numberOfSiTilesCmd) { << 229 if( command == SiliconThickCmd ) 222 detector->SetNbOfTKRTiles(numberOfSiTilesC << 230 { GammaRayTelDetector->SetTKRSiliconThickness(SiliconThickCmd->GetNewDoubleValue(newValue));} 223 } else if (command == numberOfTKRLayersCmd) << 231 224 detector->SetNbOfTKRLayers(numberOfTKRLaye << 232 if( command == NbSiTilesCmd ) 225 } else if (command == layerDistanceCmd) { << 233 { GammaRayTelDetector->SetNbOfTKRTiles(NbSiTilesCmd->GetNewIntValue(newValue));} 226 detector->SetTKRLayerDistance(layerDistanc << 234 227 } else if (command == viewsDistanceCmd) { << 235 if( command == NbTKRLayersCmd ) 228 detector->SetTKRViewsDistance(viewsDistanc << 236 { GammaRayTelDetector->SetNbOfTKRLayers(NbTKRLayersCmd->GetNewIntValue(newValue));} 229 } else << 237 230 << 238 if( command == LayerDistanceCmd ) 231 // calorimeter (CAL) << 239 { GammaRayTelDetector->SetTKRLayerDistance(LayerDistanceCmd->GetNewDoubleValue(newValue));} 232 << 240 233 if (command == numberOfCALLayersCmd) { << 241 if( command == ViewsDistanceCmd ) 234 detector->SetNbOfCALLayers(numberOfCALLaye << 242 { GammaRayTelDetector->SetTKRViewsDistance(ViewsDistanceCmd->GetNewDoubleValue(newValue));} 235 } else if (command == numberOfCALBarsCmd) { << 243 236 detector->SetNbOfCALBars(numberOfCALBarsCm << 244 // calorimeter 237 } else if (command == calThicknessCmd) { << 245 238 detector->SetCALBarThickness(calThicknessC << 246 if( command == NbCALLayersCmd ) 239 } else << 247 { GammaRayTelDetector->SetNbOfCALLayers(NbCALLayersCmd->GetNewIntValue(newValue));} 240 << 248 241 // anticoincidence (ACD) << 249 if( command == NbCALBarsCmd ) 242 << 250 { GammaRayTelDetector->SetNbOfCALBars(NbCALBarsCmd->GetNewIntValue(newValue));} 243 if (command == acdThicknessCmd) { << 251 244 detector->SetACDThickness(acdThicknessCmd- << 252 if( command == CALThickCmd ) 245 } else if (command == updateCmd) { << 253 { GammaRayTelDetector->SetCALBarThickness(CALThickCmd->GetNewDoubleValue(newValue));} 246 detector->UpdateGeometry(); << 254 247 } else if (command == magneticFieldCmd) { << 255 // anticoincidence 248 detector->SetMagField(magneticFieldCmd->Ge << 256 249 } << 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));} 250 } 265 } >> 266 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 267 >> 268 >> 269 >> 270 >> 271 >> 272 251 273