Review of AnaAlgorithm Basics

Last update: 19 May 2023 [History] [Edit]

If you have made it this far, congratulations, you now know how to setup a basic EventLoop or Athena job and run it. Your algorithm doesn’t do anything yet, but a great milestone nonetheless! Also, if in the future you need to set up a new job or algorithm you can use the same work area and analysis package skeleton (though you would likely want to rename the both to be more descriptive of your use case) and then fill in the code specific to your use case.

From this point on we will only tell you to build and run your job as well as committing/pushing your changes to gitlab, but no longer give you the actual commands. For your reference we have outlined them once more below, so you can go back to this page if you feel unsure. There are several reasons for doing things like this:

  • Compiling and running your job is a very basic task that should become second nature to you. We feel that from a training perspective it is better if you don’t just copy and paste the commands from a web page all the time. Once you start working on your own analysis there will no longer be a web page to copy from, so you may as well start now.

  • If you follow some of the advanced sections they will slightly modify these instructions. Again it is easier to leave out the instructions than to add a lot of caveats to them.

  • On a more practical level, repeating these instructions everywhere is tedious cut-and-paste that we can do without.

Compiling Your Job (Review)

Normally to recompile your job call:

cd ../build/
make

This is typically sufficient even if you have added/removed any files or packages. In case there is an issue, you can call cmake directly using:

cd ../build/
cmake ../source
make

tip Don’t forget to run source x86_64*/setup.sh

It is always safe to call cmake, but it can be quite slow, so omitting it when it is not needed is often a reasonable choice.

Some users prefer instead of changing directories all the time to log in a second time and then have one window just for compilation. Other users relies on shell scripts or IDEs (integrated development environment) to call the commands automatically in the right directory, or they rely on the --build option of cmake:

cmake --build ../build/

warning Sometimes we tell you to run cmake explicitly (typically because we added files or packages). In that case you really have to go to the build directory and call cmake. Calling cmake --build will often not be sufficient.

Running the Job

To run your job using EventLoop call:

cd ../run
ATestRun_eljob.py --submission-dir=submitDir

If you are using Athena call:

cd ../run
athena.py MyAnalysis/ATestRun_jobOptions.py

Committing changes to git

When you are satisfied with the changes to your code, use the following commands within the git repository to preserve your changes:

  • git status - list the files that have changed since the last commit
  • git diff <filename> - show the differences in <filename> since the last commit
  • git add <filename> - stage <filename> to be committed
  • git commit - save the staged changes to the local repository
  • git push - push locally committed changes to a remote repository