Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:08

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 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
0029 //
0030 // History:
0031 // -----------
0032 //
0033 //  29 Aug 2003  Alfonso Mantero created
0034 //
0035 // -------------------------------------------------------------------
0036 
0037 #ifndef XrayFluoPlaneDetectorConstruction_hh
0038 #define XrayFluoPlaneDetectorConstruction_hh 1
0039 
0040 #include "globals.hh"
0041 #include "G4RotationMatrix.hh"
0042 #include "G4VUserDetectorConstruction.hh"
0043 #include "G4Cache.hh"
0044 
0045 #include "XrayFluoSiLiDetectorType.hh"
0046 #include "XrayFluoHPGeDetectorType.hh"
0047 #include "XrayFluoSD.hh"
0048 
0049 class G4Box;
0050 class G4Sphere;
0051 class G4LogicalVolume;
0052 class G4VPhysicalVolume;
0053 class G4Material;
0054 class XrayFluoPlaneDetectorMessenger;
0055 class XrayFluoNistMaterials;
0056 
0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0058 
0059 class XrayFluoPlaneDetectorConstruction : public G4VUserDetectorConstruction
0060 {
0061 public:
0062   
0063 
0064   ~XrayFluoPlaneDetectorConstruction();
0065   
0066 public:
0067   
0068   G4VPhysicalVolume* Construct();
0069   
0070   void ConstructSDandField();
0071 
0072   void UpdateGeometry();
0073 
0074 
0075   void SetPlaneMaterial(G4String newMaterial);
0076 
0077   void SetDetectorType(G4String type);
0078 
0079   static XrayFluoPlaneDetectorConstruction* GetInstance();
0080 
0081   inline void SetPlaneGranularity(G4bool granularity) 
0082   {planeGranularity = granularity;};
0083 
0084   inline void SetGrainDia(G4double size)
0085   {grainDia = size;};
0086 
0087   void DeleteGrainObjects();
0088   
0089 public:
0090   
0091   void PrintApparateParameters(); 
0092 
0093   XrayFluoVDetectorType* GetDetectorType() const;
0094 
0095 
0096   G4double GetWorldSizeZ() const          {return WorldSizeZ;}; 
0097   G4double GetWorldSizeXY() const     {return WorldSizeXY;};
0098   
0099   G4double GetDeviceThickness() const     {return DeviceThickness;}; 
0100   G4double GetDeviceSizeX() const         {return DeviceSizeX;};
0101   G4double GetDeviceSizeY() const          {return DeviceSizeY;};
0102   G4double GetPixelSizeXY() const         {return PixelSizeXY;};
0103   G4double GetContactSizeXY()  const       {return ContactSizeXY;};
0104 
0105   G4int GetNbOfPixels() const             {return NbOfPixels;}; //mandatory for XrayFluoSD 
0106   G4int GetNbOfPixelRows() const          {return NbOfPixelRows;}; 
0107   G4int GetNbOfPixelColumns() const        {return NbOfPixelColumns;}; 
0108   
0109   G4Material* GetOhmicPosMaterial() const {return OhmicPosMaterial;};
0110   G4double    GetOhmicPosThickness()const  {return OhmicPosThickness;};      
0111   
0112   G4Material* GetOhmicNegMaterial() const {return OhmicNegMaterial;};
0113   G4double    GetOhmicNegThickness() const {return OhmicNegThickness;};      
0114   
0115   const G4VPhysicalVolume* GetphysiWorld() const {return physiWorld;};  
0116   const G4VPhysicalVolume* GetHPGe() const {return physiHPGe;};
0117   const G4VPhysicalVolume* GetPlane() const {return physiPlane;};
0118   //  const G4VPhysicalVolume* GetDia1()        {return physiDia1;};
0119   //  const G4VPhysicalVolume* GetDia3()        {return physiDia3;};
0120   
0121   const G4VPhysicalVolume* GetphysiPixel() const {return physiPixel;};           
0122   const G4VPhysicalVolume* GetOhmicPos() const   {return physiOhmicPos;};
0123   const G4VPhysicalVolume* GetOhmicNeg() const   {return physiOhmicNeg;};
0124   
0125 private:
0126   
0127   XrayFluoPlaneDetectorConstruction();
0128 
0129   static XrayFluoPlaneDetectorConstruction* instance;
0130 
0131   XrayFluoVDetectorType* detectorType;
0132 
0133   G4bool planeGranularity;
0134 
0135   G4double           DeviceSizeX;
0136   G4double           DeviceSizeY;
0137   G4double           DeviceThickness;
0138   
0139   G4Box*             solidWorld;    //pointer to the solid    World 
0140   G4LogicalVolume*   logicWorld;    //pointer to the logical  World
0141   G4VPhysicalVolume* physiWorld;    //pointer to the physical World
0142   
0143   G4Box*             solidHPGe; //pointer to the solid    Sensor
0144   G4LogicalVolume*   logicHPGe; //pointer to the logical  Sensor
0145   G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor
0146  
0147   G4Box*             solidScreen; //pointer to the solid    Screen
0148   G4LogicalVolume*   logicScreen; //pointer to the logical  Screen
0149   G4VPhysicalVolume* physiScreen; //pointer to the physical Screen
0150  
0151   G4Box*             solidPlane;    //pointer to the solid    Plane
0152   G4LogicalVolume*   logicPlane;    //pointer to the logical  Plane
0153   G4VPhysicalVolume* physiPlane;    //pointer to the physical Plane
0154   
0155   //  G4Tubs*             solidDia1; //pointer to the solid   Diaphragm
0156   //  G4LogicalVolume*   logicDia1; //pointer to the logical  Diaphragm
0157   //  G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm 
0158   
0159   //  G4Tubs*             solidDia3; //pointer to the solid   Diaphragm
0160   //  G4LogicalVolume*   logicDia3; //pointer to the logical  Diaphragm
0161   //  G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm  
0162   
0163   G4Box*             solidOhmicPos;
0164   G4LogicalVolume*   logicOhmicPos; 
0165   G4VPhysicalVolume* physiOhmicPos; 
0166   
0167   G4Box*             solidOhmicNeg;
0168   G4LogicalVolume*   logicOhmicNeg; 
0169   G4VPhysicalVolume* physiOhmicNeg;     
0170   
0171   G4Box*             solidPixel;   
0172   G4LogicalVolume*   logicPixel;  
0173   G4VPhysicalVolume* physiPixel;    
0174  
0175   G4Sphere*          solidGrain;
0176   G4LogicalVolume*   logicGrain;
0177   G4VPhysicalVolume* physiGrain;
0178 
0179   //materials management
0180   XrayFluoNistMaterials* materials;
0181 
0182   G4Material*        screenMaterial;
0183   G4Material*        OhmicPosMaterial;
0184   G4Material*        OhmicNegMaterial; 
0185   G4Material*        pixelMaterial;
0186   G4Material*        planeMaterial;
0187   //  G4Material*        Dia1Material;
0188   //  G4Material*        Dia3Material;
0189   G4Material*        defaultMaterial;
0190 
0191   //apparate parameters
0192 
0193   G4double           OhmicPosThickness;
0194   G4double           OhmicNegThickness;
0195   
0196   G4double           screenSizeXY;
0197   G4double           screenThickness;
0198 
0199   G4int              PixelCopyNb;
0200   G4int              grainCopyNb;
0201   G4int              NbOfPixels;
0202   G4int              NbOfPixelRows;
0203   G4int              NbOfPixelColumns;
0204   G4double           PixelThickness;
0205   G4double           PixelSizeXY;
0206   G4double           ContactSizeXY;
0207 
0208   G4double           planeThickness;
0209   G4double           planeSizeXY;
0210   G4double           grainDia;
0211   //  G4double           Dia1Thickness;
0212   //  G4double           Dia1SizeXY;
0213   //  G4double           Dia3Thickness;
0214   //  G4double           Dia3SizeXY;
0215   //  G4double           DiaInnerSize;
0216   //  G4double           Dia3InnerSize;
0217 
0218   
0219 public:
0220 
0221   G4Material* GetPlaneMaterial() const {return planeMaterial;}; 
0222   G4Material* GetPixelMaterial() const {return pixelMaterial;}; 
0223   //  G4Material* GetDia1Material()  {return Dia1Material;}; 
0224   //  G4Material* GetDia3Material()  {return Dia3Material;}; 
0225   
0226   G4double GetPlaneThickness()  const {return planeThickness;};
0227   G4double GetPlaneSizeXY() const              {return planeSizeXY;};
0228   
0229 //   G4double GetDia1Thickness()         {return Dia1Thickness;};
0230 //   G4double GetDia1SizeXY()              {return Dia1SizeXY;};
0231   
0232 //   G4double GetDia3Thickness()         {return Dia3Thickness;};
0233 //   G4double GetDia3SizeXY()              {return Dia3SizeXY;};
0234   
0235   
0236 private:
0237 
0238   
0239   G4double           ThetaHPGe;
0240   
0241   G4double           DistDe;
0242   G4double           distScreen;
0243 
0244   //  G4double           DistDia;
0245   //  G4double           Dia3Dist;
0246   G4double           PhiHPGe;
0247   //  G4double           PhiDia1;
0248   //  G4double           PhiDia3;
0249   //  G4double AlphaDia1;
0250   //  G4double AlphaDia3;
0251   
0252   
0253   G4RotationMatrix   zRotPhiHPGe;
0254   //  G4RotationMatrix   zRotPhiDia1;
0255   //  G4RotationMatrix   zRotPhiDia3;
0256   G4double           WorldSizeXY;
0257   G4double           WorldSizeZ;
0258   
0259   
0260   XrayFluoPlaneDetectorMessenger* detectorMessenger; //pointer to the Messenger
0261 
0262   G4Cache<XrayFluoSD*> HPGeSD;  //pointer to the sensitive detector
0263   
0264 private:
0265   
0266   void DefineDefaultMaterials();
0267   G4VPhysicalVolume* ConstructApparate();
0268 
0269   //calculates some quantities used to construct geometry
0270   void ComputeApparateParameters();
0271 
0272 };
0273 
0274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0275 
0276 inline void XrayFluoPlaneDetectorConstruction::ComputeApparateParameters()
0277 {     
0278   // Compute derived parameters of the apparate
0279   
0280   DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness;
0281 
0282   G4cout << "DeviceThickness(cm): "<< DeviceThickness/CLHEP::cm << G4endl;
0283 
0284   DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY));
0285   DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY));
0286 
0287   screenSizeXY = 2 * DeviceThickness + std::max(DeviceSizeY,DeviceSizeX);
0288 
0289   G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/CLHEP::cm <<G4endl;
0290   G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/CLHEP::cm << G4endl;
0291 
0292   WorldSizeZ = (2 * (DistDe  + DeviceThickness + screenThickness)) + 5*CLHEP::m; 
0293   WorldSizeXY = (2 * (planeSizeXY))+ 5*CLHEP::m;
0294   
0295 }
0296 
0297 #endif