ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4BackwardHcalDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4BackwardHcalDisplayAction.cc
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  : PHG4DisplayAction(name)
23 {
24  showdetails = detailed;
25  if (!detailed) std::cout << "PHG4BackwardHcalDisplayAction::disabled detailed view of towers" << std::endl;
26 }
27 
29 {
30  for (auto &it : m_VisAttVec)
31  {
32  delete it;
33  }
34  m_VisAttVec.clear();
35 }
36 
38 {
39  // check if vis attributes exist, if so someone else has set them and we do nothing
40  for (auto it : m_LogicalVolumeMap)
41  {
42  G4LogicalVolume *logvol = it.first;
43  if (logvol->GetVisAttributes())
44  {
45  continue;
46  }
47  G4VisAttributes *visatt = new G4VisAttributes();
48  visatt->SetVisibility(true);
49  visatt->SetForceSolid(true);
50  m_VisAttVec.push_back(visatt); // for later deletion
51  if (it.second == "Absorber")
52  {
53  visatt->SetColour(G4Colour::Red());
54  if (showdetails)
55  visatt->SetVisibility(true);
56  else
57  visatt->SetVisibility(false);
58  }
59  else if (it.second == "FHcalEnvelope")
60  {
61  visatt->SetVisibility(false);
62  }
63  else if (it.second == "Scintillator")
64  {
65  visatt->SetColour(G4Colour::White());
66  if (showdetails)
67  visatt->SetVisibility(true);
68  else
69  visatt->SetVisibility(false);
70  }
71  else if (it.second == "WLSplate")
72  {
73  visatt->SetColour(G4Colour::Yellow());
74  if (showdetails)
75  visatt->SetVisibility(true);
76  else
77  visatt->SetVisibility(false);
78  }
79  else if (it.second == "SupportPlate")
80  {
81  visatt->SetColour(G4Colour::Gray());
82  if (showdetails)
83  visatt->SetVisibility(true);
84  else
85  visatt->SetVisibility(false);
86  }
87  else if (it.second == "SingleTower")
88  {
89  visatt->SetColour(G4Colour::Red());
90  if (showdetails)
91  visatt->SetVisibility(false);
92  else
93  visatt->SetVisibility(true);
94  }
95  else
96  {
97  cout << "unknown logical volume " << it.second << endl;
98  gSystem->Exit(1);
99  }
100  logvol->SetVisAttributes(visatt);
101  }
102  return;
103 }