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