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 #include "G4MIRDRibCage.hh" 31 #include "G4MIRDRibCage.hh" 32 32 33 #include "globals.hh" 33 #include "globals.hh" 34 #include "G4SystemOfUnits.hh" 34 #include "G4SystemOfUnits.hh" 35 #include "G4SDManager.hh" 35 #include "G4SDManager.hh" 36 #include "G4VisAttributes.hh" 36 #include "G4VisAttributes.hh" 37 #include "G4HumanPhantomMaterial.hh" 37 #include "G4HumanPhantomMaterial.hh" 38 #include "G4SubtractionSolid.hh" 38 #include "G4SubtractionSolid.hh" 39 #include "G4EllipticalTube.hh" 39 #include "G4EllipticalTube.hh" 40 #include "G4PVReplica.hh" 40 #include "G4PVReplica.hh" 41 #include "G4Box.hh" 41 #include "G4Box.hh" 42 #include "G4PVPlacement.hh" 42 #include "G4PVPlacement.hh" 43 #include "G4HumanPhantomColour.hh" 43 #include "G4HumanPhantomColour.hh" 44 G4MIRDRibCage::G4MIRDRibCage():fPhysRib1(nullp 44 G4MIRDRibCage::G4MIRDRibCage():fPhysRib1(nullptr), fPhysRib2(nullptr), fPhysRib3(nullptr), 45 fPhysRib4(nullptr), fPhysRib5(nu 45 fPhysRib4(nullptr), fPhysRib5(nullptr), fPhysRib6(nullptr), 46 fPhysRib7(nullptr), fPhysRib8(nu 46 fPhysRib7(nullptr), fPhysRib8(nullptr), fPhysRib9(nullptr), 47 fPhysRib10(nullptr), fPhysRib11( 47 fPhysRib10(nullptr), fPhysRib11(nullptr), fPhysRib12(nullptr) 48 {;} 48 {;} 49 49 50 G4VPhysicalVolume* G4MIRDRibCage::Construct(co 50 G4VPhysicalVolume* G4MIRDRibCage::Construct(const G4String& volumeName, G4VPhysicalVolume* mother, 51 const G4String& colourName, G4bo 51 const G4String& colourName, G4bool wireFrame, G4bool) 52 52 53 { 53 { 54 auto* material = new G4HumanPhantomMaterial( 54 auto* material = new G4HumanPhantomMaterial(); 55 55 56 G4cout<<"Construct "<<volumeName<<" with mot 56 G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl; 57 57 58 auto* skeleton = material -> GetMaterial("sk 58 auto* skeleton = material -> GetMaterial("skeleton"); 59 auto* soft = material -> GetMaterial("soft_t 59 auto* soft = material -> GetMaterial("soft_tissue"); 60 60 61 delete material; 61 delete material; 62 62 63 G4double dx= 17. *cm; // a2 63 G4double dx= 17. *cm; // a2 64 G4double dy= 9.8 * cm; //b2 64 G4double dy= 9.8 * cm; //b2 65 G4double thickness= 32.4 * cm; // z2/2 of ca 65 G4double thickness= 32.4 * cm; // z2/2 of cage 66 66 67 auto* outCage = new G4EllipticalTube("outCag 67 auto* outCage = new G4EllipticalTube("outCage",dx, dy, thickness/2.); 68 68 69 dx = 16.4 * cm; // a1 69 dx = 16.4 * cm; // a1 70 dy = 9.2 * cm; // b1 70 dy = 9.2 * cm; // b1 71 G4double dz = 34. *cm; // z2/2 71 G4double dz = 34. *cm; // z2/2 72 72 73 auto* inCage = new G4EllipticalTube("inCage" 73 auto* inCage = new G4EllipticalTube("inCage",dx, dy, dz/2.); 74 74 75 auto* cage = new G4SubtractionSolid("Cage", 75 auto* cage = new G4SubtractionSolid("Cage", 76 outCage, 76 outCage, 77 inCage, nullptr, G4ThreeVector 77 inCage, nullptr, G4ThreeVector(0.*cm, 0.*cm, 0. * cm)); 78 78 79 79 80 auto* logicRibCage = new G4LogicalVolume(cag 80 auto* logicRibCage = new G4LogicalVolume(cage, soft, "logicalCage", nullptr, nullptr, nullptr); 81 81 82 G4VPhysicalVolume* physRibCage = new G4PVPla 82 G4VPhysicalVolume* physRibCage = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, thickness/2. + 0.1 * cm), 83 // with respect to the trunk 83 // with respect to the trunk 84 "physicalRibCage", 84 "physicalRibCage", 85 logicRibCage, 85 logicRibCage, 86 mother, 86 mother, 87 false, 87 false, 88 0, true); 88 0, true); 89 89 90 G4double xx = 17.*cm; 90 G4double xx = 17.*cm; 91 G4double yy = 9.8*cm; 91 G4double yy = 9.8*cm; 92 G4double ribThickness = 1.4*cm; 92 G4double ribThickness = 1.4*cm; 93 auto* rib_out = new G4EllipticalTube("rib_ou 93 auto* rib_out = new G4EllipticalTube("rib_out",xx, yy, ribThickness/2.); 94 94 95 xx = 16.5 *cm; 95 xx = 16.5 *cm; 96 yy = 9.3 * cm; 96 yy = 9.3 * cm; 97 G4double zz = 1.5 * cm; 97 G4double zz = 1.5 * cm; 98 auto* rib_in = new G4EllipticalTube("rib_in" 98 auto* rib_in = new G4EllipticalTube("rib_in",xx, yy, zz/2.); 99 auto* rib = new G4SubtractionSolid("rib",rib 99 auto* rib = new G4SubtractionSolid("rib",rib_out, rib_in); 100 100 101 auto* logicRib= new G4LogicalVolume(rib, ske 101 auto* logicRib= new G4LogicalVolume(rib, skeleton, "logical" + volumeName, nullptr, nullptr, nullptr); 102 102 103 fPhysRib1 = new G4PVPlacement(nullptr,G4Thre 103 fPhysRib1 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (- 32.2*cm/2. + 0.8 *cm)), 104 // with respect to the trunk 104 // with respect to the trunk 105 "physicalRib", 105 "physicalRib", 106 logicRib, 106 logicRib, 107 physRibCage, 107 physRibCage, 108 false, 108 false, 109 0, true); 109 0, true); 110 110 111 fPhysRib2 = new G4PVPlacement(nullptr,G4Thre 111 fPhysRib2 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, ( - 32.2*cm/2. + 0.8 *cm + 2.8 *cm)), 112 // with respect to the trunk 112 // with respect to the trunk 113 "physicalRib", 113 "physicalRib", 114 logicRib, 114 logicRib, 115 physRibCage, 115 physRibCage, 116 false, 116 false, 117 0, true); 117 0, true); 118 118 119 fPhysRib3 = new G4PVPlacement(nullptr,G4Thre 119 fPhysRib3 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 5.6 *cm)), 120 // with respect to the trunk 120 // with respect to the trunk 121 "physicalRib", 121 "physicalRib", 122 logicRib, 122 logicRib, 123 physRibCage, 123 physRibCage, 124 false, 124 false, 125 0, true); 125 0, true); 126 126 127 fPhysRib4 = new G4PVPlacement(nullptr,G4Thre 127 fPhysRib4 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 8.4 *cm)), 128 // with respect to the trunk 128 // with respect to the trunk 129 "physicalRib", 129 "physicalRib", 130 logicRib, 130 logicRib, 131 physRibCage, 131 physRibCage, 132 false, 132 false, 133 0, true); 133 0, true); 134 134 135 fPhysRib5 = new G4PVPlacement(nullptr,G4Thre 135 fPhysRib5 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 11.2 *cm)), 136 // with respect to the trunk 136 // with respect to the trunk 137 "physicalRib", 137 "physicalRib", 138 logicRib, 138 logicRib, 139 physRibCage, 139 physRibCage, 140 false, 140 false, 141 0, true); 141 0, true); 142 142 143 fPhysRib6 = new G4PVPlacement(nullptr,G4Thre 143 fPhysRib6 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 14. *cm)), 144 // with respect to the trunk 144 // with respect to the trunk 145 "physicalRib", 145 "physicalRib", 146 logicRib, 146 logicRib, 147 physRibCage, 147 physRibCage, 148 false, 148 false, 149 0, true); 149 0, true); 150 150 151 fPhysRib7 = new G4PVPlacement(nullptr,G4Thre 151 fPhysRib7 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 16.8 *cm)), 152 // with respect to the trunk 152 // with respect to the trunk 153 "physicalRib", 153 "physicalRib", 154 logicRib, 154 logicRib, 155 physRibCage, 155 physRibCage, 156 false, 156 false, 157 0, true); 157 0, true); 158 158 159 fPhysRib8 = new G4PVPlacement(nullptr,G4Thre 159 fPhysRib8 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 19.6 *cm)), 160 // with respect to the trunk 160 // with respect to the trunk 161 "physicalRib", 161 "physicalRib", 162 logicRib, 162 logicRib, 163 physRibCage, 163 physRibCage, 164 false, 164 false, 165 0, true); 165 0, true); 166 166 167 fPhysRib9 = new G4PVPlacement(nullptr,G4Thre 167 fPhysRib9 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 22.4 *cm)), 168 // with respect to the trunk 168 // with respect to the trunk 169 "physicalRib", 169 "physicalRib", 170 logicRib, 170 logicRib, 171 physRibCage, 171 physRibCage, 172 false, 172 false, 173 0, true); 173 0, true); 174 174 175 fPhysRib10 = new G4PVPlacement(nullptr, G4Th 175 fPhysRib10 = new G4PVPlacement(nullptr, G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 25.2 *cm)), 176 // with respect to the trunk 176 // with respect to the trunk 177 "physicalRib", 177 "physicalRib", 178 logicRib, 178 logicRib, 179 physRibCage, 179 physRibCage, 180 false, 180 false, 181 0, true); 181 0, true); 182 182 183 fPhysRib11 = new G4PVPlacement(nullptr,G4Thr 183 fPhysRib11 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 28. *cm)), 184 // with respect to the trunk 184 // with respect to the trunk 185 "physicalRib", 185 "physicalRib", 186 logicRib, 186 logicRib, 187 physRibCage, 187 physRibCage, 188 false, 188 false, 189 0, true); 189 0, true); 190 190 191 fPhysRib12 = new G4PVPlacement(nullptr,G4Thr 191 fPhysRib12 = new G4PVPlacement(nullptr,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 30.8 *cm)), 192 // with respect to the trunk 192 // with respect to the trunk 193 "physicalRib", 193 "physicalRib", 194 logicRib, 194 logicRib, 195 physRibCage, 195 physRibCage, 196 false, 196 false, 197 0, true); 197 0, true); 198 198 199 // Visualization Attributes 199 // Visualization Attributes 200 logicRibCage -> SetVisAttributes(G4VisAttrib 200 logicRibCage -> SetVisAttributes(G4VisAttributes::GetInvisible()); 201 201 202 //G4VisAttributes* RibCageVisAtt = new G4Vis 202 //G4VisAttributes* RibCageVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6)); 203 203 204 auto* colourPointer = new G4HumanPhantomColo 204 auto* colourPointer = new G4HumanPhantomColour(); 205 G4Colour colour = colourPointer -> GetColour 205 G4Colour colour = colourPointer -> GetColour(colourName); 206 auto* RibCageVisAtt = new G4VisAttributes(co 206 auto* RibCageVisAtt = new G4VisAttributes(colour); 207 RibCageVisAtt->SetForceSolid(wireFrame); 207 RibCageVisAtt->SetForceSolid(wireFrame); 208 logicRib->SetVisAttributes(RibCageVisAtt); 208 logicRib->SetVisAttributes(RibCageVisAtt); 209 209 210 G4cout << "RibCage created !!!!!!" << G4endl 210 G4cout << "RibCage created !!!!!!" << G4endl; 211 // Testing Pelvis Volume 211 // Testing Pelvis Volume 212 G4double RibCageVol = logicRib->GetSolid()-> 212 G4double RibCageVol = logicRib->GetSolid()->GetCubicVolume(); 213 G4cout << "Volume of RibCage = " << ((RibCag 213 G4cout << "Volume of RibCage = " << ((RibCageVol)*12.)/cm3 << " cm^3" << G4endl; 214 214 215 // Testing RibCage Material 215 // Testing RibCage Material 216 G4String RibCageMat = logicRib->GetMaterial( 216 G4String RibCageMat = logicRib->GetMaterial()->GetName(); 217 G4cout << "Material of RibCage = " << RibCag 217 G4cout << "Material of RibCage = " << RibCageMat << G4endl; 218 218 219 // Testing Density 219 // Testing Density 220 G4double RibCageDensity = logicRib->GetMater 220 G4double RibCageDensity = logicRib->GetMaterial()->GetDensity(); 221 G4cout << "Density of Material = " << RibCag 221 G4cout << "Density of Material = " << RibCageDensity*cm3/g << " g/cm^3" << G4endl; 222 222 223 // Testing Mass 223 // Testing Mass 224 G4double RibCageMass = (RibCageVol)* RibCage 224 G4double RibCageMass = (RibCageVol)* RibCageDensity * 12;// 12 is the total number of ribs; 225 G4cout << "Mass of RibCage = " << (RibCageMa 225 G4cout << "Mass of RibCage = " << (RibCageMass)/gram << " g" << G4endl; 226 226 227 return physRibCage; 227 return physRibCage; 228 } 228 } 229 229