# JSROOT Geometry Item

**URL:** <https://root-forum.cern.ch/t/jsroot-geometry-item/47438>\
**Category:** ROOT\
**Tags:** jsroot\
**Created:** [October 28, 2021, 1:57am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438 "2021-10-28T01:57:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ED\_ED](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ed_ed/32/27740_2.png) [@ED\_ED](https://root-forum.cern.ch/u/ED_ED)\
**Post date:** [October 28, 2021, 1:57am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/1 "2021-10-28T01:57:24Z")

</div>

I have two data ,one is detecotr,another is event data, if i want show the data in one canvas in 3D(the detector show by geometry,and the event show by 3D line) how can i do.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [October 28, 2021, 6:23am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/2 "2021-10-28T06:23:11Z")

</div>

Hi,

Detector drawing should be straightforward to do - see examples here:

[https://root.cern/js/latest/examples.htm#tgeo\_eve](https://root.cern/js/latest/examples.htm#tgeo_eve)

Geometry can be stored as `TGeoManager` or `TEveGeoShapeExtract` instance.  
And geometry drawing can be used as place to draw objects like `TEvePointSet` and `TEveTrack`

[https://root.cern/js/latest/examples.htm#tgeo\_tracks+hits](https://root.cern/js/latest/examples.htm#tgeo_tracks+hits)

But question - in which form your event data are stored?  
If you have `TTree`, you have to extract your data and convert into object like `TEveTrack`.  
This can be done with plain C++ ROOT code, but also there is example how data from TTree  
can be read directly by JSROOT:

[https://root.cern/js/latest/api.htm#ttree\_extract\_tracks](https://root.cern/js/latest/api.htm#ttree_extract_tracks)

There is small JavaScript loaded which performs such transformation:

> <https://github.com/root-project/jsroot/blob/master/demo/alice_esd.js>

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![ED\_ED](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ed_ed/32/27740_2.png) [@ED\_ED](https://root-forum.cern.ch/u/ED_ED)\
**Post date:** [October 28, 2021, 9:16am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/4 "2021-10-28T09:16:25Z")

</div>

I think, but I not sure,my ![file](https://github.com/ED-97/picture/blob/main/FullSim.root) is TTree data,  
because I get the gui like ![this](https://github.com/ED-97/picture/blob/main/36%243BA9U)4T%7DWQ7AF%5BS(I(S.png)  
if i extract the data to TTEvetrack i want to merge into 3D Detector(this i have completed),i shoud put the data in jsroot? or i need to more,

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [October 28, 2021, 10:24am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/5 "2021-10-28T10:24:44Z")

</div>

Attachment is missing in your post.

Do you have geometry and data in ROOT files?  
Can you post them here?  
Of course if size is not too large.

---

<div class="post-metadata">

**Author:** ![ED\_ED](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ed_ed/32/27740_2.png) [@ED\_ED](https://root-forum.cern.ch/u/ED_ED)\
**Post date:** [October 28, 2021, 1:08pm UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/6 "2021-10-28T13:08:40Z")

</div>

sorry,the previous link have some problem, the detector i have achieved,like this [detector](https://github.com/ED-97/picture/blob/main/detector.png?raw=true),but this is so ugly i change the light , color opacity, and Effect processing after rendering(i have some knowladge of threejs) ,but i still get a bad result (I used Threejs to draw a model of the probe) your demo are so beautiful, do you have some experience?  
the event file gui is [this](https://github.com/ED-97/picture/blob/main/event.png?raw=true) ,and the file on [here](https://github.com/ED-97/picture/blob/main/FullSim.root?raw=true) the file is ttree? and if is,i need convert to TTeveTrack and add to threejs.scene or JSROOT has other function?

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [October 28, 2021, 2:05pm UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/7 "2021-10-28T14:05:56Z")

</div>

Yes, your events data stored as TTree.  
One can browse it like this:

[https://root.cern/js/latest/?file=https://raw.githubusercontent.com/ED-97/picture/main/FullSim.root+](https://root.cern/js/latest/?file=https://raw.githubusercontent.com/ED-97/picture/main/FullSim.root+)

And one can extract (dump) data:

[https://root.cern/js/latest/?file=https://raw.githubusercontent.com/ED-97/picture/main/FullSim.root+&item=events&opt=SCDHitCol\>\>dump](https://root.cern/js/latest/?file=https://raw.githubusercontent.com/ED-97/picture/main/FullSim.root+&item=events&opt=SCDHitCol%3E%3Edump)

Do you have geometry model of your detector?

---

<div class="post-metadata">

**Author:** ![ED\_ED](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ed_ed/32/27740_2.png) [@ED\_ED](https://root-forum.cern.ch/u/ED_ED)\
**Post date:** [October 28, 2021, 2:37pm UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/8 "2021-10-28T14:37:01Z")

</div>

yes [i have](https://github.com/ED-97/picture/blob/main/HERD.root?raw=true),(I drew the probe in Threejs with some XML files ) so if i want to draw the evnet in detector,i need to extract the data to TTeveTrack and then draw them in scene or add them into item?  
and Do you have a way to beautify my geometry?

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [October 28, 2021, 3:28pm UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/9 "2021-10-28T15:28:48Z")

</div>

Here how your geometry drawing looks like:

[https://root.cern/js/latest/?file=https://raw.githubusercontent.com/ED-97/picture/main/HERD.root+&item=Default](https://root.cern/js/latest/?file=https://raw.githubusercontent.com/ED-97/picture/main/HERD.root+&item=Default)

> [@ED\_ED](#):
>
> i need to extract the data to TTeveTrack and then draw them in scene or add them into item?

If you have code where you can easily access data from FullSim.root file - then just use it to convert into `TEveTrack` or `TGeoTrack` objects. And store them as `TList` in other ROOT file. This is how following example works:

> **[JSROOT examples](https://root.cern/js/latest/examples.htm#tgeo_tracks)**
>
> Web page shows supported ROOT classes and correspondent draw options

Or you can implement JavaScript code which extract tracks directly from ROOT TTree.  
This is how other example is working:

> **[JSROOT API examples](https://root.cern/js/dev/api.htm#ttree_extract_tracks)**
>
> Web page shows URL syntax and JSROOT API usage

---

<div class="post-metadata">

**Author:** ![ED\_ED](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ed_ed/32/27740_2.png) [@ED\_ED](https://root-forum.cern.ch/u/ED_ED)\
**Post date:** [October 29, 2021, 2:44am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/10 "2021-10-29T02:44:29Z")

</div>

ok,i think i konw how i should do next,thanks for your help.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [November 12, 2021, 2:44am UTC](https://root-forum.cern.ch/t/jsroot-geometry-item/47438/11 "2021-11-12T02:44:40Z")

</div>

Closed on November 12, 2021, 2:44am UTC

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