Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MIRDPancreas.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 and M. G. Pia, INFN Genova, 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 "G4MIRDPancreas.hh"
35 
36 #include "globals.hh"
37 #include "G4SystemOfUnits.hh"
38 #include "G4SDManager.hh"
39 #include "G4VisAttributes.hh"
40 #include "G4Ellipsoid.hh"
41 #include "G4ThreeVector.hh"
42 #include "G4VPhysicalVolume.hh"
43 #include "G4RotationMatrix.hh"
44 #include "G4Material.hh"
45 #include "G4LogicalVolume.hh"
47 #include "G4VPhysicalVolume.hh"
48 #include "G4PVPlacement.hh"
49 #include "G4Box.hh"
50 #include "G4SubtractionSolid.hh"
51 #include "G4HumanPhantomColour.hh"
52 
54 {
55 }
56 
58 {
59 
60 }
61 
63  const G4String& colourName
64  ,G4bool wireFrame, G4bool sensitivity)
65 {
66 
67  G4cout << "Construct "<< volumeName << G4endl;
68 
70  G4Material* soft = material -> GetMaterial("soft_tissue");
71  delete material;
72 
73  G4double ax= 3.*cm; //c
74  G4double by= 1.*cm;//b
75  G4double cz= 15.*cm;//a
76  G4double zcut1= -15. *cm;// -a
77  G4double zcut2= 0.0 *cm;
78 
79  G4Ellipsoid* pancreasFirst = new G4Ellipsoid("PancreasFirst",ax, by, cz,
80  zcut1, zcut2);
81 
82  G4double xx = 6. * cm;// 2*c
83  G4double yy = 2. * cm;// 2*b
84  G4double zz = 12. * cm; // cz - x1 = 3 cm
85  G4Box* subtrPancreas = new G4Box("SubtrPancreas",xx/2., yy/2., zz/2.);
86 
87  G4SubtractionSolid* pancreas = new G4SubtractionSolid("pancreas",
88  pancreasFirst,
89  subtrPancreas,
90  0,
91  G4ThreeVector(-3 * cm,0.0,-9.*cm));
92  //
93  G4LogicalVolume* logicPancreas = new G4LogicalVolume(pancreas, soft,
94  "logical" + volumeName,
95  0, 0, 0);
96  G4RotationMatrix* rotation = new G4RotationMatrix();
97  rotation ->rotateY(90. * degree);
98 
99 
100  G4VPhysicalVolume* physPancreas = new G4PVPlacement(rotation,
101  G4ThreeVector(-0. *cm, 0.0, 2*cm),//x0, 0, 2 cm
102  "physicalPancreas",
103  logicPancreas,
104  mother,
105  false,
106  0, true);
107  // Sensitive Body Part
108  if (sensitivity==true)
109  {
111  logicPancreas->SetSensitiveDetector( SDman->FindSensitiveDetector("BodyPartSD") );
112  }
113 
114  // Visualization Attributes
115  // G4VisAttributes* PancreasVisAtt = new G4VisAttributes(G4Colour(0.28,0.82,0.8));
116  G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour();
117  G4Colour colour = colourPointer -> GetColour(colourName);
118  G4VisAttributes* PancreasVisAtt = new G4VisAttributes(colour);
119  PancreasVisAtt->SetForceSolid(wireFrame);
120  logicPancreas->SetVisAttributes(PancreasVisAtt);
121 
122  G4cout << "Pancreas created !!!!!!" << G4endl;
123 
124  // Testing Pancreas Volume
125  G4double PancreasVol = logicPancreas->GetSolid()->GetCubicVolume();
126  G4cout << "Volume of Pancreas = " << PancreasVol/cm3 << " cm^3" << G4endl;
127 
128  // Testing Pancreas Material
129  G4String PancreasMat = logicPancreas->GetMaterial()->GetName();
130  G4cout << "Material of Pancreas = " << PancreasMat << G4endl;
131 
132  // Testing Density
133  G4double PancreasDensity = logicPancreas->GetMaterial()->GetDensity();
134  G4cout << "Density of Material = " << PancreasDensity*cm3/g << " g/cm^3" << G4endl;
135 
136  // Testing Mass
137  G4double PancreasMass = (PancreasVol)*PancreasDensity;
138  G4cout << "Mass of Pancreas = " << PancreasMass/gram << " g" << G4endl;
139 
140 
141  return physPancreas;
142 }