source: trunk/examples/advanced/human_phantom/src/G4VoxelLeftBreastROGeometry.cc @ 1319

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

update

File size: 5.6 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// Authors: S. Guatelli and M. G. Pia, INFN Genova, Italy
27//
28// Based on code developed by the undergraduate student G. Guerrieri
29// Note: this is a preliminary beta-version of the code; an improved
30// version will be distributed in the next Geant4 public release, compliant
31// with the design in a forthcoming publication, and subject to a
32// design and code review.
33//
34#include "G4VoxelLeftBreastROGeometry.hh"
35#include "G4HumanDummyLeftBreastSD.hh"
36#include "G4LogicalVolume.hh"
37#include "G4VPhysicalVolume.hh"
38#include "G4PVPlacement.hh"
39#include "G4PVReplica.hh"
40#include "G4SDManager.hh"
41#include "G4Box.hh"
42#include "G4ThreeVector.hh"
43#include "G4Material.hh"
44#include "G4Tubs.hh"
45
46G4VoxelLeftBreastROGeometry::G4VoxelLeftBreastROGeometry(G4String aString):
47                                               
48  G4VReadOutGeometry(aString), ROvoxel_phys(0)
49{
50}
51
52G4VoxelLeftBreastROGeometry::~G4VoxelLeftBreastROGeometry()
53{
54}
55
56G4VPhysicalVolume* G4VoxelLeftBreastROGeometry::Build()
57{
58 
59  // A dummy material is used to fill the volumes of the readout geometry.
60  // (It will be allowed to set a NULL pointer in volumes of such virtual
61  // division in future, since this material is irrelevant for tracking.)
62
63  G4Material* dummyMat = new G4Material(name="dummyMat", 
64                                        1., 1.*g/mole, 1.*g/cm3);
65
66  G4double worldSizeX = 2.0*m;
67  G4double worldSizeY = 2.0*m;
68  G4double worldSizeZ = 2.0*m;
69
70  // world volume of ROGeometry ...
71  G4Box *ROWorld = new G4Box("ROWorld",
72                             worldSizeX/2.,
73                             worldSizeY/2.,
74                             worldSizeZ/2.);
75
76  G4LogicalVolume *ROWorldLog = new G4LogicalVolume(ROWorld,
77                                                    dummyMat,
78                                                    "ROWorldLog",
79                                                    0,0,0);
80
81  G4VPhysicalVolume *ROWorldPhys = new G4PVPlacement(0,
82                                                     G4ThreeVector(),
83                                                     "ROWorldPhys",
84                                                     ROWorldLog,
85                                                     0,false,0);
86   
87  // Breast Mother Volume
88  G4double rmin = 0.* cm;
89  G4double startPhi = 0.* degree;
90  G4double spanningPhi = 180. * degree;
91  G4double rmax = 5.5 *cm;
92  G4double zz = 5. *cm;
93 
94  // RO geometry is defined for the inner tube of the breast
95 
96  G4Tubs* ROinnerLeftBreast = new G4Tubs("innerVoxelLeftBreast",
97                                   rmin, rmax,
98                                   zz/2., startPhi, spanningPhi);
99 
100  G4LogicalVolume* ROinnerLeftBreast_log = new G4LogicalVolume(ROinnerLeftBreast,
101                                                        dummyMat,
102                                                        "InnerLeftBreast",
103                                                         0, 0, 0);
104  G4RotationMatrix* matrix = new G4RotationMatrix();
105  matrix -> rotateX(-90.* degree);
106  matrix -> rotateY(180.* degree);
107  matrix -> rotateZ(-18. * degree);
108
109
110 G4VPhysicalVolume* ROphysInnerLeftBreast = new G4PVPlacement(matrix,
111                                                          G4ThreeVector(10.*cm, 52.* cm, 8.7 *cm),
112                               "physicalVoxelLeftBreast",
113                               ROinnerLeftBreast_log,
114                               ROWorldPhys,
115                               false,
116                               0);
117
118  // Breast RO Geometry - slices along z axis
119  G4double rmin_voxelz = 0.* cm;
120  G4double rmax_voxelz = 5.5 * cm;
121  G4double zz_voxels = 5. * cm;
122  G4double startPhi_voxelz = 0.* degree;
123  G4double spanningPhi_voxelz = 180. * degree; 
124  G4int nslice = 10;
125
126  G4Tubs* ROvoxelz = new G4Tubs("voxel_z", rmin_voxelz, rmax_voxelz, zz_voxels/(2*nslice),startPhi_voxelz, spanningPhi_voxelz);
127
128  G4LogicalVolume* ROvoxelz_log = new G4LogicalVolume(ROvoxelz, dummyMat, "voxelz_log",0 , 0, 0);
129 
130  G4VPhysicalVolume* ROvoxelz_phys = new G4PVReplica("LinearArray", ROvoxelz_log, ROphysInnerLeftBreast,
131                                                   kZAxis, nslice, zz_voxels/nslice);
132
133  G4double voxel_height = (zz_voxels/nslice);
134 
135// Breast RO Geometry - slices along phi angle
136
137  G4int n_voxels = 10;
138
139  G4double voxel_phi = spanningPhi_voxelz/n_voxels;
140
141 
142  G4Tubs* ROvoxel = new G4Tubs("voxel", rmin_voxelz, rmax_voxelz, voxel_height/2.,
143                             startPhi_voxelz,voxel_phi);
144                             
145  G4LogicalVolume* ROvoxel_log = new G4LogicalVolume(ROvoxel, dummyMat, "voxel_log", 0,0,0);
146
147  ROvoxel_phys = new G4PVReplica("RZPhiSlices",
148                                  ROvoxel_log,
149                                 ROvoxelz_phys,
150                                 kPhi, n_voxels, voxel_phi,- (voxel_phi/2.)); 
151
152  //delete matrix;
153                                                 
154  G4HumanDummyLeftBreastSD *dummySD = new G4HumanDummyLeftBreastSD;
155  ROvoxel_log -> SetSensitiveDetector(dummySD);
156
157  return ROWorldPhys;
158}
159
160
161
Note: See TracBrowser for help on using the repository browser.