Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MIRDRibCage.cc
Go to the documentation of this file.
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 // Authors: S. Guatelli , M. G. Pia, INFN Genova and F. Ambroglini INFN Perugia, Italy
27 //
28 // Based on code developed by the undergraduate student G. Guerrieri
29 // Note: this is a preliminary beta-version of the code; an improved
30 // version will be distributed in the next Geant4 public release, compliant
31 // with the design in a forthcoming publication, and subject to a
32 // design and code review.
33 //
34 #include "G4MIRDRibCage.hh"
35 
36 #include "globals.hh"
37 #include "G4SystemOfUnits.hh"
38 #include "G4SDManager.hh"
39 #include "G4VisAttributes.hh"
41 #include "G4SubtractionSolid.hh"
42 #include "G4EllipticalTube.hh"
43 #include "G4PVReplica.hh"
44 #include "G4Box.hh"
45 #include "G4PVPlacement.hh"
46 #include "G4HumanPhantomColour.hh"
47 
49 {
50 }
51 
53 {
54 }
55 
56 
58  const G4String& colourName, G4bool wireFrame, G4bool)
59 {
61 
62  G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
63 
64  G4Material* skeleton = material -> GetMaterial("skeleton");
65  G4Material* soft = material -> GetMaterial("soft_tissue");
66 
67  delete material;
68 
69  G4double dx= 17. *cm; // a2
70  G4double dy= 9.8 * cm; //b2
71  G4double thickness= 32.4 * cm; // z2/2 of cage
72 
73  G4EllipticalTube* outCage = new G4EllipticalTube("outCage",dx, dy, thickness/2.);
74 
75  dx = 16.4 * cm; // a1
76  dy = 9.2 * cm; // b1
77  G4double dz = 34. *cm; // z2/2
78 
79  G4EllipticalTube* inCage = new G4EllipticalTube("inCage",dx, dy, dz/2.);
80 
81  G4SubtractionSolid* cage = new G4SubtractionSolid("Cage",
82  outCage,
83  inCage, 0, G4ThreeVector(0.*cm, 0.*cm, 0. * cm));
84 
85 
86  G4LogicalVolume* logicRibCage = new G4LogicalVolume(cage, soft, "logicalCage", 0, 0, 0);
87 
88  G4VPhysicalVolume* physRibCage = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, thickness/2. + 0.1 * cm),
89  // with respect to the trunk
90  "physicalRibCage",
91  logicRibCage,
92  mother,
93  false,
94  0, true);
95 
96 
97  G4double xx = 17.*cm;
98  G4double yy = 9.8*cm;
99  G4double ribThickness = 1.4*cm;
100  G4EllipticalTube* rib_out = new G4EllipticalTube("rib_out",xx, yy, ribThickness/2.);
101 
102  xx = 16.5 *cm;
103  yy = 9.3 * cm;
104  G4double zz = 1.5 * cm;
105  G4EllipticalTube* rib_in = new G4EllipticalTube("rib_in",xx, yy, zz/2.);
106  G4SubtractionSolid* rib = new G4SubtractionSolid("rib",rib_out, rib_in);
107 
108  G4LogicalVolume* logicRib= new G4LogicalVolume(rib, skeleton, "logical" + volumeName, 0, 0, 0);
109 
110  physRib1 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (- 32.2*cm/2. + 0.8 *cm)),
111  // with respect to the trunk
112  "physicalRib",
113  logicRib,
114  physRibCage,
115  false,
116  0, true);
117 
118  physRib2 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, ( - 32.2*cm/2. + 0.8 *cm + 2.8 *cm)),
119  // with respect to the trunk
120  "physicalRib",
121  logicRib,
122  physRibCage,
123  false,
124  0, true);
125 
126  physRib3 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 5.6 *cm)),
127  // with respect to the trunk
128  "physicalRib",
129  logicRib,
130  physRibCage,
131  false,
132  0, true);
133 
134  physRib4 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 8.4 *cm)),
135  // with respect to the trunk
136  "physicalRib",
137  logicRib,
138  physRibCage,
139  false,
140  0, true);
141 
142  physRib5 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 11.2 *cm)),
143  // with respect to the trunk
144  "physicalRib",
145  logicRib,
146  physRibCage,
147  false,
148  0, true);
149 
150  physRib6 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 14. *cm)),
151  // with respect to the trunk
152  "physicalRib",
153  logicRib,
154  physRibCage,
155  false,
156  0, true);
157 
158  physRib7 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 16.8 *cm)),
159  // with respect to the trunk
160  "physicalRib",
161  logicRib,
162  physRibCage,
163  false,
164  0, true);
165 
166  physRib8 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 19.6 *cm)),
167  // with respect to the trunk
168  "physicalRib",
169  logicRib,
170  physRibCage,
171  false,
172  0, true);
173 
174  physRib9 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 22.4 *cm)),
175  // with respect to the trunk
176  "physicalRib",
177  logicRib,
178  physRibCage,
179  false,
180  0, true);
181 
182  physRib10 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 25.2 *cm)),
183  // with respect to the trunk
184  "physicalRib",
185  logicRib,
186  physRibCage,
187  false,
188  0, true);
189 
190  physRib11 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 28. *cm)),
191  // with respect to the trunk
192  "physicalRib",
193  logicRib,
194  physRibCage,
195  false,
196  0, true);
197 
198  physRib12 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 30.8 *cm)),
199  // with respect to the trunk
200  "physicalRib",
201  logicRib,
202  physRibCage,
203  false,
204  0, true);
205 
206  // Visualization Attributes
207  logicRibCage -> SetVisAttributes(G4VisAttributes::GetInvisible());
208 
209  //G4VisAttributes* RibCageVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6));
210 
211  G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour();
212  G4Colour colour = colourPointer -> GetColour(colourName);
213  G4VisAttributes* RibCageVisAtt = new G4VisAttributes(colour);
214  RibCageVisAtt->SetForceSolid(wireFrame);
215  logicRib->SetVisAttributes(RibCageVisAtt);
216 
217  G4cout << "RibCage created !!!!!!" << G4endl;
218  // Testing Pelvis Volume
219  G4double RibCageVol = logicRib->GetSolid()->GetCubicVolume();
220  G4cout << "Volume of RibCage = " << ((RibCageVol)*12.)/cm3 << " cm^3" << G4endl;
221 
222  // Testing RibCage Material
223  G4String RibCageMat = logicRib->GetMaterial()->GetName();
224  G4cout << "Material of RibCage = " << RibCageMat << G4endl;
225 
226  // Testing Density
227  G4double RibCageDensity = logicRib->GetMaterial()->GetDensity();
228  G4cout << "Density of Material = " << RibCageDensity*cm3/g << " g/cm^3" << G4endl;
229 
230  // Testing Mass
231  G4double RibCageMass = (RibCageVol)* RibCageDensity * 12;// 12 is the total number of ribs;
232  G4cout << "Mass of RibCage = " << (RibCageMass)/gram << " g" << G4endl;
233 
234  return physRibCage;
235 }
G4Material * GetMaterial() const
CLHEP::Hep3Vector G4ThreeVector
const G4String & GetName() const
Definition: G4Material.hh:178
virtual G4double GetCubicVolume()
Definition: G4VSolid.cc:189
G4double GetDensity() const
Definition: G4Material.hh:180
G4VSolid * GetSolid() const
void SetForceSolid(G4bool=true)
static constexpr double gram
Definition: G4SIunits.hh:178
string material
Definition: eplot.py:19
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
static constexpr double cm
Definition: G4SIunits.hh:119
static constexpr double cm3
Definition: G4SIunits.hh:121
G4VPhysicalVolume * Construct(const G4String &, G4VPhysicalVolume *, const G4String &, G4bool, G4bool)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const G4VisAttributes & GetInvisible()
void SetVisAttributes(const G4VisAttributes *pVA)