ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4BbcDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4BbcDisplayAction.cc
1 #include "PHG4BbcDisplayAction.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 <TSystem.h>
10 
11 #include <iostream>
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  G4VisAttributes *visatt = new G4VisAttributes();
39  visatt->SetVisibility(true);
40  visatt->SetForceSolid(true);
41  m_VisAttVec.push_back(visatt); // for later deletion
42  if (it.second == "Bbc_Breeder_Module")
43  {
44  visatt->SetColour(G4Colour::Green());
45  }
46  else if (it.second == "Bbc_Cover_Plates")
47  {
48  visatt->SetColour(G4Colour::Gray());
49  }
50  else if (it.second == "Bbc_Inner_Shell")
51  {
52  visatt->SetColour(G4Colour::Gray());
53  }
54  else if (it.second == "Bbc_quartz")
55  {
56  visatt->SetColour(G4Colour::Cyan());
57  }
58  else if (it.second == "Bbc_Outer_Shell")
59  {
60  visatt->SetColour(G4Colour::Gray());
61  }
62  else if (it.second == "Bbc_PMT")
63  {
64  visatt->SetColour(G4Colour::Blue());
65  }
66  else if (it.second == "Bbc_Shell")
67  {
68  visatt->SetColour(0.5, 0.5, 0.5, 0.4);
69  }
70  else if (it.second == "Bbc_Front_Plate")
71  {
72  visatt->SetColour(0.5, 0.5, 0.5, 0.4);
73  }
74  else if (it.second == "Bbc_attach_plate")
75  {
76  visatt->SetColour(G4Colour::Gray());
77  }
78  else
79  {
80  std::cout << "PHG4BbcDisplayAction::ApplyDisplayAction unknown logical volume " << it.second << " in " << GetName() << std::endl;
81  gSystem->Exit(1);
82  }
83  logvol->SetVisAttributes(visatt);
84  }
85  return;
86 }