PHYS291 Project: Looking for clusters of events

Project description

In this project, I used an AGILE satellite dataset of detector events and looked for clusters of events. I received the dataset from PhD-student Carolina Maiorana at Birkeland Space Centre. One event in the dataset is when a particle collides with a detector element. A cluster is when there are at least six events occurring within 300 microseconds. As terrestrial gamma ray flashes (TGFs) consist of several particles, a cluster of events represents a TGF or cosmic ray. The aim of my project was to find clusters of events, to calculate the average energies of these clusters and to compare them.

AGILE and the dataset

The AGILE (Astrorivelatore Gamma a Immagini Leggero) satellite is a gamma ray detector from the Italian space agency. The dataset I used was a ROOT-file with a TTree-structure that had eight branches (time, mult, bar, pdA, pdB, pos, E, and Etot). The dataset contained data from orbit 41014, which was obtained on the 31st of March, 2015. Because AGILE is in trigger mode, there were some "jumps" in the dataset. AGILE records two seconds of data after one trigger. In this project I looked at two of the branches - time and total energy (Etot). The dataset contains 77577 events, with the time written in the format "seconds.microseconds" and the energy given in MeV.

Terrestrial gamma ray flashes

TGFs were first observed by the Compton Gamma Ray Obervatory at the beginning of the 1990s, but had been predicted as early as in the 1920s. It is believed that TGFs are produced by bremsstrahlung radiation (1) from relativistic electrons accelerated in strong electric fields above thunderstorms (2). High-energy electrons that collide with air molecules produce bremsstrahlung. Typically, the instruments that have detected TGFs have been designed for other purposes. This leads to uncertainties in the measurements that have been made (2). The purpose of AGILE was to observe sources of gamma rays in the universe, and other instruments that have observed TGFs, such as NASA's satellite RHESSI, was designed to study the emission of x-rays and gamma rays from solar flares. The recently launched ASIM (Atmosphere-Space Interactions Monitor) has electronics designed to handle the high fluxes of TGFs (2).

The code

The codes and the dataset can be found here. The code tree_plots.cpp creates a canvas where several of the variables are plotted with another variable. It also creates two other larger plots, where the two variables (time and Etot) that were the focus of this project are displayed. In the code project_mainfile.cpp, which was the main code for the project, I started looking for the clusters of events. To find the clusters I only used the time variable. After finding a cluster, I looked at whether there were more than six events within that cluster and counted the number of events each cluster contained. Thereafter, I looked at the energies of the events in the clusters and calculated the average energy of each cluster. These energies were then grouped into different intervals and plotted in histograms. Following this, I looked at the time between the clusters, and the average time between the events within the clusters.


1) Plots of the different variables

This first canvas shows four different plots using all the events in the dataset. The second and third canvases (Figures 2 and 3) contain larger plots of the two variables that were focused on in the project. The y-axis in Figures 2 and 3 is the number of counts, and the plots contain all the events in the dataset.
Image 1
Figure 1: Canvas with plots of several of the variables/branches in the dataset

Image time Image Etot
Figures 2 and 3: Larger plots of the two variables (time and Etot) that were focused on in this project

2) The clusters

The next thing that was done was to print in the terminal the number of clusters, their starting times, their average energies and the number of events each cluster consisted of. It can be seen that most of the clusters were found around 354.862*106 seconds, and this can also be seen in the large peak in Figure 2. The other peaks in Figure 2 also correspond to the clusters printed in the terminal, as there are increased numbers of counts there.

Image 2
Figure 4: Screenshot of the print-outs in the terminal

3) Histogram of energies by intervals

i) Histogram 1

For the first histogram, the cluster energies were organized into intervals of the same size. However, there was quite a big spread in the cluster energies, and the largest ones (reaching up to over 500 MeV) were placed in the last interval. The majority of the clusters either have energies below 10 MeV or above 60 MeV.

Image 3
Figure 5: Number of clusters having certain energies

ii) Histogram 2

For the second histogram, the clusters were organized into intervals of different sizes. Here it becomes apparent that most of the clusters have energies above 5 MeV. Also, quite a large portion of the clusters have energies above 100 MeV.

Image 4
Figure 6: Number of clusters having certain energies

4) Number of events in the clusters

This histogram shows number of events that were contained in the clusters. The majority of the clusters contained less than 12 events.

Image 5
Figure 7: Number of events found in the different clusters

5) Time between clusters

The following histogram shows the time, given in seconds, between the onset of two consecutive clusters. The majority of the clusters occur less than 400 seconds after the previous cluster.

Image clusters new
Figure 8: Time between clusters

6) Average time between events within a cluster

Following this, the average time between consecutive events within a cluster was looked into. Most of the clusters had an average time between consecutive events of less than 0.00004 seconds.

Image events
Figure 9: The average time between the events found in each cluster


Although the dataset was very large, the total number of clusters found was quite small (only 23 clusters were found), with energies ranging from 0-511 MeV. Typically, TGFs have energies around 1-10 MeV, but they can also have larger energies. Cosmic rays can also have very large energies. Although the condition for the clusters was that there had to be at least six events within 300 microseconds, some of the clusters even contained more than 20 events, with the largest containing 29 events.

It would have been interesting to be able to distinguish between the real TGFs and possible cosmic rays, as the energies for some of the clusters were much larger than the typical TGF-energies.

When running the main code there was sometimes a problem when exiting ROOT. After running the program many times in a terminal, and each time exiting ROOT, the program would crash suddenly when trying to exit ROOT.


I would like to thank Carolina Maiorana for her guidance and for providing the dataset, and Ladislav Kocbach and Boris Wagner for their guidance in the computer lab.


(1) Inan, U. S., et al, 2006. Terrestrial gamma ray flases and lightning discharges. Geophysical Research Letters , 19 September. Available at

(2) Gjesteland, T., 2012. Properties of Terrestrial Gamma ray Flashes. (PhD-paper). Available at