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
G4EicDircDisplayAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4EicDircDisplayAction.cc
1
#include "
G4EicDircDisplayAction.h
"
2
3
#include <
g4main/PHG4DisplayAction.h
>
4
#include <
g4main/PHG4Utils.h
>
5
6
#include <phparameter/PHParameters.h>
7
8
#include <Geant4/G4Colour.hh>
// for G4Colour
9
#include <Geant4/G4LogicalVolume.hh>
10
#include <Geant4/G4VisAttributes.hh>
11
12
#include <cmath>
// for isfinite
13
14
G4EicDircDisplayAction::G4EicDircDisplayAction
(
const
std::string &
name
,
PHParameters
*pars)
15
:
PHG4DisplayAction
(name)
16
, m_Params(pars)
17
, m_MyVolume(nullptr)
18
, m_VisAtt(nullptr)
19
, m_Colour(nullptr)
20
{
21
}
22
23
G4EicDircDisplayAction::~G4EicDircDisplayAction
()
24
{
25
delete
m_VisAtt
;
26
delete
m_Colour
;
27
}
28
29
void
G4EicDircDisplayAction::ApplyDisplayAction
(
G4VPhysicalVolume
*physvol)
30
{
31
// check if vis attributes exist, if so someone else has set them and we do nothing
32
for
(
auto
it
:
m_LogicalVolumeMap
)
33
{
34
m_MyVolume
=
it
.first;
35
if
(
m_MyVolume
->
GetVisAttributes
())
36
{
37
continue
;
38
}
39
m_VisAtt
=
new
G4VisAttributes
();
40
if
(
m_Params
->
get_int_param
(
"blackhole"
))
41
{
42
PHG4Utils::SetColour
(
m_VisAtt
,
"BlackHole"
);
43
m_VisAtt
->
SetVisibility
(
false
);
44
m_VisAtt
->
SetForceSolid
(
false
);
45
}
46
else
47
{
48
PHG4Utils::SetColour
(
m_VisAtt
,
m_Params
->
get_string_param
(
"material"
));
49
m_VisAtt
->
SetVisibility
(
true
);
50
m_VisAtt
->
SetForceSolid
(
true
);
51
}
52
if
(
m_Colour
)
53
{
54
m_VisAtt
->
SetColour
(
m_Colour
->
GetRed
(),
55
m_Colour
->
GetGreen
(),
56
m_Colour
->
GetBlue
(),
57
m_Colour
->
GetAlpha
());
58
m_VisAtt
->
SetVisibility
(
true
);
59
m_VisAtt
->
SetForceSolid
(
true
);
60
}
61
m_MyVolume
->
SetVisAttributes
(
m_VisAtt
);
62
}
63
return
;
64
}
65
66
void
G4EicDircDisplayAction::SetColor
(
const
double
red,
const
double
green,
const
double
blue,
const
double
alpha
)
67
{
68
if
(
std::isfinite
(red) &&
std::isfinite
(green) &&
std::isfinite
(blue) &&
std::isfinite
(alpha))
69
{
70
m_Colour
=
new
G4Colour
(red, green, blue, alpha);
71
}
72
return
;
73
}
fun4all_eicdetectors
blob
master
simulation
g4simulation
g4eicdirc
G4EicDircDisplayAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:47
using
1.8.2 with
ECCE GitHub integration