Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy 28 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia 29 // 30 31 #include "G4MIRDSmallIntestine.hh" 32 33 #include "globals.hh" 34 #include "G4SystemOfUnits.hh" 35 #include "G4SDManager.hh" 36 #include "G4VisAttributes.hh" 37 #include "G4EllipticalTube.hh" 38 #include "G4UnionSolid.hh" 39 #include "G4RotationMatrix.hh" 40 #include "G4ThreeVector.hh" 41 #include "G4VPhysicalVolume.hh" 42 #include "G4PVPlacement.hh" 43 #include "G4LogicalVolume.hh" 44 #include "G4Torus.hh" 45 #include "G4Tubs.hh" 46 #include "G4Box.hh" 47 #include "G4IntersectionSolid.hh" 48 #include "G4SubtractionSolid.hh" 49 #include "G4HumanPhantomMaterial.hh" 50 #include "G4HumanPhantomColour.hh" 51 52 G4VPhysicalVolume* G4MIRDSmallIntestine::Construct(const G4String& volumeName, 53 G4VPhysicalVolume* mother, 54 const G4String& colourName, G4bool wireFrame,G4bool) 55 { 56 G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl; 57 58 auto* material = new G4HumanPhantomMaterial(); 59 auto* soft = material -> GetMaterial("soft_tissue"); 60 delete material; 61 62 G4double boxX = 11.*cm; 63 G4double boxY = 3.53*cm; 64 G4double boxZ = 5*cm; 65 66 auto* smallIntestineBox = new G4Box("smallIntestineBox",boxX,boxY,boxZ); 67 68 G4double tubsRmin = 0*cm; 69 G4double tubsRmax = 11.*cm; 70 G4double tubsZ = 5*cm; 71 G4double tubsSphi = 0*degree; 72 G4double tubsDphi = 360*degree; 73 74 auto* smallIntestineTubs = new G4Tubs("smallIntestineTubs",tubsRmin,tubsRmax,tubsZ,tubsSphi,tubsDphi); 75 76 //G4IntersectionSolid* SmallIntestine = new G4IntersectionSolid("SmallIntestine",smallIntestineTubs,smallIntestineBox, 77 auto* filledSmallIntestine1 = new G4IntersectionSolid("filledSmallIntestine1",smallIntestineTubs,smallIntestineBox, 78 nullptr,G4ThreeVector(0*cm,-1.33*cm, 0*cm)); 79 80 auto* filledSmallIntestine = new G4IntersectionSolid("filledSmallIntestine",filledSmallIntestine1,smallIntestineTubs, 81 nullptr,G4ThreeVector(0*cm,0.8*cm, 0*cm)); 82 83 G4double dx = 2.50*cm; // aU 84 G4double dy = 2.50*cm; //bU 85 G4double dz = 4.775*cm; //dzU 86 87 auto* AscendingColonUpperLargeIntestine = new G4EllipticalTube("AscendingColon",dx, dy, dz); 88 89 dx = 2.50 * cm;//bt 90 dy = 1.50 *cm;//ct 91 dz = 10.50* cm;//x1t 92 93 auto* TraverseColonUpperLargeIntestine = new G4EllipticalTube("TraverseColon",dx, dy, dz); 94 95 auto* relative_rm = new G4RotationMatrix(); 96 relative_rm -> rotateX(90. * degree); 97 //relative_rm -> rotateZ(180. * degree); 98 relative_rm -> rotateY(90. * degree); 99 auto* upperLargeIntestine = new G4UnionSolid("UpperLargeIntestine", 100 AscendingColonUpperLargeIntestine, 101 TraverseColonUpperLargeIntestine, 102 relative_rm, 103 G4ThreeVector(-8.0 *cm, 0.0*cm,6.275* cm)); //,0,dzU + ct transverse 104 105 dx = 1.88 * cm; //a 106 dy = 2.13 *cm; //b 107 dz = 7.64 *cm; //(z1-z2)/2 108 109 auto* DescendingColonLowerLargeIntestine = new G4EllipticalTube("DiscendingColon",dx, dy, dz); 110 111 auto* upperlowerLargeIntestine = new G4UnionSolid("UpperLowerLargeIntestine", 112 upperLargeIntestine, 113 DescendingColonLowerLargeIntestine, 114 nullptr, 115 G4ThreeVector(-16.72*cm, 0.0*cm,-2.865* cm)); //,0,dzU + ct t 116 117 118 auto* SmallIntestine = new G4SubtractionSolid("SmallIntestine", 119 filledSmallIntestine, 120 upperlowerLargeIntestine, 121 nullptr, 122 G4ThreeVector(8.0*cm,-0.3*cm,-2.775*cm)); 123 124 125 auto* logicSmallIntestine = new G4LogicalVolume( SmallIntestine, 126 soft, 127 "logical"+volumeName, 128 nullptr, nullptr, nullptr); 129 auto* rm = new G4RotationMatrix(); 130 rm->rotateX(180.*degree); 131 rm->rotateY(180.*degree); 132 G4VPhysicalVolume* physSmallIntestine = new G4PVPlacement(rm, 133 G4ThreeVector(0*cm, -2.66*cm, -13*cm), // Xcheck the spina position the correct placement shuod be this one 134 //G4ThreeVector(0*cm, -5.13*cm, -13*cm), // Xcheck the spina position the correct placement shuod be this one 135 //G4ThreeVector(0*cm, -6*cm, -13*cm), 136 "physical"+volumeName, 137 logicSmallIntestine, 138 mother, 139 false, 140 0, true); 141 142 143 // Visualization Attributes 144 //G4VisAttributes* SmallIntestineVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0)); 145 auto* colourPointer = new G4HumanPhantomColour(); 146 G4Colour colour = colourPointer -> GetColour(colourName); 147 auto* SmallIntestineVisAtt = new G4VisAttributes(colour); 148 SmallIntestineVisAtt->SetForceSolid(wireFrame); 149 logicSmallIntestine->SetVisAttributes(SmallIntestineVisAtt); 150 151 G4cout << "SmallIntestine created !!!!!!" << G4endl; 152 153 // Testing SmallIntestine Volume 154 G4double SmallIntestineVol = logicSmallIntestine->GetSolid()->GetCubicVolume(); 155 G4cout << "Volume of SmallIntestine = " << SmallIntestineVol/cm3 << " cm^3" << G4endl; 156 157 // Testing SmallIntestine Material 158 G4String SmallIntestineMat = logicSmallIntestine->GetMaterial()->GetName(); 159 G4cout << "Material of SmallIntestine = " << SmallIntestineMat << G4endl; 160 161 // Testing Density 162 G4double SmallIntestineDensity = logicSmallIntestine->GetMaterial()->GetDensity(); 163 G4cout << "Density of Material = " << SmallIntestineDensity*cm3/g << " g/cm^3" << G4endl; 164 165 // Testing Mass 166 G4double SmallIntestineMass = (SmallIntestineVol)*SmallIntestineDensity; 167 G4cout << "Mass of SmallIntestine = " << SmallIntestineMass/gram << " g" << G4endl; 168 169 return physSmallIntestine; 170 } 171