Skip to content
Snippets Groups Projects
Verified Commit 09b9a901 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Add example files

parent d90f4ff4
No related branches found
No related tags found
No related merge requests found
# Cherenkov times
In this example, we will pick the best reconstructed muon (from the Jpp muon
reconstruction chain `JMuon`) in each event and calculate the Cherenkov hit time
residuals for each triggered hit.
We open the `numucc.root` file from the `KM3NeTTestData` package:
```@example 1
using KM3io, KM3NeTTestData
f = ROOTFile(datapath("offline", "numucc.root"))
```
Each event holds a vector of reconstructed tracks (`Vector{Trk}`) behind the
`.trks` field. This vector contains different stages of reconstruction results
from a variety of reconstruction algorithms (`JMuon`, `JShower`, `aashower`
etc.). `KM3io.jl` exports helper functions to pick the best reconstructed track
for a given reconstruction algorithm. The logic is based on the reference
implementation in [KM3NeT DataFormat
tools](https://git.km3net.de/common/km3net-dataformat/-/blob/master/tools/reconstruction.hh).
The function `bestjppmuon()` can be used to select the best reconstructed `JMuon`
for a given event:
```@example 1
evt = f.offline[1]
m = bestjppmuon(evt)
```
# Examples
## Offline data
Let's use the `KM3NeTTestData` Julia package which contains all kinds of KM3NeT
related sample files. The `datapath()` function can be used to get a path to
such a file. In the following, we will discover the `numucc.root` file which
contains 10 muon neutrino charged current interaction events.
```@example 1
using KM3io, KM3NeTTestData
f = ROOTFile(datapath("offline", "numucc.root"))
```
The `ROOTFile` is the container object which gives access to both the online and
offline tree. In this case, the online tree is empty
```@example 1
f.online
```
and the offline tree holds our 10 MC events:
```@example 1
f.offline
```
### Events
To access a single event, you can use the usual indexing syntax:
```@example 1
some_event = f.offline[5]
```
or ranges of events:
```@example 1
events = f.offline[6:9]
```
Each event consists of a vector of hits, MC hits, tracks and MC tracks. Depending
on the file, they may be empty. They are accessible via the fields `.hit`, `.mc_hits`, `.trks` and `.mc_trks`.
Let's grab an event:
```@example 1
evt = f.offline[3]
```
and have a look at its contents:
```@example 1
evt.hits
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment