ECCE @ EIC Software
 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
2 
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 
15  : PHG4DisplayAction(name)
16  , m_Params(pars)
17  , m_MyVolume(nullptr)
18  , m_VisAtt(nullptr)
19  , m_Colour(nullptr)
20 {
21 }
22 
24 {
25  delete m_VisAtt;
26  delete m_Colour;
27 }
28 
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;
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  {
49  m_VisAtt->SetVisibility(true);
50  m_VisAtt->SetForceSolid(true);
51  }
52  if (m_Colour)
53  {
55  m_Colour->GetGreen(),
56  m_Colour->GetBlue(),
57  m_Colour->GetAlpha());
58  m_VisAtt->SetVisibility(true);
59  m_VisAtt->SetForceSolid(true);
60  }
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 }