Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:44

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 runAndEvent/RE04/src/RE04DetectorContruction.cc
0027 /// \brief Implementation of the RE04DetectorContruction class
0028 //
0029 //
0030 #include "RE04DetectorConstruction.hh"
0031 
0032 #include "G4Box.hh"
0033 #include "G4Colour.hh"
0034 #include "G4FieldManager.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4Material.hh"
0037 #include "G4NistManager.hh"
0038 #include "G4PVPlacement.hh"
0039 #include "G4SystemOfUnits.hh"
0040 #include "G4TransportationManager.hh"
0041 #include "G4UniformMagField.hh"
0042 #include "G4VisAttributes.hh"
0043 #include "G4ios.hh"
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0046 RE04DetectorConstruction::RE04DetectorConstruction()
0047   : G4VUserDetectorConstruction(), fAir(0), fWater(0), fPb(0), fWorldPhys(0), fConstructed(false)
0048 {
0049   ;
0050 }
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 RE04DetectorConstruction::~RE04DetectorConstruction()
0054 {
0055   ;
0056 }
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 G4VPhysicalVolume* RE04DetectorConstruction::Construct()
0060 {
0061   if (!fConstructed) {
0062     fConstructed = true;
0063     DefineMaterials();
0064     SetupGeometry();
0065   }
0066   return fWorldPhys;
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 void RE04DetectorConstruction::DefineMaterials()
0071 {
0072   //=====================
0073   // Material Definitions
0074   //=====================
0075   //
0076   //-------- NIST Materials ----------------------------------------------------
0077   //  Material Information imported from NIST database.
0078   //
0079   G4NistManager* pNISTman = G4NistManager::Instance();
0080   fAir = pNISTman->FindOrBuildMaterial("G4_AIR");
0081   fWater = pNISTman->FindOrBuildMaterial("G4_WATER");
0082   fPb = pNISTman->FindOrBuildMaterial("G4_Pb");
0083 
0084   //
0085   // Print all the materials defined.
0086   G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
0087   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 void RE04DetectorConstruction::SetupGeometry()
0092 {
0093   //
0094   // World
0095   //
0096   G4VSolid* worldSolid = new G4Box("World", 1. * m, 1. * m, 1. * m);
0097   G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid, fAir, "World");
0098   fWorldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLogical, "World", 0, false, 0);
0099 
0100   //
0101   // Phantom
0102   //
0103   G4VSolid* phantomSolid = new G4Box("Phantom", 50. * cm, 50. * cm, 50. * cm);
0104   G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid, fAir, "Phantom");
0105   new G4PVPlacement(0, G4ThreeVector(), phantomLogical, "Phantom", worldLogical, false, 0);
0106 
0107   //
0108   // Visualization attributes
0109   //
0110   worldLogical->SetVisAttributes(G4VisAttributes::GetInvisible());
0111   G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0112   simpleBoxVisAtt->SetVisibility(true);
0113   phantomLogical->SetVisAttributes(simpleBoxVisAtt);
0114 }