XAOD Software Tutorial at LBL

This is the wiki page for the xAOD Software Tutorial at LBL, July 22-25, 2014. The indico page for this event can be found at https://indico.cern.ch/event/315726/

Setting up ATLAS software

On all machines, we'll be setting up ATLAS software via CVMFS. Make sure you have these lines in your login script:

 export ATLAS_LOCAL_ROOT_BASE="/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase"
 alias setupATLAS='source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh'

Then, in each terminal session for the tutorial material, run setupATLAS.

Site-specific important information

PDSF specific instructions

You'll need to use SLC6 in order to setup the releases necessary for the tutorial material. Edit your ~/.chos file to say "sl64", then logout and log back in.

xAOD file locations

The entire xAOD ttbar sample used for the tutorial is already on NERSC_LOCALGROUPDISK. For the single file used in the hands-on sessions, the path is:

/eliza18/atlas/atlasdata/atlaslocalgroupdisk/rucio/valid2/4c/15/AOD.01482225._000107.pool.root.1

SLAC specific instructions

I recommend you use the following machine for the tutorial sessions: atlint04.slac.stanford.edu.

Set up a work area on AFS where you'll store your code and files:

mkdir /afs/slac.stanford.edu/g/atlas/work/<firstLetterOfUsername>/<username>

To setup the Analysis Release and RootCore, you'll need to set up python independently. I'm not exactly sure why, but consider it a workaround for now. After running rcSetup, do:

localSetupPython 2.7.3-x86_64-slc6-gcc47

xAOD file locations

The entire xAOD ttbar sample used for the tutorial is already on SLACXRD_LOCALGROUPDISK. For the single file used in the hands-on sessions, the path is:

/xrootd/atlas/atlaslocalgroupdisk/rucio/valid2/4c/15/AOD.01482225._000107.pool.root.1

Helpful xAOD links

The ASG twiki is a great place to start for finding useful information related to the new analysis model: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/AnalysisSoftwareGroup

Browsing the source code

You can view the code either in SVN:

https://svnweb.cern.ch/trac/atlasoff/browser/Event/xAOD

or in Doxygen:

http://atlas-computing.web.cern.ch/atlas-computing/links/nightlyDocDirectory/allpackages.html

Hands-on sessions

The following sessions may assume that you have already set up the basic ATLAS environment via CVMFS. Check above for instructions.

Introduction to ATLAS software

SoftwareTutorialSoftwareBasics

Analysis Release and the xAOD EDM

Analysis Release and the xAOD EDM

xAOD in CINT/PyROOT

Analyzing xAOD in CINT/PyROOT

xAOD analysis in ROOT/C++

The material you will use can be found at this official page: SoftwareTutorialxAODAnalysisInROOT. However, you should use this section to steer you through the material and help you avoid some important pitfalls.

Section 1: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#1_Setup_the_Analysis_Release

  • By now you should know how to setup the analysis release, but go ahead and make a new work directory and setup Base,2.0.2 as described.

Section 2: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#2_xAOD_samples

  • This section gives the file paths which will work on lxplus.
  • However, if you're on PDSF or working at SLAC and using the file paths I mentioned above, there are some necessary caveats! First of all, using a file path of the form mentioned above requires a different feature of SampleHandler which doesn't work in the package tag included in the release. To remedy this, check out the latest tag of SampleHandle. Accomplish this by doing
    rc checkout_pkg atlasoff/PhysicsAnalysis/D3PDTools/SampleHandler/tags
    and look back here for special instructions in section 5.

Section 3: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#3_Creating_your_analysis_package

  • Here you will create your own EventLoop algorithm.

Section 4: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#4_Accessing_xAOD_quantities

  • Add some minimal xAOD stuff to your code.

Section 5: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#5_Creating_and_running_our_steer

  • Create either a steering macro or a compiled C++ executable. You can do either. If you ask me, I recommend using the compiled executable method over the CINT macro because CINT is awful and evil.
  • If you're on PDSF or SLAC, here are the additional instructions required to use SampleHandler with the rucio file path. In the steering macro or compiled executable, you'll need to use a DiskListLocal object and the scanFiles function (instead of the scanDir function) like this, and don't forget to also add an include statement for SampleHandler/DiskListLocal.h:

  // Construct the samples to run on:
  SH::SampleHandler sh;
  SH::DiskListLocal list("/eliza18/atlas/atlasdata/atlaslocalgroupdisk/rucio/valid2/4c/15/");
  SH::scanFiles(sh, list);

Section 6: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#6_Objects_and_tools_for_analysis

  • Analyze xAOD objects and utilize some fancy tools.

Section 7: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#7_Creating_and_saving_histograms

  • Creating and saving histograms.

Section 8: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#8_Writing_out_another_xAOD

  • Modifying and writing out an xAOD. This is an important section, and errors may happen, so pay attention to the details.

Section 9: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/SoftwareTutorialxAODAnalysisInROOT#9_More_EventLoop_features

  • More EventLoop features. I think you should consider this section optional. I'd rather have you play more with tools and making fancy plots.

Advanced: for extra credit, try to make an interesting plot from lepton + jet events!

  • Select events with
    • at least one lepton (electron or muon)
    • at least 3 jets with pt > 20 GeV and |eta| < 2.5
  • Create and fill a histogram with the invariant mass of two jets
    • See if you can reconstruct a W mass peak!

If you get stuck, you can take a look at my code here: https://github.com/sparticlesteve/TutorialAna

xAOD analysis in Athena

SoftwareTutorialxAODAnalysisInAthena

The Derivation Framework

Derivation Framework Tutorial

Grid Stuff

Get the tutorial workarea:

 wget http://www-atlas.lbl.gov/~mhance/grid_tutorial.tar
 tar -xvf grid_tutorial.tar
 cd grid_tutorial


Now let's set up our environment. Using xAODs means using either RootCore or Athena, we'll use RootCore:

 setupATLAS
 rcSetup Base,2.0.2
 rc find_packages
 rc compile


Get some test data so we can do some local checks before submitting to the grid:

 localSetupDQ2Wrappers
 voms-proxy-init -voms atlas
 rucio-get -n 1 valid2.117050.PowhegPythia_P2011C_ttbar.digit.AOD.e2657_s1933_s1964_r5534_tid01482225_00

Or you can just use the files Steve noted above.

Test our code locally:

 cd submit_area
 /bin/ls $PWD/../valid2.117050.PowhegPythia_P2011C_ttbar.digit.AOD.e2657_s1933_s1964_r5534_tid01482225_00/* > test_input.txt
 ./grid_exec.py --input=test_input.txt


If that goes well, we should now have a file called hist.root with a histogram of electron pT's. Now we can submit:

 localSetupPandaClient --noAthenaCheck
 ./grid_submit.sh