source: trunk/examples/advanced/brachytherapy/src/BrachyPhantomROGeometry.cc@ 1277

Last change on this file since 1277 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 6.8 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// Code developed by:
28// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
29//
30// ************************************
31// * *
32// * BrachyPhantomROGeometry.cc *
33// * *
34// ************************************
35//
36// $Id: BrachyPhantomROGeometry.cc,v 1.11 2006/06/29 15:48:36 gunter Exp $
37// GEANT4 tag $Name: geant4-09-03-cand-01 $
38//
39#include "BrachyPhantomROGeometry.hh"
40#include "BrachyDummySD.hh"
41#include "G4LogicalVolume.hh"
42#include "G4VPhysicalVolume.hh"
43#include "G4PVPlacement.hh"
44#include "G4PVReplica.hh"
45#include "G4SDManager.hh"
46#include "G4Box.hh"
47#include "G4ThreeVector.hh"
48#include "G4Material.hh"
49
50BrachyPhantomROGeometry::BrachyPhantomROGeometry(G4String aString,
51 G4double phantomDimX,
52 G4double phantomDimY,
53 G4double phantomDimZ,
54 G4int numberOfVoxelsX,
55 G4int numberOfVoxelsY,
56 G4int numberOfVoxelsZ):
57 G4VReadOutGeometry(aString),
58 phantomSizeX(phantomDimX),
59 phantomSizeY(phantomDimY),
60 phantomSizeZ(phantomDimZ),
61 numberOfVoxelsAlongX(numberOfVoxelsX),
62 numberOfVoxelsAlongY(numberOfVoxelsY),
63 numberOfVoxelsAlongZ(numberOfVoxelsZ)
64{
65}
66
67BrachyPhantomROGeometry::~BrachyPhantomROGeometry()
68{
69}
70
71G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
72{
73
74 // A dummy material is used to fill the volumes of the readout geometry.
75 // (It will be allowed to set a NULL pointer in volumes of such virtual
76 // division in future, since this material is irrelevant for tracking.)
77
78 G4Material* dummyMat = new G4Material(name="dummyMat",
79 1., 1.*g/mole, 1.*g/cm3);
80
81 G4double worldSizeX = 4.0*m;
82 G4double worldSizeY = 4.0*m;
83 G4double worldSizeZ = 4.0*m;
84
85 G4double halfPhantomSizeX = phantomSizeX;
86 G4double halfPhantomSizeZ = phantomSizeZ;
87 G4double halfPhantomSizeY = phantomSizeY;
88
89 // variables for x division ...
90 G4double halfVoxelSize = halfPhantomSizeX/numberOfVoxelsAlongX;
91 G4double halfSize = halfPhantomSizeZ;
92 G4double voxelThickness = 2*halfVoxelSize;
93
94 // world volume of ROGeometry ...
95 G4Box *ROWorld = new G4Box("ROWorld",
96 worldSizeX,
97 worldSizeY,
98 worldSizeZ);
99
100 G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld,
101 dummyMat,
102 "ROWorldLog",
103 0,0,0);
104
105 G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0,
106 G4ThreeVector(),
107 "ROWorldPhys",
108 ROWorldLog,
109 0,false,0);
110
111 // Phantom ROGeometry ...
112 G4Box *ROPhantom = new G4Box("ROPhantom",
113 halfPhantomSizeX,
114 halfPhantomSizeY,
115 halfPhantomSizeZ);
116
117 G4LogicalVolume *ROPhantomLog = new G4LogicalVolume(ROPhantom,
118 dummyMat,
119 "ROPhantomLog",
120 0,0,0);
121
122 G4VPhysicalVolume *ROPhantomPhys = new G4PVPlacement(0,
123 G4ThreeVector(),
124 "PhantomPhys",
125 ROPhantomLog,
126 ROWorldPhys,
127 false,0);
128
129 // ROGeometry: Voxel division
130
131 // X division first...
132 G4Box *ROPhantomXDivision = new G4Box("ROPhantomXDivision",
133 halfVoxelSize,
134 halfSize,
135 halfSize);
136
137 G4LogicalVolume *ROPhantomXDivisionLog = new G4LogicalVolume(ROPhantomXDivision,
138 dummyMat,
139 "ROPhantomXDivisionLog",
140 0,0,0);
141
142 G4VPhysicalVolume *ROPhantomXDivisionPhys = new G4PVReplica("ROPhantomXDivisionPhys",
143 ROPhantomXDivisionLog,
144 ROPhantomPhys,
145 kXAxis,
146 numberOfVoxelsAlongX,
147 voxelThickness);
148 // ...then Z division
149
150 G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
151 halfVoxelSize,
152 halfSize,
153 halfVoxelSize);
154
155 G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
156 dummyMat,
157 "ROPhantomZDivisionLog",
158 0,0,0);
159
160 G4VPhysicalVolume *ROPhantomZDivisionPhys = new G4PVReplica("ROPhantomZDivisionPhys",
161 ROPhantomZDivisionLog,
162 ROPhantomXDivisionPhys,
163 kZAxis,
164 numberOfVoxelsAlongZ,
165 voxelThickness);
166 // ...then Y division
167
168 G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
169 halfVoxelSize,
170 halfVoxelSize,
171 halfVoxelSize);
172
173 G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
174 dummyMat,
175 "ROPhantomYDivisionLog",
176 0,0,0);
177
178 ROPhantomYDivisionPhys = new G4PVReplica("ROPhantomYDivisionPhys",
179 ROPhantomYDivisionLog,
180 ROPhantomZDivisionPhys,
181 kYAxis,
182 numberOfVoxelsAlongY,
183 voxelThickness);
184 BrachyDummySD *dummySD = new BrachyDummySD;
185 ROPhantomYDivisionLog -> SetSensitiveDetector(dummySD);
186
187 return ROWorldPhys;
188}
189
190
191
Note: See TracBrowser for help on using the repository browser.