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