Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4MicromegasDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4MicromegasDisplayAction.cc
2 
3 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
4 
5 #include <Geant4/G4Color.hh>
6 #include <Geant4/G4LogicalVolume.hh>
7 #include <Geant4/G4VisAttributes.hh>
8 
9 #include <iostream> // for operator<<, basic_ostream, endl
10 #include <string>
11 #include <utility> // for pair
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  for (auto it : m_LogicalVolumeMap)
30  {
31  G4LogicalVolume *logvol = it.first;
32  if (logvol->GetVisAttributes())
33  {
34  continue;
35  }
36  G4VisAttributes *visatt = new G4VisAttributes();
37  visatt->SetVisibility(true);
38  visatt->SetForceSolid(true);
39  m_VisAttVec.push_back(visatt); // for later deletion
40  if (it.first->GetName().find("invisible") != std::string::npos)
41  {
42  visatt->SetColour(it.second);
43  visatt->SetVisibility(false);
44  }
45  else
46  {
47  visatt->SetColour(it.second);
48  }
49  logvol->SetVisAttributes(visatt);
50  }
51  return;
52 }