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
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
blob
master
analysis
reconstruction
simulation
g4simulation
g4b0
B0TrackFastSim.cc
B0TrackFastSim.h
B0TrackFastSimEval.cc
B0TrackFastSimEval.h
EICG4B0Detector.cc
EICG4B0Detector.h
EICG4B0Detector_Pipe.cc
EICG4B0SteppingAction.cc
EICG4B0SteppingAction.h
EICG4B0Subsystem.cc
EICG4B0Subsystem.h
g4b0ecal
g4barrelmmg
g4beastmagnet
g4bwd
g4drcalo
g4drich
g4eiccalos
g4eicdirc
g4etof
g4jleic
g4lblvtx
g4lumi
g4mrich
g4rich
g4rp
g4trd
g4ttl
g4zdc
geant4
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EICG4B0Detector_Pipe.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EICG4B0Detector_Pipe.cc
1
//____________________________________________________________________________..
2
//
3
// This is a working template for the G4 Construct() method which needs to be implemented
4
// We wedge a method between the G4 Construct() to enable volume hierarchies on the macro
5
// so here it is called ConstructMe() but there is no functional difference
6
// Currently this installs a simple G4Box solid, creates a logical volume from it
7
// and places it. Put your own detector in place (just make sure all active volumes
8
// get inserted into the m_PhysicalVolumesSet)
9
//
10
// Rather than using hardcoded values you should consider using the parameter class
11
// Parameter names and defaults are set in EICG4B0Subsystem::SetDefaultParameters()
12
// Only parameters defined there can be used (also to override in the macro)
13
// to avoids typos.
14
// IMPORTANT: parameters have no inherent units, there is a convention (cm/deg)
15
// but in any case you need to multiply them here with the correct CLHEP/G4 unit
16
//
17
// The place where you put your own detector is marked with
18
// //begin implement your own here://
19
// //end implement your own here://
20
// Do not forget to include the G4 includes for your volumes
21
//____________________________________________________________________________..
22
23
#include "
EICG4B0Detector.h
"
24
25
#include <phparameter/PHParameters.h>
26
27
#include <
g4main/PHG4Detector.h
>
28
29
#include <Geant4/G4Color.hh>
30
#include <Geant4/G4LogicalVolume.hh>
31
#include <Geant4/G4Material.hh>
32
#include <Geant4/G4PVPlacement.hh>
33
#include <Geant4/G4SubtractionSolid.hh>
34
#include <Geant4/G4SystemOfUnits.hh>
35
#include <Geant4/G4Tubs.hh>
36
#include <Geant4/G4UnionSolid.hh>
37
#include <Geant4/G4VisAttributes.hh>
38
39
#include <cmath>
40
#include <iostream>
41
42
class
G4VSolid
;
43
class
PHCompositeNode
;
44
45
//____________________________________________________________________________..
46
EICG4B0Detector::EICG4B0Detector
(
PHG4Subsystem
*subsys,
47
PHCompositeNode
*Node,
48
PHParameters
*
parameters
,
49
const
std::string &dnam,
const
int
lyr)
50
:
PHG4Detector
(subsys, Node, dnam)
51
, m_Params(parameters)
52
, m_Layer(lyr)
53
{
54
}
55
56
//_______________________________________________________________
57
int
EICG4B0Detector::IsInDetector
(
G4VPhysicalVolume
*
volume
)
const
58
{
59
set<G4VPhysicalVolume *>::const_iterator iter =
m_PhysicalVolumesSet
.find(volume);
60
if
(iter !=
m_PhysicalVolumesSet
.end())
61
{
62
return
1;
63
}
64
return
0;
65
}
66
67
int
EICG4B0Detector::GetDetId
(
G4VPhysicalVolume
*volume)
const
68
{
69
if
(
IsInDetector
(volume))
70
{
71
return
1;
72
}
73
return
-1;
74
}
75
76
//_______________________________________________________________
77
void
EICG4B0Detector::ConstructMe
(
G4LogicalVolume
*logicWorld)
78
{
79
//begin implement your own here://
80
// Do not forget to multiply the parameters with their respective CLHEP/G4 unit !
81
cout <<
" !!! length = "
<<
m_Params
->
get_double_param
(
"length"
);
82
if
(
m_Params
->
get_int_param
(
"ispipe"
) == 0)
83
{
84
G4VSolid
*solid0 =
new
G4Tubs
(
"EICG4B0Solid0"
,
85
0.,
86
m_Params
->
get_double_param
(
"outer_radius"
) *
cm
,
87
m_Params
->
get_double_param
(
"length"
) / 2. *
cm
,
88
m_Params
->
get_double_param
(
"startAngle"
) *
degree
,
89
m_Params
->
get_double_param
(
"spanningAngle"
) *
degree
);
90
G4VSolid
*solid1 =
new
G4Tubs
(
"EICG4B0Solid1"
,
91
0.,
92
(
m_Params
->
get_double_param
(
"outer_radius"
) -
m_Params
->
get_double_param
(
"d_radius"
)) *
cm
,
93
m_Params
->
get_double_param
(
"length"
) / 2. *
cm
,
94
(
m_Params
->
get_double_param
(
"startAngle"
) +
m_Params
->
get_double_param
(
"spanningAngle"
)) *
degree
,
95
(360 -
m_Params
->
get_double_param
(
"spanningAngle"
)) *
degree
);
96
G4VSolid
*solidPipeHole =
new
G4Tubs
(
"EICG4B0IonPipeSolid"
,
97
0.,
98
m_Params
->
get_double_param
(
"pipe_hole"
) *
cm
,
99
m_Params
->
get_double_param
(
"length"
) *
cm
,
100
0., 360. *
degree
);
101
G4UnionSolid
*solid10 =
new
G4UnionSolid
(
"EICG4B0Solid10"
, solid0, solid1);
102
G4SubtractionSolid
*solidB0 =
new
G4SubtractionSolid
(
"EICG4B0Solid"
, solid10, solidPipeHole, 0,
G4ThreeVector
(
m_Params
->
get_double_param
(
"pipe_x"
) *
cm
,
m_Params
->
get_double_param
(
"pipe_y"
) *
cm
,
m_Params
->
get_double_param
(
"pipe_z"
) *
cm
));
103
G4LogicalVolume
*logical =
new
G4LogicalVolume
(solidB0,
104
//GetDetectorMaterial("G4_PbWO4"),
105
GetDetectorMaterial
(
m_Params
->
get_string_param
(
"material"
)),
106
"EICG4B0Logical"
);
107
108
G4VisAttributes
*vis =
new
G4VisAttributes
(
G4Color
(0.8, 0.4, 0.2, 1.0));
109
if
(
m_Params
->
get_string_param
(
"material"
) ==
"G4_PbWO4"
)
110
vis->
SetColor
(0.8, 0.4, 0.2, 1.0);
111
if
(
m_Params
->
get_string_param
(
"material"
) ==
"G4_Cu"
)
112
vis->
SetColor
(1., 0., 1., .5);
113
// G4VisAttributes *vis = new G4VisAttributes(G4Color(1, 0, 1, .8));
114
if
(
m_Params
->
get_string_param
(
"material"
) ==
"G4_Si"
)
115
vis->
SetColor
(1., 1., 0., .8);
116
// G4VisAttributes *vis = new G4VisAttributes(G4Color(1, 1, 0., .8));
117
// vis->SetForceSolid(true);
118
logical->
SetVisAttributes
(vis);
119
G4RotationMatrix
*rotm =
new
G4RotationMatrix
();
120
rotm->
rotateY
(
m_Params
->
get_double_param
(
"rot_y"
) *
deg
);
121
// rotm->rotateY(0. * deg);
122
123
G4VPhysicalVolume
*phy =
new
G4PVPlacement
(
124
rotm,
125
G4ThreeVector
(
m_Params
->
get_double_param
(
"place_x"
) *
cm
,
126
m_Params
->
get_double_param
(
"place_y"
) *
cm
,
127
m_Params
->
get_double_param
(
"place_z"
) *
cm
),
128
// G4ThreeVector(0. * cm,
129
// 0. * cm,
130
// 0. * cm),
131
logical,
"EICG4B0"
, logicWorld, 0,
false
,
OverlapCheck
());
132
// add it to the list of placed volumes so the IsInDetector method
133
// picks them up
134
m_PhysicalVolumesSet
.insert(phy);
135
// hard code detector id to 1
136
m_PhysicalVolumesDet
.insert({phy,
m_Params
->
get_double_param
(
"detid"
) + 1});
137
// m_LogicalVolumesSet.insert(logical);
138
//end implement your own here://
139
return
;
140
}
141
else
142
{
143
G4VSolid
*solidPipe =
new
G4Tubs
(
"EICG4B0IonPipe"
,
144
m_Params
->
get_double_param
(
"pipe_ir"
) *
cm
,
145
m_Params
->
get_double_param
(
"pipe_or"
) *
cm
,
146
m_Params
->
get_double_param
(
"length"
) *
cm
,
147
0., 360. *
degree
);
148
149
G4LogicalVolume
*logical =
new
G4LogicalVolume
(solidPipe,
150
GetDetectorMaterial
(
m_Params
->
get_string_param
(
"material"
)),
151
"EICG4B0Logical"
);
152
153
G4VisAttributes
*vis =
new
G4VisAttributes
(
G4Color
(0.5, 0.5, 0.5, 0.5));
154
vis->
SetForceSolid
(
true
);
155
logical->SetVisAttributes(vis);
156
G4RotationMatrix
*rotm =
new
G4RotationMatrix
();
157
rotm->
rotateY
(
m_Params
->
get_double_param
(
"rot_y"
) *
deg
);
158
G4VPhysicalVolume
*phy =
new
G4PVPlacement
(
159
rotm,
160
G4ThreeVector
(
m_Params
->
get_double_param
(
"pipe_x"
) *
cm
,
161
m_Params
->
get_double_param
(
"pipe_y"
) *
cm
,
162
m_Params
->
get_double_param
(
"pipe_z"
) *
cm
),
163
logical,
"EICG4B0"
, logicWorld, 0,
false
,
OverlapCheck
());
164
m_PhysicalVolumesSet
.insert(phy);
165
m_PhysicalVolumesDet
.insert({phy,
m_Params
->
get_double_param
(
"detid"
) + 1});
166
return
;
167
}
168
}
169
170
//_______________________________________________________________
171
void
EICG4B0Detector::Print
(
const
std::string &what)
const
172
{
173
std::cout <<
"EICG4B0 Detector:"
<< std::endl;
174
if
(what ==
"ALL"
|| what ==
"VOLUME"
)
175
{
176
std::cout <<
"Version 0.1"
<< std::endl;
177
std::cout <<
"Parameters:"
<< std::endl;
178
m_Params
->
Print
();
179
}
180
return
;
181
}
182
183
PHParameters
*
EICG4B0Detector::getParams
()
184
{
185
return
m_Params
;
186
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4b0
EICG4B0Detector_Pipe.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:46
using
1.8.2 with
ECCE GitHub integration