Geant4  10.00.p02
IORTDetectorROGeometry.cc
Go to the documentation of this file.
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 // This is the *BASIC* version of IORT, a Geant4-based application
27 //
28 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
29 // Contributor Authors: S.Guatelli(e)
30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
31 //
32 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
33 // (b) IBFM-CNR , Segrate (Milano), Italy
34 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
35 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
36 // (e) University of Wallongong, Australia
37 //
38 // *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
40 
42 #include "IORTDummySD.hh"
43 #include "G4SystemOfUnits.hh"
44 #include "G4LogicalVolume.hh"
45 #include "G4VPhysicalVolume.hh"
46 #include "G4PVPlacement.hh"
47 #include "G4PVReplica.hh"
48 #include "G4Box.hh"
49 #include "G4ThreeVector.hh"
50 #include "G4Material.hh"
51 
54  G4double detectorDimX,
55  G4double detectorDimY,
56  G4double detectorDimZ,
57  G4int numberOfVoxelsX,
58  G4int numberOfVoxelsY,
59  G4int numberOfVoxelsZ):
60 
61  G4VReadOutGeometry(aString),
62  detectorToWorldPosition(pos),
63  detectorSizeX(detectorDimX),
64  detectorSizeY(detectorDimY),
65  detectorSizeZ(detectorDimZ),
66  numberOfVoxelsAlongX(numberOfVoxelsX),
67  numberOfVoxelsAlongY(numberOfVoxelsY),
68  numberOfVoxelsAlongZ(numberOfVoxelsZ)
69 {
70 }
71 
74 {
75 }
76 
79 {
80  // A dummy material is used to fill the volumes of the readout geometry.
81  // (It will be allowed to set a NULL pointer in volumes of such virtual
82  // division in future, since this material is irrelevant for tracking.)
83 
84  G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
85 
86  G4double worldSizeX = 400.0 *cm; // 200.0 *cm;
87  G4double worldSizeY = 400.0 *cm; // 200.0 *cm;
88  G4double worldSizeZ = 400.0 *cm; // 200.0 *cm;
89 
90  G4double halfDetectorSizeX = detectorSizeX;
91  G4double halfDetectorSizeY = detectorSizeY;
92  G4double halfDetectorSizeZ = detectorSizeZ;
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, dummyMat,
101  "ROWorldLog", 0,0,0);
102 
103  G4VPhysicalVolume* ROWorldPhys = new G4PVPlacement(0,G4ThreeVector(),
104  "ROWorldPhys",
105  ROWorldLog,
106  0,false,0);
107 
108  // Detector ROGeometry
109  G4Box *RODetector = new G4Box("RODetector",
110  halfDetectorSizeX,
111  halfDetectorSizeY,
112  halfDetectorSizeZ);
113 
114  G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,
115  dummyMat,
116  "RODetectorLog",
117  0,0,0);
118 
119  G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,
121  "DetectorPhys",
122  RODetectorLog,
123  ROWorldPhys,
124  false,0);
125 
126 
127  // Division along X axis: the detector is divided in slices along the X axis
128 
129  G4double halfXVoxelSizeX = halfDetectorSizeX/numberOfVoxelsAlongX;
130  G4double halfXVoxelSizeY = halfDetectorSizeY;
131  G4double halfXVoxelSizeZ = halfDetectorSizeZ;
132  G4double voxelXThickness = 2*halfXVoxelSizeX;
133 
134  G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",
135  halfXVoxelSizeX,
136  halfXVoxelSizeY,
137  halfXVoxelSizeZ);
138 
139  G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,
140  dummyMat,
141  "RODetectorXDivisionLog",
142  0,0,0);
143 
144  G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",
145  RODetectorXDivisionLog,
146  RODetectorPhys,
147  kXAxis,
149  voxelXThickness);
150 
151  // Division along Y axis: the slices along the X axis are divided along the Y axis
152 
153  G4double halfYVoxelSizeX = halfXVoxelSizeX;
154  G4double halfYVoxelSizeY = halfDetectorSizeY/numberOfVoxelsAlongY;
155  G4double halfYVoxelSizeZ = halfDetectorSizeZ;
156  G4double voxelYThickness = 2*halfYVoxelSizeY;
157 
158  G4Box *RODetectorYDivision = new G4Box("RODetectorYDivision",
159  halfYVoxelSizeX,
160  halfYVoxelSizeY,
161  halfYVoxelSizeZ);
162 
163  G4LogicalVolume *RODetectorYDivisionLog = new G4LogicalVolume(RODetectorYDivision,
164  dummyMat,
165  "RODetectorYDivisionLog",
166  0,0,0);
167 
168  G4VPhysicalVolume *RODetectorYDivisionPhys = new G4PVReplica("RODetectorYDivisionPhys",
169  RODetectorYDivisionLog,
170  RODetectorXDivisionPhys,
171  kYAxis,
173  voxelYThickness);
174 
175  // Division along Z axis: the slices along the Y axis are divided along the Z axis
176 
177  G4double halfZVoxelSizeX = halfXVoxelSizeX;
178  G4double halfZVoxelSizeY = halfYVoxelSizeY;
179  G4double halfZVoxelSizeZ = halfDetectorSizeZ/numberOfVoxelsAlongZ;
180  G4double voxelZThickness = 2*halfZVoxelSizeZ;
181 
182  G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",
183  halfZVoxelSizeX,
184  halfZVoxelSizeY,
185  halfZVoxelSizeZ);
186 
187  G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,
188  dummyMat,
189  "RODetectorZDivisionLog",
190  0,0,0);
191 
192  RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",
193  RODetectorZDivisionLog,
194  RODetectorYDivisionPhys,
195  kZAxis,
197  voxelZThickness);
198 
199  IORTDummySD *dummySD = new IORTDummySD;
200  RODetectorZDivisionLog -> SetSensitiveDetector(dummySD);
201 
202  return ROWorldPhys;
203 }
204 
205 
206 
static const double cm
Definition: G4SIunits.hh:106
G4VPhysicalVolume * RODetectorZDivisionPhys
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
int G4int
Definition: G4Types.hh:78
const G4ThreeVector detectorToWorldPosition
G4VPhysicalVolume * Build()
static const double cm3
Definition: G4SIunits.hh:108
static const double g
Definition: G4SIunits.hh:162
static const double mole
Definition: G4SIunits.hh:265
double G4double
Definition: G4Types.hh:76
static const G4double pos
IORTDetectorROGeometry(G4String aString, G4ThreeVector detectorPos, G4double detectorDimX, G4double detectorDimY, G4double detectorDimZ, G4int numberOfVoxelsX, G4int numberOfVoxelsY, G4int numberOfVoxelsZ)