Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/xray_telescope/src/XrayTelDetectorConstruction.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // *                                                                    *
0029 // *                    GEANT 4 xray_telescope advanced example         *
0030 // *                                                                    *
0031 // * MODULE:            XrayTelDetectorConstruction.cc                  *     
0032 // * -------                                                            *
0033 // *                                                                    *
0034 // * Version:           0.4                                             *
0035 // * Date:              06/11/00                                        *
0036 // * Author:            R Nartallo                                      *
0037 // * Organisation:      ESA/ESTEC, Noordwijk, THe Netherlands           *
0038 // *                                                                    *
0039 // **********************************************************************
0040 // 
0041 // CHANGE HISTORY
0042 // --------------
0043 //
0044 // 06.11.2000 R.Nartallo
0045 // - First implementation of xray_telescope geometry
0046 // - Based on Chandra and XMM models by R Nartallo, P Truscott, F Lei 
0047 //   and P Arce
0048 //
0049 //
0050 // **********************************************************************
0051 
0052 #include "XrayTelDetectorConstruction.hh"
0053 
0054 #include "globals.hh"
0055 #include "G4PhysicalConstants.hh"
0056 #include "G4SystemOfUnits.hh"
0057 #include "G4UnitsTable.hh"
0058 #include "G4VUserDetectorConstruction.hh"
0059 #include "G4Material.hh"
0060 #include "G4MaterialTable.hh"
0061 #include "G4Element.hh"
0062 #include "G4ElementTable.hh"
0063 #include "G4Box.hh"
0064 #include "G4Cons.hh"
0065 #include "G4Tubs.hh"
0066 #include "G4LogicalVolume.hh"
0067 #include "G4ThreeVector.hh"
0068 #include "G4PVPlacement.hh"
0069 #include "G4PVReplica.hh"
0070 #include "G4SDManager.hh"
0071 #include "G4VisAttributes.hh"
0072 #include "G4Colour.hh"
0073 
0074 XrayTelDetectorConstruction::XrayTelDetectorConstruction()
0075 {
0076   world_x = 2500.*cm;
0077   world_y = 2500.*cm;
0078   world_z = 2500.*cm;
0079 }
0080 
0081 XrayTelDetectorConstruction::~XrayTelDetectorConstruction()
0082 {;}
0083 
0084 G4VPhysicalVolume* XrayTelDetectorConstruction::Construct( )
0085 {
0086 
0087   // Material: Vacuum
0088   G4Material* Vacuum = new G4Material("Vacuum",
0089                       1.0 , 1.01*g/mole, 1.0E-25*g/cm3,
0090                       kStateGas, 2.73*kelvin, 3.0E-18*pascal );
0091 
0092   // Visualization attributes
0093   G4VisAttributes* VisAttWorld= new G4VisAttributes( G4Colour(204/255.,255/255.,255/255.));
0094 
0095   // World
0096   G4Box * solidWorld = new G4Box( "world_S", world_x, world_y, world_z );
0097   G4LogicalVolume * logicalWorld = new G4LogicalVolume( solidWorld, // solid
0098                             Vacuum,                          // material
0099                             "world_L",                       // name 
0100                             0,0,0);
0101 
0102   logicalWorld -> SetVisAttributes(VisAttWorld);
0103 
0104   // Physical volume
0105   physicalWorld= new G4PVPlacement( 0,
0106                     G4ThreeVector(),
0107                     "world_P",        // name (2nd constructor)
0108                     logicalWorld,     // logical volume
0109                     NULL,             // mother volume
0110                     false,            // no boolean operation
0111                     0);               // copy number
0112 
0113   // Make Invisible
0114   logicalWorld -> SetVisAttributes(G4VisAttributes::GetInvisible());
0115 
0116   // Construct geometry
0117   ConstructTelescope();
0118   ConstructFocalPlane();
0119 
0120   return physicalWorld;
0121 }
0122 
0123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0124 
0125 // Construct Telescope
0126 
0127 void XrayTelDetectorConstruction::ConstructTelescope()
0128 {
0129   // Construct Mirror
0130   // Single shell mirror made of Nickel with thin Gold coating
0131   // Mirror made up of two cones approximating the parabolic section and
0132   // two cones approximating the hyperbolic section
0133   // The centre of the mirror is filled wiith a solid aluminium rod shaped as the
0134   // mirrors, so as to leave a constant BaffleGap distance from the mirror surface
0135 
0136   // Build materials
0137   G4Material* Ni = new G4Material("Nickel", 28., 58.6934*g/mole, 8.902*g/cm3);
0138   G4Material* Au = new G4Material("Gold", 79., 196.96654*g/mole, 19.300*g/cm3);
0139   G4Material* Al = new G4Material("Aluminium", 13., 26.98*g/mole, 2.700*g/cm3);
0140 
0141   // Visualization attributes
0142   G4VisAttributes* VisAttMirror = new G4VisAttributes(
0143                               G4Colour(0/255., 0/255.,255/255.));
0144   G4VisAttributes* VisAttAuCoating = new G4VisAttributes(
0145                              G4Colour(255/255., 255/255., 0/255.));
0146   G4VisAttributes* VisAttBaffle = new G4VisAttributes(
0147                               G4Colour(128/255., 128/255., 128/255.));
0148 
0149   // Rotation Matrix
0150   G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
0151   rotateMatrix -> rotateY(90.*deg);
0152 
0153   // Construct cones to make  Mirror sections
0154   G4int i;
0155   G4double MirrorEnd[5] = { 34.9995975*cm, 34.8277209*cm, 34.6549918*cm,
0156                 34.1347834*cm, 33.6137753*cm };
0157   G4double MirrorPosition[4] = { 772.5*cm, 757.5*cm, 742.5*cm, 727.5*cm };
0158   G4double MirrorSectionLength = 15.0*cm;
0159   G4double MirrorNiThickness = 1.07*mm;
0160   G4double MirrorAuCoating = 50.0e-6*mm;
0161   G4double BaffleGap = 4.0*mm;
0162 
0163   G4Cons* MirrorSolid[4];
0164   G4Cons* MirrorAuCoatingSolid[4];
0165   G4Cons* BaffleSolid[4];
0166 
0167   G4LogicalVolume* MirrorLogicalVolume[4];
0168   G4LogicalVolume* MirrorAuCoatingLogicalVolume[4];
0169   G4LogicalVolume* BaffleLogicalVolume[4];
0170 
0171   for ( i=0; i<4; i++ ) {
0172 
0173     // Mirror Nickel base
0174     MirrorSolid[i] = new G4Cons( "Mirror_S",
0175                  MirrorEnd[i], MirrorEnd[i] + MirrorNiThickness,
0176                  MirrorEnd[i+1], MirrorEnd[i+1] + MirrorNiThickness,
0177                  MirrorSectionLength/2, 0*deg, 360.*deg);
0178     MirrorLogicalVolume[i] = new G4LogicalVolume(
0179                          MirrorSolid[i], Ni, "Mirror_L", 0, 0, 0 );
0180     MirrorLogicalVolume[i]->SetVisAttributes(VisAttMirror);
0181 
0182     // Gold coating on mirror
0183     MirrorAuCoatingSolid[i] = new G4Cons( 
0184                      "MirrorAuCoating_S",
0185                      MirrorEnd[i] - MirrorAuCoating, MirrorEnd[i],
0186                      MirrorEnd[i+1] - MirrorAuCoating, MirrorEnd[i+1], 
0187                      MirrorSectionLength/2, 0*deg, 360.*deg);
0188     MirrorAuCoatingLogicalVolume[i] = new G4LogicalVolume(
0189                               MirrorAuCoatingSolid[i],
0190                               Au,
0191                               "MirrorAuCoating_L",
0192                               0, 0, 0 );
0193     MirrorAuCoatingLogicalVolume[i]->SetVisAttributes(VisAttAuCoating);
0194 
0195     // Aluminium baffle inside mirror
0196     BaffleSolid[i] = new G4Cons( "Baffle_S",
0197                  0, MirrorEnd[i] - BaffleGap,
0198                  0, MirrorEnd[i+1] - BaffleGap,
0199                  MirrorSectionLength/2, 0*deg, 360.*deg);
0200     BaffleLogicalVolume[i] = new G4LogicalVolume(
0201                          BaffleSolid[i], Al, "Baffle_L", 0, 0, 0 );
0202     BaffleLogicalVolume[i]-> SetVisAttributes(VisAttBaffle);
0203   }
0204 
0205   // Physical volume
0206  
0207   for ( i=0; i<4; i++ ) {
0208      new G4PVPlacement(
0209                rotateMatrix,
0210                G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
0211                "Mirror_P",
0212                MirrorLogicalVolume[i],
0213                physicalWorld, false, 0 );
0214      new G4PVPlacement(
0215                rotateMatrix,
0216                G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
0217                "MirrorAuCoating_P",
0218                MirrorAuCoatingLogicalVolume[i],
0219                physicalWorld, false, 0 );
0220     new G4PVPlacement(
0221               rotateMatrix,
0222               G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
0223               "Baffle_P",
0224               BaffleLogicalVolume[i],
0225               physicalWorld, false, 0 );
0226   }
0227 
0228   // Make Mirror Invisible
0229 
0230   for ( i=0; i<4; i++ ) {
0231     //   MirrorLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::GetInvisible());
0232     //   MirrorAuCoatingLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::GetInvisible());
0233     BaffleLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::GetInvisible());
0234   }
0235 
0236 
0237   // Construct Optical Bench
0238   // Main Telescope carbon fibre tube and two aluminium end caps
0239 
0240   G4int nel;
0241   G4String symbol;
0242 
0243   // Elements
0244   G4Element* C = new G4Element("Carbon", symbol="C", 6., 12.011*g/mole);
0245   G4Element* H = new G4Element("Hydrogen",symbol="H", 1., 1.00794*g/mole);
0246 
0247   // Materials from Combination
0248   G4Material* Cf = new G4Material("Carbon Fibre", 2.0*g/cm3, nel=2);
0249   Cf->AddElement(C,1);
0250   Cf->AddElement(H,2);
0251 
0252   // Visualization attributes
0253   G4VisAttributes* VisAttBench = new G4VisAttributes(
0254                              G4Colour(0/255., 200/255., 0/255.));
0255 
0256   // Construct Optical bench
0257   G4double BenchThickness = 1.0*cm;
0258   G4double BenchFrontEndMinRadiusOut = MirrorEnd[4] + 
0259     ( MirrorEnd[3] - MirrorEnd[4] )*7.5/15
0260     + MirrorNiThickness;
0261   G4double BenchFrontEndMinRadiusIn  = MirrorEnd[4] + 
0262     ( MirrorEnd[3] - MirrorEnd[4] )*7.4/15
0263     + MirrorNiThickness;
0264   G4double BenchFrontEndMaxRadius = MirrorEnd[4] + MirrorNiThickness + 25.*cm;
0265   G4double BenchBackEndMinRadius = 0.0*cm;
0266   G4double BenchBackEndMaxRadius =  MirrorEnd[4] + MirrorNiThickness + 5.*cm;
0267   G4double BenchMainLength;
0268 
0269   BenchMainLength = MirrorPosition[3] - BenchThickness;
0270 
0271   G4Cons* BenchFrontEndSolid;
0272   G4Tubs* BenchBackEndSolid;
0273   G4Cons* BenchMainSolid;
0274 
0275   G4LogicalVolume* BenchFrontEndLogicalVolume;
0276   G4LogicalVolume* BenchBackEndLogicalVolume;
0277   G4LogicalVolume* BenchMainLogicalVolume;
0278 
0279   BenchFrontEndSolid = new G4Cons( "BenchFrontEnd_S",
0280                    BenchFrontEndMinRadiusOut, BenchFrontEndMaxRadius,
0281                    BenchFrontEndMinRadiusIn, BenchFrontEndMaxRadius,
0282                    BenchThickness/2, 0*deg, 360.*deg );
0283   BenchFrontEndLogicalVolume = new G4LogicalVolume(
0284                            BenchFrontEndSolid, Al, "BenchFrontEnd_L", 0, 0, 0 );
0285   BenchFrontEndLogicalVolume->SetVisAttributes(VisAttBench);
0286 
0287   BenchBackEndSolid  = new G4Tubs( "BenchBackEnd_S",
0288                    BenchBackEndMinRadius, BenchBackEndMaxRadius,
0289                    BenchThickness/2, 0*deg, 360.*deg );
0290   BenchBackEndLogicalVolume = new G4LogicalVolume(
0291                           BenchBackEndSolid, Al, "BenchBackEnd_L", 0, 0, 0 );
0292   BenchBackEndLogicalVolume->SetVisAttributes(VisAttBench);
0293 
0294   BenchMainSolid     = new G4Cons( "BenchMain_S",
0295                    BenchFrontEndMaxRadius - BenchThickness,
0296                    BenchFrontEndMaxRadius,
0297                    BenchBackEndMaxRadius - BenchThickness,
0298                    BenchBackEndMaxRadius,
0299                    BenchMainLength/2, 0*deg, 360.*deg);
0300   BenchMainLogicalVolume = new G4LogicalVolume(
0301                            BenchMainSolid, Cf, "BenchMain_L", 0, 0, 0 );
0302   BenchMainLogicalVolume -> SetVisAttributes(VisAttBench);
0303 
0304   // Physical volume
0305 
0306   new G4PVPlacement(
0307             rotateMatrix,
0308             G4ThreeVector( MirrorPosition[3] - BenchThickness/2,
0309                    0.0*cm, 0.0*cm ),
0310             "BenchFrontEnd_P",
0311             BenchFrontEndLogicalVolume,
0312             physicalWorld, false, 0 );
0313 
0314   new G4PVPlacement(
0315             rotateMatrix,
0316             G4ThreeVector(0.0*cm - BenchThickness/2, 0.0*cm, 0.0*cm ),
0317             "BenchBackEnd_P",
0318             BenchBackEndLogicalVolume,
0319             physicalWorld, false, 0 );
0320   
0321   new G4PVPlacement(
0322             rotateMatrix,
0323             G4ThreeVector( BenchMainLength/2, 0.0*cm, 0.0*cm ),
0324             "BenchMain_P",
0325             BenchMainLogicalVolume,
0326             physicalWorld, false, 0 );
0327   
0328   //--- Make Bench Invisible
0329 
0330   // BenchFrontEndLogicalVolume -> SetVisAttributes(G4VisAttributes::GetInvisible())
0331 
0332   // BenchBackEndLogicalVolume -> SetVisAttributes(G4VisAttributes::GetInvisible());
0333   BenchMainLogicalVolume -> SetVisAttributes(G4VisAttributes::GetInvisible());
0334 
0335   return;
0336 }
0337 
0338 // Construct Focal Plane
0339 // Conical Titanium baffle and silicon detector
0340 
0341 void XrayTelDetectorConstruction::ConstructFocalPlane()
0342 {
0343 
0344   // Elements
0345   G4Material* Ti = new G4Material("Titanium", 22., 47.867*g/mole, 4.54*g/cm3);
0346   G4Material* Si = new G4Material("Silicon", 14., 28.090*g/mole, 2.33*g/cm3);
0347 
0348   // Visualization attributes
0349   G4VisAttributes* VisDetectorBaffle = new G4VisAttributes(
0350                                G4Colour(190/255., 255/255., 0/255.) );
0351   G4VisAttributes* VisDetector = new G4VisAttributes(
0352                              G4Colour(255/255., 0/255., 0/255.) );
0353 
0354   // Rotation Matrix
0355   G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
0356   rotateMatrix -> rotateY(90.*deg);
0357 
0358   // Construct Detector Baffle
0359   G4double DetectorBaffleLength = 57.2*cm;
0360   G4double DetectorBaffleOuterRadiusIn = 7.1*cm;
0361   G4double DetectorBaffleOuterRadiusOut = 7.35*cm;
0362   G4double DetectorBaffleInnerRadiusIn = 4.55*cm;
0363   G4double DetectorBaffleInnerRadiusOut = 5.75*cm;
0364 
0365   G4Cons* DetectorBaffleSolid;
0366 
0367   G4LogicalVolume* DetectorBaffleLogicalVolume;
0368 
0369   DetectorBaffleSolid = new G4Cons( "DetectorBaffle_S",              
0370                     DetectorBaffleOuterRadiusIn,
0371                     DetectorBaffleOuterRadiusOut,
0372                     DetectorBaffleInnerRadiusIn,
0373                     DetectorBaffleInnerRadiusOut,
0374                     DetectorBaffleLength/2, 0*deg, 360.*deg);  
0375   DetectorBaffleLogicalVolume = new G4LogicalVolume( 
0376                             DetectorBaffleSolid, Ti, "DetectorBaffle_L", 0, 0, 0 );
0377   DetectorBaffleLogicalVolume -> SetVisAttributes( VisDetectorBaffle );
0378 
0379   // Physical volume
0380  
0381   /* G4VPhysicalVolume* DetectorBafflePhysicalVolume = */
0382   new G4PVPlacement(
0383             rotateMatrix,
0384             G4ThreeVector( DetectorBaffleLength/2, 0.0*cm, 0.0*cm),
0385             "DetectorBaffle_P",
0386             DetectorBaffleLogicalVolume,
0387             physicalWorld, false, 0 );
0388   
0389   //--- Make Invisible
0390 
0391   // DetectorBaffleLogicalVolume -> SetVisAttributes( G4VisAttributes::GetInvisible() );
0392 
0393   // Construct Detector
0394 
0395   G4double DetectorRadius = 32.5*mm;
0396   G4double DetectorThickness = 50e-6*m;
0397 
0398   G4Tubs* DetectorSolid;
0399 
0400   G4LogicalVolume* DetectorLogicalVolume;
0401 
0402   DetectorSolid = new G4Tubs( "Detector_S",                        
0403                   0, DetectorRadius,
0404                   DetectorThickness/2, 0*deg, 360.*deg);  
0405   DetectorLogicalVolume = new G4LogicalVolume( 
0406                           DetectorSolid, Si, "Detector_L", 0, 0, 0 );
0407   DetectorLogicalVolume -> SetVisAttributes( VisDetector );
0408 
0409   // Physical volume
0410   /*G4VPhysicalVolume* DetectorPhysicalVolume = */
0411   new G4PVPlacement( 
0412             rotateMatrix,
0413             G4ThreeVector( DetectorThickness/2, 0.0*cm, 0.0*cm),
0414             "Detector_P",
0415             DetectorLogicalVolume,
0416             physicalWorld, false, 0 );
0417   
0418   //--- Make Invisible
0419   // DetectorLogicalVolume -> SetVisAttributes( G4VisAttributes::GetInvisible() );
0420 
0421   return;
0422 }