Geant4.10
 All Data Structures 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
38 //////////////////////////////////////////////////////////////////////////////////////////////
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  }
82 /////////////////////////////////////////////////////////////////////////////
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 
92 /////////////////////////////////////////////////////////////////////////////
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  }
104 /////////////////////////////////////////////////////////////////////////////
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 }
157 /////////////////////////////////////////////////////////////////////////////
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* red;
192 
193  G4VPhysicalVolume* motherPhys;
194 
195  IORTDetectorSD* detectorSD; // Pointer to sensitive detector
196  IORTDetectorROGeometry* detectorROGeometry; // Pointer to ROGeometry
197  IORTMatrix* matrix;
198 
199  G4Box *phantom , *detector;
200  G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume;
201  G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume;
202 
203  G4double phantomSizeX;
204  G4double phantomSizeY;
205  G4double phantomSizeZ;
206 
207  G4double detectorSizeX;
208  G4double detectorSizeY;
209  G4double detectorSizeZ;
210 
211  G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position
212 
213  G4double sizeOfVoxelAlongX;
214  G4double sizeOfVoxelAlongY;
215  G4double sizeOfVoxelAlongZ;
216 
217  G4int numberOfVoxelsAlongX;
218  G4int numberOfVoxelsAlongY;
219  G4int numberOfVoxelsAlongZ;
220 
221  G4double volumeOfVoxel, massOfVoxel;
222 
223  G4Material *phantomMaterial, *detectorMaterial;
224  G4Region* aRegion;
225 
226 
227 
228  //Disco0 IORT
229  G4Tubs* solidDiscoIORT0;
230  G4LogicalVolume* logicDiscoIORT0;
231  G4VPhysicalVolume* physiDiscoIORT0;
232  G4double AngleDiscoIORT0;
233 
234  // Disco1 IORT
235  G4VisAttributes* white;
236  G4VisAttributes* gray;
237  G4VisAttributes* gray1;
238  G4double innerRadiusDiscoIORT;
239  G4double OuterRadiusDiscoIORT;
240  G4double heightDiscoIORT;
241  G4double DiscoXPositionIORT;
242  G4double DiscoYPositionIORT;
243  G4double DiscoZPositionIORT;
244  G4Tubs* solidDiscoIORT;
245  G4LogicalVolume* logicDiscoIORT;
246  G4VPhysicalVolume* physiDiscoIORT;
247  G4Material* DiscoMaterialIORT;
248 
249 
250  // Disco2 IORT
251 
252  G4double innerRadiusDiscoIORT1;
253  G4double OuterRadiusDiscoIORT1;
254  G4double heightDiscoIORT1;
255  G4double DiscoXPositionIORT1;
256  G4Tubs* solidDiscoIORT1;
257  G4LogicalVolume* logicDiscoIORT1;
258  G4VPhysicalVolume* physiDiscoIORT1;
259  G4Material* DiscoMaterialIORT1;
260 };
261 #endif
262 
263 
264 
G4ThreeVector GetDetectorToPhantomPosition()
void SetDiscoZPositionIORT(G4double zpos)
CLHEP::Hep3Vector G4ThreeVector
void SetOuterRadiusDiscoIORT1(G4double outerr)
Definition: G4Box.hh:63
void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition)
Definition: G4Tubs.hh:84
void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
double getY() const
int G4int
Definition: G4Types.hh:78
void setY(double)
void SetheightDiscoIORT1(G4double height)
void SetinnerRadiusDiscoIORT1(G4double innerr)
void setZ(double)
void setX(double)
G4bool SetDiscoMaterialIORT(G4String material)
void SetDiscoYPositionIORT(G4double ypos)
string material
Definition: eplot.py:19
G4bool SetPhantomMaterial(G4String material)
double getX() const
bool IsInside(G4double detectorX, G4double detectorY, G4double detectorZ, G4double phantomX, G4double phantomY, G4double phantomZ, G4ThreeVector detToPhantomPosition)
G4LogicalVolume * GetDetectorLogicalVolume()
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void SetDiscoXPositionIORT1(G4double xpos)
IORTDetectorConstruction(G4VPhysicalVolume *)
void SetAngleDiscoIORT0(G4double phi0)
void SetPhantomPosition(G4ThreeVector)
void SetinnerRadiusDiscoIORT(G4double innerr)
void SetheightDiscoIORT(G4double height)
double getZ() const
void SetOuterRadiusDiscoIORT(G4double outerr)
G4bool SetDiscoMaterialIORT1(G4String material)
void SetDiscoXPositionIORT(G4double xpos)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ)