ROOT with C++ and python

C++ and ROOT pre-exercise logo

These pre-exercises are designed to prepare you for working with ROOT files and the broader ROOT analysis library in two separate contexts: editing and running much of the pre-existing code used to access some of the older open data files and then working with more recent, user-friendly python libraries to interface with the output files that you will be creating.

In the first case, you will be editing and/or writing files using C++ and ROOT, and perhaps examining those files with a python interface to ROOT. In the second case, you’ll use some python libraries (uproot and awkward arrays) to read some ROOT files, but then analyze the data with non-ROOT-specific libraries.

This is not a full introduction to C++ or ROOT or uproot/awkward, however, we do take time to explain some key concepts that will help you feel more comfortably working with the open data codebase.

You should definitely take time to go through this exercise before participating in the workshop.

If you run into problems with any of these steps, please reach out to the organizers through the dedicated Mattermost channel for this lesson. General questions about the workshop as a whole can be posted on the Mattermost channel for the workshop.

Schedule

Setup Download files required for the lesson
00:00 1. Introduction What is C++?
What is ROOT?
What is the point of these exercises?
00:05 2. Lightning overview of C++ How do I write and execute C++ code?
00:20 3. Using ROOT with C++ to write and read a file Why do I need to use ROOT?
How do I use ROOT with C++?
00:55 4. Using ROOT with C++ to fill a histogram Is there more than reading and writing files that can be done with ROOT?
How do I run a ROOT script?
01:25 5. Using ROOT with python Can I call ROOT from python?
01:25 6. Installing python and the analysis tools locally How do I set up my local python environment?
How do I install uproot and awkward?
01:50 7. Using uproot to open ROOT files How do I open a ROOT file with uproot?
How do I explore what is in the file?
02:10 8. Using awkward arrays to analyze HEP data What are awkward arrays?
How do I work with awkward arrays?
02:30 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.