Geant4 Cross Reference |
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 Wollongong, 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; 53 class IORTDetectorMessenger; 54 55 class IORTDetectorConstruction 56 { 57 public: 58 59 IORTDetectorConstruction(G4VPhysicalVolume*); 60 61 ~IORTDetectorConstruction(); 62 63 // G4VPhysicalVolume *detectorPhysicalVolume; aggiunto 64 65 private: 66 67 void ConstructPhantom(); 68 void ConstructDetector(); 69 // void ConstructDisc(); 70 void ConstructSensitiveDetector(); 71 void ParametersCheck(); 72 73 public: 74 // Get detector position relative to WORLD 75 inline G4ThreeVector GetDetectorToWorldPosition() 76 { 77 return phantomPosition + detectorPosition; 78 } 79 80 ///////////////////////////////////////////////////////////////////////////// 81 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes 82 inline G4ThreeVector GetDetectorToPhantomPosition() 83 { 84 return G4ThreeVector(phantomSizeX/2 - detectorSizeX/2 + detectorPosition.getX(), 85 phantomSizeY/2 - detectorSizeY/2 + detectorPosition.getY(), 86 phantomSizeZ/2 - detectorSizeZ/2 + detectorPosition.getZ() 87 ); 88 } 89 90 ///////////////////////////////////////////////////////////////////////////// 91 // Calculate (and set) detector position by displacement, phantom and detector sizes 92 inline void SetDetectorPosition() 93 { 94 // Adjust detector position 95 detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX/2 + detectorSizeX/2); 96 detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY/2 + detectorSizeY/2); 97 detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ/2 + detectorSizeZ/2); 98 99 //G4cout << "*************** DetectorToPhantomPosition " << detectorToPhantomPosition/cm << "\n"; 100 //G4cout << "*************** DetectorPosition " << detectorPosition/cm << "\n"; 101 } 102 ///////////////////////////////////////////////////////////////////////////// 103 // Check whether detector is inside phantom 104 inline bool IsInside(G4double detectorX, 105 G4double detectorY, 106 G4double detectorZ, 107 G4double phantomX, 108 G4double phantomY, 109 G4double phantomZ, 110 G4ThreeVector detToPhantomPosition) 111 { 112 // Dimensions check... X Y and Z 113 // Firstly check what dimension we are modifying 114 { 115 if (detectorX > phantomX) 116 { 117 G4cout << "Error: Detector X dimension must be smaller or equal to the correspondent of the phantom" << G4endl; 118 return false; 119 } 120 if ( (phantomX - detectorX) < detToPhantomPosition.getX()) 121 { 122 G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl; 123 return false; 124 } 125 } 126 127 { 128 if (detectorY > phantomY) 129 { 130 G4cout << "Error: Detector Y dimension must be smaller or equal to the correspondent of the phantom" << G4endl; 131 return false; 132 } 133 if ( (phantomY - detectorY) < detToPhantomPosition.getY()) 134 { 135 G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl; 136 return false; 137 } 138 } 139 140 { 141 if (detectorZ > phantomZ) 142 { 143 G4cout << "Error: Detector Z dimension must be smaller or equal to the correspondent of the phantom" << G4endl; 144 return false; 145 } 146 if ( (phantomZ - detectorZ) < detToPhantomPosition.getZ()) 147 { 148 G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl; 149 return false; 150 } 151 } 152 153 return true; 154 } 155 ///////////////////////////////////////////////////////////////////////////// 156 157 G4bool SetPhantomMaterial(G4String material); 158 void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ); 159 void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ); 160 void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ); 161 void SetPhantomPosition(G4ThreeVector); 162 void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition); 163 void UpdateGeometry(); 164 void DeleteDisc(); 165 void ConstructDisc(); 166 void PrintParameters(); 167 G4LogicalVolume* GetDetectorLogicalVolume(){ return detectorLogicalVolume;} 168 169 G4bool SetDiscoMaterialIORT(G4String material); 170 void SetOuterRadiusDiscoIORT(G4double outerr); 171 void SetinnerRadiusDiscoIORT(G4double innerr); 172 void SetheightDiscoIORT(G4double height); 173 void SetDiscoXPositionIORT(G4double xpos); 174 void SetDiscoYPositionIORT(G4double ypos); 175 void SetDiscoZPositionIORT(G4double zpos); 176 177 G4bool SetDiscoMaterialIORT1(G4String material); 178 void SetOuterRadiusDiscoIORT1(G4double outerr); 179 void SetinnerRadiusDiscoIORT1(G4double innerr); 180 void SetheightDiscoIORT1(G4double height); 181 void SetDiscoXPositionIORT1(G4double xpos); 182 183 void SetAngleDiscoIORT0(G4double phi0); 184 185 private: 186 187 IORTDetectorMessenger* detectorMessenger; 188 189 G4VisAttributes* red; 190 191 G4VPhysicalVolume* motherPhys; 192 193 G4Box *phantom , *detector; 194 G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume; 195 G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume; 196 197 G4double phantomSizeX; 198 G4double phantomSizeY; 199 G4double phantomSizeZ; 200 201 G4double detectorSizeX; 202 G4double detectorSizeY; 203 G4double detectorSizeZ; 204 205 G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition; // phantom center, detector center, detector to phantom relative position 206 207 G4Material *phantomMaterial, *detectorMaterial; 208 G4Region* aRegion; 209 210 //Disco0 IORT 211 G4Tubs* solidDiscoIORT0; 212 G4LogicalVolume* logicDiscoIORT0; 213 G4VPhysicalVolume* physiDiscoIORT0; 214 G4double AngleDiscoIORT0; 215 216 // Disco1 IORT 217 G4VisAttributes* white; 218 G4VisAttributes* gray; 219 G4VisAttributes* gray1; 220 G4double innerRadiusDiscoIORT; 221 G4double OuterRadiusDiscoIORT; 222 G4double heightDiscoIORT; 223 G4double DiscoXPositionIORT; 224 G4double DiscoYPositionIORT; 225 G4double DiscoZPositionIORT; 226 G4Tubs* solidDiscoIORT; 227 G4LogicalVolume* logicDiscoIORT; 228 G4VPhysicalVolume* physiDiscoIORT; 229 G4Material* DiscoMaterialIORT; 230 231 // Disco2 IORT 232 233 G4double innerRadiusDiscoIORT1; 234 G4double OuterRadiusDiscoIORT1; 235 G4double heightDiscoIORT1; 236 G4double DiscoXPositionIORT1; 237 G4Tubs* solidDiscoIORT1; 238 G4LogicalVolume* logicDiscoIORT1; 239 G4VPhysicalVolume* physiDiscoIORT1; 240 G4Material* DiscoMaterialIORT1; 241 }; 242 #endif 243 244 245 246