An open API service indexing awesome lists of open source software.

https://github.com/p2-718na/alice-simulation

Code for my Lab-2 course.
https://github.com/p2-718na/alice-simulation

cern-root data-analysis

Last synced: 11 months ago
JSON representation

Code for my Lab-2 course.

Awesome Lists containing this project

README

          


Alma Mater Studiorum Logo

# ALICE-simulation
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.

## Experiments
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).

### Kaon* decay experiment
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][1], [analysis results][2]).

--------------------------------------------------------------------------------

## Dependencies
- [ROOT](https://root.cern/) (required, version 6.18^)
- [CMake](https://cmake.org/) (recommended)
- [Doctest](https://github.com/onqtam/doctest) (bundled)
- [Lyra](https://github.com/bfgroup/Lyra) (bundled)

## Building
The best way to build this code is by using CMake. I recommend you build in
`Release` configuration, as the data generation is slow.
```shell
take build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
```
The program executable will be generated inside the build folder.

### NOTE: Building ROOT application with CMake
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.

## Running
This code was tested and running on _Mac OS X 10.14.6 Mojave_ and
_Ubuntu 20.04 LTS (running on WSL)_.

### Generating data
Simply run
```bash
./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).

### Running on WSL
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.

### Testing
Currently there are no tests available. I left a doctest boilerplate in case I
need to add them later.

--------------------------------------------------------------------------------

## Additional notes
I had some specific requirements for writing this code (see [trace 1][A],
[trace 2][B]); 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.

[1]: https://github.com/P2-718na/kstar-decay-analysis
[2]: https://github.com/P2-718na/kstar-decay-analysis/blob/master/notebooks/kstar-decay.ipynb

[A]: assets/trace.pdf
[B]: assets/trace2.pdf