Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // $Id: GeometryConstruction.cc 67272 2013-02-13 12:05:47Z ihrivnac $ 26 // 27 // 27 /// \file eventgenerator/exgps/src/GeometryCon 28 /// \file eventgenerator/exgps/src/GeometryConstruction.cc 28 /// \brief Implementation of the GeometryConst 29 /// \brief Implementation of the GeometryConstruction class 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "GeometryConstruction.hh" 34 #include "GeometryConstruction.hh" 34 35 35 #include "G4Box.hh" << 36 #include "G4Material.hh" 36 #include "G4Colour.hh" << 37 #include "G4Element.hh" 37 #include "G4Element.hh" >> 38 #include "G4Box.hh" >> 39 #include "G4Sphere.hh" 38 #include "G4LogicalVolume.hh" 40 #include "G4LogicalVolume.hh" 39 #include "G4Material.hh" << 41 #include "G4ThreeVector.hh" 40 #include "G4PVPlacement.hh" 42 #include "G4PVPlacement.hh" >> 43 #include "G4VisAttributes.hh" >> 44 #include "G4Colour.hh" 41 #include "G4PhysicalConstants.hh" 45 #include "G4PhysicalConstants.hh" 42 #include "G4Sphere.hh" << 43 #include "G4SystemOfUnits.hh" 46 #include "G4SystemOfUnits.hh" 44 #include "G4ThreeVector.hh" << 47 45 #include "G4VisAttributes.hh" << 46 48 47 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 50 49 GeometryConstruction::GeometryConstruction() 51 GeometryConstruction::GeometryConstruction() 50 : G4VUserDetectorConstruction(), fUniverse_p << 52 : G4VUserDetectorConstruction(), 51 { << 53 fUniverse_phys(0), 52 ; << 54 fAl_phys(0), 53 } << 55 fSphere_phys(0) >> 56 {;} 54 57 55 //....oooOO0OOooo........oooOO0OOooo........oo 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 56 59 57 GeometryConstruction::~GeometryConstruction() 60 GeometryConstruction::~GeometryConstruction() 58 { << 61 {;} 59 ; << 60 } << 61 62 62 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 63 64 64 G4VPhysicalVolume* GeometryConstruction::Const 65 G4VPhysicalVolume* GeometryConstruction::Construct() 65 { 66 { 66 // 67 // 67 // 68 // 68 // Define materials. 69 // Define materials. 69 // 70 // 70 G4double a, z, density, pressure, temperatur << 71 G4double a, z, density,pressure, temperature; 71 G4String name, symbol; 72 G4String name, symbol; 72 73 73 density = universe_mean_density; // from Ph << 74 74 pressure = 3.e-18 * pascal; << 75 density = universe_mean_density; //from PhysicalConstants.h 75 temperature = 2.73 * kelvin; << 76 pressure = 3.e-18*pascal; 76 G4Material* Vacuum = << 77 temperature = 2.73*kelvin; 77 new G4Material("Vacuum", 1., 1.01 * g / mo << 78 G4Material* Vacuum = new G4Material("Vacuum", 78 a = 26.98154 * g / mole; << 79 1., 1.01*g/mole, density, 79 density = 2.70 * g / cm3; << 80 kStateGas,temperature,pressure); 80 G4Material* Aluminium = new G4Material(name << 81 a = 26.98154*g/mole; 81 << 82 density = 2.70*g/cm3; 82 a = 28.0855 * g / mole; << 83 G4Material* Aluminium = new G4Material(name="aluminium", z=13., a, density); 83 G4Element* elSi = new G4Element(name = "sili << 84 84 << 85 a = 28.0855*g/mole; 85 a = 16.00 * g / mole; << 86 G4Element* elSi = new G4Element(name="silicon", symbol="Si", z=14., a); 86 G4Element* elO = new G4Element(name = "Oxyge << 87 87 << 88 a = 16.00*g/mole; 88 density = 2.65 * g / cm3; << 89 G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a); 89 G4Material* SiliconDioxide = new G4Material( << 90 >> 91 density = 2.65*g/cm3; >> 92 G4Material* SiliconDioxide = >> 93 new G4Material(name="silicon oxide", density, 2); 90 SiliconDioxide->AddElement(elSi, 1); 94 SiliconDioxide->AddElement(elSi, 1); 91 SiliconDioxide->AddElement(elO, 2); << 95 SiliconDioxide->AddElement(elO, 2); 92 // 96 // 93 // Define size of world and volumes in it. 97 // Define size of world and volumes in it. 94 // 98 // 95 G4double world_r = 18 * cm; << 99 G4double world_r = 18*cm; 96 100 97 G4double box_x = 10 * cm; << 101 G4double box_x = 10*cm; 98 G4double box_y = 10 * cm; << 102 G4double box_y = 10*cm; 99 G4double box_z = 10 * cm; << 103 G4double box_z = 10*cm; 100 104 101 G4double sphere_r = 5 * cm; << 105 G4double sphere_r = 5*cm; 102 106 103 // Define bodies, logical volumes and physic 107 // Define bodies, logical volumes and physical volumes. 104 // First define the experimental hall. 108 // First define the experimental hall. 105 // 109 // 106 G4Sphere* universe_s = new G4Sphere("univers << 110 G4Sphere * universe_s 107 G4LogicalVolume* universe_log = new G4Logica << 111 = new G4Sphere("universe_s", 0, world_r, 0, twopi, 0, pi); 108 // << 112 G4LogicalVolume * universe_log 109 fUniverse_phys = new G4PVPlacement(0, G4Thre << 113 = new G4LogicalVolume(universe_s,Vacuum,"universe_L",0,0,0); 110 << 114 // 111 // define an aluminium box << 115 fUniverse_phys 112 // << 116 = new G4PVPlacement(0,G4ThreeVector(),"universe_P", 113 G4Box* Al_box = new G4Box("Al_b", box_x, box << 117 universe_log,0,false,0); 114 G4LogicalVolume* Al_log = new G4LogicalVolum << 118 115 // << 119 //define an aluminium box 116 fAl_phys = << 120 // 117 new G4PVPlacement(0, G4ThreeVector(0., 0., << 121 G4Box * Al_box >> 122 = new G4Box("Al_b", box_x, box_y, box_z); >> 123 G4LogicalVolume * Al_log >> 124 = new G4LogicalVolume(Al_box,Aluminium,"Box_log",0,0,0); >> 125 // >> 126 fAl_phys >> 127 = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Box_phys", >> 128 Al_log,fUniverse_phys,false,0); 118 129 119 // Define an inner sphere. 130 // Define an inner sphere. 120 // 131 // 121 G4Sphere* aSphere_sph = new G4Sphere("aSpher << 132 G4Sphere * aSphere_sph 122 G4LogicalVolume* aSphere_log = << 133 = new G4Sphere("aSphere", 0, sphere_r, 0, twopi, 0, pi); 123 new G4LogicalVolume(aSphere_sph, SiliconDi << 134 G4LogicalVolume * aSphere_log 124 // << 135 = new G4LogicalVolume(aSphere_sph,SiliconDioxide,"Sphere_log",0,0,0); 125 fSphere_phys = << 136 // 126 new G4PVPlacement(0, G4ThreeVector(0., 0., << 137 fSphere_phys 127 << 138 = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Sphere_phys",aSphere_log, 128 //--------- Visualization attributes ------- << 139 fAl_phys,false,0); >> 140 >> 141 //--------- Visualization attributes ------------------------------- 129 universe_log->SetVisAttributes(G4VisAttribut 142 universe_log->SetVisAttributes(G4VisAttributes::GetInvisible()); 130 G4VisAttributes* aVisAtt = new G4VisAttribut << 143 G4VisAttributes* aVisAtt= new G4VisAttributes(G4Colour(0,1.0,1.0)); 131 Al_log->SetVisAttributes(aVisAtt); 144 Al_log->SetVisAttributes(aVisAtt); 132 G4VisAttributes* bVisAtt = new G4VisAttribut << 145 G4VisAttributes* bVisAtt= new G4VisAttributes(G4Colour(1.0,2.0,.0)); 133 aSphere_log->SetVisAttributes(bVisAtt); 146 aSphere_log->SetVisAttributes(bVisAtt); 134 147 135 return fUniverse_phys; 148 return fUniverse_phys; 136 } 149 } 137 150 138 //....oooOO0OOooo........oooOO0OOooo........oo 151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 139 152