ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MIRDRibCage.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4MIRDRibCage.cc
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 "G4MIRDRibCage.hh"
32 
33 #include "globals.hh"
34 #include "G4SystemOfUnits.hh"
35 #include "G4SDManager.hh"
36 #include "G4VisAttributes.hh"
38 #include "G4SubtractionSolid.hh"
39 #include "G4EllipticalTube.hh"
40 #include "G4PVReplica.hh"
41 #include "G4Box.hh"
42 #include "G4PVPlacement.hh"
43 #include "G4HumanPhantomColour.hh"
44 
46 {
47 }
48 
50 {
51 }
52 
53 
55  const G4String& colourName, G4bool wireFrame, G4bool)
56 {
58 
59  G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
60 
61  G4Material* skeleton = material -> GetMaterial("skeleton");
62  G4Material* soft = material -> GetMaterial("soft_tissue");
63 
64  delete material;
65 
66  G4double dx= 17. *cm; // a2
67  G4double dy= 9.8 * cm; //b2
68  G4double thickness= 32.4 * cm; // z2/2 of cage
69 
70  G4EllipticalTube* outCage = new G4EllipticalTube("outCage",dx, dy, thickness/2.);
71 
72  dx = 16.4 * cm; // a1
73  dy = 9.2 * cm; // b1
74  G4double dz = 34. *cm; // z2/2
75 
76  G4EllipticalTube* inCage = new G4EllipticalTube("inCage",dx, dy, dz/2.);
77 
78  G4SubtractionSolid* cage = new G4SubtractionSolid("Cage",
79  outCage,
80  inCage, 0, G4ThreeVector(0.*cm, 0.*cm, 0. * cm));
81 
82 
83  G4LogicalVolume* logicRibCage = new G4LogicalVolume(cage, soft, "logicalCage", 0, 0, 0);
84 
85  G4VPhysicalVolume* physRibCage = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, thickness/2. + 0.1 * cm),
86  // with respect to the trunk
87  "physicalRibCage",
88  logicRibCage,
89  mother,
90  false,
91  0, true);
92 
93 
94  G4double xx = 17.*cm;
95  G4double yy = 9.8*cm;
96  G4double ribThickness = 1.4*cm;
97  G4EllipticalTube* rib_out = new G4EllipticalTube("rib_out",xx, yy, ribThickness/2.);
98 
99  xx = 16.5 *cm;
100  yy = 9.3 * cm;
101  G4double zz = 1.5 * cm;
102  G4EllipticalTube* rib_in = new G4EllipticalTube("rib_in",xx, yy, zz/2.);
103  G4SubtractionSolid* rib = new G4SubtractionSolid("rib",rib_out, rib_in);
104 
105  G4LogicalVolume* logicRib= new G4LogicalVolume(rib, skeleton, "logical" + volumeName, 0, 0, 0);
106 
107  physRib1 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (- 32.2*cm/2. + 0.8 *cm)),
108  // with respect to the trunk
109  "physicalRib",
110  logicRib,
111  physRibCage,
112  false,
113  0, true);
114 
115  physRib2 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, ( - 32.2*cm/2. + 0.8 *cm + 2.8 *cm)),
116  // with respect to the trunk
117  "physicalRib",
118  logicRib,
119  physRibCage,
120  false,
121  0, true);
122 
123  physRib3 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 5.6 *cm)),
124  // with respect to the trunk
125  "physicalRib",
126  logicRib,
127  physRibCage,
128  false,
129  0, true);
130 
131  physRib4 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 8.4 *cm)),
132  // with respect to the trunk
133  "physicalRib",
134  logicRib,
135  physRibCage,
136  false,
137  0, true);
138 
139  physRib5 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 11.2 *cm)),
140  // with respect to the trunk
141  "physicalRib",
142  logicRib,
143  physRibCage,
144  false,
145  0, true);
146 
147  physRib6 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 14. *cm)),
148  // with respect to the trunk
149  "physicalRib",
150  logicRib,
151  physRibCage,
152  false,
153  0, true);
154 
155  physRib7 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 16.8 *cm)),
156  // with respect to the trunk
157  "physicalRib",
158  logicRib,
159  physRibCage,
160  false,
161  0, true);
162 
163  physRib8 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 19.6 *cm)),
164  // with respect to the trunk
165  "physicalRib",
166  logicRib,
167  physRibCage,
168  false,
169  0, true);
170 
171  physRib9 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 22.4 *cm)),
172  // with respect to the trunk
173  "physicalRib",
174  logicRib,
175  physRibCage,
176  false,
177  0, true);
178 
179  physRib10 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 25.2 *cm)),
180  // with respect to the trunk
181  "physicalRib",
182  logicRib,
183  physRibCage,
184  false,
185  0, true);
186 
187  physRib11 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 28. *cm)),
188  // with respect to the trunk
189  "physicalRib",
190  logicRib,
191  physRibCage,
192  false,
193  0, true);
194 
195  physRib12 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 30.8 *cm)),
196  // with respect to the trunk
197  "physicalRib",
198  logicRib,
199  physRibCage,
200  false,
201  0, true);
202 
203  // Visualization Attributes
204  logicRibCage -> SetVisAttributes(G4VisAttributes::GetInvisible());
205 
206  //G4VisAttributes* RibCageVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6));
207 
208  G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour();
209  G4Colour colour = colourPointer -> GetColour(colourName);
210  G4VisAttributes* RibCageVisAtt = new G4VisAttributes(colour);
211  RibCageVisAtt->SetForceSolid(wireFrame);
212  logicRib->SetVisAttributes(RibCageVisAtt);
213 
214  G4cout << "RibCage created !!!!!!" << G4endl;
215  // Testing Pelvis Volume
216  G4double RibCageVol = logicRib->GetSolid()->GetCubicVolume();
217  G4cout << "Volume of RibCage = " << ((RibCageVol)*12.)/cm3 << " cm^3" << G4endl;
218 
219  // Testing RibCage Material
220  G4String RibCageMat = logicRib->GetMaterial()->GetName();
221  G4cout << "Material of RibCage = " << RibCageMat << G4endl;
222 
223  // Testing Density
224  G4double RibCageDensity = logicRib->GetMaterial()->GetDensity();
225  G4cout << "Density of Material = " << RibCageDensity*cm3/g << " g/cm^3" << G4endl;
226 
227  // Testing Mass
228  G4double RibCageMass = (RibCageVol)* RibCageDensity * 12;// 12 is the total number of ribs;
229  G4cout << "Mass of RibCage = " << (RibCageMass)/gram << " g" << G4endl;
230 
231  return physRibCage;
232 }