Geant4 Cross Reference |
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 // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) 29 // 30 // History: 31 // ----------- 32 // 28 Nov 2001 Elena Guardincerri Created 33 // Nov 2002 Alfonso Mantero materials added, Material selection implementation 34 // 16 Jul 2003 Alfonso Mantero Detector type selection added + minor fixes 35 // 21 Aug 2003 Alfonso Mantero Material Management moved to XrayFluoMaterials 36 // 37 // ------------------------------------------------------------------- 38 39 #ifndef XrayFluoDetectorConstruction_hh 40 #define XrayFluoDetectorConstruction_hh 1 41 42 #include "globals.hh" 43 #include "G4RotationMatrix.hh" 44 #include "G4VUserDetectorConstruction.hh" 45 #include "G4Navigator.hh" 46 #include "G4Cache.hh" 47 48 #include "XrayFluoSiLiDetectorType.hh" 49 #include "XrayFluoHPGeDetectorType.hh" 50 #include "XrayFluoSD.hh" 51 #include "XrayFluoGeometry.hh" 52 53 class G4Box; 54 class G4Tubs; 55 class G4Sphere; 56 class G4LogicalVolume; 57 class G4VPhysicalVolume; 58 class G4Material; 59 class XrayFluoDetectorMessenger; 60 class XrayFluoNistMaterials; 61 62 //class XrayFluoSD; 63 //class XrayFluoVDetectorType; 64 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 66 67 class XrayFluoDetectorConstruction : public G4VUserDetectorConstruction 68 { 69 public: 70 71 72 ~XrayFluoDetectorConstruction(); 73 74 public: 75 76 G4VPhysicalVolume* Construct(); 77 78 void ConstructSDandField(); 79 80 void UpdateGeometry(); 81 82 void SetOhmicPosThickness(G4double); 83 84 void SetSampleMaterial(G4String newMaterial); 85 86 void SetDetectorType(G4String type); 87 88 static XrayFluoDetectorConstruction* GetInstance(); 89 90 inline void SetSampleGranularity(G4bool granularity) 91 {sampleGranularity = granularity;}; 92 93 inline void PhaseSpaceOn() 94 {phaseSpaceFlag = true;}; 95 96 inline void PhaseSpaceOff() 97 {phaseSpaceFlag = false;}; 98 99 inline G4bool GetPhaseSpaceFlag() const 100 {return phaseSpaceFlag;}; 101 102 inline void SetGrainDia(G4double size) 103 {grainDia = size;}; 104 105 void DeleteGrainObjects(); 106 107 public: 108 109 void PrintApparateParameters(); 110 111 XrayFluoVDetectorType* GetDetectorType() const; 112 113 114 G4double GetWorldSizeZ() const {return WorldSizeZ;}; 115 G4double GetWorldSizeXY() const {return WorldSizeXY;}; 116 117 G4double GetDeviceThickness() const {return DeviceThickness;}; 118 G4double GetDeviceSizeX() const {return DeviceSizeX;}; 119 G4double GetDeviceSizeY() const {return DeviceSizeY;}; 120 G4double GetPixelSizeXY() const {return PixelSizeXY;}; 121 G4double GetContactSizeXY() const {return ContactSizeXY;}; 122 123 G4int GetNbOfPixels() const {return NbOfPixels;}; 124 G4int GetNbOfPixelRows() const {return NbOfPixelRows;}; 125 G4int GetNbOfPixelColumns() const {return NbOfPixelColumns;}; 126 127 G4Material* GetOhmicPosMaterial() const {return OhmicPosMaterial;}; 128 G4double GetOhmicPosThickness() const {return OhmicPosThickness;}; 129 130 G4Material* GetOhmicNegMaterial() const {return OhmicNegMaterial;}; 131 G4double GetOhmicNegThickness() const {return OhmicNegThickness;}; 132 133 G4ThreeVector GetDetectorPosition() const; 134 G4ThreeVector GetSamplePosition() const {return G4ThreeVector(0,0,0);}; 135 136 const G4VPhysicalVolume* GetphysiWorld() const {return physiWorld;}; 137 const G4VPhysicalVolume* GetHPGe() const {return physiHPGe;}; 138 const G4VPhysicalVolume* GetSample() const {return physiSample;}; 139 const G4VPhysicalVolume* GetDia1() const {return physiDia1;}; 140 const G4VPhysicalVolume* GetDia3() const {return physiDia3;}; 141 142 const G4VPhysicalVolume* GetphysiPixel() const {return physiPixel;}; 143 const G4VPhysicalVolume* GetOhmicPos() const {return physiOhmicPos;}; 144 const G4VPhysicalVolume* GetOhmicNeg() const {return physiOhmicNeg;}; 145 const G4VPhysicalVolume* GetWindow () const {return physiWindow ;}; 146 private: 147 148 G4Navigator* aNavigator; 149 150 XrayFluoDetectorConstruction(); 151 152 static XrayFluoDetectorConstruction* instance; 153 154 XrayFluoVDetectorType* detectorType; 155 156 G4bool sampleGranularity; 157 G4bool phaseSpaceFlag; 158 159 G4double DeviceSizeX; 160 G4double DeviceSizeY; 161 G4double DeviceThickness; 162 163 G4Box* solidWorld; //pointer to the solid World 164 G4LogicalVolume* logicWorld; //pointer to the logical World 165 G4VPhysicalVolume* physiWorld; //pointer to the physical World 166 167 G4Box* solidHPGe; //pointer to the solid Sensor 168 G4LogicalVolume* logicHPGe; //pointer to the logical Sensor 169 G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor 170 171 G4Box* solidSample; //pointer to the solid Sample 172 G4LogicalVolume* logicSample; //pointer to the logical Sample 173 G4VPhysicalVolume* physiSample; //pointer to the physical Sample 174 175 G4Tubs* solidDia1; //pointer to the solid Diaphragm 176 G4LogicalVolume* logicDia1; //pointer to the logical Diaphragm 177 G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm 178 179 G4Tubs* solidDia3; //pointer to the solid Diaphragm 180 G4LogicalVolume* logicDia3; //pointer to the logical Diaphragm 181 G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm 182 183 G4Box* solidOhmicPos; 184 G4LogicalVolume* logicOhmicPos; 185 G4VPhysicalVolume* physiOhmicPos; 186 187 G4Box* solidWindow; // added 188 G4LogicalVolume* logicWindow; // added 189 G4VPhysicalVolume* physiWindow; // added 190 191 G4Box* solidOhmicNeg; 192 G4LogicalVolume* logicOhmicNeg; 193 G4VPhysicalVolume* physiOhmicNeg; 194 195 G4Box* solidPixel; 196 G4LogicalVolume* logicPixel; 197 G4VPhysicalVolume* physiPixel; 198 199 G4Sphere* solidGrain; 200 G4LogicalVolume* logicGrain; 201 G4VPhysicalVolume* physiGrain; 202 203 204 //materials management 205 XrayFluoNistMaterials* materials; 206 207 G4Material* OhmicPosMaterial; 208 G4Material* OhmicNegMaterial; 209 G4Material* pixelMaterial; 210 G4Material* sampleMaterial; 211 G4Material* Dia1Material; 212 G4Material* Dia3Material; 213 G4Material* defaultMaterial; 214 G4Material* windowMaterial; //added 215 216 217 //apparate parameters 218 219 G4double OhmicPosThickness; 220 221 G4double OhmicNegThickness; 222 223 G4double windowThickness; //added 224 225 G4int PixelCopyNb; 226 G4int grainCopyNb; 227 G4int NbOfPixels; 228 G4int NbOfPixelRows; 229 G4int NbOfPixelColumns; 230 G4double PixelThickness; // added 231 232 233 234 G4double PixelSizeXY; 235 G4double ContactSizeXY; 236 237 public: 238 239 G4Material* GetSampleMaterial() const {return sampleMaterial;}; 240 G4Material* GetPixelMaterial() const {return pixelMaterial;}; 241 G4Material* GetDia1Material() const {return Dia1Material;}; 242 G4Material* GetDia3Material() const {return Dia3Material;}; 243 244 245 G4Navigator* GetGeometryNavigator() const {return aNavigator;}; 246 247 private: 248 249 G4double SampleThickness; 250 G4double SampleSizeXY; 251 G4double grainDia; 252 G4double Dia1Thickness; 253 G4double Dia1SizeXY; 254 G4double Dia3Thickness; 255 G4double Dia3SizeXY; 256 G4double DiaInnerSize; 257 G4double Dia3InnerSize; 258 // G4double DistSi; 259 public: 260 261 262 G4double GetSampleThickness() const {return SampleThickness;}; 263 G4double GetSampleSizeXY() const {return SampleSizeXY;}; 264 265 G4double GetDia1Thickness() const {return Dia1Thickness;}; 266 G4double GetDia1SizeXY() const {return Dia1SizeXY;}; 267 268 G4double GetDia3Thickness() const {return Dia3Thickness;}; 269 G4double GetDia3SizeXY() const {return Dia3SizeXY;}; 270 271 272 private: 273 274 275 G4double ThetaHPGe; 276 G4double ThetaDia1; 277 G4double ThetaDia3; 278 279 G4double DistDe; 280 G4double DistDia; 281 G4double Dia3Dist; 282 G4double PhiHPGe; 283 G4double PhiDia1; 284 G4double PhiDia3; 285 G4double AlphaDia1; 286 G4double AlphaDia3; 287 288 289 G4RotationMatrix zRotPhiHPGe; 290 G4RotationMatrix zRotPhiDia1; 291 G4RotationMatrix zRotPhiDia3; 292 G4double WorldSizeXY; 293 G4double WorldSizeZ; 294 295 296 XrayFluoDetectorMessenger* detectorMessenger; //pointer to the Messenger 297 298 G4Cache<XrayFluoSD*> HPGeSD; //pointer to the sensitive detector 299 300 G4Region* sampleRegion; 301 302 303 private: 304 305 void DefineDefaultMaterials(); 306 G4VPhysicalVolume* ConstructApparate(); 307 308 //calculates some quantities used to construct geometry 309 void ComputeApparateParameters(); 310 311 }; 312 313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 314 315 inline void XrayFluoDetectorConstruction::ComputeApparateParameters() 316 { 317 // Compute derived parameters of the apparate 318 319 if (phaseSpaceFlag) { 320 321 WorldSizeZ = 10 *CLHEP::m; 322 WorldSizeXY = 10 *CLHEP::m; 323 324 } 325 else { 326 327 DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness+windowThickness;//change! 328 329 G4cout << "DeviceThickness(cm): "<< DeviceThickness/CLHEP::cm << G4endl; 330 331 DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY)); 332 DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY)); 333 334 G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/CLHEP::cm <<G4endl; 335 G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/CLHEP::cm << G4endl; 336 337 WorldSizeZ = (2 * (DistDe +1.4142 *(std::max(std::max(DeviceThickness,DeviceSizeY), DeviceSizeX))))+5*CLHEP::m; 338 WorldSizeXY = 2 * (DistDe +1.4142 *Dia1SizeXY)+5*CLHEP::m; 339 340 } 341 } 342 343 #endif 344