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
PHG4SpacalDisplayAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4SpacalDisplayAction.cc
1
#include "
PHG4SpacalDisplayAction.h
"
2
3
#include "
PHG4CylinderGeom_Spacalv1.h
"
// for PHG4CylinderGeom_Spacalv1
4
5
#include <
g4main/PHG4DisplayAction.h
>
// for PHG4DisplayAction
6
#include <
g4main/PHG4Utils.h
>
7
8
#include <TSystem.h>
9
10
#include <Geant4/G4LogicalVolume.hh>
11
#include <Geant4/G4String.hh>
// for G4String
12
#include <Geant4/G4VisAttributes.hh>
13
14
#include <iostream>
15
#include <utility>
// for pair
16
17
using namespace
std;
18
19
PHG4SpacalDisplayAction::PHG4SpacalDisplayAction
(
const
std::string &
name
)
20
:
PHG4DisplayAction
(name)
21
, m_Geom(nullptr)
22
{
23
}
24
25
PHG4SpacalDisplayAction::~PHG4SpacalDisplayAction
()
26
{
27
for
(
auto
&
it
:
m_VisAttVec
)
28
{
29
delete
it
;
30
}
31
m_VisAttVec.clear();
32
}
33
34
void
PHG4SpacalDisplayAction::ApplyDisplayAction
(
G4VPhysicalVolume
*
/*physvol*/
)
35
{
36
// check if vis attributes exist, if so someone else has set them and we do nothing
37
for
(
auto
it
:
m_LogicalVolumeMap
)
38
{
39
G4LogicalVolume
*logvol =
it
.first;
40
if
(logvol->
GetVisAttributes
())
41
{
42
continue
;
43
}
44
G4VisAttributes
*visatt =
new
G4VisAttributes
();
45
visatt->
SetVisibility
(
true
);
46
visatt->
SetForceSolid
(
true
);
47
visatt->
SetForceWireframe
(
false
);
48
49
m_VisAttVec
.push_back(visatt);
// for later deletion
50
if
(
it
.second ==
"AzimuthSegment"
)
51
{
52
visatt->
SetColor
(.1, .1, .1, .5);
53
visatt->
SetVisibility
(
m_Geom
->
is_virualize_fiber
());
54
visatt->
SetForceSolid
(
false
);
55
}
56
else
if
(
it
.second ==
"Block"
)
57
{
58
visatt->
SetColor
(.3, .3, .3, .3);
59
visatt->
SetVisibility
(
m_Geom
->
is_azimuthal_seg_visible
() or
m_Geom
->
is_virualize_fiber
());
60
visatt->
SetForceSolid
(not
m_Geom
->
is_virualize_fiber
());
61
}
62
else
if
(
it
.second ==
"Divider"
)
63
{
64
visatt->
SetColor
(.8, 1, .8, .3);
65
visatt->
SetVisibility
(
m_Geom
->
is_azimuthal_seg_visible
());
66
}
67
else
if
(
it
.second ==
"Fiber"
)
68
{
69
PHG4Utils::SetColour
(visatt,
"G4_POLYSTYRENE"
);
70
visatt->
SetVisibility
(
m_Geom
->
is_virualize_fiber
());
71
visatt->
SetForceSolid
(
m_Geom
->
is_virualize_fiber
());
72
}
73
else
if
(
it
.second ==
"FiberCore"
)
74
{
75
PHG4Utils::SetColour
(visatt,
"G4_POLYSTYRENE"
);
76
visatt->
SetVisibility
(
false
);
77
visatt->
SetForceSolid
(
false
);
78
}
79
else
if
(
it
.second ==
"LightGuide"
)
80
{
81
PHG4Utils::SetColour
(visatt,
m_MaterialMap
[
"LightGuide"
]);
82
visatt->
SetColor
(.8, 1, .8, .3);
83
visatt->
SetVisibility
(
m_Geom
->
is_azimuthal_seg_visible
() or
m_Geom
->
is_virualize_fiber
());
84
visatt->
SetForceSolid
(not
m_Geom
->
is_virualize_fiber
());
85
}
86
else
if
(
it
.second ==
"Sector"
)
87
{
88
visatt->
SetColor
(.5, .9, .5, .5);
89
visatt->
SetVisibility
(
m_Geom
->
is_azimuthal_seg_visible
() or
m_Geom
->
is_virualize_fiber
());
90
visatt->
SetForceSolid
(
false
);
91
visatt->
SetForceWireframe
(
true
);
92
}
93
else
if
(
it
.second ==
"SpacalCylinder"
)
94
{
95
PHG4Utils::SetColour
(visatt,
"W_Epoxy"
);
96
visatt->
SetForceSolid
((not
m_Geom
->
is_virualize_fiber
()) and (not
m_Geom
->
is_azimuthal_seg_visible
()));
97
}
98
else
if
(
it
.second ==
"Wall"
)
99
{
100
visatt->
SetColor
(.5, .9, .5, .1);
101
visatt->
SetVisibility
(
m_Geom
->
is_azimuthal_seg_visible
());
102
}
103
else
if
(
it
.second ==
"WallProj"
)
104
{
105
visatt->
SetColor
(.5, .9, .5, .2);
106
visatt->
SetVisibility
(
m_Geom
->
is_azimuthal_seg_visible
() and (not
m_Geom
->
is_virualize_fiber
()));
107
}
108
else
109
{
110
cout <<
"did not assing color to "
<<
it
.first->GetName()
111
<<
" under "
<<
it
.second << endl;
112
gSystem->Exit(1);
113
}
114
logvol->
SetVisAttributes
(visatt);
115
}
116
return
;
117
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4SpacalDisplayAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:42
using
1.8.2 with
ECCE GitHub integration