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),
105 sizeOfVoxelAlongX = 0.5 *CLHEP::mm;
106 sizeOfVoxelAlongY = 0.5 *CLHEP::mm;
107 sizeOfVoxelAlongZ = 0.5 *CLHEP::mm;
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);
260 const G4double startAngleDiscoIORT0 = 0.*CLHEP::deg;
261 const G4double spanningAngleDiscoIORT0 = 360.*CLHEP::deg;
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);
305 const G4double startAngleDiscoIORT = 0.*CLHEP::deg;
306 const G4double spanningAngleDiscoIORT = 360.*CLHEP::deg;
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);
341 const G4double startAngleDiscoIORT1 = 0.*CLHEP::deg;
342 const G4double spanningAngleDiscoIORT1 = 360.*CLHEP::deg;
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,
707 delete solidDiscoIORT0;
708 delete logicDiscoIORT0;
709 delete physiDiscoIORT0;
710 delete solidDiscoIORT;
711 delete logicDiscoIORT;
712 delete physiDiscoIORT;
713 delete solidDiscoIORT1;
714 delete logicDiscoIORT1;
715 delete physiDiscoIORT1;
724 G4cout <<
"The (X,Y,Z) dimensions of the phantom are : (" <<
725 G4BestUnit( phantom -> GetXHalfLength()*2.,
"Length") <<
',' <<
726 G4BestUnit( phantom -> GetYHalfLength()*2.,
"Length") <<
',' <<
729 G4cout <<
"The (X,Y,Z) dimensions of the detector are : (" <<
730 G4BestUnit( detector -> GetXHalfLength()*2.,
"Length") <<
',' <<
731 G4BestUnit( detector -> GetYHalfLength()*2.,
"Length") <<
',' <<
734 G4cout <<
"Displacement between Phantom and World is: ";
739 G4cout <<
"The (X,Y,Z) sizes of the Voxels are: (" <<
740 G4BestUnit(sizeOfVoxelAlongX,
"Length") <<
',' <<
741 G4BestUnit(sizeOfVoxelAlongY,
"Length") <<
',' <<
744 G4cout <<
"The number of Voxels along (X,Y,Z) is: (" <<
745 numberOfVoxelsAlongX <<
',' <<
746 numberOfVoxelsAlongY <<
',' <<
747 numberOfVoxelsAlongZ <<
')' <<
G4endl;