Files
geant4/examples/advanced/brachytherapy/src/BrachyPhantomROGeometry.cc
T
2016-06-08 16:57:27 +02:00

135 lines
5.4 KiB
C++

//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
//
// ************************************
// * *
// * BrachyPhantomROGeometry.cc *
// * *
// ************************************
//
// $Id: BrachyPhantomROGeometry.cc,v 1.3 2002/11/18 15:18:38 guatelli Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyDummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SubtractionSolid.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
//....
BrachyPhantomROGeometry::BrachyPhantomROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ)
: G4VReadOutGeometry(aString),m_DetDimX(DetDimX),m_DetDimZ(DetDimZ),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
}
//....
BrachyPhantomROGeometry::~BrachyPhantomROGeometry()
{
}
//....
G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// (It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
// Slice thickness is the average of Voxel X and Z sizes
G4double DetVoxel_y = (m_DetDimX/m_NumVoxelX+m_DetDimZ/m_NumVoxelZ)/2.0;
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4double Det_x = m_DetDimX/2;
G4double Det_y = DetVoxel_y;
G4double Det_z = m_DetDimZ/2;
G4double Det_y2 =m_DetDimX/2 ;
G4double DetVoxelX_x = Det_x/m_NumVoxelX;
G4double DetVoxelX_y = DetVoxel_y;
G4double DetVoxelX_z = Det_z;
G4double DetVoxelX_dx = 2*DetVoxelX_x;
G4double DetVoxelZ_x = Det_x;
G4double DetVoxelZ_y = DetVoxel_y;
G4double DetVoxelZ_z = Det_z/m_NumVoxelZ;
G4double DetVoxelZ_dz = 2*DetVoxelZ_z;
G4Box *ROExpHall = new G4Box("ROExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume *ROExpHallLog = new G4LogicalVolume(ROExpHall,dummyMat,"ROExpHallLog",0,0,0);
G4VPhysicalVolume *ROExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ROExpHallPhys",ROExpHallLog,0,false,0);
G4Box *RODetector = new G4Box("RODetector", Det_x, Det_y2, Det_z);
G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,dummyMat,"RODetectorLog",0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,G4ThreeVector(),"DetectorPhys",RODetectorLog,ROExpHallPhys,false,0);
// ReadOut Voxel division
// X division first...
G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",DetVoxelX_x,DetVoxelX_z,DetVoxelX_z);
G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,dummyMat,"RODetectorXDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",RODetectorXDivisionLog,RODetectorPhys,kXAxis,m_NumVoxelX,DetVoxelX_dx);
// ...then Z division
G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",DetVoxelZ_x,DetVoxelZ_x,DetVoxelZ_z);
G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,dummyMat,"RODetectorZDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",RODetectorZDivisionLog,RODetectorXDivisionPhys,kZAxis,m_NumVoxelZ,DetVoxelZ_dz);
// ...then Y division
G4Box *RODetectorYDivision = new G4Box("RODetectorYDivision",DetVoxelZ_x,DetVoxelZ_y,DetVoxelZ_x);
G4LogicalVolume *RODetectorYDivisionLog = new G4LogicalVolume(RODetectorYDivision,dummyMat,"RODetectorYDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorYDivisionPhys = new G4PVReplica("RODetectorYDivisionPhys",RODetectorYDivisionLog,RODetectorZDivisionPhys,kYAxis,m_NumVoxelZ,DetVoxelZ_dz);
BrachyDummySD *dummySD = new BrachyDummySD;
RODetectorYDivisionLog->SetSensitiveDetector(dummySD);
return ROExpHallPhys;
}