Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4BbcDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4BbcDisplayAction.cc
1 #include "PHG4BbcDisplayAction.h"
2 
3 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
4 
5 #include <Geant4/G4Colour.hh>
6 #include <Geant4/G4LogicalVolume.hh>
7 #include <Geant4/G4VisAttributes.hh>
8 
9 #include <TSystem.h>
10 
11 #include <iostream>
12 #include <utility> // for pair
13 
15  : PHG4DisplayAction(name)
16 {
17 }
18 
20 {
21  for (auto &it : m_VisAttVec)
22  {
23  delete it;
24  }
25  m_VisAttVec.clear();
26 }
27 
29 {
30  // check if vis attributes exist, if so someone else has set them and we do nothing
31  for (const auto &it : m_LogicalVolumeMap)
32  {
33  G4LogicalVolume *logvol = it.first;
34  if (logvol->GetVisAttributes())
35  {
36  continue;
37  }
38  G4VisAttributes *visatt = new G4VisAttributes();
39  visatt->SetVisibility(true);
40  visatt->SetForceSolid(true);
41  m_VisAttVec.push_back(visatt); // for later deletion
42  if (it.second == "Bbc_Breeder_Module")
43  {
44  visatt->SetColour(G4Colour::Green());
45  }
46  else if (it.second == "Bbc_Cover_Plates")
47  {
48  visatt->SetColour(G4Colour::Gray());
49  }
50  else if (it.second == "Bbc_Inner_Shell")
51  {
52  visatt->SetColour(G4Colour::Gray());
53  }
54  else if (it.second == "Bbc_quartz")
55  {
56  visatt->SetColour(G4Colour::Cyan());
57  }
58  else if (it.second == "Bbc_Outer_Shell")
59  {
60  visatt->SetColour(G4Colour::Gray());
61  }
62  else if (it.second == "Bbc_PMT")
63  {
64  visatt->SetColour(G4Colour::Blue());
65  }
66  else if (it.second == "Bbc_Shell")
67  {
68  visatt->SetColour(0.5, 0.5, 0.5, 0.4);
69  }
70  else if (it.second == "Bbc_Front_Plate")
71  {
72  visatt->SetColour(0.5, 0.5, 0.5, 0.4);
73  }
74  else if (it.second == "Bbc_attach_plate")
75  {
76  visatt->SetColour(G4Colour::Gray());
77  }
78  else if (it.second == "Bbc_CableCond")
79  {
80  visatt->SetColour(G4Colour::Yellow());
81  }
82  else if (it.second == "Bbc_CableShield")
83  {
84  visatt->SetColour(G4Colour::White());
85  }
86  else if (it.second == "Bbc_Base_Plates")
87  {
88  visatt->SetColour(G4Colour::White());
89  }
90  else if (it.second == "Bbc_Sidesupport_Plates")
91  {
92  visatt->SetColour(G4Colour::White());
93  }
94  else if (it.second == "Bbc_Support_Post")
95  {
96  visatt->SetColour(G4Colour::Green());
97  }
98  else if (it.second == "Bbc_Support_Arm")
99  {
100  visatt->SetColour(G4Colour::Green());
101  }
102  else if (it.second == "Bbc_Gusset0_Plates")
103  {
104  visatt->SetColour(G4Colour::White());
105  }
106  else if (it.second == "Bbc_Gusset1_Plates")
107  {
108  visatt->SetColour(G4Colour::White());
109  }
110  else if (it.second == "Bbc_Gusset2_Plates")
111  {
112  visatt->SetColour(G4Colour::White());
113  }
114  else if (it.second == "Bbc_Splice_Plates")
115  {
116  visatt->SetColour(G4Colour::White());
117  }
118  else
119  {
120  std::cout << "PHG4BbcDisplayAction::ApplyDisplayAction unknown logical volume " << it.second << " in " << GetName() << std::endl;
121  gSystem->Exit(1);
122  }
123  logvol->SetVisAttributes(visatt);
124  }
125  return;
126 }