πŸš€ INTRODUCTION#

This is a python library to process and analyze raw data from the lab. The design objectives were:

  • To have a classless structure. We store in dictionaries all the run/ch information + the waveforms.

  • Avoid as much overcalculation as possible, in particular:

    • Calculate pedestal/charge/time values all at once and store them separately from the raw data.

    • Prevent excessive memory usage when dealing with multiple runs.

  • Avoid complicated hierarchies and commented/uncommented lines with the same code.

  • To have all the functions compatible between them and moreover, that the obtained output is suitable to be used with all the functions.

🧐 OBJECTIVES

  1. Study the detector

    • GAIN β†’ Calibration β†’ {CUTS + GAUSSIAN FITS}

    • Data analysis (RAW processing)

    • Characterization β†’ Effective fits, cross-talk, noise, etc.

  2. Physics studies

    • Signal deconvolution

    • Physics fits

    • MC simulations

  3. Electronics studies


Getting Started - SETUP βš™οΈ#

Note

  • We recommend to install VSCode as editor. Some useful extensions are: Remote-SSH, Jupyter, vscode-numpy-viewer, Python Environment Manager

  • Check that you have python installed with a version >=3.7 by running python --version. If you are working locally and you do not have it run sudo apt-get update and sudo apt-get install python3-pip to start.

1. Configure your SSH connection#

To run the SCINT library you will need to work from any PCAE at CIEMAT or establish an SSH connection from your laptop.

  • Terminal pro-users: ssh AFS_USER@YOUR_PCAE.ciemat.es or ssh AFS_USER@gaeuidc1.ciemat.es

  • VSCode users:

    • Click on the Remote-SSH icon

    • Add new SSH remote connection

    • Type ssh AFS_USER@gaeuidc1.ciemat.es

    • Introduce your AFS password

    • Work as usual in the new window that appears

    • You can change your SSH configuration at .ssh/config

2. Download the library by cloning it from GitHub#

git clone https://github.com/CIEMAT-Neutrino/SCINT.git 
cd SCINT
# code . #[OPTIONAL]: Opens a new window with all the folders inside SCINT for easy coding

Please, create a branch for including changes in the library and if everything works as it should you could merge with the main one.

Or run git checkout -b <your_branch_name> in a terminal.

ℹ️ The folder structure you will see is the following ℹ️

.
── config
β”‚Β Β  β”œβ”€β”€ FitConfig.yml
β”‚Β Β  β”œβ”€β”€ options.yml
β”‚Β Β  β”œβ”€β”€ input
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ MegaCellLArDic23.txt
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ MegaCellLArMar24Extr.txt
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ MegaCellLArMar24.txt
β”‚Β Β  β”‚Β Β  └── TUTORIAL.txt
β”œβ”€β”€ docs
β”‚
β”œβ”€β”€ lib
β”‚Β Β  β”œβ”€β”€ __init__.py
β”‚Β Β  β”œβ”€β”€ ana_functions.py
β”‚Β Β  β”œβ”€β”€ cal_functions.py
β”‚Β Β  β”œβ”€β”€ cut_functions.py
β”‚Β Β  β”œβ”€β”€ dec_functions.py
β”‚Β Β  β”œβ”€β”€ fig_config.py
β”‚Β Β  β”œβ”€β”€ fit_functions.py
β”‚Β Β  β”œβ”€β”€ group_functions.py
β”‚Β Β  β”œβ”€β”€ head_functions.py
β”‚Β Β  β”œβ”€β”€ io_functions.py
β”‚Β Β  β”œβ”€β”€ minuit_functions.py
β”‚Β Β  β”œβ”€β”€ ply_functions.py
β”‚Β Β  β”œβ”€β”€ sim_functions.py
β”‚Β Β  β”œβ”€β”€ sty_functions.py
β”‚Β Β  β”œβ”€β”€ unit_functions.py
β”‚Β Β  β”œβ”€β”€ vis_functions.py
β”‚Β Β  └── wvf_functions.py
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ macros
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ info
β”‚Β Β  β”‚Β Β  └── simulation
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ 00ProcessScintAndDeco.py
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ 01MCScintAndDeco.py
β”‚Β Β  β”‚Β Β      └── 02VisMCScintAndDeco.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 00Raw2Np.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 01PreProcess.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 02AnaProcess.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 03Integration.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 04Calibration.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 05Charge.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 06Deconvolution.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 0VVisPersistance.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 0WVisWvf.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 0XVisEvents.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 0YVisHist1D.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 0ZVisHist2D.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 10Ana2Root.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 11Average.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 11AverageSPE.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 12GenerateSER.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 13Noise.py
β”‚Β Β  β”œβ”€β”€ scripts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ make_python_env.sh
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ requirementsTeX.txt
β”‚Β Β  β”‚Β Β  └── Utils.md
β”‚Β Β  β”œβ”€β”€ requirements.txt
β”‚Β Β  └── utils.py
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ setup.sh
└── ToDo.md

πŸ“‚ config\input β†’ input txt files are stored here, and they are used as input in all the macros (check TUTORIAL.txt as template)

πŸ“‚ \lib β†’ all the functions of the library itself are stored here

πŸ“‚ \srcs β†’ macros and scripts subfolders

  • \macros β†’ macros to run the analysis. 0i are used for visualizing and 0# are used for processing data (they are sorted to make easy to remember the work-flow)

  • \scripts β†’ the scripts are used to configure the needed packages for the library (make_python_env.sh), create a Docker image and other utilities

πŸ’‘ Recommendation: It is recommended not to change the content of the scripts so that anyone can run the library from scratch with the initial configuration, except to include improvements, of course πŸ’™.

3. Install packages needed for the library to run#

  • Execute source setup.sh script that will create a virtual environment to run SCINT with all the required packages. It will also generate a symbolic link to a folder were data to follow the tutorial is included.

  • [Pro-users] You can create the virtual environment by your own:

    • Install VSCode and some extensions: Remote-SSH, Jupyter, vscode-numpy-viewer, Python Environment Manager

    • CREATE VIRTUAL ENVIROMENT: VSCode venv extension.

    You need to source a python version installed in your computer [+ Enter interpreter path]. In gaeuidc1.ciemat.es you can source to /cvmfs/sft.cern.ch/lcg/releases/Python/3.7.3-f4f57/x86_64-centos7-gcc7-opt/bin/python3 (as long as it is >=3.7) (Figure 2). Then it will recommend you the /srcs/requirements.txt packages, and it will automatically install them (Figure 3) :)

    It will create the environment, and you will be able to see it in the right panel of VSCode (Figure 4). Jupyter notebooks will detect this .venv and you can also open terminals and activate it with source SCINT/.venv/bin/activate.

    • From the terminal

      mkdir .venv
      cd .venv
      /cvmfs/sft.cern.ch/lcg/releases/Python/3.7.3-f4f57/x86_64-centos7-gcc7-opt/bin/python3 -m venv .
      source bin/activate
      

Additionally, if you have sudo permissions you can try an installation requirementsTeX.txt with sudo apt install <requirementsTeX.txt to be able to use LaTeX in the notebooks.