I’m looking for some more complex examples of TGeoNode usage within an Eve application, and the ROOT tutorials don’t seem to provide very much in this area.
All I find in tutorials/eve from ROOT 6.18 is the following:
This is not really sufficient for what I want to do…
How can I pick a set of arbitrary TGeoNode objects from the geo manager, group them into an element list, and then have Eve display them under a single element in the tree, preserving their global positions in the scene?
The psuedo-code of what I want to do would be something like the following:
TEveElementList* detector = new TEveElementList("My Detector");
TEveElementList* subdet = new TEveElementList("subdetector");
subdet->AddElement(node1); // add a TEveGeoNode
subdet->AddElement(node2); // add another TEveGeoNode
detector->AddElement(subdet);
gEve->AddElement(detector);
This doesn’t seem to work, as nothing shows in the viewer. I can see that the Event tree is populated properly. The GL viewer just shows all black, even after I call the redraw function on the Eve manager.
The entire geometry DOES show up okay when I use TEveGeoTopNode, but I want to select only certain volumes to include in my scene, as the geometry is from a fairly messy GDML file with some dead material that I do not want included at all.
How can I go about doing this? Do I just need to adjust some visualization settings?
From what I can tell, what I’m trying to do is slightly different. I don’t want to set a top node that points at the actual geometry and then filter sub-volume visibility. In other words, I do not want to make use of the TEveGeoTopNode class to point into my full geometry or parts of it.
I want to create a list of nodes that I select myself, wrap them with TEveGeoNode, and then put them in a TEveElementList, and then I want the viewer display them with their global positions and rotations. I can get these lists and their elements to show up perfectly fine in the tree view on the left, but I just can’t get them to show up in the viewer. I’ve tried toggling various visibility settings but none of them seemed to have any effect - the canvas is black/blank.
Are there some specific visibility settings I should play with in order to get this working, either in Eve or the TGeoNode objects I’m trying to use?
Or do you think setting TEveGeoTopNode to point to my world volume and then turning off the nodes I don’t want to see is a better approach?
The problems is that parts of the detector are not grouped according to how I want them in the tree view, e.g. the tracker modules don’t have an envelope volume but I’d like to put them all in a “Tracker” group within Eve.
Oh, maybe you looked at the wrong example, the last one, test2.C from me earlier today copies out GeoShapes from given geo path and sets trnsformation matrices accordingly.
You could of course also set TEveGeoTopNode to anywhere in the tgeo hierarchy … but then you are limited with what TGeoPainter can do with the state in TGeoAtt of nodes and volumes.
I did look at the test2.C example. I’m not sure what you mean by “copies out GeoShapes” but I do see there is filtering of the Eve elements which seems to happen here:
I’m going to try this approach with TEveGeoTopNode just to get something going, so I can turn off various dead material volumes, etc.
Is there a certain approach you could suggest with adding elements in the original way I had wanted, e.g. lists of arbitrary TGeoNode objects which may not actually be within the same volume in the TGeoManager? (Am I missing something like this in the example you sent?)
I had found some code in another project which essentially had a structure like:
- detector (list)
- subdetector (list)
- Eve shape
[...]
But they had actually directly added TEveGeoShape objects to the lists rather than nodes from the geometry. When I do this instead with TEveGeoNode objects I don’t get the same result (geometry doesn’t show up in the viewer).
Maybe I can put some code on github as it might be easier to understand what I’m trying to accomplish here.
I’m still struggling with the best way to do this, as this seems heavily redundant to copy out all the information from a TGeoNode into an Eve object like you’ve done in the example, since I just want to use existing geometry nodes with all their attributes/matrices/shapes as is.