Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IORTDetectorConstruction.hh
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 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
28 // Contributor Authors: S.Guatelli(e)
29 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
30 //
31 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
32 // (b) IBFM-CNR , Segrate (Milano), Italy
33 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
34 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
35 // (e) University of Wallongong, Australia
36 //
37 // *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
39 
40 
41 #ifndef IORTDetectorConstruction_H
42 #define IORTDetectorConstruction_H 1
43 
44 #include "G4Box.hh"
45 #include "globals.hh"
46 #include "G4VisAttributes.hh"
47 #include "G4LogicalVolume.hh"
48 #include "G4UnitsTable.hh"
49 #include "G4Tubs.hh"
50 
51 class G4VPhysicalVolume;
52 class G4LogicalVolume;
55 class IORTDetectorSD;
56 class IORTMatrix;
57 
59 {
60 public:
61 
63 
65 
66  // G4VPhysicalVolume *detectorPhysicalVolume; aggiunto
67 
68 private:
69 
70  void ConstructPhantom();
71  void ConstructDetector();
72  // void ConstructDisc();
73  void ConstructSensitiveDetector(G4ThreeVector positionToWORLD);
74  void ParametersCheck();
75 
76 public:
77 // Get detector position relative to WORLD
79  {
80  return phantomPosition + detectorPosition;
81  }
83 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
85 {
86  return G4ThreeVector(phantomSizeX/2 - detectorSizeX/2 + detectorPosition.getX(),
87  phantomSizeY/2 - detectorSizeY/2 + detectorPosition.getY(),
88  phantomSizeZ/2 - detectorSizeZ/2 + detectorPosition.getZ()
89  );
90 }
91 
93 // Calculate (and set) detector position by displacement, phantom and detector sizes
94 inline void SetDetectorPosition()
95  {
96  // Adjust detector position
97  detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX/2 + detectorSizeX/2);
98  detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY/2 + detectorSizeY/2);
99  detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ/2 + detectorSizeZ/2);
100 
101  //G4cout << "*************** DetectorToPhantomPosition " << detectorToPhantomPosition/cm << "\n";
102  //G4cout << "*************** DetectorPosition " << detectorPosition/cm << "\n";
103  }
105 // Check whether detector is inside phantom
106 inline bool IsInside(G4double detectorX,
107  G4double detectorY,
108  G4double detectorZ,
109  G4double phantomX,
110  G4double phantomY,
111  G4double phantomZ,
112  G4ThreeVector detToPhantomPosition)
113 {
114 // Dimensions check... X Y and Z
115 // Firstly check what dimension we are modifying
116  {
117  if (detectorX > phantomX)
118  {
119  G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
120  return false;
121  }
122  if ( (phantomX - detectorX) < detToPhantomPosition.getX())
123  {
124  G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
125  return false;
126  }
127  }
128 
129  {
130  if (detectorY > phantomY)
131  {
132  G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
133  return false;
134  }
135  if ( (phantomY - detectorY) < detToPhantomPosition.getY())
136  {
137  G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
138  return false;
139  }
140  }
141 
142  {
143  if (detectorZ > phantomZ)
144  {
145  G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl;
146  return false;
147  }
148  if ( (phantomZ - detectorZ) < detToPhantomPosition.getZ())
149  {
150  G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
151  return false;
152  }
153  }
154 
155  return true;
156 }
158 
160  void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
161  void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
162  void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
164  void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
165  void UpdateGeometry();
166  void DeleteDisc();
167  void ConstructDisc();
168  void PrintParameters();
169  G4LogicalVolume* GetDetectorLogicalVolume(){ return detectorLogicalVolume;}
170 
172  void SetOuterRadiusDiscoIORT(G4double outerr);
173  void SetinnerRadiusDiscoIORT(G4double innerr);
174  void SetheightDiscoIORT(G4double height);
175  void SetDiscoXPositionIORT(G4double xpos);
176  void SetDiscoYPositionIORT(G4double ypos);
177  void SetDiscoZPositionIORT(G4double zpos);
178 
180  void SetOuterRadiusDiscoIORT1(G4double outerr);
181  void SetinnerRadiusDiscoIORT1(G4double innerr);
182  void SetheightDiscoIORT1(G4double height);
183  void SetDiscoXPositionIORT1(G4double xpos);
184 
185  void SetAngleDiscoIORT0(G4double phi0);
186 
187 private:
188 
189  IORTDetectorMessenger* detectorMessenger;
190 
191  G4VisAttributes* skyBlue;
192  G4VisAttributes* red;
193 
194  G4VPhysicalVolume* motherPhys;
195 
196  IORTDetectorSD* detectorSD; // Pointer to sensitive detector
197  IORTDetectorROGeometry* detectorROGeometry; // Pointer to ROGeometry
198  IORTMatrix* matrix;
199 
200  G4Box *phantom , *detector;
201  G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume;
202  G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume;
203 
204  G4double phantomSizeX;
205  G4double phantomSizeY;
206  G4double phantomSizeZ;
207 
208  G4double detectorSizeX;
209  G4double detectorSizeY;
210  G4double detectorSizeZ;
211 
212  G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
213 
214  G4double sizeOfVoxelAlongX;
215  G4double sizeOfVoxelAlongY;
216  G4double sizeOfVoxelAlongZ;
217 
218  G4int numberOfVoxelsAlongX;
219  G4int numberOfVoxelsAlongY;
220  G4int numberOfVoxelsAlongZ;
221 
222  G4double volumeOfVoxel, massOfVoxel;
223 
224  G4Material *phantomMaterial, *detectorMaterial;
225  G4Region* aRegion;
226 
227 
228 
229  //Disco0 IORT
230  G4Tubs* solidDiscoIORT0;
231  G4LogicalVolume* logicDiscoIORT0;
232  G4VPhysicalVolume* physiDiscoIORT0;
233  G4double AngleDiscoIORT0;
234 
235  // Disco1 IORT
236  G4VisAttributes* white;
237  G4VisAttributes* gray;
238  G4VisAttributes* gray1;
239  G4double innerRadiusDiscoIORT;
240  G4double OuterRadiusDiscoIORT;
241  G4double heightDiscoIORT;
242  G4double DiscoXPositionIORT;
243  G4double DiscoYPositionIORT;
244  G4double DiscoZPositionIORT;
245  G4Tubs* solidDiscoIORT;
246  G4LogicalVolume* logicDiscoIORT;
247  G4VPhysicalVolume* physiDiscoIORT;
248  G4Material* DiscoMaterialIORT;
249 
250 
251  // Disco2 IORT
252 
253  G4double innerRadiusDiscoIORT1;
254  G4double OuterRadiusDiscoIORT1;
255  G4double heightDiscoIORT1;
256  G4double DiscoXPositionIORT1;
257  G4Tubs* solidDiscoIORT1;
258  G4LogicalVolume* logicDiscoIORT1;
259  G4VPhysicalVolume* physiDiscoIORT1;
260  G4Material* DiscoMaterialIORT1;
261 };
262 #endif
263 
264 
265