ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BeastMagnetDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BeastMagnetDisplayAction.cc
2 
4 #include <g4main/PHG4Utils.h>
5 
6 #include <Geant4/G4Colour.hh> // for G4Colour
7 #include <Geant4/G4LogicalVolume.hh>
8 #include <Geant4/G4VisAttributes.hh>
9 
10 #include <cmath> // for isfinite
11 
12 using namespace std;
13 
15  : PHG4DisplayAction(name)
16  , m_MyVolume(nullptr)
17 {
18 }
19 
21 {
22  for (auto &it : m_VisAttVec)
23  {
24  delete it;
25  }
26  m_VisAttVec.clear();
27  m_LogVolSet.clear();
28 }
29 
31 {
32  // check if vis attributes exist, if so someone else has set them and we do nothing
33  for (auto &it : m_LogVolSet)
34  {
35  if (it->GetVisAttributes())
36  {
37  continue;
38  }
39  G4VisAttributes *VisAtt = new G4VisAttributes();
40  m_VisAttVec.push_back(VisAtt);
41  VisAtt->SetVisibility(true);
42  VisAtt->SetForceSolid(true);
43  if (it->GetName().find("Coil") != string::npos)
44  {
45  VisAtt->SetColour(G4Colour::Cyan());
46  }
47  else if (it->GetName().find("CryostatHe") != string::npos)
48  {
49  VisAtt->SetColour(G4Colour::Blue());
50  }
51  else if (it->GetName().find("CryostatAl") != string::npos)
52  {
53  VisAtt->SetColour(G4Colour::Green());
54  }
55  else
56  {
57  VisAtt->SetColour(G4Colour::Red());
58  }
59 
60  it->SetVisAttributes(VisAtt);
61  }
62  return;
63 }