python ./generate_DL2_file.py -l LAYOUT_NAME gamma_onSource.S.BL-4LSTs25MSTs70SSTs-MSTF_ID0.eff-0.rootNote the DL2 format used is based on the open specifications from 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:
ColDefs(
name = 'OBS_ID'; format = '1K'
name = 'EVENT_ID'; format = '1K'
name = 'MC_ALT'; format = '1E'; unit = 'deg'
name = 'MC_AZ'; format = '1E'; unit = 'deg'
name = 'MC_ENERGY'; format = '1E'; unit = 'TeV'
name = 'ALT'; format = '1E'; unit = 'deg'
name = 'AZ'; format = '1E'; unit = 'deg'
name = 'ENERGY'; format = '1E'; unit = 'TeV'
name = 'MULTIP'; format = '1J'
)- Adding an additional HDU containing a histogram with the number of simulated events vs
MC_ENERGY.
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.
ColDefs(
name = 'MC_ENERG_LO'; format = '60E'; unit = 'TeV'
name = 'MC_ENERG_HI'; format = '60E'; unit = 'TeV'
name = 'EVENTS'; format = '60E'
)DL2 events trees are called 'DL2EventTree' and include gamma/hadron cut statistics.
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
The Class parameter can be used to select different type of events:
- Events passing gamma/hadron separation cut and direction cut
DL2EventTree->Draw("MVA", "Class==5" );
- Events passing gamma/hadron separation cut and not direction cut
DL2EventTree->Draw("MVA", "Class==0" );
- Events before applying gamma/hadron separation cut and before applying direction cut
DL2EventTree->Draw("MVA", "Class==0||Class==7||Class==5", "");
The simulated events vs energy are stored in a histogram in the file:
TH1D *h = (TH1D*)gDirectory->Get("hEmcUW");
Events are not weighted while filling this histogram (in contrary to earlier versions)
CTA internal prod3b Redmine page (older version; needs to be updated)
Install the required packages and activate conda environment:
mamba env create -f environment.yml
conda activate DL2Update your environment:
conda env update -f environment.ymlDocker images can be downloaded from the package directory.
Use the container, e.g., by:
$ docker run --rm -it -v "$(pwd):/workdir" \
ghcr.io/eventdisplay/converters:latest-dl2 \
./generate_DL2_file.py -l LAYOUT_NAME \
/workdir/gamma_onSource.S.BL-4LSTs25MSTs70SSTs-MSTF_ID0.eff-0.rootUse apptainer:
apptainer exec docker://ghcr.io/eventdisplay/converters:latest-dl2 bash