ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4MvtxDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4MvtxDisplayAction.cc
2 
3 #include "g4main/PHG4DisplayAction.h" // for PHG4DisplayAction
4 #include <g4main/PHG4Utils.h>
5 
6 #include <Geant4/G4LogicalVolume.hh>
7 #include <Geant4/G4VisAttributes.hh>
8 
9 #include <utility> // for pair
10 
11 using namespace std;
12 
14  : PHG4DisplayAction(name)
15 {
16 }
17 
19 {
20  for (auto &it : m_VisAttVec)
21  {
22  delete it;
23  }
24  m_VisAttVec.clear();
25 }
26 
28 {
29  // check if vis attributes exist, if so someone else has set them and we do nothing
30  for (auto it : m_LogicalVolumeMap)
31  {
32  G4LogicalVolume *logvol = it.first;
33  if (logvol->GetVisAttributes())
34  {
35  continue;
36  }
37  G4VisAttributes *visatt = new G4VisAttributes();
38  m_VisAttVec.push_back(visatt); // for later deletion
39  if (it.second == "Carbon")
40  {
41  visatt->SetColour(0.5, 0.5, 0.5, .25);
42  }
43  else if (it.second == "M60J3K")
44  {
45  visatt->SetColour(0.25, 0.25, 0.25, .25);
46  }
47  else if (it.second == "WATER")
48  {
49  visatt->SetColour(0.0, 0.5, 0.0, .25);
50  }
51  else if (it.second == "SI")
52  {
53  PHG4Utils::SetColour(visatt, "G4_Si");
54  }
55  else if (it.second == "KAPTON")
56  {
57  PHG4Utils::SetColour(visatt, "G4_KAPTON");
58  }
59  else if (it.second == "ALUMINUM")
60  {
61  PHG4Utils::SetColour(visatt, "G4_Al");
62  }
63  else
64  {
65  visatt->SetColour(.2, .2, .7, .25);
66  }
67  visatt->SetVisibility(true);
68  visatt->SetForceSolid(true);
69  logvol->SetVisAttributes(visatt);
70  }
71  return;
72 }