EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4LBLVtxDisplayAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4LBLVtxDisplayAction.cc
2 
4 
5 #include <Geant4/G4Colour.hh> // for G4Colour
6 #include <Geant4/G4LogicalVolume.hh>
7 #include <Geant4/G4Material.hh>
8 #include <Geant4/G4VisAttributes.hh>
9 
10 using namespace std;
11 
13  : PHG4DisplayAction(name)
14 {
15 }
16 
18 {
19  for (auto &it : m_VisAttVec)
20  {
21  delete it;
22  }
23  m_VisAttVec.clear();
24  m_LogVolSet.clear();
25 }
26 
27 void G4LBLVtxDisplayAction::ApplyDisplayAction(G4VPhysicalVolume *physvol)
28 {
29  // check if vis attributes exist, if so someone else has set them and we do nothing
30  for (auto &it : m_LogVolSet)
31  {
32  if (it->GetVisAttributes())
33  {
34  continue;
35  }
36  G4VisAttributes *VisAtt = new G4VisAttributes();
37  m_VisAttVec.push_back(VisAtt);
38  string material_name(it->GetMaterial()->GetName());
39  // cout << "materialname: " << material_name << endl;
40  if (material_name == "ITS_WATER")
41  {
42  VisAtt->SetColor(G4Colour::Blue());
43  }
44  else if (material_name == "ITS_PEEKCF30")
45  {
46  VisAtt->SetColor(G4Colour::White());
47  }
48  else if (material_name == "ITS_FGS003")
49  {
50  VisAtt->SetColor(G4Colour::Yellow());
51  }
52  else if (material_name == "ITS_CarbonFleece")
53  {
54  VisAtt->SetColor(G4Colour::Red());
55  }
56  else
57  {
58  VisAtt->SetColor(G4Colour::Cyan());
59  }
60 
61  VisAtt->SetVisibility(true);
62  VisAtt->SetForceSolid(true);
63  it->SetVisAttributes(VisAtt);
64  }
65  return;
66 }