ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4EPDDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4EPDDisplayAction.cc
1 #include "PHG4EPDDisplayAction.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 <iostream> // for operator<<, basic_ostream, endl
10 #include <utility> // for pair
11 #include <string>
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.second == "Absorber")
41  {
42  visatt->SetColour(G4Colour::Blue());
43  }
44  if (it.second.find("EPD_tile") != std::string::npos)
45  {
46  visatt->SetColour(G4Colour::Red());
47  }
48  else
49  {
50  std::cout << GetName() << " unknown logical volume " << it.second << std::endl;
51  visatt->SetColour(G4Colour::White());
52  }
53  logvol->SetVisAttributes(visatt);
54  }
55  return;
56 }