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 medical/DICOM/src/DicomNestedParamDetectorConstruction.cc
0028 /// \brief Implementation of the DicomNestedParamDetectorConstruction class
0029 //
0030 // History:
0031 //        Pedro Arce
0032 //
0033 //*******************************************************
0034 
0035 #include "DicomNestedParamDetectorConstruction.hh"
0036 
0037 #include "DicomNestedPhantomParameterisation.hh"
0038 
0039 #include "G4Box.hh"
0040 #include "G4LogicalVolume.hh"
0041 #include "G4PVParameterised.hh"
0042 #include "G4PVPlacement.hh"
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4VisAttributes.hh"
0045 #include "globals.hh"
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 DicomNestedParamDetectorConstruction::DicomNestedParamDetectorConstruction()
0049   : DicomDetectorConstruction()
0050 {}
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 DicomNestedParamDetectorConstruction::~DicomNestedParamDetectorConstruction() {}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 void DicomNestedParamDetectorConstruction::ConstructPhantom()
0057 {
0058 #ifdef G4VERBOSE
0059   G4cout << "DicomNestedParamDetectorConstruction::ConstructPhantom " << G4endl;
0060 #endif
0061 
0062   //----- Replication of Water Phantom Volume.
0063   //--- Y Slice
0064   G4String yRepName("RepY");
0065   G4VSolid* solYRep =
0066     new G4Box(yRepName, fNoVoxelsX * fVoxelHalfDimX, fVoxelHalfDimY, fNoVoxelsZ * fVoxelHalfDimZ);
0067   G4LogicalVolume* logYRep = new G4LogicalVolume(solYRep, fAir, yRepName);
0068   new G4PVReplica(yRepName, logYRep, fContainer_logic, kYAxis, fNoVoxelsY, fVoxelHalfDimY * 2.);
0069 
0070   logYRep->SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
0071 
0072   //--- X Slice
0073   G4String xRepName("RepX");
0074   G4VSolid* solXRep =
0075     new G4Box(xRepName, fVoxelHalfDimX, fVoxelHalfDimY, fNoVoxelsZ * fVoxelHalfDimZ);
0076   G4LogicalVolume* logXRep = new G4LogicalVolume(solXRep, fAir, xRepName);
0077   new G4PVReplica(xRepName, logXRep, logYRep, kXAxis, fNoVoxelsX, fVoxelHalfDimX * 2.);
0078 
0079   logXRep->SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
0080 
0081   //----- Voxel solid and logical volumes
0082   //--- Z Slice
0083   G4VSolid* solVoxel = new G4Box("phantom", fVoxelHalfDimX, fVoxelHalfDimY, fVoxelHalfDimZ);
0084   G4LogicalVolume* logicVoxel = new G4LogicalVolume(solVoxel, fAir, "phantom");
0085 
0086   logicVoxel->SetVisAttributes(new G4VisAttributes(G4VisAttributes::GetInvisible()));
0087 
0088   //
0089   // Parameterisation for transformation of voxels.
0090   //  (voxel size is fixed in this example.
0091   //    e.g. nested parameterisation handles material
0092   //    and transfomation of voxels.)
0093   G4ThreeVector voxelSize(fVoxelHalfDimX, fVoxelHalfDimY, fVoxelHalfDimZ);
0094   DicomNestedPhantomParameterisation* param =
0095     new DicomNestedPhantomParameterisation(voxelSize, fMaterials);
0096 
0097   new G4PVParameterised("phantom",  // their name
0098                         logicVoxel,  // their logical volume
0099                         logXRep,  // Mother logical volume
0100                         kZAxis,  // Are placed along this axis
0101                         // kUndefined,
0102                         //  Are placed along this axis
0103                         fNoVoxelsZ,  // Number of cells
0104                         param);  // Parameterisation.
0105 
0106   param->SetMaterialIndices(fMateIDs);
0107   param->SetNoVoxels(fNoVoxelsX, fNoVoxelsY, fNoVoxelsZ);
0108 
0109   // phantom_phys->SetRegularStructureId(0);
0110 
0111   // Z logical volume
0112   SetScorer(logicVoxel);
0113 }