Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-15 08:11:09

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 /// \file GB06/src/GB06DetectorConstruction.cc
0027 /// \brief Implementation of the GB06DetectorConstruction class
0028 //
0029 #include "GB06DetectorConstruction.hh"
0030 
0031 #include "GB06SD.hh"
0032 
0033 #include "G4Box.hh"
0034 #include "G4LogicalVolume.hh"
0035 #include "G4Material.hh"
0036 #include "G4NistManager.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4SDManager.hh"
0039 #include "G4SystemOfUnits.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 GB06DetectorConstruction::GB06DetectorConstruction() : G4VUserDetectorConstruction() {}
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0046 
0047 GB06DetectorConstruction::~GB06DetectorConstruction() = default;
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 G4VPhysicalVolume* GB06DetectorConstruction::Construct()
0052 {
0053   G4Material* worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
0054   G4Material* concreteMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_CONCRETE");
0055 
0056   G4VSolid* solidWorld = new G4Box("World.solid", 10 * m, 10 * m, 10 * m);
0057 
0058   auto logicWorld = new G4LogicalVolume(solidWorld,  // its solid
0059                                         worldMaterial,  // its material
0060                                         "World.logical");  // its name
0061 
0062   auto physiWorld = new G4PVPlacement(nullptr,  // no rotation
0063                                       G4ThreeVector(),  // at (0,0,0)
0064                                       logicWorld,  // its logical volume
0065                                       "World.physical",  // its name
0066                                       nullptr,  // its mother volume
0067                                       false,  // no bool. operation
0068                                       0);  // copy number
0069 
0070   // ----------------------------------------------------
0071   // -- volume of shield, made of concrete, in one block:
0072   // ----------------------------------------------------
0073   G4double halfXY = 1.5 * m;
0074   G4double halfZ = 2.5 * m;
0075   G4VSolid* solidShield = new G4Box("shield.solid", halfXY, halfXY, halfZ);
0076 
0077   auto logicTest = new G4LogicalVolume(solidShield,  // its solid
0078                                        concreteMaterial,  // its material
0079                                        "shield.logical");  // its name
0080 
0081   new G4PVPlacement(nullptr,  // no rotation
0082                     G4ThreeVector(0, 0, halfZ),  // volume entrance is set at (0,0,0)
0083                     logicTest,  // its logical volume
0084                     "shield.physical",  // its name
0085                     logicWorld,  // its mother  volume
0086                     false,  // no boolean operation
0087                     0);  // copy number
0088 
0089   // ------------------------------------------------------------
0090   // -- dummy volume to display exiting neutron flux information:
0091   // ------------------------------------------------------------
0092   G4double halfz = 1 * cm;
0093   G4VSolid* solidMeasurement = new G4Box("meas.solid", halfXY, halfXY, halfz);
0094 
0095   logicMeasurement = new G4LogicalVolume(solidMeasurement,  // its solid
0096                                          worldMaterial,  // its material
0097                                          "meas.logical");  // its name
0098 
0099   new G4PVPlacement(nullptr,  // no rotation
0100                     G4ThreeVector(0, 0, 2 * halfZ + halfz),  // entrance set after shield
0101                     logicMeasurement,  // its logical volume
0102                     "meas.physical",  // its name
0103                     logicWorld,  // its mother  volume
0104                     false,  // no boolean operation
0105                     0);  // copy number
0106 
0107   // -- world volume pointer returned:
0108   return physiWorld;
0109 }
0110 
0111 void GB06DetectorConstruction::ConstructSDandField()
0112 {
0113   // ---------------------------------------------------------------------------------
0114   // -- Attach sensitive detector to print information on particle exiting the shield:
0115   // ---------------------------------------------------------------------------------
0116   // -- create and register sensitive detector code module:
0117   G4SDManager* SDman = G4SDManager::GetSDMpointer();
0118   G4VSensitiveDetector* sd = new GB06SD("Measurer");
0119   SDman->AddNewDetector(sd);
0120   // -- Fetch volume for sensitivity and attach sensitive module to it:
0121   logicMeasurement->SetSensitiveDetector(sd);
0122 }