Key Programs and Features

The tools in MEGAlib comprise the the whole data analysis path: A tool to model the detector geometry and characteristics (Geomega), a Geant4 simulation tool (Cosima), a program to perform event reconstruction (Revan), a tool for high-level data analysis and image reconstruction (Mimrec), a library for spectral analysis (Spectralyzer), a program to do all the above in real-time (Realta), an event viewer (Eview), and many more smaller programs.


Geomega - Geometry for MEGAlib - is MEGAlib's universal geometry and detector library. The geometry itself is described in an object oriented ASCII file, which describes the volume tree, the materials, the detectors, the trigger criteria, etc. Geomega is used by all other programs of MEGAlib including the Geant4 simulator Cosima.

Geomega's key features are:

  • Advanced geometry file format with features such as constants, math functions, for-loops, if conditions, matrices, etc.
  • Various detector types: simple single volume detectors, strip detectors, voxel detectors, MEGA-like calorimeters, Anger-cameras, etc.
  • Interactive display of the geometry using ROOT's standard or openGL display
  • Overlap checking based on Geant4's overlap checker
  • A sophisticated detector effects engine including energy, position, time resolutions, noise and trigger thresholds, ADC overflows, etc.
  • Complex trigger criteria: by detector type or by individual detector, trigger or veto, by channel or by detector

For a full list of features see the Geomega manual. The latest version can be found in the doc-directory of MEGAlib.

The main reference for Geomega is: A. Zoglauer et al., Cosima - The cosmic simulator of MEGAlib, NSS Conference record, 2009


The "Cosmic simulator" Cosima is MEGAlib's Geant4 based simulator. It utilizes the geometry and detector information from Geomega to perform the simulations. The beam and spectral parameters include options for astrophysics and as well as for most terrestrial applications ranging from homeland security to phantoms for medical imaging. The output is a simple text file which can be analyzed by the other MEGAlib programs.

For a full list of features see the Cosima manual. The latest version can be found in the doc-directory of MEGAlib.

The main reference for Cosima is: A. Zoglauer et al., Cosima - The cosmic simulator of MEGAlib, NSS Conference record, 2009


Revan - the real event analyzer - is responsible for reconstructing events in MEGAlib, and can handle simple, single site events, Compton scatter events, pair creation events, and high-energy charged particle events such as muons. However, Revan's specialization is Compton event reconstruction and therefore it contains a variety of different algorithms to determine the event type, starting with coincidence search, charged particle track searches including Compton electron tracks, and several algorithms to determine the Compton interaction sequence (classic and Bayesian algorithms).

Revan can handle simulated as well as real measured data!

The main reference for Revan is: Andreas Zoglauer, "First Light for the Next Generation of Compton and Pair Telescopes", Doctoral thesis, TU Muenchen, 2005


Mimrec is MEGAlib's high-level data analyzer. It contains options to perform event selections on all important event parameters of single site, Compton and pair creation events (e.g. energies, interaction distances, scatter or opening angles, and many more). It's main goal however is to perform list-mode likelihood image reconstruction in spherical, Galactic, as well as Cartesian coordinates (2D, 3D) including different response calculation approaches (from quick and dirty to slow and sophisticated) which are mostly optimized for Compton image reconstruction. Finally Mimrec contains several options to look at further parameters of your data, such as energy spectra, ARM distributions (for gamma-ray and electrons), interaction distances, scatter angle distributions, polarization, time distribution, and several more.

The main reference for Mimrec is: A. Zoglauer et al., "Design, Implementation, and Optimization of MEGAlib's image reconstruction tool Mimrec", NIM A 652, 2011


Another new addition (or latest revival of a very old tool) is Realta, MEGAlib's real-time analyzer. It accepts data via a TCP/IP connection and then performs coincidence search, event reconstruction, image reconstruction, and spectral analysis all in real-time in several threads.

The main reference for Realta is: A. Zoglauer et al., "Status of MEGAlib's Real-Time Analysis Tool Realta", NSS Conference Record 2011


The latest addition to MEGAlib is its spectral analyzer, which starts with an input spectrum and tries to identify nuclear isotopes through classifying nuclear lines in the spectrum. Revan, Mimrec, and Realta can access the Spectralyzer.

The main reference for Spectralyzer is: M. Galloway et al., "Spectral Analysis for the High-efficiency Multimode Imager", NSS Conference Record 2010