File indexing completed on 2025-01-31 09:22:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #ifndef IORTDetectorConstruction_H
0042 #define IORTDetectorConstruction_H 1
0043
0044 #include "G4Box.hh"
0045 #include "globals.hh"
0046 #include "G4VisAttributes.hh"
0047 #include "G4LogicalVolume.hh"
0048 #include "G4UnitsTable.hh"
0049 #include "G4Tubs.hh"
0050
0051 class G4VPhysicalVolume;
0052 class G4LogicalVolume;
0053 class IORTDetectorMessenger;
0054
0055 class IORTDetectorConstruction
0056 {
0057 public:
0058
0059 IORTDetectorConstruction(G4VPhysicalVolume*);
0060
0061 ~IORTDetectorConstruction();
0062
0063
0064
0065 private:
0066
0067 void ConstructPhantom();
0068 void ConstructDetector();
0069
0070 void ConstructSensitiveDetector();
0071 void ParametersCheck();
0072
0073 public:
0074
0075 inline G4ThreeVector GetDetectorToWorldPosition()
0076 {
0077 return phantomPosition + detectorPosition;
0078 }
0079
0080
0081
0082 inline G4ThreeVector GetDetectorToPhantomPosition()
0083 {
0084 return G4ThreeVector(phantomSizeX/2 - detectorSizeX/2 + detectorPosition.getX(),
0085 phantomSizeY/2 - detectorSizeY/2 + detectorPosition.getY(),
0086 phantomSizeZ/2 - detectorSizeZ/2 + detectorPosition.getZ()
0087 );
0088 }
0089
0090
0091
0092 inline void SetDetectorPosition()
0093 {
0094
0095 detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX/2 + detectorSizeX/2);
0096 detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY/2 + detectorSizeY/2);
0097 detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ/2 + detectorSizeZ/2);
0098
0099
0100
0101 }
0102
0103
0104 inline bool IsInside(G4double detectorX,
0105 G4double detectorY,
0106 G4double detectorZ,
0107 G4double phantomX,
0108 G4double phantomY,
0109 G4double phantomZ,
0110 G4ThreeVector detToPhantomPosition)
0111 {
0112
0113
0114 {
0115 if (detectorX > phantomX)
0116 {
0117 G4cout << "Error: Detector X dimension must be smaller or equal to the correspondent of the phantom" << G4endl;
0118 return false;
0119 }
0120 if ( (phantomX - detectorX) < detToPhantomPosition.getX())
0121 {
0122 G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl;
0123 return false;
0124 }
0125 }
0126
0127 {
0128 if (detectorY > phantomY)
0129 {
0130 G4cout << "Error: Detector Y dimension must be smaller or equal to the correspondent of the phantom" << G4endl;
0131 return false;
0132 }
0133 if ( (phantomY - detectorY) < detToPhantomPosition.getY())
0134 {
0135 G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl;
0136 return false;
0137 }
0138 }
0139
0140 {
0141 if (detectorZ > phantomZ)
0142 {
0143 G4cout << "Error: Detector Z dimension must be smaller or equal to the correspondent of the phantom" << G4endl;
0144 return false;
0145 }
0146 if ( (phantomZ - detectorZ) < detToPhantomPosition.getZ())
0147 {
0148 G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl;
0149 return false;
0150 }
0151 }
0152
0153 return true;
0154 }
0155
0156
0157 G4bool SetPhantomMaterial(G4String material);
0158 void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ);
0159 void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ);
0160 void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ);
0161 void SetPhantomPosition(G4ThreeVector);
0162 void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition);
0163 void UpdateGeometry();
0164 void DeleteDisc();
0165 void ConstructDisc();
0166 void PrintParameters();
0167 G4LogicalVolume* GetDetectorLogicalVolume(){ return detectorLogicalVolume;}
0168
0169 G4bool SetDiscoMaterialIORT(G4String material);
0170 void SetOuterRadiusDiscoIORT(G4double outerr);
0171 void SetinnerRadiusDiscoIORT(G4double innerr);
0172 void SetheightDiscoIORT(G4double height);
0173 void SetDiscoXPositionIORT(G4double xpos);
0174 void SetDiscoYPositionIORT(G4double ypos);
0175 void SetDiscoZPositionIORT(G4double zpos);
0176
0177 G4bool SetDiscoMaterialIORT1(G4String material);
0178 void SetOuterRadiusDiscoIORT1(G4double outerr);
0179 void SetinnerRadiusDiscoIORT1(G4double innerr);
0180 void SetheightDiscoIORT1(G4double height);
0181 void SetDiscoXPositionIORT1(G4double xpos);
0182
0183 void SetAngleDiscoIORT0(G4double phi0);
0184
0185 private:
0186
0187 IORTDetectorMessenger* detectorMessenger;
0188
0189 G4VisAttributes* red;
0190
0191 G4VPhysicalVolume* motherPhys;
0192
0193 G4Box *phantom , *detector;
0194 G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume;
0195 G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume;
0196
0197 G4double phantomSizeX;
0198 G4double phantomSizeY;
0199 G4double phantomSizeZ;
0200
0201 G4double detectorSizeX;
0202 G4double detectorSizeY;
0203 G4double detectorSizeZ;
0204
0205 G4ThreeVector phantomPosition, detectorPosition, detectorToPhantomPosition;
0206
0207 G4Material *phantomMaterial, *detectorMaterial;
0208 G4Region* aRegion;
0209
0210
0211 G4Tubs* solidDiscoIORT0;
0212 G4LogicalVolume* logicDiscoIORT0;
0213 G4VPhysicalVolume* physiDiscoIORT0;
0214 G4double AngleDiscoIORT0;
0215
0216
0217 G4VisAttributes* white;
0218 G4VisAttributes* gray;
0219 G4VisAttributes* gray1;
0220 G4double innerRadiusDiscoIORT;
0221 G4double OuterRadiusDiscoIORT;
0222 G4double heightDiscoIORT;
0223 G4double DiscoXPositionIORT;
0224 G4double DiscoYPositionIORT;
0225 G4double DiscoZPositionIORT;
0226 G4Tubs* solidDiscoIORT;
0227 G4LogicalVolume* logicDiscoIORT;
0228 G4VPhysicalVolume* physiDiscoIORT;
0229 G4Material* DiscoMaterialIORT;
0230
0231
0232
0233 G4double innerRadiusDiscoIORT1;
0234 G4double OuterRadiusDiscoIORT1;
0235 G4double heightDiscoIORT1;
0236 G4double DiscoXPositionIORT1;
0237 G4Tubs* solidDiscoIORT1;
0238 G4LogicalVolume* logicDiscoIORT1;
0239 G4VPhysicalVolume* physiDiscoIORT1;
0240 G4Material* DiscoMaterialIORT1;
0241 };
0242 #endif
0243
0244
0245