# How to save and access reconstructed tracks

**URL:** <https://corryvreckan-forum.web.cern.ch/t/how-to-save-and-access-reconstructed-tracks/83>\
**Category:** Uncategorized\
**Created:** [September 18, 2023, 9:24am UTC](https://corryvreckan-forum.web.cern.ch/t/how-to-save-and-access-reconstructed-tracks/83 "2023-09-18T09:24:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![0010110101101011110](https://corryvreckan-forum.web.cern.ch/letter_avatar_proxy/v4/letter/0/839c29/32.png) [@0010110101101011110](https://corryvreckan-forum.web.cern.ch/u/0010110101101011110)\
**Post date:** [September 18, 2023, 9:24am UTC](https://corryvreckan-forum.web.cern.ch/t/how-to-save-and-access-reconstructed-tracks/83/1 "2023-09-18T09:24:27Z")

</div>

I am new to Corryvreckan (and ROOT). I run `corry` with the following config file:

```auto
[Corryvreckan]
output_directory = "corry_output"
log_level = "INFO"

detectors_file = "blah.geo"
histogram_file = "01_reconstruct_tracks.root"

[EventLoaderEUDAQ2]
name = "MIMOSA26_0"
file_name = "blah.raw"
sync_by_event = true
ignore_bore = false

[EventLoaderEUDAQ2]
type = "mimosa26"
file_name = "blah.raw"
sync_by_event = true
discard_raw_events = "MIMOSA26_0"

[ClusteringSpatial]
type = "Mimosa26"

[Tracking4D]
log_level = INFO
momentum = 120.0GeV
track_model = "straightline"
spatial_cut_abs = 100um, 100um
exclude_dut = true
min_hits_on_track = 6

[FileWriter]
file_name = "tracks.root"
include = "Track"

```

This created the file `corry_output/tracks.root` which, I guess, contains a collection of [`Track` objects](https://project-corryvreckan.web.cern.ch/project-corryvreckan/reference/classcorryvreckan_1_1Track.html) which I would like to retrieve and use [`getIngercept`](https://project-corryvreckan.web.cern.ch/project-corryvreckan/reference/classcorryvreckan_1_1Track.html#a876e0a7714b6b21045b5eeb8f8ad7891) at some specific `z` points. How could I do this?

I am trying to run a ROOT script with this content:

```auto
#include "TROOT.h"
#include "TObject.h"
#include "TFile.h"
#include "TTree.h"
#include <Track.hpp> // Corry's Track definition.

void main() {
	TFile f("corry_output/tracks.root");

	TTree* tracks;
	f.GetObject("Track", tracks);

	Track track;
	tracks->SetBranchAddress("Track", track);
}

```

but I get `fatal error: 'Track.hpp' file not found`. I noticed that if I run this within the ROOT interpreter it fails somewhere else:

```auto
root [0] TFile f("tracks.root");
root [1] TTree* tracks; f.GetObject("Track",tracks);
root [2] #include <Track.hpp>
root [3] Track track;
ROOT_prompt_3:1:6: error: expected ';' after expression
Track track;
     ^
     ;
ROOT_prompt_3:1:7: error: use of undeclared identifier 'track'
Track track;
      ^

```

Any help is very much appreciated.

---

<div class="post-metadata">

**Author:** ![simonspa](https://corryvreckan-forum.web.cern.ch/letter_avatar_proxy/v4/letter/s/f04885/32.png) [@simonspa](https://corryvreckan-forum.web.cern.ch/u/simonspa)\
**Post date:** [September 19, 2023, 6:00am UTC](https://corryvreckan-forum.web.cern.ch/t/how-to-save-and-access-reconstructed-tracks/83/2 "2023-09-19T06:00:18Z")

</div>

Hi 0x16B5E,

we store the full C++ objects in the output file, so in order to read and interpret them you need to point ROOT to the class header as well as the compiled library. You can do that e.g. like such:

```shell
$ root -l /path/to/data.root
# .L path/to/libCorryvreckanObjects.so

```

For the header include you might have to provide the full file path or at least make sure that ROOT finds the file in the provided include paths.

Best,  
Simon
