-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Geom color scheme #21047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geom color scheme #21047
Conversation
Full description of the feature in geom/geom/src/TGeoColorScheme.cxx
e0114d5 to
7128804
Compare
Test Results 22 files 22 suites 3d 11h 11m 56s ⏱️ Results for commit 6a462da. ♻️ This comment has been updated with latest results. |
dpiparo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this solid work.
Besides the minor comments on the code, I see an opportunity for improvement, i.e. the possibility to add an example in the geometry tutorials and tests. Presently, the test coverage of the geometry package can be improved, and this seems like a perfect opportunity to kick off this process!
These changes are impactful and would also deserve some words (and a beautiful image, like "before and after") in the Release Notes.
|
Adding a tutorial for this, and release notes |
I added a nice tutorial and the entry in the release notes, w/o a picture (don't know where to put it) but a link to the PR. A coverage test for this is difficult to implement because it is pure visualization, but a working tutorial is more meaningful. |
dpiparo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just merge it at your convenience.
This Pull request:
Introduces an extensible color scheme mechanism for geometry visualization, improving the default coloring of imported geometries (notably GDML, which does not store color information).
Changes or fixes:
TGeoManager::DefaultColors() historically assigns colors based only on material effective Z, resulting in:
Modern detector descriptions contain rich material names (e.g. Copper, FR4, Kapton, Steel, Carbon fiber, Gases), which can be exploited to produce clearer and more meaningful visualizations.
What’s new
TGeoColorSchemethat encapsulates color and transparency policies.User extensibility:
std::function) to override colors or transparency,TGeoColorSchemefor full control.Backward compatibility:
TGeoManager::DefaultColors()with no arguments still works and now defaults to the natural scheme.API overview
if
scheme == nullptra defaultTGeoColorScheme(EGeoColorSet::kNatural)is used internally.The color set is selected via a global enum:
Examples
cs.SetZFallbackHook([](Int_t Z, EGeoColorSet) -> Int_t { float g = std::min(1.f, Z / 100.f); return TColor::GetColor(g, g, g); });Checklist:
This PR fixes #