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