7 #include <Geant4/G4Colour.hh>
8 #include <Geant4/G4LogicalVolume.hh>
9 #include <Geant4/G4String.hh>
10 #include <Geant4/G4VisAttributes.hh>
33 G4Colour colour_air(0.0, 0.0, 0.0, 0.0);
34 G4Colour colour_CFRP(0.4, 0.4, 0.4, 1);
35 G4Colour colour_endcap(0.0, 0.0, 1.0, 0.2);
36 G4Colour colour_endcap_Al(0.3, 0.0, 1.0, 0.4);
37 G4Colour colour_endcap_C(0.4, 0.4, 0.4, 0.4);
38 G4Colour colour_copper(0.7, 0.4, 0, 1);
42 G4LogicalVolume *logvol =
it.first;
43 if (logvol->GetVisAttributes())
48 G4VisAttributes *visatt =
new G4VisAttributes();
49 visatt->SetVisibility(
true);
50 visatt->SetForceSolid(
true);
53 if (
it.second ==
"FPHX")
55 visatt->SetColour(G4Colour(1.0, 0.843, 0.0, 0.5));
56 visatt->SetVisibility(
true);
58 else if (
it.second ==
"Ladder" ||
it.second ==
"FPHXContainer" ||
it.second ==
"FPHXGlueContainer" ||
it.second ==
"StaveBox")
60 visatt->SetColour(colour_air);
61 visatt->SetForceWireframe(
true);
62 visatt->SetVisibility(
false);
64 else if (
it.second ==
"Rail")
66 visatt->SetColour(G4Colour::Cyan());
68 visatt->SetVisibility(
true);
70 else if (
it.second ==
"RohaCell")
72 visatt->SetColour(G4Colour(0.9, 0.9, 0.9, 0.5));
73 visatt->SetVisibility(
true);
75 else if (
it.second ==
"SiActive")
77 visatt->SetColour(G4Colour(1.0, 0, 0.0, 0.5));
78 visatt->SetVisibility(
true);
80 else if (
it.second ==
"SiInActive")
82 visatt->SetColour(G4Colour(0, 0, 1, 0.5));
83 visatt->SetVisibility(
true);
85 else if (
it.second ==
"StaveCooler")
87 visatt->SetColour(colour_CFRP);
88 visatt->SetVisibility(
true);
90 else if (
it.second ==
"StaveCurve")
92 visatt->SetColour(colour_CFRP);
93 visatt->SetVisibility(
true);
95 else if (
it.second ==
"StaveGlueBox")
97 visatt->SetColour(G4Colour::Cyan());
98 visatt->SetVisibility(
true);
100 else if (
it.second ==
"StavePipe")
102 visatt->SetColour(colour_CFRP);
103 visatt->SetVisibility(
true);
105 else if (
it.second ==
"StaveStraightInner")
107 visatt->SetColour(G4Colour::Grey());
108 visatt->SetVisibility(
true);
110 else if (
it.second ==
"StaveStraightOuter")
112 visatt->SetColour(colour_CFRP);
113 visatt->SetVisibility(
true);
115 else if (
it.second ==
"StaveWater")
117 visatt->SetColour(G4Colour::Blue());
118 visatt->SetVisibility(
true);
120 else if (
it.second.find(
"Endcap") != std::string::npos)
122 if (
it.second.find(
"_Al") != std::string::npos)
123 visatt->SetColour(colour_endcap_Al);
124 else if (
it.second.find(
"_C") != std::string::npos)
125 visatt->SetColour(colour_endcap_C);
127 visatt->SetColour(colour_endcap);
128 visatt->SetVisibility(
true);
130 else if (
it.second.find(
"Glue") != std::string::npos)
132 visatt->SetColour(G4Colour(0.1, 0.1, 0.1, 0.8));
133 visatt->SetVisibility(
true);
135 else if (
it.second.find(
"Copper") != std::string::npos)
137 visatt->SetColour(colour_copper);
138 visatt->SetVisibility(
true);
140 else if (
it.second.find(
"Kapton") != std::string::npos)
142 visatt->SetColour(G4Colour(0.0, 0.590, 1.0, 0.5));
143 visatt->SetVisibility(
true);
145 else if (
it.second ==
"Skin")
147 visatt->SetColour(colour_CFRP);
148 visatt->SetVisibility(
true);
152 std::cout <<
"did not assign color to " <<
it.first->GetName()
153 <<
" under " <<
it.second << std::endl;
156 logvol->SetVisAttributes(visatt);