This lesson is being piloted (Beta version)

Uproot Tutorial

Welcome! This tutorial aims to demonstrate how to quickly get started with Uproot, a Python package that can read and write files in the .root format without actually requiring or running the ROOT software at all (as opposed to PyROOT, which is just an interface in Python that runs ROOT behind the scenes).

It was written by Mason Proffitt and first taught during the Software Carpentry Workshop at CERN on November 29, 2019.

The HSF Training Curriculum

HSF Logo
This training module is part of the Training Curriculum, a series of training modules that serves HEP newcomers the software skills needed as they enter the field, and in parallel, instill best practices for writing software.

Schedule

Setup Download files required for the lesson
00:00 1. Introduction Why Python?
What is Uproot?
Why should I use it?
00:10 2. Opening files How do I open a ROOT file with Uproot?
How can I tell what’s in the file?
How do I access the contents?
00:30 3. Trees, Branches, and Events How do I access a TTree?
How can I tell what branches are in a TTree?
How do I read the data from a TTree?
00:55 4. Histograms How do I make a histogram in Python (without ROOT)?
How can I change histogram settings?
01:20 5. Columnar Analysis What is columnar analysis?
What are its advantages over row-based analysis?
How do I perform selections and operations on columns?
01:50 6. Getting Physics-Relevant Information How can I use columnar analysis to do something useful for physics?
02:20 7. Advanced topic: Fitting (optional) How can I fit a common function to a histogram?
02:20 8. Further resources Where can I find more advanced information on these topics?
What other Python packages exist with tools for more complicated analysis?
02:25 Finish

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