# About the conversion of gate data

**URL:** <https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426>\
**Category:** General Discussions\
**Tags:** pet\
**Created:** [October 23, 2022, 1:53pm UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426 "2022-10-23T13:53:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuanhang](https://avatars.discourse-cdn.com/v4/letter/y/ec9cab/32.png) [@yuanhang](https://castor-project.discourse.group/u/yuanhang)\
**Post date:** [October 23, 2022, 1:53pm UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/1 "2022-10-23T13:53:40Z")

</div>

hello everyone:  
When I want to convert a data file obtained from a GATE simulation to a castor data file, do I need to install GATE and can I complete the conversion without installing the GATE software.

---

<div class="post-metadata">

**Author:** ![Maxime\_Toussaint](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Maxime\_Toussaint](https://castor-project.discourse.group/u/Maxime_Toussaint)\
**Post date:** [October 23, 2022, 2:10pm UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/2 "2022-10-23T14:10:25Z")

</div>

If my memory serves right, CASToR “only” offers a converter for GATE acquisitions saved in the ROOT format. As such, it does not need GATE for the conversion, but it need ROOT.

Note: you can see this when compiling CASToR: if you set “GATE utilities” to True, it ask only for the path toward the ROOT program/script/thingy.

---

<div class="post-metadata">

**Author:** ![tmerlin](https://yyz2.discourse-cdn.com/free1/user_avatar/castor-project.discourse.group/tmerlin/32/216_2.png) [@tmerlin](https://castor-project.discourse.group/u/tmerlin)\
**Post date:** [October 24, 2022, 5:52pm UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/3 "2022-10-24T17:52:08Z")

</div>

Hi,  
Maxime has good memory 🙂  
Indeed the converter only works with ROOT output format, so only ROOT library is required to perform the conversion.

---

<div class="post-metadata">

**Author:** ![ginsanity](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@ginsanity](https://castor-project.discourse.group/u/ginsanity)\
**Post date:** [December 23, 2022, 2:56am UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/4 "2022-12-23T02:56:05Z")

</div>

Hi Thibaut,

I am also trying to convert the root data (simulation of a ecat system) generated by GATE but this process has not been smooth.

Following the instruction provided in the general documentation of CASToR, I believe I have successfully installed the GATE utilities. In addition, the .geom file generated by `castor-GATEMacToGeom` also seems reasonable to me. However, `castor-GATERootToCastor` cannot convert the root file generated by GATE to those compatible with CASToR.

The only thing (or violation) that I can think about is: the geometry I used for GATE simulation has applied both linear repeater and ring repeater in the first hierarchic level (block for ecat), while in the general documentation, it is mentioned that it is assumed that the first hierarchic level element (i.e rsector for cylindricalPET and block for ecat) use a ring repeater. Do you think this could be the cause of my problem? If so, how should we create geometry for PET system that has multiple rings along the axial direction?

In text below, I have pasted how I called `castor-GATERootToCastor` in the terminal and what error message has been printed. However, I am rather clueless toward what it means.

```auto
bogao@cri-gpu:~/castor/castor_v3.1.1$ castor-GATERootToCastor -i /home/bwang/JOYbrain3/output/SimJoyBrainAtt_360.Coincidences.root -o /home/bogao/castor/GateSim/JoyBrain/SimJoyBrainAtt_360Coin -m /home/bwang/JOYbrain3/Gatescript_360.mac -s JOYBrain3 -oh
0 : /home/bwang/JOYbrain3/Gatescript_360.mac
 --- Start conversion of datafile(s) : /home/bwang/JOYbrain3/output/SimJoyBrainAtt_360.Coincidences.root
     using mac file: /home/bwang/JOYbrain3/Gatescript_360.mac
     CASToR output header datafile: /home/bogao/castor/GateSim/JoyBrain/SimJoyBrainAtt_360Coin.Cdh
     CASToR output binary datafile: /home/bogao/castor/GateSim/JoyBrain/SimJoyBrainAtt_360Coin.Cdf

 ***Break*** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f6fc98f4c3a in __GI___ wait4 (pid=4059268, stat_loc=stat_loc
entry=0x7ffe5dc01228, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007f6fc98f4bfb in __GI___ waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffe5dc01228, options=options
entry=0) at waitpid.c:38
#2 0x00007f6fc9863f67 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3 0x00007f6fca4896de in TUnixSystem::StackTrace() () from /home/bogao/root/root/lib/libCore.so.6.26
#4 0x00007f6fca486565 in TUnixSystem::DispatchSignals(ESignals) () from /home/bogao/root/root/lib/libCore.so.6.26
#5 <signal handler called>
#6 0x000055c8f457ad24 in main ()
===========================================================

The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/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 0x000055c8f457ad24 in main ()
===========================================================

```

---

<div class="post-metadata">

**Author:** ![Virtuall](https://avatars.discourse-cdn.com/v4/letter/v/ecd19e/32.png) [@Virtuall](https://castor-project.discourse.group/u/Virtuall)\
**Post date:** [December 23, 2022, 3:34am UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/5 "2022-12-23T03:34:40Z")

</div>

Hi Bo,

Try to change your input root file name from _SimJoyBrainAtt\_360.Coincidences.root_ to _SimJoyBrainAtt\_360\_Coincidences.root_.

Best,  
Xinjie

---

<div class="post-metadata">

**Author:** ![ginsanity](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@ginsanity](https://castor-project.discourse.group/u/ginsanity)\
**Post date:** [December 23, 2022, 3:49am UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/6 "2022-12-23T03:49:11Z")

</div>

Hi Xinjie,

Thanks for your quick repliy! I modified the name of the root file just now but unfortunately the problem still exists. 🙁

Nevertheless, thanks for your reply and this is indeed a perspective we have never thought about.

Kind regards,  
Bo

---

<div class="post-metadata">

**Author:** ![Virtuall](https://avatars.discourse-cdn.com/v4/letter/v/ecd19e/32.png) [@Virtuall](https://castor-project.discourse.group/u/Virtuall)\
**Post date:** [December 23, 2022, 5:58am UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/7 "2022-12-23T05:58:23Z")

</div>

Would you mind sharing your GATE macro for this root file? Also, if you can share the corresponding .geom file, that would be better. I will have a glance at it.

Best,  
Xinjie

---

<div class="post-metadata">

**Author:** ![ginsanity](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@ginsanity](https://castor-project.discourse.group/u/ginsanity)\
**Post date:** [December 23, 2022, 7:21am UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/8 "2022-12-23T07:21:18Z")

</div>

Hi all,

My colleague has figured out the problem in our case.

In short, currently GATE offers two approaches to generate root file. The first one is the conventional method and the utilities provided by CASToR has no issues to convert root files generated with such approach.

However, another approach (which is currently being recommended by GATE) to generate the root file is to use the [GateToTree](https://opengate.readthedocs.io/en/latest/data_output_management.html#new-unified-tree-output-general-set-label) class. Unfortunately, the utilities provided by CASToR cannot convert the root file generated by such approach.

Hope such information could also be helpful to someone in the future 😃

Kind regards,  
Bo

---

<div class="post-metadata">

**Author:** ![ginsanity](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@ginsanity](https://castor-project.discourse.group/u/ginsanity)\
**Post date:** [December 23, 2022, 7:27am UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/9 "2022-12-23T07:27:00Z")

</div>

Hi Xinjie,

Since we have already found the problem, I guess it is no longer necessary for me to sent the .geom file or GATE macro to you.

Nevertheless, please accept my sincere gratitude for having such a nice member in our community.

Kind regards,  
Bo

---

<div class="post-metadata">

**Author:** ![tmerlin](https://yyz2.discourse-cdn.com/free1/user_avatar/castor-project.discourse.group/tmerlin/32/216_2.png) [@tmerlin](https://castor-project.discourse.group/u/tmerlin)\
**Post date:** [January 5, 2023, 3:42pm UTC](https://castor-project.discourse.group/t/about-the-conversion-of-gate-data/426/10 "2023-01-05T15:42:53Z")

</div>

Hi Bo,  
Thank you for the information. At the time the converter was implemented this approach was not available, the code will have to be updated in order to read the new macro commands. Definitely something we will have to look at!

Kind regards,  
Thibaut
