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 // 26 // 27 /// \file eventgenerator/exgps/src/GeometryCon 27 /// \file eventgenerator/exgps/src/GeometryConstruction.cc 28 /// \brief Implementation of the GeometryConst 28 /// \brief Implementation of the GeometryConstruction class 29 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 32 33 #include "GeometryConstruction.hh" 33 #include "GeometryConstruction.hh" 34 34 35 #include "G4Box.hh" << 35 #include "G4Material.hh" 36 #include "G4Colour.hh" << 37 #include "G4Element.hh" 36 #include "G4Element.hh" >> 37 #include "G4Box.hh" >> 38 #include "G4Sphere.hh" 38 #include "G4LogicalVolume.hh" 39 #include "G4LogicalVolume.hh" 39 #include "G4Material.hh" << 40 #include "G4ThreeVector.hh" 40 #include "G4PVPlacement.hh" 41 #include "G4PVPlacement.hh" >> 42 #include "G4VisAttributes.hh" >> 43 #include "G4Colour.hh" 41 #include "G4PhysicalConstants.hh" 44 #include "G4PhysicalConstants.hh" 42 #include "G4Sphere.hh" << 43 #include "G4SystemOfUnits.hh" 45 #include "G4SystemOfUnits.hh" 44 #include "G4ThreeVector.hh" << 46 45 #include "G4VisAttributes.hh" << 46 47 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 49 49 GeometryConstruction::GeometryConstruction() 50 GeometryConstruction::GeometryConstruction() 50 : G4VUserDetectorConstruction(), fUniverse_p << 51 : G4VUserDetectorConstruction(), 51 { << 52 fUniverse_phys(0), 52 ; << 53 fAl_phys(0), 53 } << 54 fSphere_phys(0) >> 55 {;} 54 56 55 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 56 58 57 GeometryConstruction::~GeometryConstruction() 59 GeometryConstruction::~GeometryConstruction() 58 { << 60 {;} 59 ; << 60 } << 61 61 62 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 63 63 64 G4VPhysicalVolume* GeometryConstruction::Const 64 G4VPhysicalVolume* GeometryConstruction::Construct() 65 { 65 { 66 // 66 // 67 // 67 // 68 // Define materials. 68 // Define materials. 69 // 69 // 70 G4double a, z, density, pressure, temperatur << 70 G4double a, z, density,pressure, temperature; 71 G4String name, symbol; 71 G4String name, symbol; 72 72 73 density = universe_mean_density; // from Ph << 73 74 pressure = 3.e-18 * pascal; << 74 density = universe_mean_density; //from PhysicalConstants.h 75 temperature = 2.73 * kelvin; << 75 pressure = 3.e-18*pascal; 76 G4Material* Vacuum = << 76 temperature = 2.73*kelvin; 77 new G4Material("Vacuum", 1., 1.01 * g / mo << 77 G4Material* Vacuum = new G4Material("Vacuum", 78 a = 26.98154 * g / mole; << 78 1., 1.01*g/mole, density, 79 density = 2.70 * g / cm3; << 79 kStateGas,temperature,pressure); 80 G4Material* Aluminium = new G4Material(name << 80 a = 26.98154*g/mole; 81 << 81 density = 2.70*g/cm3; 82 a = 28.0855 * g / mole; << 82 G4Material* Aluminium = new G4Material(name="aluminium", z=13., a, density); 83 G4Element* elSi = new G4Element(name = "sili << 83 84 << 84 a = 28.0855*g/mole; 85 a = 16.00 * g / mole; << 85 G4Element* elSi = new G4Element(name="silicon", symbol="Si", z=14., a); 86 G4Element* elO = new G4Element(name = "Oxyge << 86 87 << 87 a = 16.00*g/mole; 88 density = 2.65 * g / cm3; << 88 G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a); 89 G4Material* SiliconDioxide = new G4Material( << 89 >> 90 density = 2.65*g/cm3; >> 91 G4Material* SiliconDioxide = >> 92 new G4Material(name="silicon oxide", density, 2); 90 SiliconDioxide->AddElement(elSi, 1); 93 SiliconDioxide->AddElement(elSi, 1); 91 SiliconDioxide->AddElement(elO, 2); << 94 SiliconDioxide->AddElement(elO, 2); 92 // 95 // 93 // Define size of world and volumes in it. 96 // Define size of world and volumes in it. 94 // 97 // 95 G4double world_r = 18 * cm; << 98 G4double world_r = 18*cm; 96 99 97 G4double box_x = 10 * cm; << 100 G4double box_x = 10*cm; 98 G4double box_y = 10 * cm; << 101 G4double box_y = 10*cm; 99 G4double box_z = 10 * cm; << 102 G4double box_z = 10*cm; 100 103 101 G4double sphere_r = 5 * cm; << 104 G4double sphere_r = 5*cm; 102 105 103 // Define bodies, logical volumes and physic 106 // Define bodies, logical volumes and physical volumes. 104 // First define the experimental hall. 107 // First define the experimental hall. 105 // 108 // 106 G4Sphere* universe_s = new G4Sphere("univers << 109 G4Sphere * universe_s 107 G4LogicalVolume* universe_log = new G4Logica << 110 = new G4Sphere("universe_s", 0, world_r, 0, twopi, 0, pi); 108 // << 111 G4LogicalVolume * universe_log 109 fUniverse_phys = new G4PVPlacement(0, G4Thre << 112 = new G4LogicalVolume(universe_s,Vacuum,"universe_L",0,0,0); 110 << 113 // 111 // define an aluminium box << 114 fUniverse_phys 112 // << 115 = new G4PVPlacement(0,G4ThreeVector(),"universe_P", 113 G4Box* Al_box = new G4Box("Al_b", box_x, box << 116 universe_log,0,false,0); 114 G4LogicalVolume* Al_log = new G4LogicalVolum << 117 115 // << 118 //define an aluminium box 116 fAl_phys = << 119 // 117 new G4PVPlacement(0, G4ThreeVector(0., 0., << 120 G4Box * Al_box >> 121 = new G4Box("Al_b", box_x, box_y, box_z); >> 122 G4LogicalVolume * Al_log >> 123 = new G4LogicalVolume(Al_box,Aluminium,"Box_log",0,0,0); >> 124 // >> 125 fAl_phys >> 126 = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Box_phys", >> 127 Al_log,fUniverse_phys,false,0); 118 128 119 // Define an inner sphere. 129 // Define an inner sphere. 120 // 130 // 121 G4Sphere* aSphere_sph = new G4Sphere("aSpher << 131 G4Sphere * aSphere_sph 122 G4LogicalVolume* aSphere_log = << 132 = new G4Sphere("aSphere", 0, sphere_r, 0, twopi, 0, pi); 123 new G4LogicalVolume(aSphere_sph, SiliconDi << 133 G4LogicalVolume * aSphere_log 124 // << 134 = new G4LogicalVolume(aSphere_sph,SiliconDioxide,"Sphere_log",0,0,0); 125 fSphere_phys = << 135 // 126 new G4PVPlacement(0, G4ThreeVector(0., 0., << 136 fSphere_phys 127 << 137 = new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),"Sphere_phys",aSphere_log, 128 //--------- Visualization attributes ------- << 138 fAl_phys,false,0); >> 139 >> 140 //--------- Visualization attributes ------------------------------- 129 universe_log->SetVisAttributes(G4VisAttribut 141 universe_log->SetVisAttributes(G4VisAttributes::GetInvisible()); 130 G4VisAttributes* aVisAtt = new G4VisAttribut << 142 G4VisAttributes* aVisAtt= new G4VisAttributes(G4Colour(0,1.0,1.0)); 131 Al_log->SetVisAttributes(aVisAtt); 143 Al_log->SetVisAttributes(aVisAtt); 132 G4VisAttributes* bVisAtt = new G4VisAttribut << 144 G4VisAttributes* bVisAtt= new G4VisAttributes(G4Colour(1.0,2.0,.0)); 133 aSphere_log->SetVisAttributes(bVisAtt); 145 aSphere_log->SetVisAttributes(bVisAtt); 134 146 135 return fUniverse_phys; 147 return fUniverse_phys; 136 } 148 } 137 149 138 //....oooOO0OOooo........oooOO0OOooo........oo 150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 139 151