Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor readme updates #28

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 32 additions & 33 deletions DL2/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Eventdisplay to DL2 FITS format

Example of use
----------
## Example use

```shell
python ./generate_DL2_file.py -l LAYOUT_NAME gamma_onSource.S.BL-4LSTs25MSTs70SSTs-MSTF_ID0.eff-0.root
```

Format definition
-------------
Note the DL2 format used is based on the open specifications from:
## Format definition

https://github.com/open-gamma-ray-astro/gamma-astro-data-formats
Note the DL2 format used is based on the open specifications from [gamma-astro data formats](https://github.com/open-gamma-ray-astro/gamma-astro-data-formats).

The only modifications implemented were:

* Adding MC parameters (true energy, true azimuth/zenith...) by adding to the column name (`MC_*`)
within the events table:

Expand All @@ -32,14 +30,16 @@ ColDefs(
```

* Adding an additional HDU containing a histogram with the number of simulated events vs `MC_ENERGY`.

```bash
No. Name Ver Type Cards Dimensions Format
0 PRIMARY 1 PrimaryHDU 7 ()
1 EVENTS 1 BinTableHDU 44 549346R x 9C [1K, 1K, 1E, 1E, 1E, 1E, 1E, 1E, 1J]
2 SIMULATED EVENTS 1 BinTableHDU 21 1R x 3C [60E, 60E, 60E]
```
The table is stored as a binary table with 3 columns: two columns defining the low and high `MC_ENERGY` bins, and a third column containing
the number of events.

The table is stored as a binary table with 3 columns: two columns defining the low and high `MC_ENERGY` bins, and a third column containing the number of events.

```bash
ColDefs(
name = 'MC_ENERG_LO'; format = '60E'; unit = 'TeV'
Expand All @@ -48,84 +48,83 @@ ColDefs(
)
```

Input format from Eventdisplay Effective Area files
----------
## Input format from Eventdisplay Effective Area files

## Event trees
### Event trees

DL2 events trees are called 'DL2EventTree' and include gamma/hadron cut statistics.


### Data trees

Data tree variables (subset):

- MCe0: MC energy (in TeV)
- MCaz, MCel: MC shower direction
- MCxoff and MCyoff: true position (relative to camera centre; in deg)
- ArrayPointing_Azimuth, ArrayPointing_Elevation: telescope pointing direction
- erec: reconstructed energy (in TeV)
- nimages: number of images used for the reconstruction
- xoff and xoff: reconstructed position (relative to camera centre; in deg)
- Class: cut class defining different type of events (see below)
- MVA: BDT mva parameter
* MCe0: MC energy (in TeV)
* MCaz, MCel: MC shower direction
* MCxoff and MCyoff: true position (relative to camera centre; in deg)
* ArrayPointing_Azimuth, ArrayPointing_Elevation: telescope pointing direction
* erec: reconstructed energy (in TeV)
* nimages: number of images used for the reconstruction
* xoff and xoff: reconstructed position (relative to camera centre; in deg)
* Class: cut class defining different type of events (see below)
* MVA: BDT mva parameter

The Class parameter can be used to select different type of events:

1. Events passing gamma/hadron separation cut and direction cut

```
```root
DL2EventTree->Draw("MVA", "Class==5" );
```

2. Events passing gamma/hadron separation cut and not direction cut

```
```root
DL2EventTree->Draw("MVA", "Class==0" );
```

3. Events before applying gamma/hadron separation cut and before applying direction cut

```
```root
DL2EventTree->Draw("MVA", "Class==0||Class==7||Class==5", "");
```

### Simulated events

The simulated events vs energy are stored in a histogram in the file:

```
```root
TH1D *h = (TH1D*)gDirectory->Get("hEmcUW");
```

Events are not weighted while filling this histogram (in contrary to earlier versions)

Links
-----
## Links

CTA internal prod3b redmine page: https://redmine.cta-observatory.org/projects/cta_analysis-and-simulations/wiki/Eventdisplay_Prod3b_DL2_Lists
CTA internal [prod3b Redmine page](https://redmine.cta-observatory.org/projects/cta_analysis-and-simulations/wiki/Eventdisplay_Prod3b_DL2_Lists)
(older version; needs to be updated)

## Installation

Install the required packages and activate conda environment:

```
```bash
mamba env create -f environment.yml
conda activate DL2
```

Update your environment:
```

```bash
conda env update -f environment.yml
```

## Docker images

Docker images can be downloaded from the package directory: https://github.com/Eventdisplay/Converters/pkgs/container/converters
Docker images can be downloaded from the [package directory](https://github.com/Eventdisplay/Converters/pkgs/container/converters).

Use the container, e.g., by:
```

```bash
$ docker run --rm -it -v "$(pwd):/workdir" \
ghcr.io/eventdisplay/converters:latest-dl2 \
./generate_DL2_file.py -l LAYOUT_NAME \
Expand All @@ -134,6 +133,6 @@ $ docker run --rm -it -v "$(pwd):/workdir" \

Use apptainer:

```
```bash
apptainer exec docker://ghcr.io/eventdisplay/converters:latest-dl2 bash
```
4 changes: 2 additions & 2 deletions DL2/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Install:
# mamba env create -f environment.yml
# conda activate EDconvert
#
name: EDconvert

name: EDconvert
channels:
- astropy
- conda-forge

dependencies:
- pre-commit
- numpy
- astropy
- click
Expand Down
5 changes: 4 additions & 1 deletion DL3-IRFs/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# conda env create -f environment.yml
# Conda environment
#
# Install:
# mamba env create -f environment.yml
# conda activate dl3irfs

name: dl3irfs
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Repository for Converters from Eventdisplay format (ROOT-based) into FITS / HDF5 / etc.
This allows to use data products in proprietary format (e.g., from CTA or VERITAS) to be used with public science tools like gammapy.

- convert eventlists from ROOT to FITS format: [DL2](DL2/README.md)
- convert event lists from ROOT to FITS format: [DL2](DL2/README.md)
- convert IRFs from ROOT to GDAF/FITS format: [DL3-IRFs](DL3-IRFs/README.md)

Docker containers are available for both converter.
Docker containers are available for both converters.