HESS sprint #1


This Wiki page summarizes the organization and development efforts planned for the HESS sprint #1 that will take place at IRAP (Toulouse, France) from Monday June 24 (noon) to Friday June 28 (noon).

See the https://cta-redmine.irap.omp.eu/projects/ctools/wiki/Coding_sprints page for information on later coding sprints.

The purpose of the sprint is to extend the GammaLib and ctools to allow the analysis of data from Cherenkov telescopes in a way currently adopted by the HESS/VERITAS/MAGIC collaborations: the ON and OFF technique, which can be used in different ways. The objectives are concept validation and cross-checking with the existing analysis pipelines. Our initial goal is to provide support for a point source spectral analysis for data taken in wobble mode using background estimates from reflected regions.

The meeting will start with some introduction to GammaLib and ctools development, followed by a common software coding session (for the spirit of the meeting see https://en.wikipedia.org/wiki/Sprint_(software_development)).

An initial discussion about the project can be found in GammaLib-ctools_AddTradAnaMethods.pdf. This was followed by a code structure proposal presented in GammaLib-ctools_AddTradAnaMethods_2.pdf. The first objective of the meeting is to fix the code structure and interfaces, before filling in the required functionalities.


The following people have attended the code sprint:

  • Christoph Deil (MPIK)
  • Jürgen Knödlseder (IRAP)
  • Pierrick Martin (IRAP)
  • Michael Mayer (DESY)
  • Anneli Schulz (DESY)
  • Chia-Chun Lu (MPIK)
  • Hélène Laffon (CENBG, only for the introductory part)
  • Marie-Hélène Grondin (IRAP, only for the introductory part)


An informal program for the coding sprint is:

  • Monday afternoon: Introduction to Gammalib/ctools
  • Tuesday morning: Introduction to Gammalib/ctools
  • Tuesday afternoon: Discussion of the code structure for the sprint / Discussion of the HESS IRF format
  • Wednesday morning: Coding session
  • Wednesday afternoon: Coding session
  • Thursday morning: Coding session
  • Thursday afternoon: Coding session
  • Thursday evening: Dinner in town at “Bistrot de l’étoile"”
  • Friday morning: Coding session / Discussion of further developments


The list of features and tasks dealt with during the HESS sprint #1 is:

  • Implement sky region objects #903
  • Implement ON and OFF data storage #907
  • Implement ON/OFF response handling #922
  • Implement ctools for classical analysis #932
  • Define HESS data format #565
  • Add XSPEC support module #46

The latter action about XSPEC actually shares many tasks with what is needed for classical analysis (in the form of PHA and ARF data notably), so it was decided to consider both developments at the same time.


An outline of the things we’d like to implement can be obtained from the virtual scripts posted in #570.
The philosophy eventually adopted is to have Gammalib providing mostly the necessary objects (such as sky regions or ON-OFF data container), while the action is done by specific ctools. This allows for modularity. On use and extension to other classical analysis methods, it may appear that some functionalities may need to be shifted from ctools to gammalib.

Notes on further developments

Taken from Christoph...

On Classes

The fit statistic function should live on GObservation (may be extended to whole gammalib).
GObservations.optimizer(LevMarOpt) is a method on the GObservations container that calls an external minimizer.
In the container there could be one Fermi GObservation, one HESS spectral observation, … any kind of data set.

On ctools

  • ctspecgen — rewrite of csspecgen in C++
    + take source spatial model as input because region containment fraction is model-dependent.
    + take PSF file as input
    + use npred for ARF computation (correct for leakage)
  • ctspecfit — take PHA, ARF, RMF and spectral model description as input and do on-off likelihood fit.
    + for a given reco energy bin
    + implement on-off likelihood function (could have variants); for now in GCTAOnOffObservation.
    + it’s not completely clear which n_pred to implement (option1: use RMF; option2: use ARF as a function of reco energy).
  • ctfluxpoints — takes ctspecfit input and output as input.
    + for now first fit spectral model function, then compute flux points by adjusting normalization in energy bins.
    + rebinning to get 3 sigma per point.
    + upper limit calculations
  • ctspeccombine — combine GCTAOnOffObservations
  • ctcubegen — ctbin can create the counts cube, but we need one or several tools to create exposure cubes, background model cubes, PSF and RMF cubes???
  • ctcubefit – Do we need this or can we use the normal ctlike?

On HESS IRFs conversion

Create per-run IRFs that contain the full information for the whole field of view:

1. full-enclosure effective area as a function of X, Y, logE
2. PSF as a function of X, Y, logE, theta2
integrate to 1 along theta2 axis
3. Energy resolution as a function of X, Y, logEtrue, logEreco
integrate to 1 along logEreco axis


1. The IRFs are stored as 3D and 4D FITS arrays.
2. There is no reason to pre-define the ranges / binning of the axes.
The IRFs are used as lookups, they do not define the analysis data space.
Linear interpolation in the range and linear or constant extrapolation outside should be OK.
3. X and Y has WCS info attached (i.e. pixel ↔ world transformation is easily possible)
4. logE and theta2 binning is defined in FITS table extensions (example: Fermi diffuse model file)

Check that the FITS effective area, PSF and energy resolution matches HAP / ParisAnalysis values.

Open questions:
- Store IRFs as ND array or as a FITS table with one row (X and Y pixel coordinates, WCS info stored separately)
- Should IRFs be attached to the event list as extra HDUs or in separate FITS files?
- alternative for PSF: use triple-Gauss instead of theta2 histogram?
- support analysis without energy resolution (i.e. effective area as a function of reco energy)?
- safe energy cut?
- background?

The next steps

After spectral analyses of the Crab nebula and PKS 2155 with the reflected region approach, based on the small 1DC runlist that was shared with CTA:
  • Cube-based analysis (simultaneous spec/morph fit) of small overlapping sources, e.g. Kookaburra (Background modelling? On-off fit?)
  • Simultaneous HESS On-off likelihood and Fermi likelihood fit
  • Template analysis (Michael)


The meeting will take place in room 225-226 (in the basement of IRAP-Roche building). Coffee breaks at 11:00 and 16:30.

How to come to IRAP:

From the airport:
- Take the shuttle bus. You can find it at 50m from one of the exit gate (depending on where you exit, you may have to follow the road and pass the taxi line)
- Tickets probably cannot be purchased on the bus but at an office that is located next to the exit gate (only at night can they be purchased on the bus)
- The fare is 5€ and cover the shuttle bus and the public transportation downtown for a 1h duration.
- If you need/want to go to your hotel first, you’ll have to alight at “Jean Jaurès” which is the most central stop (up to you to check where your hotel is)
- Otherwise, you can alight at the first stop of the shuttle bus which is “Compans Caffarelli”
- From “Jean Jaurès” or “Compans Caffarelli”, take the subway line B (there are only two lines: A/red and B/yellow, and they cross only at Jean Jaurès).
- Take the subway direction “Ramonville”
- Alight at “Faculté de pharmacie”
- From here you can either walk (10-15min) or take the bus.
- The bus stop is on your right when you exit the subway station. Take bus line 78 and alight at “LAAS”.
- Then you are a few 100m away from IRAP, use the attached map.

The map shows you the way from subway station to IRAP if you walk. The bus takes the same way except at the beginning, and will drop you slightly before the roundabout.

GammaLib-ctools_AddTradAnaMethods.pdf (193 KB) Preview Knödlseder Jürgen, 05/15/2013 09:38 AM

GammaLib-ctools_AddTradAnaMethods_2.pdf (56 KB) Preview Martin Pierrick, 06/24/2013 10:37 AM

Map-Subway-IRAP.png (340 KB) Martin Pierrick, 06/24/2013 10:37 AM


Also available in: PDF HTML TXT