SetVisible geometry in JSROOT

Dear ROOTers,
I would like to display the geometry of the detector with JSROOT. The problem is that some of the detectors are not visible. I figured out that such objects have “emtpy checkbox” in TBrowser, however I can’t change this visiblity. I tried something like topNode->GetDaughter()->SetVisibility(kTRUE) but after opening new file (with changed geoemtry) in TBrowser such object still is not visible (have empty checkbox).
I suppose that solution is simple but I cannot find it.

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


JSROOT requires that visibility flag is set already in ROOT file - this is most easy way.
Normally one does: gGeoMaganager->GetVolume("name")->SetVisibility(kTRUE);
If it does not help - can you provide reproducer macro?


I tried something like this:

void FixDaughter(TGeoNodeMatrix* mother) {
  for (int i = 0; i < mother->GetNdaughters(); i++) {
    TGeoNode* dau = mother->GetDaughter(i);
    cout << dau << " " << dau->GetVolume() << endl;
void fix() {
  TFile* f          = new TFile("geom3.root");
  TGeoNodeMatrix* x = (TGeoNodeMatrix*) f->Get("cave_1");
  TFile* f2 = new TFile("fixed.root", "recreate");

However my code crash when calll


I’ve error like TGeoManager::IsClosed (this=0x0) at /opt/FairGroup/FairSoft_19/tools/root/build_for_fair/include/TGeoManager.h:283

Can you attach geom3.root file that I can reproduce problem?

I’m sending compressed version. I used event display and tried in event display do:


However exported files (via mother->Write()) are still not visible.
Edit: I created function for save geometry in Event Display, I see in “Geometry scene” that those functions make visible node but not the volume. (2,6 MB)


First of all, your macro does not work for me.
Problem that you tries to store part of geometry without TGeoManager - in many cases it does not work correctly.

But I can understand your problem now. It is kVisOnScreen bit which is assigned for very few volumes in geometry. JSROOT search first for such bits and if found displays only these volumes.

There is “no_screen” draw option for geometry which let ignore these bits. In your case:;black

Or you can clear these bits already before storing TGeoManager to the file:



Just small remark:

“no_screen” option exists since a while in JSROOT, in “dev” version I just add it to default context menu that it can be easily used in interactive mode. I also add possibility to easily expand TGeoNodeMatrix object which you store in the file.

But again - I recommend to store TGeoManager object

There are two problems:

  1. as far as I can see ClearVisibleVolumes is protected
  2. I look at your examples and still - some detectors are not visible


as far as I can see ClearVisibleVolumes is protected

Sorry, oversees it. Then just call gGeoManager->SetVisLevel(4);, it automatically should remove visibility bits as well.

I look at your examples and still - some detectors are not visible

Either visibility is not set or there are too many volumes and JSROOT cuts drawing of so many elements. You can try to add “all” to draw options like opt=no_screen;black;all

it seems to not help, I also tried geoManager->ClearAttributes() but still thes objects have some flag “not visible” also in event display I cannot change property “VisVolume”. I think it’s fixed somewhere in EventDiplay because when I try to change visibility of these volumes I get warning “Info in TGeoManager::SetVisLevel: Automatic visible depth disabled”.

Please try to draw geometry before calling SetVisLevel.
Only then painter object is created, it can reset visibility bits.
Or you can apply attached macro - reset_vis.C (327 Bytes)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.