How do I draw two TGeoVolumes on the same canvas of the JSROOT using urls

I know that in Javascript you can redraw two TGeoVolumes on the same canvas, but I want to display two TGeoVolumes at the same time using the URL of JSROOT, but there is no implementation for this example. I refer to proj and modify the track file to TGeoVolume, which cannot be displayed. I would really appreciate it if you could help me with this problem!

Hi,

The only way to draw two volumes in JSROOT - to have them both in the same TGeoManager instance. It is not possible to superimpose them like in mentioned examples with tracks.

Regards,
Sergey

I manually tried different methods and came to the same conclusion – the JSROOT can only display one geometry. Further, does JSROOT treat TGeoVolume as a reference frame similar to top on which to draw various tracks and hits? That’s the first question

The second question is as follows:

  1. I drew a probe model using GEANT4 and exported it as a root file using some code. This file includes a TGeoManager with a TopVolume underneath it.
  2. I am now going to import this TopVolume from the root file, together with another TGeoVolume, as a child node of a new TGeoVolume.
  3. The specific code for adding nodes is as follows:
    top-> AddNode(hits, 1, nullptr);
    top-> AddNode(maceGeo, 1, nullptr);
  4. However, when I performed the above operations, the CLI of root showed some strange errors, which asked me to consult the forum. The details are as follows:

*** Break *** segmentation violation

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
There was a crash.
This is the entire stack trace of all threads:


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
#0  0x00007f0d26eea45a in __GI___wait4 (pid=77034, stat_loc=stat_loc
entry=0x7ffc937f6358, options=options
entry=0, usage=usage
entry=0x0) at .. /sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f0d26eea41b in __GI___waitpid (pid=< optimized out> , stat_loc=stat_loc
entry=0x7ffc937f6358, options=options
entry=0) at ./posix/waitpid.c:38
#2  0x00007f0d26e50bcb in do_system (line=< optimized out>)  at .. /sysdeps/posix/system.c:171
# 3 0 x00007f0d279168a4 TUnixSystem in: : StackTrace () () the from/home/tobias/root/lib/libCore. So. 6.26
# 4 0 x00007f0d27913bb5 TUnixSystem in: : DispatchSignals ESignals () () the from/home/tobias/root/lib/libCore. So. 6.26
#5  < signal handler called>
#6  0x00007f0d0bf9578a in TGeoVolume::AddNode(TGeoVolume*, int, TGeoMatrix*,  Char const *) () the from/home/tobias/root/lib/libGeom. So. 6.26.10
#7  0x00007f0d270733e5 in ??  (a)
#8  0x0000000000000016 in ??  (a)
#9  0x00007f0d22ec0920 in ??  () from /home/tobias/root/lib/libCling.so
#10 0x00000000017f9070 in ??  (a)
#11 0x00007f0d27073b20 in ??  (a)
#12 0x00005597747f0dd0 in ??  (a)
#13 0x0000559778fd51e0 in ??  (a)
#14 0x00000d70000000ce in ??  (a)
#15 0x00007f0d27323130 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#16 0x00005597747f0dd0 in ??  (a)
#17 0x00000000000000c5 in ??  (a)
#18 0x41006e8f774b9040 in ??  (a)
#19 0x0000559778d520c0 in ??  (a)
#20 0x4024000000000000 in ??  (a)
#21 0x00007f0d2733c7b0 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#22 0x00007f0d2733ce60 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#23 0x00007f0d27427540 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#24 0x00005597787a1d60 in ??  (a)
#25 0x0000000000000000 in ??  (a)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at xxx bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
#6  0x00007f0d0bf9578a in TGeoVolume::AddNode(TGeoVolume*, int, TGeoMatrix*,  Char const *) () the from/home/tobias/root/lib/libGeom. So. 6.26.10
#7  0x00007f0d270733e5 in ??  (a)
#8  0x0000000000000016 in ??  (a)
#9  0x00007f0d22ec0920 in ??  () from /home/tobias/root/lib/libCling.so
#10 0x00000000017f9070 in ??  (a)
#11 0x00007f0d27073b20 in ??  (a)
#12 0x00005597747f0dd0 in ??  (a)
#13 0x0000559778fd51e0 in ??  (a)
#14 0x00000d70000000ce in ??  (a)
#15 0x00007f0d27323130 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#16 0x00005597747f0dd0 in ??  (a)
#17 0x00000000000000c5 in ??  (a)
#18 0x41006e8f774b9040 in ??  (a)
#19 0x0000559778d520c0 in ??  (a)
#20 0x4024000000000000 in ??  (a)
#21 0x00007f0d2733c7b0 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#22 0x00007f0d2733ce60 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#23 0x00007f0d27427540 in ??  () from /lib/x86_64-linux-gnu/libstdc++.so.6
#24 0x00005597787a1d60 in ??  (a)
#25 0x0000000000000000 in ??  (a)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

In a word, thank you very much for your patient reply, which makes me understand jsroot better. I would appreciate it if you could give me more help.

Yes, only single geometry or volume can be displayed in one frame.
It is not possible to add more volumes to such frame - only tracks or hits.

About error - can you provide ROOT file with your geometry and macro which reproduce the error?

Ok!
For the sake of file security, can we communicate through email? For your privacy, I will provide my email address below.
jt_li[at)foxmail(dot)com
Note: [at) is “@”, the left and right brackets are different. (dot) is “.”, and the forum mechanism recognizes the following content as a link that the new user does not have permission to place. All these are to prevent crawled data.

Hi,

As usual, without macro code (provided via private mail) one cannot understand your problem.
Can you publish it here to demonstrate it?

First of all, one should avoid working with two instances of TGeoManager at the same time.
If really needed - set gGeoManager = nullptr; before reading/creating second instance.

Also when drawing geometry, use “ogl” draw option to get GL-based GeomtryViewer.

Once you able to see geometry with GeometryViewer, it also will works with JSROOT url like:

https://root.cern/js/latest/?file=path/to/GeoHits.root&item=GeoHits

If you allow to upload produced ROOT file here, I can immediately provide working URL using uploaded file.

Regards,
Sergey

Thank you very much for taking the time to solve my problem! Working backwards from my own understanding of the JSROOT problem and the macro problem, is the nature of ROOT development based on a top? The core idea of root is “root”, which can efficiently manage large amounts of data.
Examples of questions:
Example 1: Geometry files require a unique top volume
Example 2: Managing geometry files requires TGeoManager, and only one Macro file is allowed to exist. The solution to the above problem is to manually empty the existing gGeoManager, because any instance of TGeoManager I create will essentially point to this gGeoManager.
Extension: If I want to use TEveManager, still only one pointer is allowed. Is that right?

Yes, only single TEveManager instance can be used at a time.

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