# Castor TOF reconstruction

**URL:** <https://castor-project.discourse.group/t/castor-tof-reconstruction/47>\
**Category:** General Discussions\
**Created:** [April 26, 2018, 1:17pm UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47 "2018-04-26T13:17:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikta\_zarif](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nikta\_zarif](https://castor-project.discourse.group/u/nikta_zarif)\
**Post date:** [April 26, 2018, 1:17pm UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47/1 "2018-04-26T13:17:04Z")

</div>

Hello,

I have a question regarding the conversion of TOF information. How do we set the TOF information flag to “on” when we use “castor-GATERootToCastor” or “castor-datafileConversionEx” tools to convert GATE root output to castor data file? Is there a specific command for that?

Best Regards  
Nikta Zarif Yussefian

---

<div class="post-metadata">

**Author:** ![Viatcheslav\_Sharyy](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Viatcheslav\_Sharyy](https://castor-project.discourse.group/u/Viatcheslav_Sharyy)\
**Post date:** [April 27, 2018, 8:27am UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47/2 "2018-04-27T08:27:06Z")

</div>

Hello Nikta,  
See example in the attached file (search for "SetTOFInfoFlag)

Slava

[castor-GATERootToCastorWithTOF.cc](https://castor-project.discourse.group/uploads/short-url/5lErsKk5BneDWGG8BUk2R8AFyIO.cc) (71.1 KB)

---

<div class="post-metadata">

**Author:** ![nikta\_zarif](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nikta\_zarif](https://castor-project.discourse.group/u/nikta_zarif)\
**Post date:** [April 27, 2018, 2:33pm UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47/3 "2018-04-27T14:33:07Z")

</div>

Hello Slava,

Thanks for your answer and for sharing the file.

How do you have access to this file? In the version I have downloaded from website the file you shared does not exist. I was not able to find it on doxygen either.

If I replace the file you shared with castor-GATERootToCastor and recompile, does castor-recon also need modification?

Regards

---

<div class="post-metadata">

**Author:** ![Viatcheslav\_Sharyy](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Viatcheslav\_Sharyy](https://castor-project.discourse.group/u/Viatcheslav_Sharyy)\
**Post date:** [April 27, 2018, 2:40pm UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47/4 "2018-04-27T14:40:16Z")

</div>

These is a modified version of castor-GATERootToCastor i made myself.  
I don’t remember if there is anything to modify other than this file.  
Try to compile it and tell me if something is missing.

The simplest way to add it is to copy the file instead of GATERootToCastor.  
If you want to have both, this file and GATERootToCastor, than you need to change the CMakeLists.txt file and add  
lines similar to those containing GATERootToCastor.

Slava

---

<div class="post-metadata">

**Author:** ![nikta\_zarif](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@nikta\_zarif](https://castor-project.discourse.group/u/nikta_zarif)\
**Post date:** [April 27, 2018, 4:08pm UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47/5 "2018-04-27T16:08:11Z")

</div>

Dear Slava,

Thanks for your immediate response.

Did you modify the iDataFilePET.cc as well? I tried to recompile and I am having these errors:

toolkits/castor-GATERootToCastor.cc: In function ‘int main(int, char\*\*)’:  
toolkits/castor-GATERootToCastor.cc:825:39: error: ‘class iDataFilePET’ has no member named ‘SetTOFInfoFlag’  
((iDataFilePET\*)Out\_data\_file)-\>SetTOFInfoFlag(true);  
^  
toolkits/castor-GATERootToCastor.cc:827:34: error: ‘class iDataFilePET’ has no member named ‘SetTOFResolution’  
((iDataFilePET\*)Out\_data\_file)-\>SetTOFResolution(tof\_reso);  
^  
toolkits/castor-GATERootToCastor.cc:829:34: error: ‘class iDataFilePET’ has no member named ‘SetTOFRange’  
((iDataFilePET\*)Out\_data\_file)-\>SetTOFRange(tof\_range);  
^  
toolkits/castor-GATERootToCastor.cc:1602:28: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteEvent’  
Out\_data\_file-\>PROJ\_WriteEvent(Event, 0);  
^  
toolkits/castor-GATERootToCastor.cc:1631:27: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteEvent’  
Out\_data\_file-\>PROJ\_WriteEvent(Event, 0);  
^  
toolkits/castor-GATERootToCastor.cc:1706:26: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteEvent’  
Out\_data\_file-\>PROJ\_WriteEvent(Event, 0);  
^  
toolkits/castor-GATERootToCastor.cc:1777:20: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteHeader’  
Out\_data\_file-\>PROJ\_WriteHeader();  
^  
toolkits/castor-GATERootToCastor.cc:1819:26: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteEvent’  
Out\_data\_file-\>PROJ\_WriteEvent(Event, 0);  
^  
toolkits/castor-GATERootToCastor.cc:1835:22: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteHeader’  
Out\_data\_file-\>PROJ\_WriteHeader();  
^  
toolkits/castor-GATERootToCastor.cc:1848:22: error: ‘class vDataFile’ has no member named ‘PROJ\_WriteHeader’  
Out\_data\_file-\>PROJ\_WriteHeader();  
^  
Makefile:223: recipe for target ‘build/\_\_tool\_castor-GATERootToCastor.o’ failed  
make: \*\*\* [build/\_\_tool\_castor-GATERootToCastor.o] Error 1

Regards  
Nikta

---

<div class="post-metadata">

**Author:** ![Viatcheslav\_Sharyy](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Viatcheslav\_Sharyy](https://castor-project.discourse.group/u/Viatcheslav_Sharyy)\
**Post date:** [April 30, 2018, 9:32am UTC](https://castor-project.discourse.group/t/castor-tof-reconstruction/47/6 "2018-04-30T09:32:50Z")

</div>

Hello Nikta,

I attache my iDataFilePET.hh.  
I see that there are other modification to in the version v2.0, so you need to copy to the new file the part related to the TOF modification (you can see it with diff). If not, I will try to merge my modification with the v2.0 version this week.

I also see that iDataFilePET::PROJ\_WriteHeader() method is absent now in v.2.0. You will probably need to replace Out\_data\_file-\>PROJ\_WriteEvent with Out\_data\_file-\>WriteEvent in toolkits/castor-GATERootToCastor.cc

Slava

[iDataFilePET.hh](https://castor-project.discourse.group/uploads/short-url/mMLWiokdu6qDJmIqb3bUJrt0CCr.hh) (14.8 KB)
