ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4PhenixDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4PhenixDisplayAction.cc
2 
3 #include <Geant4/G4LogicalVolume.hh>
4 #include <Geant4/G4VisAttributes.hh>
5 
6 #include <TSystem.h>
7 
8 #include <iostream>
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 == "World")
40  {
41  visatt->SetVisibility(false);
42  }
43  else
44  {
45  cout << "unknown logical volume " << it.second << endl;
46  gSystem->Exit(1);
47  }
48  logvol->SetVisAttributes(visatt);
49  }
50  return;
51 }