Browse the overlaps and extrusions of a geometry, and look at them in 3D.
The overlap check runs once, over the whole geometry, before the browser starts serving – TGeoVolume::CheckOverlaps() is recursive, so checking volumes one at a time as somebody clicks around both repeats the work and costs seconds per click. After the single pass the table is instant.
Pick a row and the 3D view shows that overlap and nothing else: the two volumes (red and yellow, semi-transparent) and the points on the offending surface (cyan). An overlap belongs to a logical volume, so if that volume is placed several times the pair is drawn at every placement.
#include <cstring>
#include <iostream>
{
if (!
f ||
f->IsZombie()) {
std::cerr << "cannot open " << fname << "\n";
return nullptr;
}
TIter next(
f->GetListOfKeys());
while (
auto *key = (
TKey *)next())
if (!std::strcmp(key->GetClassName(), "TGeoManager"))
std::cerr << "no TGeoManager in " << fname << "\n";
return nullptr;
}
void geom_overlaps(const char *fname = "http://root.cern/files/cms.root", double precision = 0.001)
{
auto *geom = load_geometry(fname);
if (!geom)
return;
auto *eveMng = REveManager::Create();
eveMng->AllowMultipleRemoteConnections(false, false);
std::cout << ">>> checking overlaps (precision " << precision << " cm) ...\n";
table->ScanOverlaps(geom, precision);
std::cout << ">>> found " << table->GetNumOverlaps() << " overlaps\n";
auto *tableScene = eveMng->SpawnNewScene("Overlap List");
tableScene->AddElement(table);
auto *tableViewer = eveMng->SpawnNewViewer("GeoOverlapTable", "");
tableViewer->AddScene(tableScene);
eveMng->GetEventScene()->AddElement(table->GetVizHolder());
eveMng->GetDefaultViewer()->SetCameraCenter(REveViewer::kCameraCenterBBox);
eveMng->Show();
}
The overlaps and extrusions of a geometry, as a flat list plus a 3D view.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
The manager class for any TGeo geometry.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Namespace for ROOT features in testing.
- Author
- Alja Mrak-Tadel
Definition in file geom_overlaps.C.