Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 /// \file GB06/src/GB06DetectorConstruction.cc 27 /// \brief Implementation of the GB06DetectorConstruction class 28 // 29 #include "GB06DetectorConstruction.hh" 30 31 #include "GB06SD.hh" 32 33 #include "G4Box.hh" 34 #include "G4LogicalVolume.hh" 35 #include "G4Material.hh" 36 #include "G4NistManager.hh" 37 #include "G4PVPlacement.hh" 38 #include "G4SDManager.hh" 39 #include "G4SystemOfUnits.hh" 40 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 43 GB06DetectorConstruction::GB06DetectorConstruction() : G4VUserDetectorConstruction() {} 44 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 47 GB06DetectorConstruction::~GB06DetectorConstruction() {} 48 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 50 51 G4VPhysicalVolume* GB06DetectorConstruction::Construct() 52 { 53 G4Material* worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic"); 54 G4Material* concreteMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_CONCRETE"); 55 56 G4VSolid* solidWorld = new G4Box("World.solid", 10 * m, 10 * m, 10 * m); 57 58 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, // its solid 59 worldMaterial, // its material 60 "World.logical"); // its name 61 62 G4PVPlacement* physiWorld = new G4PVPlacement(nullptr, // no rotation 63 G4ThreeVector(), // at (0,0,0) 64 logicWorld, // its logical volume 65 "World.physical", // its name 66 nullptr, // its mother volume 67 false, // no bool. operation 68 0); // copy number 69 70 // ---------------------------------------------------- 71 // -- volume of shield, made of concrete, in one block: 72 // ---------------------------------------------------- 73 G4double halfXY = 1.5 * m; 74 G4double halfZ = 2.5 * m; 75 G4VSolid* solidShield = new G4Box("shield.solid", halfXY, halfXY, halfZ); 76 77 G4LogicalVolume* logicTest = new G4LogicalVolume(solidShield, // its solid 78 concreteMaterial, // its material 79 "shield.logical"); // its name 80 81 new G4PVPlacement(nullptr, // no rotation 82 G4ThreeVector(0, 0, halfZ), // volume entrance is set at (0,0,0) 83 logicTest, // its logical volume 84 "shield.physical", // its name 85 logicWorld, // its mother volume 86 false, // no boolean operation 87 0); // copy number 88 89 // ------------------------------------------------------------ 90 // -- dummy volume to display exiting neutron flux information: 91 // ------------------------------------------------------------ 92 G4double halfz = 1 * cm; 93 G4VSolid* solidMeasurement = new G4Box("meas.solid", halfXY, halfXY, halfz); 94 95 logicMeasurement = new G4LogicalVolume(solidMeasurement, // its solid 96 worldMaterial, // its material 97 "meas.logical"); // its name 98 99 new G4PVPlacement(nullptr, // no rotation 100 G4ThreeVector(0, 0, 2 * halfZ + halfz), // entrance set after shield 101 logicMeasurement, // its logical volume 102 "meas.physical", // its name 103 logicWorld, // its mother volume 104 false, // no boolean operation 105 0); // copy number 106 107 // -- world volume pointer returned: 108 return physiWorld; 109 } 110 111 void GB06DetectorConstruction::ConstructSDandField() 112 { 113 // --------------------------------------------------------------------------------- 114 // -- Attach sensitive detector to print information on particle exiting the shield: 115 // --------------------------------------------------------------------------------- 116 // -- create and register sensitive detector code module: 117 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 118 G4VSensitiveDetector* sd = new GB06SD("Measurer"); 119 SDman->AddNewDetector(sd); 120 // -- Fetch volume for sensitivity and attach sensitive module to it: 121 logicMeasurement->SetSensitiveDetector(sd); 122 } 123