source: trunk/examples/extended/parallel/ExDiane/src/BrachyPhantomROGeometry.cc @ 1170

Last change on this file since 1170 was 807, checked in by garnier, 16 years ago

update

File size: 6.9 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: S.Guatelli
28//
29//    ************************************
30//    *                                  *
31//    *   BrachyPhantomROGeometry.cc    *
32//    *                                  *
33//    ************************************
34//
35// $Id: BrachyPhantomROGeometry.cc,v 1.3 2006/06/29 17:33:25 gunter Exp $
36// GEANT4 tag $Name:  $
37//
38#include "BrachyPhantomROGeometry.hh"
39#include "BrachyDummySD.hh"
40
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 "G4Tubs.hh"
48#include "G4SubtractionSolid.hh"
49#include "G4ThreeVector.hh"
50#include "G4Material.hh"
51
52BrachyPhantomROGeometry::BrachyPhantomROGeometry(G4String aString,
53                                                 G4double phantomDimX,
54                                                 G4double phantomDimZ,
55                                                 G4int numberOfVoxelsX,
56                                                 G4int numberOfVoxelsZ):
57  G4VReadOutGeometry(aString),
58  phantomDimensionX(phantomDimX),
59  phantomDimensionZ(phantomDimZ),
60  numberOfVoxelsAlongX(numberOfVoxelsX),
61  numberOfVoxelsAlongZ(numberOfVoxelsZ)
62{
63}
64
65BrachyPhantomROGeometry::~BrachyPhantomROGeometry()
66{
67}
68
69G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
70{
71 
72  // A dummy material is used to fill the volumes of the readout geometry.
73  // (It will be allowed to set a NULL pointer in volumes of such virtual
74  // division in future, since this material is irrelevant for tracking.)
75
76  G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
77
78  G4double worldDimensionX = 4.0*m;
79  G4double worldDimensionY = 4.0*m;
80  G4double worldDimensionZ = 4.0*m;
81
82  G4double halfPhantomDimensionX = phantomDimensionX;
83  G4double halfPhantomDimensionZ = phantomDimensionZ;
84  G4double halfPhantomDimensionY = phantomDimensionX;
85
86  // variables for x division ...
87  G4double halfXVoxelDimensionX = halfPhantomDimensionX/numberOfVoxelsAlongX;
88  G4double halfXVoxelDimensionZ = halfPhantomDimensionZ;
89  G4double voxelXThickness = 2*halfXVoxelDimensionX;
90
91  // world volume of ROGeometry ...
92  G4Box *ROWorld = new G4Box("ROWorld",
93                             worldDimensionX,
94                             worldDimensionY,
95                             worldDimensionZ);
96
97  G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld,
98                                                    dummyMat,
99                                                    "ROWorldLog",
100                                                    0,0,0);
101
102  G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0,
103                                                     G4ThreeVector(),
104                                                     "ROWorldPhys",
105                                                     ROWorldLog,
106                                                     0,false,0);
107 
108  // phantom ROGeometry ...
109  G4Box *ROPhantom = new G4Box("ROPhantom", 
110                               halfPhantomDimensionX, 
111                               halfPhantomDimensionY, 
112                               halfPhantomDimensionZ);
113
114  G4LogicalVolume *ROPhantomLog = new G4LogicalVolume(ROPhantom,
115                                                      dummyMat,
116                                                      "ROPhantomLog",
117                                                      0,0,0);
118
119  G4VPhysicalVolume *ROPhantomPhys = new G4PVPlacement(0,
120                                                       G4ThreeVector(),
121                                                       "PhantomPhys",
122                                                       ROPhantomLog,
123                                                       ROWorldPhys,
124                                                       false,0);
125 
126  // ROGeomtry: Voxel division
127 
128  // X division first...
129  G4Box *ROPhantomXDivision = new G4Box("ROPhantomXDivision",
130                                        halfXVoxelDimensionX,
131                                        halfXVoxelDimensionZ,
132                                        halfXVoxelDimensionZ);
133
134  G4LogicalVolume *ROPhantomXDivisionLog = new G4LogicalVolume(ROPhantomXDivision,
135                                                               dummyMat,
136                                                               "ROPhantomXDivisionLog",
137                                                               0,0,0);
138
139  G4VPhysicalVolume *ROPhantomXDivisionPhys = new G4PVReplica("ROPhantomXDivisionPhys",
140                                                              ROPhantomXDivisionLog,
141                                                              ROPhantomPhys,
142                                                              kXAxis,
143                                                              numberOfVoxelsAlongX,
144                                                              voxelXThickness);
145  // ...then Z division
146 
147  G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
148                                        halfXVoxelDimensionX,
149                                        halfXVoxelDimensionZ, 
150                                        halfXVoxelDimensionX);
151
152  G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
153                                                               dummyMat,
154                                                               "ROPhantomZDivisionLog",
155                                                               0,0,0);
156
157  G4VPhysicalVolume *ROPhantomZDivisionPhys = new G4PVReplica("ROPhantomZDivisionPhys",
158                                                              ROPhantomZDivisionLog,
159                                                              ROPhantomXDivisionPhys,
160                                                              kZAxis,
161                                                              numberOfVoxelsAlongZ,
162                                                              voxelXThickness);
163  // ...then Y  division
164
165  G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
166                                        halfXVoxelDimensionX, 
167                                        halfXVoxelDimensionX,
168                                        halfXVoxelDimensionX);
169
170  G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
171                                                               dummyMat,
172                                                               "ROPhantomYDivisionLog",
173                                                               0,0,0);
174 
175  ROPhantomYDivisionPhys = new G4PVReplica("ROPhantomYDivisionPhys",
176                                                              ROPhantomYDivisionLog,
177                                                              ROPhantomZDivisionPhys,
178                                                              kYAxis,
179                                                              numberOfVoxelsAlongZ,
180                                                              voxelXThickness);
181  BrachyDummySD *dummySD = new BrachyDummySD;
182  ROPhantomYDivisionLog -> SetSensitiveDetector(dummySD);
183
184  return ROWorldPhys;
185}
186
187
188
Note: See TracBrowser for help on using the repository browser.