/
G4JLeicVTXDisplayAction.cc
68 lines (60 loc) · 1.54 KB
/
G4JLeicVTXDisplayAction.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "G4JLeicVTXDisplayAction.h"
#include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
#include <Geant4/G4Colour.hh>
#include <Geant4/G4LogicalVolume.hh>
#include <Geant4/G4VisAttributes.hh>
#include <TSystem.h>
#include <iostream>
#include <utility> // for pair
using namespace std;
G4JLeicVTXDisplayAction::G4JLeicVTXDisplayAction(const std::string &name)
: PHG4DisplayAction(name)
{
}
G4JLeicVTXDisplayAction::~G4JLeicVTXDisplayAction()
{
for (auto &it : m_VisAttVec)
{
delete it;
}
m_VisAttVec.clear();
}
void G4JLeicVTXDisplayAction::ApplyDisplayAction(G4VPhysicalVolume *physvol)
{
// check if vis attributes exist, if so someone else has set them and we do nothing
for (auto it : m_LogicalVolumeMap)
{
G4LogicalVolume *logvol = it.first;
if (logvol->GetVisAttributes())
{
continue;
}
G4VisAttributes *visatt = new G4VisAttributes();
visatt->SetVisibility(true);
visatt->SetForceSolid(true);
m_VisAttVec.push_back(visatt); // for later deletion
if (it.second == "Absorber")
{
visatt->SetColour(G4Colour::Gray());
}
else if (it.second == "FHcalEnvelope")
{
visatt->SetVisibility(false);
}
else if (it.second == "Scintillator")
{
visatt->SetColour(G4Colour::Gray());
}
else if (it.second == "SingleScintillator")
{
visatt->SetColour(G4Colour::Cyan());
}
else
{
cout << "unknown logical volume " << it.second << endl;
gSystem->Exit(1);
}
logvol->SetVisAttributes(visatt);
}
return;
}