ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ML2Ph_BoxInBox.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ML2Ph_BoxInBox.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
// The code was written by :
27
// ^Claudio Andenna claudio.andenna@ispesl.it, claudio.andenna@iss.infn.it
28
// *Barbara Caccia barbara.caccia@iss.it
29
// with the support of Pablo Cirrone (LNS, INFN Catania Italy)
30
// with the contribute of Alessandro Occhigrossi*
31
//
32
// ^INAIL DIPIA - ex ISPESL and INFN Roma, gruppo collegato Sanità, Italy
33
// *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
34
// Viale Regina Elena 299, 00161 Roma (Italy)
35
// tel (39) 06 49902246
36
// fax (39) 06 49387075
37
//
38
// more information:
39
// http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
40
//
41
//*******************************************************//
42
43
#include "
ML2Ph_BoxInBox.hh
"
44
#include "
G4SystemOfUnits.hh
"
45
46
CML2Ph_BoxInBox::CML2Ph_BoxInBox
()
47
{
// phantom size
48
halfSize
.
set
(150.*
mm
,150.*
mm
,150.*
mm
);
49
// phantom position
50
centre
.
set
(0.*
mm
,0.*
mm
,0.*
mm
);
51
}
52
53
CML2Ph_BoxInBox::~CML2Ph_BoxInBox
(
void
)
54
{
55
}
56
void
CML2Ph_BoxInBox::writeInfo
()
57
{
58
G4cout
<<
"\n\n\tcentre of the inside box: "
<<
centreBoxInside
/
mm
<<
" [mm]"
<<
G4endl
;
59
G4cout
<<
"\thalf thickness of the inside box: "
<<
halfBoxInside_Thickness
/
mm
<<
" [mm]\n"
<<
G4endl
;
60
}
61
bool
CML2Ph_BoxInBox::Construct
(
G4VPhysicalVolume
*PWorld)
62
{
63
PVWorld
= PWorld;
64
65
66
G4double
A
,
Z
;
67
A = 1.01*
g
/
mole
;
68
G4Element
* elH =
new
G4Element
(
"Hydrogen"
,
"H"
,Z = 1.,A);
69
70
A = 12.011*
g
/
mole
;
71
G4Element
* elC =
new
G4Element
(
"Carbon"
,
"C"
,Z = 6.,A);
72
73
A = 16.00*
g
/
mole
;
74
G4Element
* elO =
new
G4Element
(
"Oxygen"
,
"O"
,Z = 8.,A);
75
76
G4double
d
= 1.18*
g
/
cm3
;
77
G4int
natoms, ncomponents;
78
G4Material
*
PMMA
=
new
G4Material
(
"Polimetilmetacrilato"
,d,ncomponents=3);
79
PMMA->
AddElement
(elC, natoms=5);
80
PMMA->
AddElement
(elH, natoms=8);
81
PMMA->
AddElement
(elO, natoms=2);
82
83
d= 0.1*
g
/
cm3
;
84
G4Material
* lightWater =
new
G4Material
(
"lightWater"
,d,ncomponents=2);
85
lightWater->
AddElement
(elH, natoms=2);
86
lightWater->
AddElement
(elO, natoms=1);
87
88
89
90
// BOX INSIDE
91
G4Material
*boxInSideMaterial;
92
93
boxInSideMaterial=
PMMA
;
94
G4cout
<<
"boxInSideMaterial name "
<<boxInSideMaterial->
GetName
() <<
" density "
<< boxInSideMaterial->
GetDensity
()/(
g
/
cm3
) <<
" g/cm3"
<<
G4endl
;
95
96
centreBoxInside
.
set
(0,0,-50);
// the centre of the inside box
97
halfBoxInside_Thickness
=3.*
cm
;
// the half thickness of the inside box
98
99
G4Box
*boxInSide=
new
G4Box
(
"BoxInSide"
,
halfBoxInside_Thickness
,
halfBoxInside_Thickness
,
halfBoxInside_Thickness
);
100
G4LogicalVolume
*boxInSideLV=
new
G4LogicalVolume
(boxInSide, boxInSideMaterial,
"boxInSideLV"
);
101
boxInSidePV
=
new
G4PVPlacement
(0,
centre
+
centreBoxInside
,
"BoxInsidePV"
, boxInSideLV,
PVWorld
,
false
,0,0);
102
103
// layer PMMA
104
G4Material
*
layerMaterial
=
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_PLEXIGLASS"
);
// changable
105
G4double
halfPMMA_Z_Thickness=0.5*
cm
;
106
G4Box
*
layer
=
new
G4Box
(
"layer"
,
halfSize
.
getX
(),
halfSize
.
getY
(), halfPMMA_Z_Thickness);
107
G4LogicalVolume
*layerLV =
new
G4LogicalVolume
(layer, layerMaterial,
"layerLV"
);
108
layerPV
=
new
G4PVPlacement
(0,
centre
+
G4ThreeVector
(0,0,-
halfSize
.
getZ
()+halfPMMA_Z_Thickness),
"layerPV"
, layerLV,
PVWorld
,
false
,0,0);
109
110
G4cout
<<
"layerMaterial name "
<<layerMaterial->
GetName
() <<
" density "
<< layerMaterial->
GetDensity
()/(
g
/
cm3
) <<
" g/cm3"
<<
G4endl
;
111
112
// BOX OUTSIDE
113
G4Material
*boxOutSideMaterial=
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_LUNG_ICRP"
);
// changable
114
boxOutSideMaterial=lightWater;
115
G4double
halfBoxOutSide_Thickness=
halfSize
.
getZ
()-halfPMMA_Z_Thickness;
116
G4Box
*boxOutSide=
new
G4Box
(
"BoxOutSide"
,
halfSize
.
getX
(),
halfSize
.
getY
(), halfBoxOutSide_Thickness);
117
118
// boolean logic subtraction between outside box and inside box
119
120
G4SubtractionSolid
* OutMinusInBox =
new
G4SubtractionSolid
(
"OutMinusInBox"
, boxOutSide, boxInSide, 0,
centreBoxInside
-
G4ThreeVector
(0,0,5));
121
G4LogicalVolume
*OutMinusInBoxLV =
new
G4LogicalVolume
(OutMinusInBox, boxOutSideMaterial,
"OutMinusInBoxLV"
,0,0,0);
122
OutMinusInBoxPV
=
new
G4PVPlacement
(0,
centre
+
G4ThreeVector
(0,0,-
halfSize
.
getZ
()+2*halfPMMA_Z_Thickness+halfBoxOutSide_Thickness),
123
"OutMinusInBoxPV"
,OutMinusInBoxLV,
PVWorld
,
false
,0);
124
125
G4cout
<<
"boxOutSideMaterial name "
<<boxOutSideMaterial->
GetName
() <<
" density "
<<boxOutSideMaterial->
GetDensity
()/(
g
/
cm3
) <<
" g/cm3"
<<
G4endl
;
126
127
// Region for cuts
128
G4Region
*regVol=
new
G4Region
(
"BoxInBoxR"
);
129
G4ProductionCuts
* cuts =
new
G4ProductionCuts
;
130
cuts->
SetProductionCut
(0.01*
mm
);
131
regVol->
SetProductionCuts
(cuts);
132
133
134
OutMinusInBoxLV->
SetRegion
(regVol);
135
regVol->
AddRootLogicalVolume
(OutMinusInBoxLV);
136
OutMinusInBoxLV->
SetUserLimits
(
new
G4UserLimits
(0.01*
mm
));
137
138
layerLV->SetRegion(regVol);
139
regVol->
AddRootLogicalVolume
(layerLV);
140
layerLV->SetUserLimits(
new
G4UserLimits
(0.01*
mm
));
141
142
boxInSideLV->
SetRegion
(regVol);
143
regVol->
AddRootLogicalVolume
(boxInSideLV);
144
boxInSideLV->
SetUserLimits
(
new
G4UserLimits
(0.01*
mm
));
145
146
// Visibility
147
G4VisAttributes
* simple_PMMA_VisAttWalls=
new
G4VisAttributes
(
G4Colour::Gray
());
148
G4VisAttributes
* simple_InBox_VisAttWalls=
new
G4VisAttributes
(
G4Colour::Red
());
149
G4VisAttributes
* simple_OutBox_VisAttWalls=
new
G4VisAttributes
(
G4Colour::Blue
());
150
151
simple_OutBox_VisAttWalls->
SetVisibility
(
true
);
152
// simple_OutBox_VisAttWalls->SetForceWireframe(true);
153
// simple_OutBox_VisAttWalls->SetForceAuxEdgeVisible(true);
154
simple_OutBox_VisAttWalls->
SetLineWidth
(2.);
155
// simple_OutBox_VisAttWalls->SetForceSolid(true);
156
157
simple_PMMA_VisAttWalls->
SetVisibility
(
true
);
158
// simple_PMMA_VisAttWalls->SetForceSolid(true);
159
160
simple_InBox_VisAttWalls->
SetVisibility
(
true
);
161
// simple_InBox_VisAttWalls->SetForceSolid(true);
162
163
OutMinusInBoxLV->
SetVisAttributes
(simple_OutBox_VisAttWalls);
164
boxInSideLV->
SetVisAttributes
(simple_InBox_VisAttWalls);
165
layerLV->SetVisAttributes(simple_PMMA_VisAttWalls);
166
167
168
return
true
;
169
}
geant4
tree
geant4-10.6-release
examples
advanced
medical_linac
src
ML2Ph_BoxInBox.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:00
using
1.8.2 with
ECCE GitHub integration