Introduction to Algorithms

Last update: 19 Nov 2024 [History] [Edit]

Overview

Physics analyses typically begin with files in the xAOD format (usually “derivation” files, though sometimes directly AOD files) 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 for using/implementing algorithms, but the simplest strategy is to put all your code into a single algorithm and produce outputs (e.g. 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 AnalysisBase (via EventLoop), AthAnalysis, and Athena. This tutorial was designed to be run with EventLoop, so we will not be using Athena. In the future, it might 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 for 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 for setting 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 using them by themselves as well as how to use any features not covered in the tutorial, please consult the documentation of each tool.