Displaying name/label for TGeoNode

I was playing around with tutorials/gl/nucleus.C and I wanted to figure out how to add a name/lable to each of the nodes.

So I modified the while loop by calling SetName, for now using its unique identifier (i) as the label, after adding the node:

         auto n = top->AddNode(proton, i, new TGeoTranslation(x, y, z));
         n->SetName(std::to_string(i).c_str());

But when I ran this script, I still didn’t see any labels on the nodes, even hovering my mouse over each node showed no label.

Is there some other commands I need to add, to get it to display a label for each node?


_ROOT Version: v6-28-06
_Platform: Ubuntu 20.04
_Compiler: gcc/g++ 9.4.0


I guess @agheata might know.

Hi,

You also can try web-based geometry viewer. It shows tooltips for geometry elements.
Just run macro like: root --web=chrome tutorials/gl/nucleus.C

Regards,
Sergey

Hi, names are not shown in geometry displays, this functionality is missing. Right-clicking gives you information about the underlying volume objects (not nodes) and in this example, there are only two: proton and neutron.

I understand that for nucleus.C there’s only proton/neutrons. I was just looking for examples of geometry displays that would allow me to have objects that would display its label/name. The goal is to write a script that will display geometry objects of various nodes/edges, but need to have a label for each of nodes/edges. I like the “geo”-like viewing that allows one to rotate, zoom in/out for further inspection, but need the ability to label the objects, since there will be many of these nodes/edges. But it looks like the closest thing to this is the web-based viewer …

Is there a documentation on TGeo related objects? I’ve looked at the turtorial samples and looking through its various class definitions, but would really be helpful if there’s some document on this. For instance how does one draw lines or arrows?

https://root.cern/doc/v628/group__Geometry.html

https://root.cern/doc/v628/group__tutorial__geom.html

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