b2luigi Starter Kit

b2luigi Starter Kit#

This tutorial was developed as a workshop for the October 2024 Belle II General Meeting. The idea of this tutorial is that each of the following examples is present in your current working directory and is executed by hand. To get the example files…

  1. … eiher copy the Python code directly from this page into a blank file or…

  2. … download the examples directly from their respective pages or…

  3. … clone the b2luigi repository and move to the examples directory, e.g.

git clone https://gitlab.desy.de/belle2/software/b2luigi.git
cd b2luigi/examples

Alternatively, you can also clone directly from GitHub.

In any of these cases, it is recommended to run the tutorial in a virtual environment. With access to the Belle II software stack, you can use the following commands to set up a virtual environment and install the necessary packages:

source /cvmfs/belle.cern.ch/tools/b2setup
b2venv release-09-00-00

Hint

Use a full basf2 release if you want to run the basf2 examples with the reconstruction.

The b2venv command creates a venv directory in the repository with the name “venv”. The next step is to activate the environment:

source venv/bin/activate

This environment will be based on the basf2 environment. However, Python packages that are not provided by the externals will be installed in the virtual environment. To install the requirements with in a b2venv for this tutorial run:

pip install b2luigi

If you use a clear venv, you can install the requirements with:

pip install b2luigi pandas pyarrow uproot matplotlib plothist

If you copied the examples from the Git repository, you can install the requirements with:

pip install -r requirements.txt

A Simple b2luigi Task

A Simple b2luigi Task

Building a Dependency Graph with b2luigi

Building a Dependency Graph with b2luigi

b2luigi.WrapperTask and b2luigi Settings

b2luigi.WrapperTask and b2luigi Settings

Multiple Tasks and Introduction to Schedulers

Multiple Tasks and Introduction to Schedulers

Introduction to Basf2PathTask

Introduction to Basf2PathTask

The requires decorator

The requires decorator

Writing a basf2 analysis steering file

Writing a basf2 analysis steering file

Scaling up your analysis

Scaling up your analysis

Submitting a task to the LSF batch system

Submitting a task to the LSF batch system

Submitting a task to the HTCondor batch system

Submitting a task to the HTCondor batch system

gbasf2 Analysis Task

gbasf2 Analysis Task

Common Analysis Workflow

Common Analysis Workflow

Common Analysis Workflow Continued

Common Analysis Workflow Continued

Gallery generated by Sphinx-Gallery