Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:12

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // ------------------------------------------------------------
0028 //      GEANT 4 class header file
0029 //      CERN Geneva Switzerland
0030 //
0031 //
0032 //      ------------ GammaRayTelDetectorConstruction  ------
0033 //           by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
0034 //
0035 // ************************************************************
0036 
0037 #ifndef GammaRayTelDetectorConstruction_h
0038 #define GammaRayTelDetectorConstruction_h 1
0039 
0040 #include "G4Cache.hh"
0041 #include "G4PhysicalConstants.hh"
0042 #include "G4SystemOfUnits.hh"
0043 #include "G4VUserDetectorConstruction.hh"
0044 #include "globals.hh"
0045 
0046 class GammaRayTelAnticoincidenceSD;
0047 class GammaRayTelCalorimeterSD;
0048 class GammaRayTelDetectorMessenger;
0049 class GammaRayTelTrackerSD;
0050 
0051 class G4Box;
0052 class G4GlobalMagFieldMessenger;
0053 class G4LogicalVolume;
0054 class G4Material;
0055 class G4Region;
0056 class G4UniformMagField;
0057 class G4VPhysicalVolume;
0058 
0059 class GammaRayTelDetectorConstruction: public G4VUserDetectorConstruction {
0060 public:
0061     explicit GammaRayTelDetectorConstruction();
0062 
0063     ~GammaRayTelDetectorConstruction() override;
0064 
0065     void SetNbOfTKRLayers(G4int value); // tracker (TKR) number of layers
0066 
0067     void SetTKRTileSizeXY(G4double value);
0068 
0069     void SetNbOfTKRTiles(G4int value); // tracker (TKR) number of tiles
0070 
0071     void SetTKRSiliconThickness(G4double value);
0072 
0073     void SetTKRSiliconPitch(G4double value);
0074 
0075     void SetTKRLayerDistance(G4double value);
0076 
0077     void SetTKRViewsDistance(G4double value);
0078 
0079     void SetConverterMaterial(G4String materialChoice); // tracker (TKR) converter material
0080 
0081     void SetConverterThickness(G4double value); // tracker (TKR) converter thickness
0082 
0083     void SetNbOfCALLayers(G4int value); // calorimeter (CAL) material, length, thickness
0084 
0085     void SetNbOfCALBars(G4int value);
0086 
0087     void SetCALBarThickness(G4double value);
0088 
0089     void SetACDThickness(G4double value); // anticoincidence (ACD) thickness
0090 
0091     void SetMagField(G4double fieldValue); // magnetic field
0092 
0093     auto Construct() -> G4VPhysicalVolume* override;
0094 
0095     void ConstructSDandField() override;
0096 
0097     void PrintPayloadParameters();
0098 
0099     void UpdateGeometry();
0100 
0101     [[nodiscard]]
0102     auto GetWorldSizeZ() const -> G4double {
0103         return worldSizeZ;
0104     }
0105 
0106     [[nodiscard]]
0107     auto GetWorldSizeXY() const -> G4double {
0108         return worldSizeXY;
0109     }
0110 
0111     [[nodiscard]]
0112     auto GetPayloadSizeZ() const -> G4double {
0113         return payloadSizeZ;
0114     }
0115 
0116     [[nodiscard]]
0117     auto GetPayloadSizeXY() const -> G4double {
0118         return payloadSizeXY;
0119     }
0120 
0121     [[nodiscard]]
0122     auto GetTKRSizeZ() const -> G4double {
0123         return tkrSizeZ;
0124     }
0125 
0126     [[nodiscard]]
0127     auto GetTKRSizeXY() const -> G4double {
0128         return tkrSizeXY;
0129     }
0130 
0131     [[nodiscard]]
0132     auto GetCALSizeZ() const -> G4double {
0133         return calSizeZ;
0134     }
0135 
0136     [[nodiscard]]
0137     auto GetCALTKRDistance() const -> G4double {
0138         return calTKRDistance;
0139     }
0140 
0141     [[nodiscard]]
0142     auto GetTKRSiliconThickness() const -> G4double {
0143         return tkrSiliconThickness;
0144     }
0145 
0146     [[nodiscard]]
0147     auto GetTKRSiliconTileXY() const -> G4double {
0148         return tkrSiliconTileXY;
0149     }
0150 
0151     [[nodiscard]]
0152     auto GetTKRSiliconPitch() const -> G4double {
0153         return tkrSiliconPitch;
0154     }
0155 
0156     [[nodiscard]]
0157     auto GetNbOfTKRLayers() const -> G4int {
0158         return numberOfTKRLayers;
0159     }
0160 
0161     auto GetNbOfTKRTiles() const -> G4int {
0162         return numberOfTKRTiles;
0163     }
0164 
0165     [[nodiscard]]
0166     auto GetNbOfTKRStrips() const -> G4int {
0167         return numberOfTKRStrips;
0168     }
0169 
0170     [[nodiscard]]
0171     auto GetTKRLayerDistance() const -> G4double {
0172         return tkrLayerDistance;
0173     }
0174 
0175     [[nodiscard]]
0176     auto GetTKRViewsDistance() const -> G4double {
0177         return tkrViewsDistance;
0178     }
0179 
0180     [[nodiscard]]
0181     auto GetTKRActiveTileXY() const -> G4double {
0182         return tkrActiveTileXY;
0183     }
0184 
0185     [[nodiscard]]
0186     auto GetTKRActiveTileZ() const -> G4double {
0187         return tkrActiveTileZ;
0188     }
0189 
0190     [[nodiscard]]
0191     auto GetSiliconGuardRing() const -> G4double {
0192         return siliconGuardRing;
0193     }
0194 
0195     [[nodiscard]]
0196     auto GetTilesSeparation() const -> G4double {
0197         return tilesSeparation;
0198     }
0199 
0200     [[nodiscard]]
0201     auto GetConverterMaterial() const -> G4Material* {
0202         return converterMaterial;
0203     }
0204 
0205     [[nodiscard]]
0206     auto GetConverterThickness() const -> G4double {
0207         return converterThickness;
0208     }
0209 
0210     [[nodiscard]]
0211     auto GetCALBarThickness() const -> G4double {
0212         return calBarThickness;
0213     }
0214 
0215     [[nodiscard]]
0216     auto GetNbOfCALLayers() const -> G4int {
0217         return numberOfCALLayers;
0218     }
0219 
0220     [[nodiscard]]
0221     auto GetNbOfCALBars() const -> G4int {
0222         return numberOfCALBars;
0223     }
0224 
0225     [[nodiscard]]
0226     auto GetACDThickness() const -> G4double {
0227         return acdThickness;
0228     }
0229 
0230     [[nodiscard]]
0231     auto GetNbOfACDTopTiles() const -> G4int {
0232         return numberOfACDTopTiles;
0233     }
0234 
0235     [[nodiscard]]
0236     auto GetNbOfACDLateralTiles() const -> G4int {
0237         return numberOfACDLateralTiles;
0238     }
0239 
0240 private:
0241     G4Material *converterMaterial;
0242     G4double converterThickness{300. * micrometer};
0243 
0244     // Tracker (TKR)
0245 
0246     G4double tkrSiliconThickness{400. * micrometer};
0247     G4double tkrSiliconTileXY{9. * cm};
0248     G4double tkrSiliconPitch{200. * micrometer};
0249 
0250     G4double tkrSizeXY;
0251     G4double tkrSizeZ;
0252     G4double tkrLayerDistance{3. * cm};
0253     G4double tkrViewsDistance{1. * mm};
0254     G4double tkrSupportThickness;
0255 
0256     G4int numberOfTKRLayers{15};
0257     G4int numberOfTKRTiles{4};
0258 
0259     // Calorimeter (CAL)
0260 
0261     G4double calBarThickness{1.5 * cm};
0262 
0263     G4int numberOfCALLayers{5};
0264     G4int numberOfCALBars{12};
0265 
0266     G4double calSizeXY;
0267     G4double calSizeZ;
0268     G4double calBarX;
0269     G4double calBarY;
0270     G4double calBarZ;
0271 
0272     // Anticoincidence (ACD)
0273 
0274     G4double acdThickness{1. * cm};
0275 
0276     G4double actSizeXY;
0277     G4double actSizeZ;
0278 
0279     G4double acl1SizeX;
0280     G4double acl1SizeY;
0281     G4double acl1SizeZ;
0282 
0283     G4double acl2SizeX;
0284     G4double acl2SizeY;
0285     G4double acl2SizeZ;
0286 
0287     G4int numberOfACDTopTiles{1};
0288     G4int numberOfACDLateralTiles{2};
0289 
0290     G4double tilesSeparation{100. * micrometer};
0291     G4double acdTKRDistance{5. * cm};
0292     G4double calTKRDistance{1.5 * cm};
0293     G4double tkrActiveTileXY;
0294     G4double tkrActiveTileZ;
0295 
0296     G4double siliconGuardRing{1.5 * mm};
0297     G4int numberOfTKRStrips;
0298 
0299     G4double tkrXStripX;
0300     G4double tkrYStripX;
0301     G4double tkrXStripY;
0302     G4double tkrYStripY;
0303     G4double tkrZStrip;
0304 
0305     G4double payloadSizeZ;
0306     G4double payloadSizeXY;
0307 
0308     G4double worldSizeXY;
0309     G4double worldSizeZ;
0310 
0311     // Material
0312     G4Material *defaultMaterial;
0313     G4Material *calMaterial;
0314     G4Material *tkrMaterial;
0315     G4Material *acdMaterial;
0316 
0317     // World
0318     G4Box *solidWorld{nullptr};
0319     G4LogicalVolume *logicWorld{nullptr};
0320     G4VPhysicalVolume *physiWorld{nullptr};
0321 
0322     // Payload
0323     G4Box *solidPayload{nullptr};
0324     G4LogicalVolume *logicPayload{nullptr};
0325     G4VPhysicalVolume *physiPayload{nullptr};
0326 
0327     // Tracker
0328     G4Box *solidTKR{nullptr};
0329     G4LogicalVolume *logicTKR{nullptr};
0330     G4VPhysicalVolume *physiTKR{nullptr};
0331 
0332     // Calorimeter
0333     G4Box *solidCAL{nullptr};
0334     G4LogicalVolume *logicCAL{nullptr};
0335     G4VPhysicalVolume *physiCAL{nullptr};
0336 
0337     // Top Anticoincidence
0338     G4Box *solidACT{nullptr};
0339     G4LogicalVolume *logicACT{nullptr};
0340     G4VPhysicalVolume *physiACT{nullptr};
0341 
0342     // Lateral Anticoincidence
0343     G4Box *solidACL1{nullptr};
0344     G4LogicalVolume *logicACL1{nullptr};
0345     G4VPhysicalVolume *physiACL1{nullptr};
0346 
0347     G4Box *solidACL2{nullptr};
0348     G4LogicalVolume *logicACL2{nullptr};
0349     G4VPhysicalVolume *physiACL2{nullptr};
0350 
0351     // Tracker PLANE X
0352     G4Box *solidTKRDetectorX{nullptr};
0353     G4LogicalVolume *logicTKRDetectorX{nullptr};
0354     G4VPhysicalVolume *physiTKRDetectorX{nullptr};
0355 
0356     // Tracker PLANE Y
0357     G4Box *solidTKRDetectorY{nullptr};
0358     G4LogicalVolume *logicTKRDetectorY{nullptr};
0359     G4VPhysicalVolume *physiTKRDetectorY{nullptr};
0360 
0361     // Calorimeter PLANE X
0362     G4Box *solidCALLayerX{nullptr};
0363     G4LogicalVolume *logicCALLayerX{nullptr};
0364     G4VPhysicalVolume *physiCALLayerX{nullptr};
0365 
0366     // Calorimeter PLANE Y
0367     G4Box *solidCALLayerY{nullptr};
0368     G4LogicalVolume *logicCALLayerY{nullptr};
0369     G4VPhysicalVolume *physiCALLayerY{nullptr};
0370 
0371     // Calorimeter DETECTOR X
0372     G4Box *solidCALDetectorX{nullptr};
0373     G4LogicalVolume *logicCALDetectorX{nullptr};
0374     G4VPhysicalVolume *physiCALDetectorX{nullptr};
0375 
0376     // Calorimeter DETECTOR Y
0377     G4Box *solidCALDetectorY{nullptr};
0378     G4LogicalVolume *logicCALDetectorY{nullptr};
0379     G4VPhysicalVolume *physiCALDetectorY{nullptr};
0380 
0381     // Support Plane
0382     G4Box *solidPlane{nullptr};
0383     G4LogicalVolume *logicPlane{nullptr};
0384     G4VPhysicalVolume *physiPlane{nullptr};
0385 
0386     // Converter
0387     G4Box *solidConverter{nullptr};
0388     G4LogicalVolume *logicConverter{nullptr};
0389     G4VPhysicalVolume *physiConverter{nullptr};
0390 
0391     G4LogicalVolume *logicTKRStripX{nullptr};
0392     G4LogicalVolume *logicTKRStripY{nullptr};
0393 
0394     // magnetic field messenger
0395     static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
0396 
0397     GammaRayTelDetectorMessenger *detectorMessenger;  // pointer to the messenger
0398 
0399     G4Cache<GammaRayTelTrackerSD*> trackerSD; // pointer to the sensitive detector, tracker (TRK)
0400     G4Cache<GammaRayTelCalorimeterSD*> calorimeterSD; // pointer to the sensitive detector, calorimeter (CAL)
0401     G4Cache<GammaRayTelAnticoincidenceSD*> anticoincidenceSD; // pointer to the sensitive detector, anticoincidence (ACD)
0402 
0403 //    G4Region* trackerCutRegion; // tracker (TKR) cut region
0404 //    G4Region* calorimeterCutRegion; // calorimeter (CAL) cut region
0405 
0406     void ComputePayloadParameters();
0407 
0408     auto ConstructPayload() -> G4VPhysicalVolume*;
0409 
0410     void DefineMaterials();
0411 };
0412 
0413 inline auto GammaRayTelDetectorConstruction::ComputePayloadParameters() -> void {
0414     // Compute derived parameters of the payload
0415 
0416     tkrSupportThickness = tkrLayerDistance - 2 * tkrSiliconThickness - tkrViewsDistance - converterThickness;
0417     tkrSizeXY = numberOfTKRTiles * tkrSiliconTileXY + (numberOfTKRTiles + 1) * tilesSeparation;
0418     tkrSizeZ = numberOfTKRLayers * tkrLayerDistance;
0419 
0420     tkrActiveTileXY = tkrSiliconTileXY - 2 * siliconGuardRing;
0421     tkrActiveTileZ = tkrSiliconThickness;
0422     numberOfTKRStrips = G4int(tkrActiveTileXY / tkrSiliconPitch);
0423 
0424     siliconGuardRing = tkrActiveTileXY - numberOfTKRStrips * tkrSiliconPitch;
0425     tkrActiveTileXY = tkrSiliconTileXY - 2 * siliconGuardRing;
0426 
0427     tkrXStripX = tkrYStripY = tkrSiliconPitch;
0428     tkrYStripX = tkrXStripY = tkrActiveTileXY;
0429     tkrZStrip = tkrSiliconThickness;
0430 
0431     calSizeXY = tkrSizeXY;
0432     calSizeZ = 2 * numberOfCALLayers * calBarThickness;
0433 
0434     calBarX = calSizeXY;
0435     calBarY = calSizeXY / (numberOfCALBars);
0436     calBarZ = calBarThickness;
0437 
0438     actSizeXY = tkrSizeXY + 2 * acdTKRDistance + 2 * acdThickness;
0439     actSizeZ = acdThickness;
0440 
0441     acl1SizeX = tkrSizeXY + 2 * acdTKRDistance + acdThickness;
0442     acl1SizeY = acdThickness;
0443     acl1SizeZ = tkrSizeZ + calSizeZ + acdTKRDistance + calTKRDistance;
0444 
0445     acl2SizeX = acdThickness;
0446     acl2SizeY = tkrSizeXY + 2 * acdTKRDistance + acdThickness;
0447     acl2SizeZ = tkrSizeZ + calSizeZ + acdTKRDistance + calTKRDistance;
0448 
0449     payloadSizeZ = 1.1 * (acl1SizeZ + actSizeZ);
0450     payloadSizeXY = (actSizeXY);
0451 
0452     worldSizeZ = 1.5 * payloadSizeZ;
0453     worldSizeXY = 1.5 * payloadSizeXY;
0454 }
0455 #endif