Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:45

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 //
0027 /// \file DicomRegularDetectorConstruction.cc
0028 /// \brief Implementation of the DicomRegularDetectorConstruction clas
0029 //
0030 // History:
0031 //        Pedro Arce
0032 //
0033 //*******************************************************
0034 
0035 #include "DicomRegularDetectorConstruction.hh"
0036 
0037 #include "DicomPhantomParameterisationColour.hh"
0038 
0039 #include "G4Box.hh"
0040 #include "G4Colour.hh"
0041 #include "G4Element.hh"
0042 #include "G4LogicalVolume.hh"
0043 #include "G4Material.hh"
0044 #include "G4PVParameterised.hh"
0045 #include "G4PVPlacement.hh"
0046 #include "G4VPhysicalVolume.hh"
0047 #include "G4VisAttributes.hh"
0048 #include "G4ios.hh"
0049 #include "globals.hh"
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 DicomRegularDetectorConstruction::DicomRegularDetectorConstruction() : DicomDetectorConstruction()
0053 {}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 DicomRegularDetectorConstruction::~DicomRegularDetectorConstruction() {}
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 void DicomRegularDetectorConstruction::ConstructPhantom()
0060 {
0061 #ifdef G4VERBOSE
0062   G4cout << "DicomRegularDetectorConstruction::ConstructPhantom " << G4endl;
0063 #endif
0064 
0065   //----- Create parameterisation
0066   DicomPhantomParameterisationColour* param = new DicomPhantomParameterisationColour();
0067 
0068   //----- Set voxel dimensions
0069   param->SetVoxelDimensions(fVoxelHalfDimX, fVoxelHalfDimY, fVoxelHalfDimZ);
0070 
0071   //----- Set number of voxels
0072   param->SetNoVoxels(fNoVoxelsX, fNoVoxelsY, fNoVoxelsZ);
0073 
0074   //----- Set list of materials
0075   param->SetMaterials(fMaterials);
0076 
0077   //----- Set list of material indices: for each voxel it is a number that
0078   // correspond to the index of its material in the vector of materials
0079   // defined above
0080   param->SetMaterialIndices(fMateIDs);
0081 
0082   //----- Define voxel logical volume
0083   G4Box* voxel_solid = new G4Box("Voxel", fVoxelHalfDimX, fVoxelHalfDimY, fVoxelHalfDimZ);
0084   G4LogicalVolume* voxel_logic =
0085     new G4LogicalVolume(voxel_solid, fMaterials[0], "VoxelLogical", 0, 0, 0);
0086   // material is not relevant, it will be changed by the
0087   // ComputeMaterial method of the parameterisation
0088 
0089   voxel_logic->SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
0090 
0091   //--- Assign the fContainer volume of the parameterisation
0092   param->BuildContainerSolid(fContainer_phys);
0093 
0094   //--- Assure yourself that the voxels are completely filling the
0095   // fContainer volume
0096   param->CheckVoxelsFillContainer(fContainer_solid->GetXHalfLength(),
0097                                   fContainer_solid->GetYHalfLength(),
0098                                   fContainer_solid->GetZHalfLength());
0099 
0100   //----- The G4PVParameterised object that uses the created parameterisation
0101   // should be placed in the fContainer logical volume
0102   G4PVParameterised* phantom_phys = new G4PVParameterised(
0103     "phantom", voxel_logic, fContainer_logic, kXAxis, fNoVoxelsX * fNoVoxelsY * fNoVoxelsZ, param);
0104   // if axis is set as kUndefined instead of kXAxis, GEANT4 will
0105   //  do an smart voxel optimisation
0106   // (not needed if G4RegularNavigation is used)
0107 
0108   //----- Set this physical volume as having a regular structure of type 1,
0109   // so that G4RegularNavigation is used
0110   phantom_phys->SetRegularStructureId(1);  // if not set, G4VoxelNavigation
0111   // will be used instead
0112 
0113   SetScorer(voxel_logic);
0114 }