Files
geant4/examples/extended/parallel/ExDiane/src/BrachyPhantomROGeometry.cc
T
2016-06-09 15:37:50 +02:00

189 lines
6.9 KiB
C++

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Code developed by: S.Guatelli
//
// ************************************
// * *
// * BrachyPhantomROGeometry.cc *
// * *
// ************************************
//
// $Id: BrachyPhantomROGeometry.cc,v 1.3 2006/06/29 17:33:25 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
#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 phantomDimX,
G4double phantomDimZ,
G4int numberOfVoxelsX,
G4int numberOfVoxelsZ):
G4VReadOutGeometry(aString),
phantomDimensionX(phantomDimX),
phantomDimensionZ(phantomDimZ),
numberOfVoxelsAlongX(numberOfVoxelsX),
numberOfVoxelsAlongZ(numberOfVoxelsZ)
{
}
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);
G4double worldDimensionX = 4.0*m;
G4double worldDimensionY = 4.0*m;
G4double worldDimensionZ = 4.0*m;
G4double halfPhantomDimensionX = phantomDimensionX;
G4double halfPhantomDimensionZ = phantomDimensionZ;
G4double halfPhantomDimensionY = phantomDimensionX;
// variables for x division ...
G4double halfXVoxelDimensionX = halfPhantomDimensionX/numberOfVoxelsAlongX;
G4double halfXVoxelDimensionZ = halfPhantomDimensionZ;
G4double voxelXThickness = 2*halfXVoxelDimensionX;
// world volume of ROGeometry ...
G4Box *ROWorld = new G4Box("ROWorld",
worldDimensionX,
worldDimensionY,
worldDimensionZ);
G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld,
dummyMat,
"ROWorldLog",
0,0,0);
G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0,
G4ThreeVector(),
"ROWorldPhys",
ROWorldLog,
0,false,0);
// phantom ROGeometry ...
G4Box *ROPhantom = new G4Box("ROPhantom",
halfPhantomDimensionX,
halfPhantomDimensionY,
halfPhantomDimensionZ);
G4LogicalVolume *ROPhantomLog = new G4LogicalVolume(ROPhantom,
dummyMat,
"ROPhantomLog",
0,0,0);
G4VPhysicalVolume *ROPhantomPhys = new G4PVPlacement(0,
G4ThreeVector(),
"PhantomPhys",
ROPhantomLog,
ROWorldPhys,
false,0);
// ROGeomtry: Voxel division
// X division first...
G4Box *ROPhantomXDivision = new G4Box("ROPhantomXDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionZ,
halfXVoxelDimensionZ);
G4LogicalVolume *ROPhantomXDivisionLog = new G4LogicalVolume(ROPhantomXDivision,
dummyMat,
"ROPhantomXDivisionLog",
0,0,0);
G4VPhysicalVolume *ROPhantomXDivisionPhys = new G4PVReplica("ROPhantomXDivisionPhys",
ROPhantomXDivisionLog,
ROPhantomPhys,
kXAxis,
numberOfVoxelsAlongX,
voxelXThickness);
// ...then Z division
G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionZ,
halfXVoxelDimensionX);
G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
dummyMat,
"ROPhantomZDivisionLog",
0,0,0);
G4VPhysicalVolume *ROPhantomZDivisionPhys = new G4PVReplica("ROPhantomZDivisionPhys",
ROPhantomZDivisionLog,
ROPhantomXDivisionPhys,
kZAxis,
numberOfVoxelsAlongZ,
voxelXThickness);
// ...then Y division
G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
halfXVoxelDimensionX,
halfXVoxelDimensionX,
halfXVoxelDimensionX);
G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
dummyMat,
"ROPhantomYDivisionLog",
0,0,0);
ROPhantomYDivisionPhys = new G4PVReplica("ROPhantomYDivisionPhys",
ROPhantomYDivisionLog,
ROPhantomZDivisionPhys,
kYAxis,
numberOfVoxelsAlongZ,
voxelXThickness);
BrachyDummySD *dummySD = new BrachyDummySD;
ROPhantomYDivisionLog -> SetSensitiveDetector(dummySD);
return ROWorldPhys;
}