72 : motherPhys(physicalTreatmentRoom),
73 detectorSD(0), detectorROGeometry(0), matrix(0),
74 phantom(0), detector(0),
75 phantomLogicalVolume(0), detectorLogicalVolume(0),
76 phantomPhysicalVolume(0), detectorPhysicalVolume(0),
141 delete detectorROGeometry;
143 delete detectorMessenger;
151 void IORTDetectorConstruction::ConstructPhantom()
154 phantom =
new G4Box(
"Phantom",
162 "phantomLog", 0, 0, 0);
168 phantomLogicalVolume,
175 red -> SetVisibility(
true);
178 phantomLogicalVolume -> SetVisAttributes(red);
204 void IORTDetectorConstruction::ConstructDetector()
208 detector =
new G4Box(
"Detector",
222 detectorLogicalVolume,
223 phantomPhysicalVolume,
235 detectorLogicalVolume -> SetVisAttributes(skyBlue1);
248 aRegion =
new G4Region(
"DetectorLog");
249 detectorLogicalVolume -> SetRegion(aRegion);
250 aRegion -> AddRootLogicalVolume(detectorLogicalVolume);
270 solidDiscoIORT0 =
new G4Tubs(
"DiscoIORT0", innerRadiusDiscoIORT,
271 OuterRadiusDiscoIORT,
272 (heightDiscoIORT + heightDiscoIORT1),
273 startAngleDiscoIORT0,
274 spanningAngleDiscoIORT0);
277 detectorMaterial,
"DiscoIORT0Log", 0, 0, 0);
280 "DiscoIORT0Phys", logDiscoIORT0, detectorPhysicalVolume,
false, 0);
283 white -> SetVisibility(
true);
285 logDiscoIORT0 -> SetVisAttributes(white);
294 gray-> SetVisibility(
true);
299 gray1-> SetVisibility(
true);
319 solidDiscoIORT =
new G4Tubs(
"DiscoIORT", innerRadiusDiscoIORT,
320 OuterRadiusDiscoIORT,
323 spanningAngleDiscoIORT);
326 DiscoMaterialIORT,
"DiscoIORTLog", 0, 0, 0);
329 "DiscoIORTPhys", logDiscoIORT, physiDiscoIORT0,
false, 0);
331 logDiscoIORT -> SetVisAttributes(gray1);
348 solidDiscoIORT1 =
new G4Tubs(
"DiscoIORT1", innerRadiusDiscoIORT1,
349 OuterRadiusDiscoIORT1,
351 startAngleDiscoIORT1,
352 spanningAngleDiscoIORT1);
355 DiscoMaterialIORT1,
"DiscoIORTLog1", 0, 0, 0);
358 "DiscoIORTPhys1", logDiscoIORT1, physiDiscoIORT0,
false, 0);
360 white -> SetVisibility(
true);
361 white -> SetForceSolid(
true);
362 logDiscoIORT1 -> SetVisAttributes(gray);
367 void IORTDetectorConstruction::ConstructSensitiveDetector(
G4ThreeVector detectorToWorldPosition)
370 delete detectorROGeometry;
376 static G4String sensitiveDetectorName =
"Detector";
383 static G4String ROGeometryName =
"DetectorROGeometry";
385 detectorToWorldPosition,
389 numberOfVoxelsAlongX,
390 numberOfVoxelsAlongY,
391 numberOfVoxelsAlongZ);
393 G4cout <<
"Instantiating new Read Out Geometry \"" << ROGeometryName <<
"\""<<
G4endl;
395 detectorROGeometry -> BuildROGeometry();
397 detectorSD -> SetROgeometry(detectorROGeometry);
399 if (!sensitiveDetectorManager -> FindSensitiveDetector(sensitiveDetectorName,
false))
401 G4cout <<
"Registering new DetectorSD \"" << sensitiveDetectorName <<
"\""<<
G4endl;
403 sensitiveDetectorManager -> AddNewDetector(detectorSD);
405 detectorLogicalVolume -> SetSensitiveDetector(detectorSD);
408 void IORTDetectorConstruction::ParametersCheck()
417 detectorToPhantomPosition
419 G4Exception(
"IORTDetectorConstruction::ParametersCheck()",
"IORT0001",
FatalException,
"Error: Detector is not fully inside Phantom!");
423 if ( detectorSizeX < sizeOfVoxelAlongX) {
424 G4Exception(
"IORTDetectorConstruction::ParametersCheck()",
"IORT0002",
FatalException,
"Error: Detector X size must be bigger or equal than that of Voxel X");
426 if ( detectorSizeY < sizeOfVoxelAlongY) {
427 G4Exception(
"IORTDetectorConstruction::ParametersCheck()",
"IORT0003",
FatalException,
"Error: Detector X size must be bigger or equal than that of Voxel Y");
429 if ( detectorSizeZ < sizeOfVoxelAlongZ) {
430 G4Exception(
"IORTDetectorConstruction::ParametersCheck()",
"IORT0004",
FatalException,
"Error: Detector X size must be bigger or equal than that of Voxel Z");
443 phantomMaterial = pMat;
444 detectorMaterial = pMat;
445 if (detectorLogicalVolume && phantomLogicalVolume)
452 G4cout <<
"The material of Phantom/Detector has been changed to " << material <<
G4endl;
457 G4cout <<
"WARNING: material \"" << material <<
"\" doesn't exist in NIST elements/materials"
458 " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" <<
G4endl;
459 G4cout <<
"Use command \"/parameter/nist\" to see full materials list!" <<
G4endl;
471 DiscoMaterialIORT = dMat;
479 G4cout <<
"The material of Protection disc 1 has been changed to " << material <<
G4endl;
484 G4cout <<
"WARNING: material \"" << material <<
"\" doesn't exist in NIST elements/materials"
485 " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" <<
G4endl;
486 G4cout <<
"Use command \"/parameter/nist\" to see full materials list!" <<
G4endl;
498 DiscoMaterialIORT1 = d1Mat;
506 G4cout <<
"The material of Protection disc 2 has been changed to " << material <<
G4endl;
511 G4cout <<
"WARNING: material \"" << material <<
"\" doesn't exist in NIST elements/materials"
512 " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" <<
G4endl;
513 G4cout <<
"Use command \"/parameter/nist\" to see full materials list!" <<
G4endl;
522 if (sizeX > 0.) phantomSizeX = sizeX;
523 if (sizeY > 0.) phantomSizeY = sizeY;
524 if (sizeZ > 0.) phantomSizeZ = sizeZ;
530 if (sizeX > 0.) {detectorSizeX = sizeX;}
531 if (sizeY > 0.) {detectorSizeY = sizeY;}
532 if (sizeZ > 0.) {detectorSizeZ = sizeZ;}
533 SetVoxelSize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ);
539 if (sizeX > 0.) {sizeOfVoxelAlongX = sizeX;}
540 if (sizeY > 0.) {sizeOfVoxelAlongY = sizeY;}
541 if (sizeZ > 0.) {sizeOfVoxelAlongZ = sizeZ;}
545 phantomPosition =
pos;
551 detectorToPhantomPosition = displ;
557 if (outerr > 0.) {OuterRadiusDiscoIORT = outerr;}
563 if (innerr > 0.) {innerRadiusDiscoIORT = innerr;}
569 if (height > 0.) {heightDiscoIORT = height;}
576 DiscoXPositionIORT = xpos;
583 DiscoYPositionIORT = ypos;
590 DiscoZPositionIORT = zpos;
596 if (outerr > 0.) {OuterRadiusDiscoIORT1 = outerr;}
602 if (innerr > 0.) {innerRadiusDiscoIORT1 = innerr;}
608 if (height > 0.) {heightDiscoIORT1 = height;}
615 DiscoXPositionIORT1 = xpos;
621 AngleDiscoIORT0 = phi0;
638 phantom -> SetXHalfLength(phantomSizeX/2);
639 phantom -> SetYHalfLength(phantomSizeY/2);
640 phantom -> SetZHalfLength(phantomSizeZ/2);
641 phantomPhysicalVolume -> SetTranslation(phantomPosition);
643 else ConstructPhantom();
649 detector -> SetXHalfLength(detectorSizeX/2);
650 detector -> SetYHalfLength(detectorSizeY/2);
651 detector -> SetZHalfLength(detectorSizeZ/2);
652 detectorPhysicalVolume -> SetTranslation(detectorPosition);
654 else ConstructDetector();
657 delete solidDiscoIORT0;
658 delete logicDiscoIORT0;
659 delete physiDiscoIORT0;
660 delete solidDiscoIORT;
661 delete logicDiscoIORT;
662 delete physiDiscoIORT;
663 delete solidDiscoIORT1;
664 delete logicDiscoIORT1;
665 delete physiDiscoIORT1;
670 numberOfVoxelsAlongX =
G4lrint(detectorSizeX / sizeOfVoxelAlongX);
671 sizeOfVoxelAlongX = ( detectorSizeX / numberOfVoxelsAlongX );
673 numberOfVoxelsAlongY =
G4lrint(detectorSizeY / sizeOfVoxelAlongY);
674 sizeOfVoxelAlongY = ( detectorSizeY / numberOfVoxelsAlongY );
676 numberOfVoxelsAlongZ =
G4lrint(detectorSizeZ / sizeOfVoxelAlongZ);
677 sizeOfVoxelAlongZ = ( detectorSizeZ / numberOfVoxelsAlongZ );
682 volumeOfVoxel = sizeOfVoxelAlongX * sizeOfVoxelAlongY * sizeOfVoxelAlongZ;
683 massOfVoxel = detectorMaterial -> GetDensity() * volumeOfVoxel;
686 numberOfVoxelsAlongY,
687 numberOfVoxelsAlongZ,
699 delete solidDiscoIORT0;
700 delete logicDiscoIORT0;
701 delete physiDiscoIORT0;
702 delete solidDiscoIORT;
703 delete logicDiscoIORT;
704 delete physiDiscoIORT;
705 delete solidDiscoIORT1;
706 delete logicDiscoIORT1;
707 delete physiDiscoIORT1;
716 G4cout <<
"The (X,Y,Z) dimensions of the phantom are : (" <<
717 G4BestUnit( phantom -> GetXHalfLength()*2.,
"Length") <<
',' <<
718 G4BestUnit( phantom -> GetYHalfLength()*2.,
"Length") <<
',' <<
721 G4cout <<
"The (X,Y,Z) dimensions of the detector are : (" <<
722 G4BestUnit( detector -> GetXHalfLength()*2.,
"Length") <<
',' <<
723 G4BestUnit( detector -> GetYHalfLength()*2.,
"Length") <<
',' <<
726 G4cout <<
"Displacement between Phantom and World is: ";
731 G4cout <<
"The (X,Y,Z) sizes of the Voxels are: (" <<
732 G4BestUnit(sizeOfVoxelAlongX,
"Length") <<
',' <<
733 G4BestUnit(sizeOfVoxelAlongY,
"Length") <<
',' <<
736 G4cout <<
"The number of Voxels along (X,Y,Z) is: (" <<
737 numberOfVoxelsAlongX <<
',' <<
738 numberOfVoxelsAlongY <<
',' <<
739 numberOfVoxelsAlongZ <<
')' <<
G4endl;
static constexpr double cm
void SetDiscoZPositionIORT(G4double zpos)
CLHEP::Hep3Vector G4ThreeVector
~IORTDetectorConstruction()
void SetOuterRadiusDiscoIORT1(G4double outerr)
void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition)
void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
HepRotation & rotateY(double delta)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetheightDiscoIORT1(G4double height)
static G4NistManager * Instance()
void SetinnerRadiusDiscoIORT1(G4double innerr)
G4bool SetDiscoMaterialIORT(G4String material)
void SetDiscoYPositionIORT(G4double ypos)
G4bool SetPhantomMaterial(G4String material)
bool IsInside(G4double detectorX, G4double detectorY, G4double detectorZ, G4double phantomX, G4double phantomY, G4double phantomZ, G4ThreeVector detToPhantomPosition)
G4GLOB_DLL std::ostream G4cout
static constexpr double mm
void SetDiscoXPositionIORT1(G4double xpos)
void SetDetectorPosition()
IORTDetectorConstruction(G4VPhysicalVolume *)
void SetAngleDiscoIORT0(G4double phi0)
static G4GeometryManager * GetInstance()
void SetPhantomPosition(G4ThreeVector)
void SetinnerRadiusDiscoIORT(G4double innerr)
static IORTAnalysisManager * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4RunManager * GetRunManager()
void SetheightDiscoIORT(G4double height)
static constexpr double deg
static G4SDManager * GetSDMpointer()
void SetOuterRadiusDiscoIORT(G4double outerr)
G4bool SetDiscoMaterialIORT1(G4String material)
void SetDiscoXPositionIORT(G4double xpos)
G4ThreeVector GetDetectorToWorldPosition()
static IORTMatrix * GetInstance()
static const G4double pos
void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ)