Skip to content

Analysis MUon LifETime. With devcontainer for further ease of use

Notifications You must be signed in to change notification settings

BrachyKnight/amulet-dev

 
 

Repository files navigation

AMULET-DEV

About The Project

This is a fork of the project AMULET (Analysis MUon LifETime), that consists in a series of C++ and python scripts written to analyze data relative to the life-times of cosmic muons. I made this fork to continue experimenting on it and to add support for a devcontainer / docker environment for ease of use. The project has two main parts:

  • Reading data taken with a caen digitizer (CAEN DT5751). This is the most important part and it is actually the main focus of this project.
  • Analyze data to produce plots, perform fit, and do everything is needed to measure in the most accurate way the lifetime of cosmic muons decaying both in carbon (scintillator material) and other materials.

Getting Started

Using thes script is simple!

First of all ensure to have the proper prerequisites, otherwise install them. Download all the project and compile the script by executing the ./compile_scripts.sh script that is present in the folder called digitizer_scripts/

There are really only two things that is important that you do properly

  • Using the correct prerequisites (in particular ROOT)
  • Work using the correct directories and the correct naming schemes for your files!

In order to understand how to use the code you have to know something about the experiment:

  • muon lifetime is measured using an array of three overlapped plastic scintillators
  • the analogic signals from the photomultipliers are converted in fast NIM negative standard signals using a CFD.
  • the logic signal pass through a trigger circuit (the most difficult part of the experiment is to realize this) that as output provide:
    • one trigger NIM to trig the digitizer to aquire the waveform
    • two signals that are aquired in the channel0 and channel1 of the digitizer, these are the waveform that the code in this project is meant to analyze

Prerequisites

  • ROOT CERN toolkit: this project is based on ROOT and, in particular, it uses RDataFrames to generate .root files containing TTree with all the relevant quantities that can be extracted from xml RAW data. Since when I developed the project (2021) RDataFrames and VecOps::RVec where under construction it is particularly important that, if you encounter problems, you install the same version I used: ROOT v6.24/00.
  • python3
  • lxml module of python3
    pip3 install lxml
    

Usage

After having downloaded the project and compiled all the C++ script using the lines of code in ./compile_scripts.sh

  1. Ensure to have the correct naming scheme for your files (runXmeasY.xml where X=run number and Y = meas number). These xml data are meant to be the ones (or equivalent to) the ones generated by CAENSCOPE taken with the digitizer DT5751;
  2. Ensure to have the exact directories and subdirectories contained in the git hub project;
  3. Go to the digitizer_scripts/ folder and from here you can start to work on your data:
  • Copy yout xml data files in the DAQERM/ folder;
  • Open the file logicSignalAnalysis.cpp and set the sampling frequency that you have used (int sampfreq = XXX, change XXX with your sampling frequency es.: 1e09). If you forget this step everything will work fine but you have to keep in mind that the time that you will see on the X-Axis of your plots have to be converted with a conversion factor depending on the ratio between the sampfreq that is set and the one that you have actually used.
  • Recompile the scripts to have consistent results ./compile_scripts.sh
  • You can choose to process all the measurements in one run by launching ./preprocess_entire_run RUNNUMBER ../DAQERM and this command will launch two scripts:
    • xmltoTTreeRDF will perform a copy of the data contained in the xml file into the .root files in the folder DAQpreprocessed/ . The output file contains a TTree with the amplitudes that the oscilloscope have measured, this is pretty useless but it is a starting point to process the data with ROOT. WARNING: this script will implicitly launch the python script called xmltotree.py which makes use of the python class DT5751ReadPersonalized.py which have a bug that fills up RAM memory of your PC if the xml file is too big contact me for me for more info, but you encouraged to find another way to manage all this part
    • logicSignalAnalysis will update the just created .root file and it will add the following information
      • the time coordinates of the waveforms collected with the first script in a TTree called amulet. You can now see the waveforms using ROOT (for example by opening the .root file and calling amulet->Draw("ch0_wvf_amp:ch0_wvf_time","Entry$ == 1") this will draw the wvf of the first entry).
      • the data relative to the waveforms for the two channels (number of squares in each signal, temporal information to when the square waves arrived). You can better understand by open up the .root file in a TBrowser and plotting some ditributions.
  • Now you have to evaluate lifetimes starting from the square wave informations:
    • launch the third script ./lifetime and it wil provide examples of what input it wants, then re-launch it again with the correct input
    • if you followed the instructions correctly the script will produce an output root file in the DAQprocessed/ folder with root file containing the decay times!!
    • you can open the file with a TBrowser and plot your distributions, there will be a lot of them but I'm sure you can figure out what they are 😉
  1. Now you can start your analysis of muon lifetime!! you can use the scripts in the folder amulet_analysis/ but they are quite buggy and they are strictly related to my set of data, so it is meant to be more like an example.

Usage with devcontainer

If you are having trouble configuring your environment to run the scripts (looking at you mascarpone), you can use the devcontainer provided in the .devcontainer/ folder. This is a docker container that contains all the necessary commands and packages to run the scripts. You can use it by following these steps:

  1. Download and install Docker Desktop from https://www.docker.com/products/docker-desktop (if you don't have WSL2 installed, you will be prompted to install it)
  2. Download and install Visual Studio Code from https://code.visualstudio.com/
  3. Install the Remote - Containers extension for Visual Studio Code from https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
  4. Clone this project in your local machine using git clone https://github.com/BrachyKnight/amulet-dev
  5. Open the project in Visual Studio Code
  6. Click on the bottom left corner of the window where it says "Open a Remote Window" and select "Reopen in Container", or open the command palette (Ctrl+Shift+P) and type "Dev Containers: Reopen in Container"
  7. The first time you open the project in the devcontainer, it will take a while to build. After that, you will be inside the container and you can run the scripts as described in the previous section.
  8. Profit (not really, this is an open source project, but you get the idea 😉)

Contact

Original Project Link: https://github.com/mgirola/amulet

Acknowledgements

About

Analysis MUon LifETime. With devcontainer for further ease of use

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 88.7%
  • Python 5.4%
  • C 2.8%
  • Shell 2.1%
  • Dockerfile 1.0%