Introduction to Algorithms

Last update: 20 Oct 2023 [History] [Edit]

Overview

Physics analyses typically begin with files in the xAOD format and produce simpler ntuple files that contain reduced information, are smaller, and are easier to use for later analysis steps. Throughout this tutorial, you will be introduced to the xAOD format. For now, we will introduce you to analysis code that will allow you to process xAOD files and produce ntuples, which will then be used for additional analysis procedures.

AnaAlgorithm

To run user code on ATLAS data our frameworks require it to be written as what we call an “algorithm”. Writing your code as an algorithm allows the ATLAS framework to load and call it without having to know any details of your code. The framework will generally “execute” the algorithm on every event, allowing you to run whatever code you need to process that event.

There are different strategies on how to use/implement algorithms, but the simplest strategy is to put all your code into a single algorithm and produce outputs (i.e. histograms and/or ntuples) directly from input event data. More advanced setups can involve multiple analysis algorithms, but that is beyond the scope of this tutorial. If you are new to ATLAS software we strongly recommend that you start out with a single algorithm and stick to that until you feel comfortable with ATLAS software in general. Using multiple algorithms allows for some very powerful designs (and is often required when contributing to shared code), but it also adds another layer of complexity that you may want to avoid if you are still working to understand the basics.

EL::AnaAlgorithm is the algorithm base class used for analysis. There are other algorithm classes available in Athena, but for the most part these should be ignored for analysis.

tip There is an older algorithm class EL::Algorithm that is still used in some analysis code. However, it is being phased out and should not be used for any new projects.

tip The EL::AnaAlgorithm allows you to run the same algorithms inside both EventLoop and Athena. This tutorial was designed to be run with EventLoop, so we will not be using Athena. In the future, it will be expanded to include information about running in Athena. In the meantime, there are details available in the ABTutorial.

EventLoop

EventLoop is an AMG (Analysis Model Group) supported ROOT tool for handling optimized event looping and data management. If you are not using Athena, this is our recommendation of what you should be using. EventLoop integrates nicely into the ATLAS software infrastructure and provides some advanced features that will make your life easier in the long run. In the following pages we will give you instructions on how to set up a basic EventLoop job, and towards the end of the tutorial we will have more pages on how to use its more advanced features.

EventLoop is really the center piece of a whole infrastructure of tools that work together to execute your job. Most of these packages were designed so that they can be used by themselves, but together they form a fairly complete analysis infrastructure and they are very well integrated. For the tutorial we will mostly show you how to use them together, for instructions on how to use them by themselves as well as how to use any features not covered in the tutorial, please consult the documentation of each tool.