Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:30

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // This is the *BASIC* version of IORT, a Geant4-based application
0027 //
0028 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
0029 // Contributor Authors: S.Guatelli(e)
0030 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
0031 //    
0032 //   (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
0033 //   (b) IBFM-CNR , Segrate (Milano), Italy
0034 //   (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
0035 //   (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
0036 //   (e) University of Wollongong, Australia
0037 //
0038 //   *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
0039 //////////////////////////////////////////////////////////////////////////////////////////////
0040 
0041 #include <cmath>
0042 #include "G4SystemOfUnits.hh"
0043 #include "globals.hh"
0044 #include "G4SDManager.hh"
0045 #include "G4RunManager.hh"
0046 #include "G4GeometryManager.hh"
0047 #include "G4SolidStore.hh"
0048 #include "G4PhysicalVolumeStore.hh"
0049 #include "G4LogicalVolumeStore.hh"
0050 #include "G4Box.hh"
0051 #include "G4LogicalVolume.hh"
0052 #include "G4ThreeVector.hh"
0053 #include "G4PVPlacement.hh"
0054 #include "G4Transform3D.hh"
0055 #include "G4RotationMatrix.hh"
0056 #include "G4Colour.hh"
0057 #include "G4UserLimits.hh"
0058 #include "G4UnitsTable.hh"
0059 #include "G4VisAttributes.hh"
0060 #include "G4NistManager.hh"
0061 #include "IORTDetectorConstruction.hh"
0062 #include "G4Tubs.hh"
0063 #include "G4MultiFunctionalDetector.hh"
0064 #include "G4VPrimitiveScorer.hh"
0065 #include "G4PSDoseDeposit3D.hh"
0066 #include "IORTDetectorMessenger.hh"
0067 
0068 /////////////////////////////////////////////////////////////////////////////
0069 IORTDetectorConstruction::IORTDetectorConstruction(G4VPhysicalVolume* physicalTreatmentRoom)
0070   : motherPhys(physicalTreatmentRoom), // pointer to WORLD volume 
0071     phantom(0), detector(0),
0072     phantomLogicalVolume(0), detectorLogicalVolume(0), 
0073     phantomPhysicalVolume(0), detectorPhysicalVolume(0),
0074     aRegion(0),
0075 
0076     solidDiscoIORT0(0),
0077     logicDiscoIORT0(0),
0078     physiDiscoIORT0(0),
0079 
0080     solidDiscoIORT(0),
0081     logicDiscoIORT(0),
0082     physiDiscoIORT(0),
0083 
0084     solidDiscoIORT1(0),
0085     logicDiscoIORT1(0),
0086     physiDiscoIORT1(0)
0087 
0088 {
0089 
0090   /* NOTE! that the IORTDetectorConstruction class
0091    * does NOT inherit from G4VUserDetectorConstruction G4 class
0092    * So the Construct() mandatory virtual method is inside another geometric class
0093    * like the collimatorXXBeamLIne, ...
0094    */
0095 
0096   // Messenger to change parameters of the phantom/detector geometry
0097   detectorMessenger = new IORTDetectorMessenger(this);
0098 
0099   // Define here the material of the water phantom and of the detector
0100   SetPhantomMaterial("G4_WATER"); 
0101 
0102   // Construct geometry (messenger commands)
0103 
0104   // Detector
0105   // Default detector sizes
0106   detectorSizeX = 7.* cm;
0107   detectorSizeY = 15.* cm;
0108   detectorSizeZ = 15.* cm;
0109 
0110   SetDetectorSize(detectorSizeX,  detectorSizeY,  detectorSizeZ); 
0111  
0112   // Phantom 
0113   SetPhantomSize(20. *cm, 20. *cm, 20. *cm);   
0114   SetPhantomPosition(G4ThreeVector(4.5 *cm, 0. *cm, 0. *cm)); 
0115   SetDetectorToPhantomPosition(G4ThreeVector(0. *cm, 2.5 *cm, 2.5 *cm));  
0116 
0117   // Default protection disc geometry and materials
0118   SetOuterRadiusDiscoIORT (40. *mm);  
0119   SetinnerRadiusDiscoIORT (0.*mm);   
0120   SetheightDiscoIORT (2.0*mm);        
0121   SetDiscoXPositionIORT (-11.0*mm);
0122   SetDiscoYPositionIORT (0.0*mm);
0123   SetDiscoZPositionIORT (0.0*mm);
0124   SetDiscoMaterialIORT("G4_WATER");   
0125 
0126   SetOuterRadiusDiscoIORT1 (40. *mm);  
0127   SetinnerRadiusDiscoIORT1 (0.*mm);   
0128   SetheightDiscoIORT1 (1.0*mm);        
0129   SetDiscoXPositionIORT1 (-8.0*mm);
0130   SetDiscoMaterialIORT1("G4_WATER");
0131 
0132   SetAngleDiscoIORT0 (90.0 *deg);    
0133 
0134   // Write virtual parameters to the real ones and check for consistency      
0135   UpdateGeometry(); 
0136 }
0137 
0138 /////////////////////////////////////////////////////////////////////////////
0139 IORTDetectorConstruction::~IORTDetectorConstruction()
0140 { 
0141     delete detectorMessenger;
0142 }
0143 
0144 /////////////////////////////////////////////////////////////////////////////
0145 // ConstructPhantom() is the method that reconstuct a water box (called phantom 
0146 // (or water phantom)). 
0147 // A water phantom can be considered a good
0148 // approximation of a an human body. 
0149 ////////////////////////////////////////////////////////////////////////////
0150 
0151 void IORTDetectorConstruction::ConstructPhantom()
0152 {
0153     // Definition of the solid volume of the Phantom
0154     phantom = new G4Box("Phantom", 
0155             phantomSizeX/2, 
0156             phantomSizeY/2, 
0157             phantomSizeZ/2);
0158     
0159 // Definition of the logical volume of the Phantom
0160     phantomLogicalVolume = new G4LogicalVolume(phantom, 
0161                          phantomMaterial, 
0162                          "phantomLog", 0, 0, 0);
0163   
0164     // Definition of the physics volume of the Phantom
0165     phantomPhysicalVolume = new G4PVPlacement(0,
0166                                         phantomPosition,
0167                         "phantomPhys",
0168                         phantomLogicalVolume,
0169                         motherPhys,
0170                         false,
0171                         0);
0172 
0173 // Visualisation attributes of the phantom
0174     red = new G4VisAttributes(G4Colour(255/255., 0/255. ,0/255.));
0175     red -> SetVisibility(true);
0176     //red -> SetForceSolid(true);
0177     //red -> SetForceWireframe(true);
0178     phantomLogicalVolume -> SetVisAttributes(red); 
0179     //phantomLogicalVolume -> SetVisAttributes(G4VisAttributes::GetInvisible());
0180 }
0181 
0182 /////////////////////////////////////////////////////////////////////////////
0183 // ConstructDetector() it the method the reconstruct a detector region 
0184 // inside the water phantom. It is a volume, located inside the water phantom
0185 // and with two coincident faces:
0186 //
0187 //           **************************
0188 //           *   water phantom        *
0189 //           *                        *
0190 //           *                        *
0191 //           *---------------         *
0192 //  Beam     *              -         *
0193 //  ----->   * detector     -         *
0194 //           *              -         *
0195 //           *---------------         *
0196 //           *                        *
0197 //           *                        *
0198 //           *                        *
0199 //           **************************
0200 //
0201 // The detector is the volume that can be dived in slices or voxelized
0202 // and in it we can collect a number of usefull information:
0203 // dose distribution, fluence distribution, LET and so on
0204 
0205 void IORTDetectorConstruction::ConstructDetector()
0206 {
0207 
0208     // Definition of the solid volume of the Detector
0209     detector = new G4Box("Detector", 
0210              detectorSizeX/2, 
0211              detectorSizeY/2, 
0212              detectorSizeZ/2);
0213     
0214     // Definition of the logic volume of the Phantom
0215     detectorLogicalVolume = new G4LogicalVolume(detector,
0216                         detectorMaterial,
0217                         "DetectorLog",
0218                         0,0,0);
0219 // Definition of the physical volume of the Phantom 
0220     detectorPhysicalVolume = new G4PVPlacement(0, 
0221                            detectorPosition, // Setted by displacement 
0222                            "DetectorPhys", 
0223                            detectorLogicalVolume, 
0224                            phantomPhysicalVolume, 
0225                            false,0);
0226 
0227 // Visualisation attributes of the detector 
0228    
0229     G4VisAttributes * skyBlue1 = new G4VisAttributes( G4Colour(135/255. , 206/255. ,  235/255. ));
0230     detectorLogicalVolume -> SetVisAttributes(skyBlue1);
0231    
0232   // **************
0233   // Cut per Region    
0234   // **************
0235   
0236   // A smaller cut is fixed in the phantom to calculate the energy deposit with the
0237   // required accuracy 
0238     if (!aRegion)
0239     {
0240     aRegion = new G4Region("DetectorLog");
0241     detectorLogicalVolume -> SetRegion(aRegion);
0242     aRegion -> AddRootLogicalVolume(detectorLogicalVolume);
0243     }
0244  G4cout << "The Detector has been built --- Add a scoring mesh for it  in the GUI if appropriate (similar to the phantom one)" << G4endl;
0245  
0246 }
0247 
0248 void IORTDetectorConstruction::ConstructDisc()
0249 {
0250 // ---------------------------------------------------------------//
0251   //                    6.0 mm Protection Discs Volume          //
0252     // ---------------------------------------------------------------//
0253   const G4double startAngleDiscoIORT0 = 0.*deg;
0254   const G4double spanningAngleDiscoIORT0 = 360.*deg;
0255 
0256   // Matrix definition for a rotation (deg).       
0257   G4RotationMatrix rm0;               
0258   rm0.rotateY(AngleDiscoIORT0);
0259 
0260   
0261   solidDiscoIORT0 = new G4Tubs("DiscoIORT0", innerRadiusDiscoIORT, 
0262                     OuterRadiusDiscoIORT,
0263                     (heightDiscoIORT + heightDiscoIORT1), 
0264                     startAngleDiscoIORT0, 
0265                     spanningAngleDiscoIORT0);
0266 
0267   G4LogicalVolume* logDiscoIORT0 = new G4LogicalVolume(solidDiscoIORT0, 
0268                                   detectorMaterial, "DiscoIORT0Log", 0, 0, 0);
0269 
0270   physiDiscoIORT0 = new G4PVPlacement(G4Transform3D(rm0, G4ThreeVector((DiscoXPositionIORT + heightDiscoIORT1),DiscoYPositionIORT,DiscoZPositionIORT)),
0271                        "DiscoIORT0Phys", logDiscoIORT0, detectorPhysicalVolume, false, 0); 
0272 
0273   white = new G4VisAttributes( G4Colour());
0274   white -> SetVisibility(true);
0275   // white -> SetForceSolid(true);
0276   logDiscoIORT0 -> SetVisAttributes(white);
0277 
0278 // ---------------------------------------------------------------//
0279   //                    4.0 mm Aluminium Protection Disc          //
0280     // ---------------------------------------------------------------//
0281   //G4bool isotopes = false;
0282  // G4Material* leadNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Pb", isotopes);
0283  // DiscoMaterialIORT = leadNist;   // messenger
0284   gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
0285   gray-> SetVisibility(true);
0286   //gray -> SetForceWireframe(true);
0287   //gray-> SetForceSolid(true);
0288 
0289   gray1 = new G4VisAttributes( G4Colour(0.7, 0.7, 0.7 ));
0290   gray1-> SetVisibility(true);
0291   //gray1 -> SetForceWireframe(true);
0292   //gray1-> SetForceSolid(true);
0293 
0294   const G4double startAngleDiscoIORT = 0.*deg;
0295   const G4double spanningAngleDiscoIORT = 360.*deg;
0296    
0297   G4double phi = 0. *deg;     
0298 
0299   // Matrix definition for a 90 deg rotation. Also used for other volumes       
0300   G4RotationMatrix rm;               
0301   rm.rotateY(phi);
0302 
0303   solidDiscoIORT = new G4Tubs("DiscoIORT", innerRadiusDiscoIORT, 
0304                     OuterRadiusDiscoIORT,
0305                     heightDiscoIORT, 
0306                     startAngleDiscoIORT, 
0307                     spanningAngleDiscoIORT);
0308 
0309   G4LogicalVolume* logDiscoIORT = new G4LogicalVolume(solidDiscoIORT, 
0310                                   DiscoMaterialIORT, "DiscoIORTLog", 0, 0, 0);
0311 
0312   physiDiscoIORT = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(0.,0.,(- heightDiscoIORT1))),
0313                        "DiscoIORTPhys", logDiscoIORT, physiDiscoIORT0, false, 0); 
0314   
0315   logDiscoIORT -> SetVisAttributes(gray1);
0316   
0317   
0318       // ---------------------------------------------------------------//
0319       //             2.0 mm Lead Protection Disc                          //
0320       // ---------------------------------------------------------------//
0321  
0322   const G4double startAngleDiscoIORT1 = 0.*deg;
0323   const G4double spanningAngleDiscoIORT1 = 360.*deg;    
0324   
0325   solidDiscoIORT1 = new G4Tubs("DiscoIORT1", innerRadiusDiscoIORT1, 
0326                     OuterRadiusDiscoIORT1,
0327                     heightDiscoIORT1, 
0328                     startAngleDiscoIORT1, 
0329                     spanningAngleDiscoIORT1);
0330 
0331   G4LogicalVolume* logDiscoIORT1 = new G4LogicalVolume(solidDiscoIORT1, 
0332                                   DiscoMaterialIORT1, "DiscoIORTLog1", 0, 0, 0);
0333 
0334   physiDiscoIORT1 = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(0.,0.,heightDiscoIORT)),
0335                        "DiscoIORTPhys1", logDiscoIORT1, physiDiscoIORT0, false, 0); 
0336   white = new G4VisAttributes( G4Colour());
0337   white -> SetVisibility(true);
0338   white -> SetForceSolid(true);
0339   logDiscoIORT1 -> SetVisAttributes(gray);
0340 
0341 }
0342 /////////////////////////////////////////////////////////////////////////////
0343 
0344 void  IORTDetectorConstruction::ParametersCheck()
0345 {
0346     // Check phantom/detector sizes & relative position
0347     if (!IsInside(detectorSizeX, 
0348         detectorSizeY, 
0349         detectorSizeZ,
0350         phantomSizeX,
0351         phantomSizeY,
0352         phantomSizeZ,
0353         detectorToPhantomPosition
0354         ))
0355       G4Exception("IORTDetectorConstruction::ParametersCheck()", "IORT0001", FatalException, "Error: Detector is not fully inside Phantom!");
0356 }
0357 
0358 /////////////////
0359 // MESSENGERS //
0360 ////////////////
0361 
0362 G4bool IORTDetectorConstruction::SetPhantomMaterial(G4String material)
0363 {
0364 
0365     if (G4Material* pMat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) )
0366     {
0367     phantomMaterial  = pMat;
0368     detectorMaterial = pMat;
0369     if (detectorLogicalVolume && phantomLogicalVolume) 
0370     {
0371         detectorLogicalVolume -> SetMaterial(pMat); 
0372         phantomLogicalVolume ->  SetMaterial(pMat);
0373 
0374         G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0375         G4RunManager::GetRunManager() -> GeometryHasBeenModified();
0376         G4cout << "The material of Phantom/Detector has been changed to " << material << G4endl;
0377     }
0378     }
0379     else
0380     {
0381     G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
0382         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl; 
0383     G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl; 
0384     return false;
0385     }
0386 
0387     return true;
0388 }
0389 
0390 G4bool IORTDetectorConstruction::SetDiscoMaterialIORT(G4String material)
0391 {
0392 
0393     if (G4Material* dMat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) )
0394     {
0395     DiscoMaterialIORT  = dMat;
0396     
0397     if (logicDiscoIORT) 
0398     {
0399         logicDiscoIORT -> SetMaterial(dMat); 
0400         
0401         G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0402         G4RunManager::GetRunManager() -> GeometryHasBeenModified();
0403         G4cout << "The material of Protection disc 1 has been changed to " << material << G4endl;
0404     }
0405     }
0406     else
0407     {
0408     G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
0409         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl; 
0410     G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl; 
0411     return false;
0412     }
0413 
0414     return true;
0415 }
0416 
0417 G4bool IORTDetectorConstruction::SetDiscoMaterialIORT1(G4String material)
0418 {
0419 
0420     if (G4Material* d1Mat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) )
0421     {
0422     DiscoMaterialIORT1  = d1Mat;
0423     
0424     if (logicDiscoIORT1) 
0425     {
0426         logicDiscoIORT1 -> SetMaterial(d1Mat); 
0427         
0428         G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0429         G4RunManager::GetRunManager() -> GeometryHasBeenModified();
0430         G4cout << "The material of Protection disc 2 has been changed to " << material << G4endl;
0431     }
0432     }
0433     else
0434     {
0435     G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
0436         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl; 
0437     G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl; 
0438     return false;
0439     }
0440 
0441     return true;
0442 }
0443 /////////////////////////////////////////////////////////////////////////////
0444 void IORTDetectorConstruction::SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
0445 {
0446     if (sizeX > 0.) phantomSizeX = sizeX;
0447     if (sizeY > 0.) phantomSizeY = sizeY;
0448     if (sizeZ > 0.) phantomSizeZ = sizeZ;
0449 }
0450 /////////////////////////////////////////////////////////////////////////////
0451 /////////////////////////////////////////////////////////////////////////////
0452 void IORTDetectorConstruction::SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
0453 {
0454     if (sizeX > 0.) {detectorSizeX = sizeX;}
0455     if (sizeY > 0.) {detectorSizeY = sizeY;}
0456     if (sizeZ > 0.) {detectorSizeZ = sizeZ;}
0457 }
0458 /////////////////////////////////////////////////////////////////////////////
0459 
0460 void IORTDetectorConstruction::SetVoxelSize(G4double , G4double , G4double)
0461 {
0462     G4cout<< "SetVoxelSize method is not needed anymore " << G4endl;
0463 }
0464 void IORTDetectorConstruction::SetPhantomPosition(G4ThreeVector pos)
0465 {
0466     phantomPosition = pos;
0467 }
0468 
0469 /////////////////////////////////////////////////////////////////////////////
0470 void IORTDetectorConstruction::SetDetectorToPhantomPosition(G4ThreeVector displ)
0471 {
0472     detectorToPhantomPosition = displ;
0473 }
0474 /////////////////////////////////protection disc///////////////////////////
0475 
0476 void IORTDetectorConstruction::SetOuterRadiusDiscoIORT(G4double outerr)
0477 {
0478     if (outerr > 0.) {OuterRadiusDiscoIORT = outerr;}
0479     
0480 }
0481 
0482 void IORTDetectorConstruction::SetinnerRadiusDiscoIORT(G4double innerr)
0483 {
0484     if (innerr >= 0.) {innerRadiusDiscoIORT = innerr;}
0485     
0486 }
0487 
0488 void IORTDetectorConstruction::SetheightDiscoIORT(G4double height)
0489 {
0490     if (height > 0.) {heightDiscoIORT = height;}
0491     
0492 }
0493 
0494 void IORTDetectorConstruction::SetDiscoXPositionIORT(G4double xpos)
0495 {
0496     
0497     DiscoXPositionIORT = xpos;
0498         
0499 }
0500 
0501 void IORTDetectorConstruction::SetDiscoYPositionIORT(G4double ypos)
0502 {
0503     
0504     DiscoYPositionIORT = ypos;
0505         
0506 }
0507 
0508 void IORTDetectorConstruction::SetDiscoZPositionIORT(G4double zpos)
0509 {
0510     
0511     DiscoZPositionIORT = zpos;
0512         
0513 }
0514 
0515 void IORTDetectorConstruction::SetOuterRadiusDiscoIORT1(G4double outerr)
0516 {
0517     if (outerr > 0.) {OuterRadiusDiscoIORT1 = outerr;}
0518     
0519 }
0520 
0521 void IORTDetectorConstruction::SetinnerRadiusDiscoIORT1(G4double innerr)
0522 {
0523     if (innerr >= 0.) {innerRadiusDiscoIORT1 = innerr;}
0524     
0525 }
0526 
0527 void IORTDetectorConstruction::SetheightDiscoIORT1(G4double height)
0528 {
0529     if (height > 0.) {heightDiscoIORT1 = height;}
0530     
0531 }
0532 
0533 void IORTDetectorConstruction::SetDiscoXPositionIORT1(G4double xpos)
0534 {
0535     
0536     DiscoXPositionIORT1 = xpos;
0537 }
0538 
0539 void IORTDetectorConstruction::SetAngleDiscoIORT0(G4double phi0)
0540 {
0541     
0542     AngleDiscoIORT0 = phi0;
0543 }
0544 
0545 /////////////////////////////////protection disc///////////end///////////
0546 
0547 
0548 ////////////////////////////////////////////////////////////////////////////////
0549 void IORTDetectorConstruction::UpdateGeometry()
0550 {
0551     /* 
0552      * Check parameters consistency
0553      */
0554     ParametersCheck();
0555 
0556     G4GeometryManager::GetInstance() -> OpenGeometry();
0557     if (phantom)
0558     {
0559     phantom -> SetXHalfLength(phantomSizeX/2);
0560     phantom -> SetYHalfLength(phantomSizeY/2);
0561     phantom -> SetZHalfLength(phantomSizeZ/2);
0562     phantomPhysicalVolume -> SetTranslation(phantomPosition);
0563     }
0564     else   ConstructPhantom();
0565 
0566     // Get the center of the detector 
0567     SetDetectorPosition();
0568     if (detector)
0569     {
0570     detector -> SetXHalfLength(detectorSizeX/2);
0571     detector -> SetYHalfLength(detectorSizeY/2);
0572     detector -> SetZHalfLength(detectorSizeZ/2);
0573     detectorPhysicalVolume -> SetTranslation(detectorPosition);      
0574     }
0575     else    ConstructDetector();
0576 
0577     // update disc function
0578    if (physiDiscoIORT1) delete physiDiscoIORT1;
0579    if (logicDiscoIORT1) delete logicDiscoIORT1;
0580    if (solidDiscoIORT1) delete solidDiscoIORT1;
0581    
0582    if (physiDiscoIORT) delete physiDiscoIORT;
0583    if (logicDiscoIORT) delete logicDiscoIORT;
0584    if (solidDiscoIORT) delete solidDiscoIORT;
0585 
0586    if (physiDiscoIORT0) delete physiDiscoIORT0;
0587    if (logicDiscoIORT0)  delete logicDiscoIORT0;
0588    if (solidDiscoIORT0) delete solidDiscoIORT0;
0589      
0590     ConstructDisc();
0591 
0592     // Inform the kernel about the new geometry
0593     G4RunManager::GetRunManager() -> GeometryHasBeenModified();
0594     G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0595 
0596     PrintParameters();
0597 }
0598 
0599 void IORTDetectorConstruction::DeleteDisc()
0600 { 
0601   if (physiDiscoIORT1) delete physiDiscoIORT1;
0602   if (logicDiscoIORT1) delete logicDiscoIORT1;
0603   if (solidDiscoIORT1) delete solidDiscoIORT1;
0604   
0605   if (physiDiscoIORT) delete physiDiscoIORT;
0606   if (logicDiscoIORT) delete logicDiscoIORT;
0607   if (solidDiscoIORT) delete solidDiscoIORT;
0608   
0609   if (physiDiscoIORT0) delete physiDiscoIORT0;
0610   if (logicDiscoIORT0) delete logicDiscoIORT0;
0611   if (solidDiscoIORT0) delete solidDiscoIORT0;
0612    
0613   G4RunManager::GetRunManager() -> GeometryHasBeenModified();
0614   G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
0615 }
0616 
0617 
0618 void IORTDetectorConstruction::PrintParameters()
0619 {
0620 
0621     G4cout << "The (X,Y,Z) dimensions of the phantom are : (" << 
0622     G4BestUnit( phantom -> GetXHalfLength()*2., "Length") << ',' << 
0623     G4BestUnit( phantom -> GetYHalfLength()*2., "Length") << ',' << 
0624     G4BestUnit( phantom -> GetZHalfLength()*2., "Length") << ')' << G4endl; 
0625     
0626     G4cout << "The (X,Y,Z) dimensions of the detector are : (" << 
0627     G4BestUnit( detector -> GetXHalfLength()*2., "Length") << ',' << 
0628     G4BestUnit( detector -> GetYHalfLength()*2., "Length") << ',' << 
0629     G4BestUnit( detector -> GetZHalfLength()*2., "Length") << ')' << G4endl; 
0630 
0631     G4cout << "Displacement between Phantom and World is: "; 
0632     G4cout << "DX= "<< G4BestUnit(phantomPosition.getX(),"Length") << 
0633     "DY= "<< G4BestUnit(phantomPosition.getY(),"Length") << 
0634     "DZ= "<< G4BestUnit(phantomPosition.getZ(),"Length") << G4endl;
0635 }
0636