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 "G4VoxelRightBreast.hh" |
---|
35 | #include "globals.hh" |
---|
36 | #include "G4SDManager.hh" |
---|
37 | #include "G4VisAttributes.hh" |
---|
38 | #include "G4Tubs.hh" |
---|
39 | #include "G4ThreeVector.hh" |
---|
40 | #include "G4VPhysicalVolume.hh" |
---|
41 | #include "G4RotationMatrix.hh" |
---|
42 | #include "G4Material.hh" |
---|
43 | #include "G4LogicalVolume.hh" |
---|
44 | #include "G4HumanPhantomMaterial.hh" |
---|
45 | #include "G4VPhysicalVolume.hh" |
---|
46 | #include "G4PVPlacement.hh" |
---|
47 | #include "G4PVReplica.hh" |
---|
48 | #include "G4VoxelRightBreastROGeometry.hh" |
---|
49 | #include "G4VoxelRightBreastSD.hh" |
---|
50 | #include "G4HumanPhantomColour.hh" |
---|
51 | G4VoxelRightBreast::G4VoxelRightBreast() |
---|
52 | { |
---|
53 | } |
---|
54 | |
---|
55 | G4VoxelRightBreast::~G4VoxelRightBreast() |
---|
56 | { |
---|
57 | |
---|
58 | |
---|
59 | } |
---|
60 | |
---|
61 | G4VPhysicalVolume* G4VoxelRightBreast::Construct(const G4String& volumeName, |
---|
62 | G4VPhysicalVolume* mother, |
---|
63 | const G4String& colourName, |
---|
64 | G4bool wireFrame,G4bool sensitivity) |
---|
65 | |
---|
66 | { |
---|
67 | G4HumanPhantomMaterial* material = new G4HumanPhantomMaterial(); |
---|
68 | G4Material* adipose = material -> GetMaterial("adipose"); |
---|
69 | G4Material* adipose_glandular = material -> GetMaterial("adipose_glandular"); |
---|
70 | delete material; |
---|
71 | |
---|
72 | G4double rmin = 0.* cm; |
---|
73 | G4double rmax = 6. * cm; |
---|
74 | G4double zz = 6. * cm; |
---|
75 | G4double startPhi = 0.* degree; |
---|
76 | G4double spanningPhi = 180. * degree; |
---|
77 | |
---|
78 | G4Tubs* breast = new G4Tubs("out_breast", rmin, rmax, |
---|
79 | zz/2., startPhi, spanningPhi); |
---|
80 | |
---|
81 | G4LogicalVolume* breast_log = new G4LogicalVolume(breast, |
---|
82 | adipose, |
---|
83 | "logicalOut"+ volumeName, |
---|
84 | 0, 0, 0); |
---|
85 | rmax = 5.5 *cm; |
---|
86 | zz = 5. *cm; |
---|
87 | G4Tubs* innerBreast = new G4Tubs("inner_breast", |
---|
88 | rmin, rmax, |
---|
89 | zz/2., startPhi, spanningPhi); |
---|
90 | |
---|
91 | G4LogicalVolume* innerBreast_log = new G4LogicalVolume(innerBreast, |
---|
92 | adipose_glandular, |
---|
93 | "logical"+ volumeName, |
---|
94 | 0, 0, 0); |
---|
95 | |
---|
96 | G4RotationMatrix* matrix = new G4RotationMatrix(); |
---|
97 | matrix -> rotateX(-90.* degree); |
---|
98 | matrix -> rotateY(180.* degree); |
---|
99 | matrix -> rotateZ(18. * degree); |
---|
100 | |
---|
101 | |
---|
102 | G4VPhysicalVolume* physBreast = new G4PVPlacement(matrix,G4ThreeVector(-10.*cm, 52.* cm, 8.7 *cm), |
---|
103 | "physicalVoxelRightBreast", |
---|
104 | breast_log, |
---|
105 | mother, |
---|
106 | false, |
---|
107 | 0, true); |
---|
108 | |
---|
109 | G4VPhysicalVolume* physInnerBreast = new G4PVPlacement(0,0, |
---|
110 | "RightBreast", |
---|
111 | innerBreast_log, |
---|
112 | physBreast, |
---|
113 | false, |
---|
114 | 0, true); |
---|
115 | |
---|
116 | |
---|
117 | // Parameterisation with Replicas |
---|
118 | /* |
---|
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* voxelz = new G4Tubs("voxel_z", rmin_voxelz, rmax_voxelz, zz_voxels/(2*nslice),startPhi_voxelz, spanningPhi_voxelz); |
---|
127 | G4LogicalVolume* voxelz_log = new G4LogicalVolume(voxelz, adipose_glandular, "voxelz_log",0 , 0, 0); |
---|
128 | G4VPhysicalVolume* voxelz_phys = new G4PVReplica("LinearArray", voxelz_log, physInnerBreast, |
---|
129 | kZAxis, nslice, zz_voxels/nslice); |
---|
130 | |
---|
131 | G4double voxel_height = (zz_voxels/nslice); |
---|
132 | |
---|
133 | G4int n_voxels = 10; |
---|
134 | |
---|
135 | G4double voxel_phi = spanningPhi_voxelz/n_voxels; |
---|
136 | |
---|
137 | G4cout <<"voxel_phi: " <<voxel_phi/degree << " deg"<< G4endl; |
---|
138 | |
---|
139 | G4Tubs* voxel = new G4Tubs("voxel", rmin_voxelz, rmax_voxelz, voxel_height/2., |
---|
140 | startPhi_voxelz,voxel_phi); |
---|
141 | |
---|
142 | G4LogicalVolume* voxel_log = new G4LogicalVolume(voxel, adipose_glandular, "voxel_log", 0,0,0); |
---|
143 | |
---|
144 | G4VPhysicalVolume* voxel_phys = new G4PVReplica("RZPhiSlices", |
---|
145 | voxel_log, |
---|
146 | voxelz_phys, |
---|
147 | kPhi, n_voxels, voxel_phi,- (voxel_phi/2.)); |
---|
148 | |
---|
149 | |
---|
150 | */ |
---|
151 | |
---|
152 | G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour(); |
---|
153 | G4Colour colour = colourPointer -> GetColour(colourName); |
---|
154 | delete colourPointer; |
---|
155 | |
---|
156 | G4VisAttributes* BreastVisAtt = new G4VisAttributes(colour); |
---|
157 | BreastVisAtt -> SetForceSolid(wireFrame); |
---|
158 | breast_log -> SetVisAttributes(BreastVisAtt); |
---|
159 | |
---|
160 | G4VisAttributes* innerBreastVisAtt = new G4VisAttributes(colour); |
---|
161 | innerBreastVisAtt -> SetForceSolid(true); |
---|
162 | innerBreast_log -> SetVisAttributes(innerBreastVisAtt); |
---|
163 | |
---|
164 | // voxelz_log -> SetVisAttributes(innerBreastVisAtt); |
---|
165 | // voxel_log -> SetVisAttributes(innerBreastVisAtt); |
---|
166 | |
---|
167 | G4cout << "Voxel Right Breast created !!!!!!" << G4endl; |
---|
168 | |
---|
169 | if (sensitivity==true) |
---|
170 | { |
---|
171 | G4SDManager* SDman = G4SDManager::GetSDMpointer(); |
---|
172 | |
---|
173 | G4String sensitiveDetectorName = "VoxelRightBreast"; |
---|
174 | |
---|
175 | G4VoxelRightBreastSD* breastSD = new G4VoxelRightBreastSD(sensitiveDetectorName); |
---|
176 | |
---|
177 | G4String ROGeometryName = "VoxelRightROGeometry"; |
---|
178 | |
---|
179 | G4VoxelRightBreastROGeometry* phantomROGeometry = new G4VoxelRightBreastROGeometry(ROGeometryName); |
---|
180 | phantomROGeometry -> BuildROGeometry(); |
---|
181 | breastSD -> SetROgeometry(phantomROGeometry); |
---|
182 | SDman -> AddNewDetector(breastSD); |
---|
183 | innerBreast_log -> SetSensitiveDetector(breastSD); |
---|
184 | } |
---|
185 | return physInnerBreast; |
---|
186 | |
---|
187 | } |
---|