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