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 // D. Cutajar, A. Le
0033 //
0034 //    ********************************************
0035 //    *                                          *
0036 //    *  BrachyDetectorConstructionOncura6711.cc *
0037 //    *                                          *
0038 //    ********************************************
0039 //
0040 // 
0041 //
0042 #include "BrachyDetectorConstructionOncura6711.hh"
0043 #include "globals.hh"
0044 #include "G4SystemOfUnits.hh"
0045 #include "G4Sphere.hh"
0046 #include "G4RunManager.hh"
0047 #include "G4Box.hh"
0048 #include "G4Tubs.hh"
0049 #include "G4LogicalVolume.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4PVPlacement.hh"
0052 #include "G4Transform3D.hh"
0053 #include "G4RotationMatrix.hh"
0054 #include "G4TransportationManager.hh"
0055 #include "G4NistManager.hh"
0056 #include "G4VisAttributes.hh"
0057 #include "G4Colour.hh"
0058 
0059 BrachyDetectorConstructionOncura6711::BrachyDetectorConstructionOncura6711()
0060   : 
0061    fOncuraCapsule(nullptr), fOncuraCapsuleLog(nullptr),
0062    fOncuraCapsulePhys(nullptr),
0063    fOncuraCapsuleTip1(nullptr), fOncuraCapsuleTip1Log(nullptr),
0064    fOncuraCapsuleTip1Phys(nullptr),
0065    fOncuraCapsuleTip2(nullptr), fOncuraCapsuleTip2Log(nullptr),
0066    fOncuraCapsuleTip2Phys(nullptr),
0067    fOncuraAirGap(nullptr), fOncuraAirGapLog(nullptr),
0068    fOncuraAirGapPhys(nullptr),
0069    fOncuraSilverCore(nullptr), fOncuraSilverCoreLog(nullptr),
0070    fOncuraSilverCorePhys(nullptr),
0071    fOncuraCapsuleShellVisAtt(nullptr), fOncuraCapsuleTipVisAtt(nullptr),
0072    fOncuraSilverCoreVisAtt(nullptr)
0073 {}
0074 
0075 void BrachyDetectorConstructionOncura6711::ConstructOncura6711(G4VPhysicalVolume* mother)
0076 {
0077 G4Colour  red     (1.0, 0.0, 0.0) ;
0078 G4Colour  magenta (1.0, 0.0, 1.0) ; 
0079 
0080 G4NistManager* nist = G4NistManager::Instance();
0081 G4Material* titanium = nist -> FindOrBuildMaterial("G4_Ti");
0082 G4Material* air = nist -> FindOrBuildMaterial("G4_AIR");
0083 G4Material* silver = nist -> FindOrBuildMaterial("G4_Ag");
0084 
0085 //Capsule shell
0086 fOncuraCapsule = new G4Tubs("OncuraCapsule",0,0.4*mm,1.875*mm,0.*deg,360.*deg);
0087 fOncuraCapsuleLog = new G4LogicalVolume(fOncuraCapsule,titanium,"OncuraCapsuleLog", nullptr,nullptr,nullptr);
0088 fOncuraCapsulePhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,0), 
0089                                 "OncuraCapsulePhys", fOncuraCapsuleLog, 
0090                                 mother, false, 0, true);
0091                         
0092 //Capsule tips
0093 fOncuraCapsuleTip1 = new G4Sphere("OncuraCapsuleTip1", 0, 0.4*mm, 0., 360*deg, 0., 90*deg);
0094 fOncuraCapsuleTip1Log = new G4LogicalVolume(fOncuraCapsuleTip1, titanium, "OncuraCapsuleTip1Log",nullptr,nullptr,nullptr);
0095 fOncuraCapsuleTip1Phys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,1.875*mm), 
0096                                 "OncuraCapsuleTip1Phys", fOncuraCapsuleTip1Log,
0097                                 mother, false, 
0098                                 0, true);
0099 
0100 fOncuraCapsuleTip2 = new G4Sphere("OncuraCapsuleTip2", 0, 0.4*mm, 0., 360*deg, 90*deg, 90*deg);
0101 fOncuraCapsuleTip2Log = new G4LogicalVolume(fOncuraCapsuleTip2, titanium, "OncuraCapsuleTip2Log", nullptr,nullptr,nullptr);
0102 fOncuraCapsuleTip2Phys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,-1.875*mm), 
0103                                 "OncuraCapsuleTip2Phys", fOncuraCapsuleTip2Log,
0104                                 mother, false, 
0105                                 0, true);
0106 
0107 //Air gap
0108 fOncuraAirGap = new G4Tubs("OncuraAirGap",0,0.33*mm,1.825*mm,0.*deg,360.*deg);
0109 fOncuraAirGapLog = new G4LogicalVolume(fOncuraAirGap, air, "OncuraAirGapLog");
0110 fOncuraAirGapPhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,0), 
0111                                 "OncuraAirGapPhys", fOncuraAirGapLog, 
0112                                 fOncuraCapsulePhys, false,
0113                                 0, true);
0114 
0115 //Silver core
0116 fOncuraSilverCore = new G4Tubs("OncuraSilverCore",0,0.25*mm,1.4*mm,0.*deg,360.*deg);
0117 fOncuraSilverCoreLog = new G4LogicalVolume(fOncuraSilverCore, silver, "silverCoreLog");
0118 fOncuraSilverCorePhys = new G4PVPlacement(nullptr, G4ThreeVector(0,0,0), 
0119                                 "OncuraSilverCorePhys", fOncuraSilverCoreLog,
0120                                 fOncuraAirGapPhys, false,
0121                                 0, true);
0122 
0123 fOncuraCapsuleShellVisAtt = new G4VisAttributes(red);
0124 fOncuraCapsuleShellVisAtt -> SetVisibility(true);  
0125 fOncuraCapsuleShellVisAtt -> SetForceWireframe(true);
0126 fOncuraCapsuleLog -> SetVisAttributes(fOncuraCapsuleShellVisAtt);
0127 
0128 fOncuraCapsuleTipVisAtt = new G4VisAttributes(red);
0129 fOncuraCapsuleTipVisAtt -> SetVisibility(true);  
0130 fOncuraCapsuleTipVisAtt -> SetForceSolid(true);
0131 fOncuraCapsuleTip1Log -> SetVisAttributes(fOncuraCapsuleTipVisAtt);
0132 fOncuraCapsuleTip2Log -> SetVisAttributes(fOncuraCapsuleTipVisAtt);
0133 
0134 fOncuraSilverCoreVisAtt = new G4VisAttributes(magenta);
0135 fOncuraSilverCoreVisAtt -> SetVisibility(true);
0136 fOncuraSilverCoreVisAtt -> SetForceSolid(true);
0137 fOncuraSilverCoreLog -> SetVisAttributes(fOncuraSilverCoreVisAtt);
0138 }
0139 
0140 void BrachyDetectorConstructionOncura6711::CleanOncura6711()
0141 { 
0142  delete fOncuraSilverCoreVisAtt;
0143  fOncuraSilverCoreVisAtt = nullptr;
0144 
0145  delete fOncuraCapsuleTipVisAtt;
0146  fOncuraCapsuleTipVisAtt = nullptr;
0147 
0148  delete fOncuraCapsuleShellVisAtt;
0149  fOncuraCapsuleShellVisAtt = nullptr;
0150 
0151  delete fOncuraSilverCorePhys;
0152  fOncuraSilverCorePhys = nullptr;
0153 
0154  delete fOncuraSilverCoreLog;
0155  fOncuraSilverCoreLog = nullptr;
0156 
0157  delete fOncuraSilverCore;
0158  fOncuraSilverCore = nullptr;
0159 
0160  delete fOncuraAirGapPhys;
0161  fOncuraAirGapPhys = nullptr;
0162 
0163  delete fOncuraAirGapLog;
0164  fOncuraAirGapLog = nullptr;
0165 
0166  delete fOncuraAirGap;
0167  fOncuraAirGap = nullptr;
0168 
0169  delete fOncuraCapsuleTip2Phys;
0170  fOncuraCapsuleTip2Phys = nullptr;
0171 
0172  delete fOncuraCapsuleTip2Log;
0173  fOncuraCapsuleTip2Log = nullptr;
0174  
0175  delete fOncuraCapsuleTip2;
0176  fOncuraCapsuleTip2 = nullptr;
0177 
0178  delete fOncuraCapsuleTip1Phys;
0179  fOncuraCapsuleTip1Phys = nullptr;
0180 
0181  delete fOncuraCapsuleTip1Log;
0182  fOncuraCapsuleTip1Log = nullptr;
0183 
0184  delete fOncuraCapsuleTip1;
0185  fOncuraCapsuleTip1 = nullptr;
0186 
0187  delete fOncuraCapsulePhys;
0188  fOncuraCapsulePhys = nullptr;
0189     
0190  delete fOncuraCapsuleLog;
0191  fOncuraCapsuleLog = nullptr;
0192 
0193  delete fOncuraCapsule;
0194  fOncuraCapsule = nullptr;
0195   
0196  G4RunManager::GetRunManager() -> GeometryHasBeenModified();
0197 }