ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MIRDSmallIntestine.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4MIRDSmallIntestine.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 //
32 #include "G4MIRDSmallIntestine.hh"
33 
34 #include "globals.hh"
35 #include "G4SystemOfUnits.hh"
36 #include "G4SDManager.hh"
37 #include "G4VisAttributes.hh"
38 #include "G4EllipticalTube.hh"
39 #include "G4UnionSolid.hh"
40 #include "G4RotationMatrix.hh"
41 #include "G4ThreeVector.hh"
42 #include "G4VPhysicalVolume.hh"
43 #include "G4PVPlacement.hh"
44 #include "G4LogicalVolume.hh"
45 #include "G4Torus.hh"
46 #include "G4Tubs.hh"
47 #include "G4Box.hh"
48 #include "G4IntersectionSolid.hh"
49 #include "G4SubtractionSolid.hh"
51 #include "G4HumanPhantomColour.hh"
52 
54 {
55 }
56 
58 {
59 
60 }
61 
62 
64  G4VPhysicalVolume* mother,
65  const G4String& colourName, G4bool wireFrame,G4bool)
66 {
67  G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
68 
70  G4Material* soft = material -> GetMaterial("soft_tissue");
71  delete material;
72 
73  G4double boxX = 11.*cm;
74  G4double boxY = 3.53*cm;
75  G4double boxZ = 5*cm;
76 
77 
78  G4Box* smallIntestineBox = new G4Box("smallIntestineBox",boxX,boxY,boxZ);
79 
80  G4double tubsRmin = 0*cm;
81  G4double tubsRmax = 11.*cm;
82  G4double tubsZ = 5*cm;
83  G4double tubsSphi = 0*degree;
84  G4double tubsDphi = 360*degree;
85 
86 
87  G4Tubs* smallIntestineTubs = new G4Tubs("smallIntestineTubs",tubsRmin,tubsRmax,tubsZ,tubsSphi,tubsDphi);
88 
89  //G4IntersectionSolid* SmallIntestine = new G4IntersectionSolid("SmallIntestine",smallIntestineTubs,smallIntestineBox,
90  G4IntersectionSolid* filledSmallIntestine1 = new G4IntersectionSolid("filledSmallIntestine1",smallIntestineTubs,smallIntestineBox,
91  0,G4ThreeVector(0*cm,-1.33*cm, 0*cm));
92 
93  G4IntersectionSolid* filledSmallIntestine = new G4IntersectionSolid("filledSmallIntestine",filledSmallIntestine1,smallIntestineTubs,
94  0,G4ThreeVector(0*cm,0.8*cm, 0*cm));
95 
96  G4double dx = 2.50*cm; // aU
97  G4double dy = 2.50*cm; //bU
98  G4double dz = 4.775*cm; //dzU
99 
100  G4VSolid* AscendingColonUpperLargeIntestine = new G4EllipticalTube("AscendingColon",dx, dy, dz);
101 
102  dx = 2.50 * cm;//bt
103  dy = 1.50 *cm;//ct
104  dz = 10.50* cm;//x1t
105 
106  G4VSolid* TraverseColonUpperLargeIntestine = new G4EllipticalTube("TraverseColon",dx, dy, dz);
107 
108  G4RotationMatrix* relative_rm = new G4RotationMatrix();
109  relative_rm -> rotateX(90. * degree);
110  //relative_rm -> rotateZ(180. * degree);
111  relative_rm -> rotateY(90. * degree);
112  G4UnionSolid* upperLargeIntestine = new G4UnionSolid("UpperLargeIntestine",
113  AscendingColonUpperLargeIntestine,
114  TraverseColonUpperLargeIntestine,
115  relative_rm,
116  G4ThreeVector(-8.0 *cm, 0.0*cm,6.275* cm)); //,0,dzU + ct transverse
117 
118  dx = 1.88 * cm; //a
119  dy = 2.13 *cm; //b
120  dz = 7.64 *cm; //(z1-z2)/2
121 
122  G4EllipticalTube* DescendingColonLowerLargeIntestine = new G4EllipticalTube("DiscendingColon",dx, dy, dz);
123 
124  G4UnionSolid* upperlowerLargeIntestine = new G4UnionSolid("UpperLowerLargeIntestine",
125  upperLargeIntestine,
126  DescendingColonLowerLargeIntestine,
127  0,
128  G4ThreeVector(-16.72*cm, 0.0*cm,-2.865* cm)); //,0,dzU + ct t
129 
130 
131  G4SubtractionSolid* SmallIntestine = new G4SubtractionSolid("SmallIntestine",
132  filledSmallIntestine,
133  upperlowerLargeIntestine,
134  0,
135  G4ThreeVector(8.0*cm,-0.3*cm,-2.775*cm));
136 
137 
138  G4LogicalVolume* logicSmallIntestine = new G4LogicalVolume( SmallIntestine,
139  soft,
140  "logical"+volumeName,
141  0, 0, 0);
143  rm->rotateX(180.*degree);
144  rm->rotateY(180.*degree);
145  G4VPhysicalVolume* physSmallIntestine = new G4PVPlacement(rm,
146  G4ThreeVector(0*cm, -2.66*cm, -13*cm), // Xcheck the spina position the correct placement shuod be this one
147  //G4ThreeVector(0*cm, -5.13*cm, -13*cm), // Xcheck the spina position the correct placement shuod be this one
148  //G4ThreeVector(0*cm, -6*cm, -13*cm),
149  "physical"+volumeName,
150  logicSmallIntestine,
151  mother,
152  false,
153  0, true);
154 
155 
156  // Visualization Attributes
157  //G4VisAttributes* SmallIntestineVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
158  G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour();
159  G4Colour colour = colourPointer -> GetColour(colourName);
160  G4VisAttributes* SmallIntestineVisAtt = new G4VisAttributes(colour);
161  SmallIntestineVisAtt->SetForceSolid(wireFrame);
162  logicSmallIntestine->SetVisAttributes(SmallIntestineVisAtt);
163 
164  G4cout << "SmallIntestine created !!!!!!" << G4endl;
165 
166  // Testing SmallIntestine Volume
167  G4double SmallIntestineVol = logicSmallIntestine->GetSolid()->GetCubicVolume();
168  G4cout << "Volume of SmallIntestine = " << SmallIntestineVol/cm3 << " cm^3" << G4endl;
169 
170  // Testing SmallIntestine Material
171  G4String SmallIntestineMat = logicSmallIntestine->GetMaterial()->GetName();
172  G4cout << "Material of SmallIntestine = " << SmallIntestineMat << G4endl;
173 
174  // Testing Density
175  G4double SmallIntestineDensity = logicSmallIntestine->GetMaterial()->GetDensity();
176  G4cout << "Density of Material = " << SmallIntestineDensity*cm3/g << " g/cm^3" << G4endl;
177 
178  // Testing Mass
179  G4double SmallIntestineMass = (SmallIntestineVol)*SmallIntestineDensity;
180  G4cout << "Mass of SmallIntestine = " << SmallIntestineMass/gram << " g" << G4endl;
181 
182 
183  return physSmallIntestine;
184 }