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 //  08 Sep 2003  Alfonso Mantero created
0034 //
0035 // -------------------------------------------------------------------
0036 
0037 #ifndef XrayFluoMercuryDetectorConstruction_hh
0038 #define XrayFluoMercuryDetectorConstruction_hh 1
0039 
0040 #include "globals.hh"
0041 #include "G4VUserDetectorConstruction.hh"
0042 #include "G4RotationMatrix.hh"
0043 #include "G4Cache.hh"
0044 #include "XrayFluoSiLiDetectorType.hh"
0045 #include "XrayFluoHPGeDetectorType.hh"
0046 #include "XrayFluoSD.hh"
0047 
0048 class G4Box;
0049 class G4Tubs;
0050 class G4Sphere;
0051 class G4LogicalVolume;
0052 class G4VPhysicalVolume;
0053 class G4Material;
0054 class XrayFluoMercuryDetectorMessenger;
0055 class XrayFluoNistMaterials;
0056 
0057 //class XrayFluoSD;
0058 //class XrayFluoVDetectorType;
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0061 
0062 class XrayFluoMercuryDetectorConstruction : public G4VUserDetectorConstruction
0063 {
0064 public:
0065   
0066 
0067   ~XrayFluoMercuryDetectorConstruction();
0068   
0069 public:
0070   
0071   G4VPhysicalVolume* Construct();
0072  
0073   void ConstructSDandField();
0074   
0075   void UpdateGeometry();
0076 
0077 
0078   void SetMercuryMaterial(G4String newMaterial);
0079 
0080   void SetDetectorType(G4String type);
0081 
0082   static XrayFluoMercuryDetectorConstruction* GetInstance();
0083 
0084   inline void SetOribitHeight(G4double size)
0085   {distDe = size;};
0086   inline void SetLatitude(G4double lat)
0087   {ThetaHPGe = 180.* CLHEP::deg - lat;};
0088 
0089   void PrintApparateParameters(); 
0090 
0091   XrayFluoVDetectorType* GetDetectorType() const;
0092 
0093 
0094   G4double GetWorldSizeZ() const     {return WorldSizeZ;}; 
0095   G4double GetWorldSizeXY() const         {return WorldSizeXY;};
0096   
0097   G4double GetDeviceThickness() const     {return DeviceThickness;}; 
0098   G4double GetDeviceSizeX() const         {return DeviceSizeX;};
0099   G4double GetDeviceSizeY() const         {return DeviceSizeY;};
0100   G4double GetPixelSizeXY() const         {return PixelSizeXY;};
0101   G4double GetContactSizeXY() const         {return ContactSizeXY;};
0102 
0103   G4int GetNbOfPixels() const  {return NbOfPixels;}; //mandatory for XrayFluoSD 
0104   G4int GetNbOfPixelRows() const    {return NbOfPixelRows;}; 
0105   G4int GetNbOfPixelColumns() const        {return NbOfPixelColumns;}; 
0106   
0107   G4Material* GetOhmicPosMaterial() const  {return OhmicPosMaterial;};
0108   G4double    GetOhmicPosThickness() const {return OhmicPosThickness;};      
0109   
0110   G4Material* GetOhmicNegMaterial() const  {return OhmicNegMaterial;};
0111   G4double    GetOhmicNegThickness() const {return OhmicNegThickness;};      
0112   
0113   const G4VPhysicalVolume* GetphysiWorld() const {return physiWorld;};  
0114   const G4VPhysicalVolume* GetHPGe() const        {return physiHPGe;};
0115   const G4VPhysicalVolume* GetMercury() const    {return physiMercury;};
0116 
0117   const G4VPhysicalVolume* GetphysiPixel() const {return physiPixel;};           
0118   const G4VPhysicalVolume* GetOhmicPos() const    {return physiOhmicPos;};
0119   const G4VPhysicalVolume* GetOhmicNeg() const     {return physiOhmicNeg;};
0120 
0121   const G4VPhysicalVolume* GetOptic() const    {return physiOptic;};
0122   
0123 private:
0124   
0125   XrayFluoMercuryDetectorConstruction();
0126 
0127   static XrayFluoMercuryDetectorConstruction* instance;
0128 
0129   XrayFluoVDetectorType* detectorType;
0130 
0131   G4bool mercuryGranularity;
0132 
0133   G4double           DeviceSizeX;
0134   G4double           DeviceSizeY;
0135   G4double           DeviceThickness;
0136   
0137   G4Box*             solidWorld;    //pointer to the solid    World 
0138   G4LogicalVolume*   logicWorld;    //pointer to the logical  World
0139   G4VPhysicalVolume* physiWorld;    //pointer to the physical World
0140   
0141   G4Box*             solidHPGe; //pointer to the solid    Sensor
0142   G4LogicalVolume*   logicHPGe; //pointer to the logical  Sensor
0143   G4VPhysicalVolume* physiHPGe; //pointer to the physical Sensor
0144  
0145   G4Box*             solidScreen; //pointer to the solid    Screen
0146   G4LogicalVolume*   logicScreen; //pointer to the logical  Screen
0147   G4VPhysicalVolume* physiScreen; //pointer to the physical Screen
0148  
0149   G4Sphere*             solidMercury;    //pointer to the solid    Mercury
0150   G4LogicalVolume*   logicMercury;    //pointer to the logical  Mercury
0151   G4VPhysicalVolume* physiMercury;    //pointer to the physical Mercury
0152   
0153   //  G4Tubs*             solidDia1; //pointer to the solid   Diaphragm
0154   //  G4LogicalVolume*   logicDia1; //pointer to the logical  Diaphragm
0155   //  G4VPhysicalVolume* physiDia1; //pointer to the physical Diaphragm 
0156   
0157   //  G4Tubs*             solidDia3; //pointer to the solid   Diaphragm
0158   //  G4LogicalVolume*   logicDia3; //pointer to the logical  Diaphragm
0159   //  G4VPhysicalVolume* physiDia3; //pointer to the physical Diaphragm  
0160   
0161   G4Box*             solidOhmicPos;
0162   G4LogicalVolume*   logicOhmicPos; 
0163   G4VPhysicalVolume* physiOhmicPos; 
0164   
0165   G4Box*             solidOhmicNeg;
0166   G4LogicalVolume*   logicOhmicNeg; 
0167   G4VPhysicalVolume* physiOhmicNeg;     
0168   
0169   G4Box*             solidPixel;   
0170   G4LogicalVolume*   logicPixel;  
0171   G4VPhysicalVolume* physiPixel;    
0172  
0173   G4Tubs*            solidOptic;
0174   G4LogicalVolume*   logicOptic;
0175   G4VPhysicalVolume* physiOptic;
0176 
0177   G4LogicalVolume*   logicGrain;
0178 
0179   //materials management
0180   XrayFluoNistMaterials* materials;
0181 
0182   G4Material*          screenMaterial;
0183   G4Material*        OhmicPosMaterial;
0184   G4Material*        OhmicNegMaterial; 
0185   G4Material*           pixelMaterial;
0186   G4Material*         mercuryMaterial;
0187   //  G4Material*        Dia3Material;
0188   G4Material*         defaultMaterial;
0189 
0190   //apparate parameters
0191 
0192   G4double           OhmicPosThickness;
0193   G4double           OhmicNegThickness;
0194   
0195   G4double           opticDia;
0196   G4double           opticThickness;
0197 
0198   G4double           screenSizeXY;
0199   G4double           screenThickness;
0200 
0201   G4int              PixelCopyNb;
0202   G4int              grainCopyNb;
0203   G4int              NbOfPixels;
0204   G4int              NbOfPixelRows;
0205   G4int              NbOfPixelColumns;
0206   G4double           PixelThickness;
0207   G4double           PixelSizeXY;
0208   G4double           ContactSizeXY;
0209 
0210   G4double           opticAperture;
0211 
0212   G4double           mercuryDia;
0213   G4double           sunDia;
0214 
0215   G4double           mercurySunDistance;
0216 
0217   G4double           ThetaHPGe;
0218   
0219   G4double           distDe;
0220   G4double           distScreen;
0221   G4double           distOptic;
0222 
0223 
0224   G4double           PhiHPGe;
0225   
0226   G4RotationMatrix   zRotPhiHPGe;
0227 
0228   G4double           WorldSizeXY;
0229   G4double           WorldSizeZ;
0230   
0231   
0232   XrayFluoMercuryDetectorMessenger* detectorMessenger; //pointer to the Messenger
0233 
0234   G4Cache<XrayFluoSD*> HPGeSD;  //pointer to the sensitive detector
0235  
0236 public:
0237 
0238   G4Material* GetMercuryMaterial() const {return mercuryMaterial;}; 
0239   G4Material* GetPixelMaterial() const  {return pixelMaterial;}; 
0240   
0241   G4double GetMercuryDia()  const       {return mercuryDia;};
0242   G4double GetSunDia() const {return sunDia;};
0243 
0244   //Inclinaton of the orbit respect Mercury respect the equator (latitude)
0245 
0246   G4double GetOrbitInclination() const  {return 180 * CLHEP::deg - ThetaHPGe;}; 
0247   G4double GetOrbitDistance() const     {return distDe;};
0248   G4double GetOpticAperture() const {return opticAperture;};  
0249 
0250 
0251   
0252 private:
0253   
0254   void DefineDefaultMaterials();
0255   G4VPhysicalVolume* ConstructApparate();
0256 
0257   //calculates some quantities used to construct geometry
0258   void ComputeApparateParameters();
0259 
0260 };
0261 
0262 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0263 
0264 inline void XrayFluoMercuryDetectorConstruction::ComputeApparateParameters()
0265 {     
0266   // Compute derived parameters of the apparate
0267   
0268   DeviceThickness = PixelThickness+OhmicNegThickness+OhmicPosThickness;
0269 
0270   ///G4cout << "DeviceThickness(cm): "<< DeviceThickness/CLHEP::cm << G4endl;
0271 
0272   DeviceSizeY =(NbOfPixelRows * std::max(ContactSizeXY,PixelSizeXY));
0273   DeviceSizeX =(NbOfPixelColumns * std::max(ContactSizeXY,PixelSizeXY));
0274 
0275   screenSizeXY = opticDia;
0276 
0277   G4cout << "DeviceSizeX(cm): "<< DeviceSizeX/CLHEP::cm <<G4endl;
0278   G4cout << "DeviceSizeY(cm): "<< DeviceSizeY/CLHEP::cm << G4endl;
0279 
0280   //*********************************************************************
0281   //**  Astronomical distances reduce by a factor 10^-7 due to G4 Bug  **
0282   //*********************************************************************
0283 
0284   WorldSizeZ = 2 * mercurySunDistance ; 
0285   WorldSizeXY = (2 * distDe) + 2000 * CLHEP::km ;
0286   //WorldSizeZ = WorldSizeXY;
0287 }
0288 
0289 #endif