ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TpcEndCapDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TpcEndCapDisplayAction.cc
2 
3 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
4 #include <g4main/PHG4Utils.h>
5 
6 #include <Geant4/G4Colour.hh>
7 #include <Geant4/G4LogicalVolume.hh>
8 #include <Geant4/G4Material.hh>
9 #include <Geant4/G4String.hh> // for G4String
10 #include <Geant4/G4VisAttributes.hh>
11 
12 #include <utility> // for pair
13 
15  : PHG4DisplayAction(name)
16 {
17 }
18 
20 {
21  for (auto &it : m_VisAttVec)
22  {
23  delete it;
24  }
25  m_VisAttVec.clear();
26 }
27 
29 {
30  // check if vis attributes exist, if so someone else has set them and we do nothing
31  for (auto it : m_LogicalVolumeMap)
32  {
33  G4LogicalVolume *logvol = it.first;
34  if (logvol->GetVisAttributes())
35  {
36  continue;
37  }
38 
39  G4VisAttributes *visatt = new G4VisAttributes();
40  visatt->SetVisibility(true);
41  visatt->SetForceSolid(true);
42  m_VisAttVec.push_back(visatt); // for later deletion
43 
44  if (it.second == "G10" or it.second == "FR4")
45  {
46  visatt->SetColour(G4Colour(0.0, .5, 0.0));
47  }
48  else if (it.second == "wagon_wheel")
49  {
50  visatt->SetColour(G4Colour(.8, 0.0, 0.0));
51  visatt->SetForceLineSegmentsPerCircle(100);
52  }
53  else if (it.second == "cooling_block")
54  {
55  visatt->SetColour(G4Colour(.8, .8, .8));
56  visatt->SetForceLineSegmentsPerCircle(100);
57  }
58  else
59  {
60  PHG4Utils::SetColour(visatt, it.first->GetMaterial()->GetName());
61  }
62  logvol->SetVisAttributes(visatt);
63  }
64  return;
65 }