refactor: update Geant scene visualization to use PhysicalVolumes instead of raw Solids for improved placement and context handling.

This commit is contained in:
AndreaRigoni
2026-04-16 15:09:42 +00:00
parent e4379811a3
commit 64bfd92e34
17 changed files with 288 additions and 169 deletions

View File

@@ -6,6 +6,7 @@
#include "Vtk/HEP/Detectors/vtkDetectorChamber.h"
#include "Vtk/HEP/Geant/vtkBoxSolid.h"
#include "Vtk/HEP/Geant/vtkTessellatedSolid.h"
#include <cstring>
#include <iostream>
@@ -150,8 +151,20 @@ Prop3D *ObjectsContext::CreateProp3D(uLib::Object *obj) {
return new Cylinder(cylinder);
} else if (auto *assembly = dynamic_cast<uLib::Assembly *>(obj)) {
return new Assembly(assembly);
} else if (auto *pv = dynamic_cast<uLib::Geant::PhysicalVolume *>(obj)) {
uLib::Geant::Solid *solid = pv->GetLogical()->GetSolid();
if (auto *box = dynamic_cast<uLib::Geant::BoxSolid *>(solid)) {
return new BoxSolid(pv);
} else if (auto *tess = dynamic_cast<uLib::Geant::TessellatedSolid *>(solid)) {
return new TessellatedSolid(pv);
} else {
return new GeantSolid(pv);
}
} else if (auto *box = dynamic_cast<uLib::Geant::BoxSolid *>(obj)) {
return new BoxSolid(box);
} else if (auto *solid = dynamic_cast<uLib::Geant::Solid *>(obj)) {
// Unplaced solid visualization
return new GeantSolid(solid);
}
// Fallback if we don't know the exact class but it might be a context itself