Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:46

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