Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-02 08:02:52

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 //
0027 // --------------------------------------------------------------
0028 //                 GEANT 4 - Brachytherapy example
0029 // --------------------------------------------------------------
0030 //
0031 // Code developed by:
0032 // S.Guatelli
0033 //
0034 //    *******************************************
0035 //    *                                         *
0036 //    *    BrachyDetectorConstructionLeipzig.cc *
0037 //    *                                         *
0038 //    *******************************************
0039 //
0040 #include "BrachyDetectorConstructionLeipzig.hh"
0041 #include "globals.hh"
0042 #include "G4SystemOfUnits.hh"
0043 #include "G4CSGSolid.hh"
0044 #include "G4Sphere.hh"
0045 #include "G4RunManager.hh"
0046 #include "G4Box.hh"
0047 #include "G4Tubs.hh"
0048 #include "G4LogicalVolume.hh"
0049 #include "G4ThreeVector.hh"
0050 #include "G4PVPlacement.hh"
0051 #include "G4Transform3D.hh"
0052 #include "G4RotationMatrix.hh"
0053 #include "G4TransportationManager.hh"
0054 #include "G4VisAttributes.hh"
0055 #include "G4Colour.hh"
0056 #include "G4NistManager.hh"
0057 
0058 BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig(): 
0059 fCapsule(nullptr), fCapsuleTip(nullptr), fIridiumCore(nullptr), fApplicator1(nullptr), fApplicator2(nullptr),
0060 fCapsuleLog(nullptr), fCapsuleTipLog(nullptr), fIridiumCoreLog(nullptr), fApplicator1Log(nullptr),
0061 fApplicator2Log(nullptr), fCapsulePhys(nullptr), fCapsuleTipPhys(nullptr), fIridiumCorePhys(nullptr), 
0062 fApplicator1Phys(nullptr), fApplicator2Phys(nullptr)
0063 {}
0064 
0065 void  BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* mother)
0066 {
0067   G4Colour  red     (1.0, 0.0, 0.0) ; 
0068   G4Colour  lblue   (0.0, 0.0, .75);
0069   
0070   G4NistManager* nist = G4NistManager::Instance();
0071   G4Material* iridium = nist -> FindOrBuildMaterial("G4_Ir");
0072   G4Material* tungsten = nist -> FindOrBuildMaterial("G4_W");
0073  
0074   // Stainless steel (Medical Physics, Vol 25, No 10, Oct 1998)
0075   constexpr G4double d = 8.02*g/cm3;
0076   G4int Z; //atomic number of the element
0077   G4Element* elMn = nist -> FindOrBuildElement(Z=12);
0078   G4Element* elSi = nist -> FindOrBuildElement(Z=14);
0079   G4Element* elCr = nist -> FindOrBuildElement(Z=24);
0080   G4Element* elFe = nist -> FindOrBuildElement(Z=26);
0081   G4Element* elNi = nist -> FindOrBuildElement(Z=28);
0082   auto steel = new G4Material("Stainless steel",d,5);
0083   steel -> AddElement(elMn, 0.02);
0084   steel -> AddElement(elSi, 0.01);
0085   steel -> AddElement(elCr, 0.19);
0086   steel -> AddElement(elNi, 0.10);
0087   steel -> AddElement(elFe, 0.68);
0088 
0089   //Iridium source ...
0090 
0091   fCapsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
0092   fCapsuleLog = new G4LogicalVolume(fCapsule,steel,"CapsuleLog");
0093   fCapsulePhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,-1.975*mm),"CapsulePhys",
0094                                   fCapsuleLog,mother, //mother volume: phantom
0095                                   false,0, true);
0096 
0097   // Capsule tip
0098   fCapsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
0099   fCapsuleTipLog = new G4LogicalVolume(fCapsuleTip,steel,"CapsuleTipLog");
0100   fCapsuleTipPhys = new G4PVPlacement(nullptr,G4ThreeVector(0.,0.,1.75*mm),"CapsuleTipPhys",
0101                                       fCapsuleTipLog,mother,false,0, true);
0102   // Iridium core
0103   fIridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
0104   fIridiumCoreLog = new G4LogicalVolume(fIridiumCore, iridium, "IridiumCoreLog");
0105   fIridiumCorePhys = new G4PVPlacement(nullptr,G4ThreeVector(0.,0.,1.975*mm),"IridiumCorePhys",
0106                                       fIridiumCoreLog, fCapsulePhys,false,0, true);
0107 
0108   //Leipzig Applicator is modelled with two different volumes
0109   fApplicator1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg);
0110   fApplicator1Log = new G4LogicalVolume(fApplicator1,tungsten,"Appl1Log");
0111   fApplicator1Phys = new G4PVPlacement(nullptr,G4ThreeVector(0,0,4.0*mm),"Appl1Phys",fApplicator1Log,
0112                                       mother,false,0, true);
0113 
0114   fApplicator2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg);
0115   fApplicator2Log = new G4LogicalVolume(fApplicator2,tungsten,"Appl2");
0116   fApplicator2Phys = new G4PVPlacement(nullptr,G4ThreeVector(0,0,-4.875*mm),
0117                                       "Appl2Phys", fApplicator2Log,mother,false,0, true);
0118 
0119   fSimpleCapsuleVisAtt = new G4VisAttributes(red); 
0120   fSimpleCapsuleVisAtt -> SetVisibility(true); 
0121   fSimpleCapsuleVisAtt -> SetForceWireframe(true); 
0122   fCapsuleLog -> SetVisAttributes(fSimpleCapsuleVisAtt); 
0123 
0124   fSimpleCapsuleTipVisAtt = new G4VisAttributes(red); 
0125   fSimpleCapsuleTipVisAtt -> SetVisibility(true); 
0126   fSimpleCapsuleTipVisAtt -> SetForceSolid(true); 
0127   fCapsuleTipLog -> SetVisAttributes(fSimpleCapsuleTipVisAtt);
0128   fIridiumCoreLog -> SetVisAttributes(fSimpleCapsuleTipVisAtt);
0129 
0130   fApplicatorVisAtt = new G4VisAttributes(lblue);
0131   fApplicatorVisAtt -> SetVisibility(true);
0132   fApplicatorVisAtt -> SetForceWireframe(true);
0133   fApplicator1Log -> SetVisAttributes(fApplicatorVisAtt);
0134   fApplicator2Log -> SetVisAttributes(fApplicatorVisAtt);
0135 }
0136 void BrachyDetectorConstructionLeipzig::CleanLeipzigApplicator()
0137 {
0138 delete fApplicatorVisAtt; fApplicatorVisAtt = nullptr;
0139 delete fSimpleCapsuleTipVisAtt; fSimpleCapsuleTipVisAtt = nullptr;
0140 delete fSimpleCapsuleVisAtt; fSimpleCapsuleVisAtt = nullptr;
0141 delete fApplicator2Phys; fApplicator2Phys = nullptr;
0142 delete fApplicator1Phys; fApplicator1Phys = nullptr;
0143 delete fIridiumCorePhys; fIridiumCorePhys = nullptr;
0144 delete fCapsuleTipPhys; fCapsuleTipPhys = nullptr;
0145 delete fCapsulePhys; fCapsulePhys = nullptr;
0146 delete fApplicator2Log; fApplicator2Log = nullptr;
0147 delete fApplicator1Log; fApplicator1Log = nullptr;
0148 delete fIridiumCoreLog; fIridiumCoreLog = nullptr;
0149 delete fCapsuleTipLog; fCapsuleTipLog = nullptr;
0150 delete fCapsuleLog; fCapsuleLog = nullptr;
0151 }