ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4ZDCDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4ZDCDisplayAction.cc
1 #include "PHG4ZDCDisplayAction.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 
14 using namespace std;
15 
17  : PHG4DisplayAction(name)
18 {
19 }
20 
22 {
23  for (auto &it : m_VisAttVec)
24  {
25  delete it;
26  }
27  m_VisAttVec.clear();
28 }
29 
31 {
32  // check if vis attributes exist, if so someone else has set them and we do nothing
33  for (auto it : m_LogicalVolumeMap)
34  {
35  G4LogicalVolume *logvol = it.first;
36  if (logvol->GetVisAttributes())
37  {
38  continue;
39  }
40  G4VisAttributes *visatt = new G4VisAttributes();
41  visatt->SetVisibility(true);
42  visatt->SetForceSolid(true);
43  m_VisAttVec.push_back(visatt); // for later deletion
44  if (it.second == "Absorber")
45  {
46  visatt->SetColour(G4Colour::Blue());
47  }
48  else if (it.second == "Envelope" || it.second == "fiber_plate_air")
49  {
50  visatt->SetVisibility(false);
51  visatt->SetForceSolid(false);
52  }
53  else if (it.second == "Fiber")
54  {
55  visatt->SetColour(G4Colour::Cyan());
56  }
57  else if (it.second == "FrontBackPlate")
58  {
59  visatt->SetColour(G4Colour::Red());
60  }
61  else if (it.second == "Window")
62  {
63  visatt->SetColour(G4Colour::Blue());
64  }
65  else if (it.second == "SMD")
66  {
67  visatt->SetColour(G4Colour::Yellow());
68  }
69  else if (it.second == "FiberPlate")
70  {
71  visatt->SetColour(G4Colour::Cyan());
72  }
73  else if (it.second == "Scint_solid")
74  {
75  visatt->SetColour(G4Colour::Cyan());
76  }
77  else
78  {
79  cout << GetName() << " unknown logical volume " << it.second << endl;
80  gSystem->Exit(1);
81  }
82  logvol->SetVisAttributes(visatt);
83  }
84  return;
85 }