This is my project for my Physics laboratory-2 course at University of Bologna. The goal of this project is to simulate a real-world use case for ROOT software. The project is divided in two parts. Firstly, we will generate data using the Montecarlo method, then we will analyze that data using ROOT's powerful instruments.
This code aims to generate data that mimics real collision events recorded by the ALICE detector at CERn. I've structured this project so that new experiments and event generation rules can be added easily, along with new types of particles. The generated data can then be saved to ROOT histograms (or other).
The K* particle is unstable, and decays into a Pion-Kaon pair as soon as it is generated. This means that we cannot observe this particle directly, but we can prove its existence through statistical analysis. This experiments simulates the generation and decay of K* particles in collision events. The data generated by this simulation is then analysed (see kstar-decay-analysis, analysis results).
The best way to build this code is by using CMake. I recommend you build in
Release
configuration, as the data generation is slow.
take build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
The program executable will be generated inside the build folder.
I run into some trouble while trying to compile ROOT with CMake. I think the solution is just to use the latest version of ROOT (at least version 6.18, I tested it out on 6.24). If you encounter any other problem, good luck.
This code was tested and running on Mac OS X 10.14.6 Mojave and Ubuntu 20.04 LTS (running on WSL).
Simply run
./lab -e N
where N is the order of magnitude of collision events you want to generate
(e.g. ./lab -e 5
will generate 1E5 events).
This is the same as running on a normal unix distribution. There is a catch,
though: ROOT uses dynamic libraries, and they are loaded into $LD_LIBRARY_PATH
when you source thisroot.sh
. This means that, if you are launching the program
from outside WSL (e.g. using CLion), your program will not find the required
libraries. If you want to run the program, you can either setup the required
environment variables manually, or just launch it from a terminal shell.
Currently there are no tests available. I left a doctest boilerplate in case I need to add them later.
I had some specific requirements for writing this code (see trace 1, trace 2); In particular, I had to use dynamic polymorphism. I didn't like the proposed solution a lot, and so I took some liberties and changed some things around. I don't think my code is perfect, but I find this solution to be a bit tidier than the proposed one.