Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
0028 // Contributor Authors: S.Guatelli(e)
0029 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
0030 //    
0031 //   (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
0032 //   (b) IBFM-CNR , Segrate (Milano), Italy
0033 //   (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
0034 //   (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
0035 //   (e) University of Wollongong, Australia
0036 //
0037 //   *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
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   //  G4VPhysicalVolume *detectorPhysicalVolume;  aggiunto
0064 
0065 private: 
0066 
0067   void ConstructPhantom();
0068   void ConstructDetector();
0069   //  void ConstructDisc();
0070   void ConstructSensitiveDetector();
0071   void ParametersCheck();
0072 
0073 public: 
0074 // Get detector position relative to WORLD
0075 inline G4ThreeVector GetDetectorToWorldPosition()
0076   {
0077     return phantomPosition + detectorPosition;
0078   }
0079 
0080 /////////////////////////////////////////////////////////////////////////////
0081 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes
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 // Calculate (and set) detector position by displacement, phantom and detector sizes
0092 inline void SetDetectorPosition()
0093   {
0094       // Adjust detector position
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     //G4cout << "*************** DetectorToPhantomPosition " << detectorToPhantomPosition/cm << "\n";
0100     //G4cout << "*************** DetectorPosition " << detectorPosition/cm << "\n";
0101   }
0102 /////////////////////////////////////////////////////////////////////////////
0103 // Check whether detector is inside phantom
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 // Dimensions check... X Y and Z
0113 // Firstly check what dimension we are modifying
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; //  phantom center, detector center, detector to phantom relative position
0206 
0207   G4Material *phantomMaterial, *detectorMaterial;
0208   G4Region* aRegion;
0209   
0210   //Disco0 IORT
0211   G4Tubs* solidDiscoIORT0;
0212   G4LogicalVolume* logicDiscoIORT0;
0213   G4VPhysicalVolume* physiDiscoIORT0;
0214   G4double AngleDiscoIORT0; 
0215 
0216   // Disco1 IORT
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    // Disco2 IORT
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