TEve - Geometry - Visibility of Daugher volumes

Dear all,
I am having a problem in visualizing some volumes with Eve. I have the geometry file and the macro to open and inspect it, but I can see only some Volumes and others are not visible.

See for example the screenshot available here:

I have a DetBox->DetCage->6 layers + cushion, and each layer contains many tubes. I can only see the cushion (?).

You can find the geometry file and the macro to access it and visualize it here:
https://www.dropbox.com/s/kydilga71cb5o3d/muCastorApparatus_2020-06-05-12-24-29_0.root?dl=0 (17 kB)
(simply root checkGeo.C)

The code (checkGeo.C to access and view the geometry with TEve) is also reported here below.

Thank you.
Best, Germano

_ROOT Version: 6.16
_Platform: Mac OSX
_Compiler: default

#include <Riostream.h>
#include <iostream>

#include "TEveManager.h"
#include "TEveGeoNode.h"

#include "TGeoManager.h"
#include "TGeoNode.h"
#include "TGeoVolume.h"
#include "TGeoMedium.h"

#include <TFile.h>
#include <vector>

Bool_t makeGeo(Int_t);

void checkGeo(Int_t runNumber=0)
	//         Getting the geometry from output file


	///< Building the simple "gentle" geometry (and saving into a "new" file)
	Bool_t geo = makeGeo(runNumber);
    if(!geo) {
        cout << "checkGeo --> could not make geometry - please check file name/run number" << endl;
    ///< Reading "gentle" geometry file generated with makeGeo
    ostringstream gEveGeoInput;
    gEveGeoInput << "output/muCastorEveApparatus-" << runNumber << ".root";
	TFile* geom = TFile::Open(gEveGeoInput.str().c_str());

	TIter next(gDirectory->GetListOfKeys());
	TKey* key;
	TString shape("TEveGeoShapeExtract");

	while ((key = (TKey*) next())){
		if (shape == key->GetClassName())
			TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) key->ReadObj();
			TEveGeoShape* gGeomGentle = TEveGeoShape::ImportShapeExtract(gse, 0);

	// Getting the volume of interest

	// Visualization 
	TEveElement* top = gEve->GetCurrentEvent();
	gEve->FullRedraw3D(kTRUE, kTRUE);


Bool_t makeGeo(Int_t runNumber=0) {


// Getting the geometry from output file and making the gentle geometry (symple geometry)


// to run after 03/03/2016 (run with time-Nrun information)
    std::ostringstream sgeo;
    sgeo << "ls output/muCastorApparatus_*_" << runNumber << ".root";
    TString file_name(gSystem->GetFromPipe(sgeo.str().c_str()));
    string sfile = file_name.Data();
    if(strcmp(sfile.c_str(),"")==0) {
        cout << "Please check presence of file " << runNumber << endl;
        return false;
    gGeoManager = TGeoManager::Import(file_name);

    ostringstream gEveGeoOutput;
    gEveGeoOutput << "output/muCastorEveApparatus-" << runNumber << ".root";


    TGeoNode* topNode = gGeoManager->GetTopNode();
    TEveGeoTopNode* eveTopNode = new TEveGeoTopNode(gGeoManager, topNode);
//    eveTopNode->SetVisOption(0);
//    eveTopNode->SetVisLevel(6);
//    eveTopNode->GetNode()->GetVolume()->SetVisibility(kFALSE);

//gEve->Redraw3D(kTRUE); // Reset camera after the first event has been shown.


    return true;

May be @matevz can help.

Hi Germano,

When I zoom in, the wires appear … but not the tubes. I figured out so far the tubes do not have TGeoShapes stored for some reason, I need to investigate. I’ll also check if there is a cut that makes wires only appear when you zoom in and how to change it.

It made it simpler for me to investigate your geometry to enable picking on geometry elements so i was able to click on elements and see them highlight, like this:

root [3] auto gs = gEve->GetGlobalScene()
(TEveScene *) @0x7fff5be66ef8
root [4] gs->SetPickableRecursively(1)

Do you prefer to create TEveGeoShapes through the extract? You could also show the TGeo geometry directly through TEveGeoTopNode (or a set of them, as shown in tutorials/eve/geom_cms.C).
But if you want to control individual tubes (for interaction and for highlighting when they are hit) this is indeed a better way.


Oh, I figured out why there are no tubes, you are calling


the last kTRUE means leaf-nodes-only … so you need to change this to kFALSE.


There seems a problem with LOD calculation for tubes and they get drawn as single pixels way too soon. This is in parts of GL code that were written before my times so I don’t feel like jumping in at the moment :slight_smile:

I submitted a workaround PR:


Dear Matevz,
thank you for the suggestions. I added these two lines to the code and it is indeed very useful.
Best, Germano

Dear Matevz,
This is indeed the solution. Putting the third input of eveTopNode->SaveExtract to kFALSE did the trick and now I see the tubes!
Thank you very much.
Best, Germano

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