Script demonstrating geometry color schemes.
*/
#include <string>
#include <algorithm>
void geomAlice_itsv()
{
}
void help()
{
printf("In the viewer window:\n"
" - de-select \"Reset on update\"\n"
" - in the \"Clipping\" tab, select \"Plane\"\n"
" - rotate the image as uou wish and zoom using the mouse wheel\n"
" - click on the different default color schemes in control bar menu\n"
" - the \"gray\" function demonstrates overriding the Z-based fallback colors\n"
" - the \"override\" function demonstrates color override from a scheme by using a hook\n"
" - the \"transparency\" function demonstrates transparency override\n");
}
void natural()
{
return;
}
void flashy()
{
return;
}
void high_contrast()
{
return;
}
void gray()
{
return;
float g = std::min(1.f, Z / 100.f);
});
}
void transparent()
{
return;
gTransparent = !gTransparent;
if (gTransparent) {
return -1;
if (
m->GetDensity() < 0.1)
tr = 95;
std::string
n =
m->GetName();
std::transform(
n.begin(),
n.end(),
n.begin(), [](
unsigned char c) { return (char)std::tolower(c); });
if (
n.find(
"cable") != std::string::npos ||
n.find(
"cables") != std::string::npos)
tr = 70;
if (
n.find(
"tungsten") != std::string::npos ||
n.find(
"_w") != std::string::npos)
tr = 75;
}
return tr;
});
} else {
}
}
void color_override()
{
return;
return -1;
if (std::string(
m->GetName()).find(
"ITS_GEN") != std::string::npos)
return -1;
});
}
void geomColors()
{
bar->
AddButton(
"How to run ",
"help()",
"Instructions for running this macro");
"A natural color scheme with name-based/Z-binned lookup for material classification");
bar->
AddButton(
"Flashy ",
"flashy()",
"Flashy, high-contrast, presentation-friendly colors");
bar->
AddButton(
"High contrast ",
"high_contrast()",
"Darker, saturated colors suited for light backgrounds");
bar->
AddButton(
"Gray fallback ",
"gray()",
"Demonstrates overriding the Z-based fallback colors");
bar->
AddButton(
"Color override ",
"color_override()",
"Demonstrates color override from a scheme by using a hook");
bar->
AddButton(
"Transparency ON/OFF ",
"transparent()",
"Demonstrates transparency override from a scheme by using a hook");
geomAlice_itsv();
}
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
EGeoColorSet
Enumeration of predefined geometry color schemes.
@ kNatural
Natural, material-inspired colors (default).
@ kFlashy
Bright, high-contrast colors for presentations.
@ kHighContrast
Dark, saturated colors for light backgrounds.
externTGeoManager * gGeoManager
static Int_t GetColor(const char *hexcolor)
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
void Show()
Show control bar.
void AddButton(TControlBarButton *button)
Add button.
Strategy object for assigning colors and transparency to geometry volumes.
static const TGeoMaterial * GetMaterial(const TGeoVolume *vol)
Retrieve the material associated with a geometry volume.
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
Base class describing materials.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.