TrackingTutorial
Contents
- 1 ATLAS Inner Detector Tracking Tutorial, LBNL, April 11-13 2007
- 2 Exercise 0: setup Athena
- 3 Exercise 1: Run Inner Detector Reconstruction Example
- 4 Exercise 2: Change input file, (if time produce ESD & AOD)
- 5 Exercise 3: Produce and investigate an InDetRecStatistics ntuple
- 6 Exercise 4: more advanced plots: efficiency, fake-rate, and resolution
- 7 Input files at SLAC
- 8 Example solutions to exercises
- 9 Some more studies we suggest if you have time
ATLAS Inner Detector Tracking Tutorial, LBNL, April 11-13 2007
Prerequisites: We recommend you use SLAC to run Athena, so you need a SLAC computing account. If you don’t have one, the tutorial should (but may not) work equally well on any site that has a recent athena 12.0.x release installed. We recommend 12.0.31 or ideally 12.0.6, and either SLAC or lxplus at CERN.
Regardless of where you run Athena, you will need a CERN lxplus account to checkout packages from CERN CVS.
We recommend you use ROOT to look at ntuples. You can do this either on your Athena machine of choice – ROOT comes as part of the atlas software installation. Or, you could run ROOT directly on your laptop, and download any ntuples you want to look at to your own machine. It is relatively quick and easy to install ROOT under either Linux or Windows.
Exercise 0: setup Athena
- Setup your work environment for the latest bugfix release 12.0.x (12.0.31 or ideally 12.0.6 if available)
- Instructions by Wim: http://wlav.web.cern.ch/wlav/fct/html/workspace.html
- (Instruction specifically for SLAC - see here for SSH/CVS setup: http://www.slac.stanford.edu/exp/atlas/computing/environment.html)
- Before start the actual exercises below, make sure that you can start up Athena! Try
athena.py –i (and CTRL D to quit)
- check that your CMT setup points to the intended release
echo $CMTPATH
In the following it as assumed that you have some, but not much, familiarity with Athena. Also beware that some modifications of jobOptions (exercise 1 and 2) are deliberately not fully spelled out in the tutorial. You may have to look through the jobOptions.py a bit to figure out what to modify, which will force you to become familiar with them.
Usually we usually don't manage to anticipate the various things that end up going wrong or behaving unexpectedly during tutorials. So, please don't hesitate to ask for help if you get stuck!
Good luck!
Exercise 1: Run Inner Detector Reconstruction Example
In this exercise we run the default Inner Detector Tracking example job, InDetRecExample, without modification. It is important to get the right example version, so that it matches the release you are running!
- Check out from cvs the version of InDetRecExample that is in the release you have setup. From the top of your workarea, do
cmt co -r InDetRecExample-01-03-42-05 InnerDetector/InDetExample/InDetRecExample
(Where 01-03-42-05 is the package tag fro 12.0.6. Find the correct tag using either the tagcollector or get_tag command on lxplus:
get_tag InnerDetector/InDetExample/InDetRecExample
Then cd into the package you checked out
cd InnerDetector/InDetExample/InDetRecExample
- and follow the instruction in the README file to build (compile) InDetRecExample
cd to InnerDetector/InDetExample/InDetRecExample/run
- follow the instruction in the README file to run InDetRecExample, but redirect the text output into a file, i.e.
athena jobOptions.py >& exercise1.out &
(This will use an input file available from CERN via afs. If you're running at SLAC and it is prohibitively slow, please let us know, and we will give to the location of a local SLAC copy instead.)
- Open the output file and spend some time looking through it
- Do you recognize some algorithms being loaded and executed from what was discussed in the tracking software talk?
- Can you figure out which input file the example was running on?
- Search for the InDetRecStatistics trackfinding summary table towards the end of the output file
- (a quick way to get it is to do:
grep InDetRecStatistics exercise1.out
- The trackfinding summary table is explained on the InDetRecStatistics Wiki page: https://twiki.cern.ch/twiki/bin/view/Atlas/InDetRecStatistics Based on the specific the table produced by your job, try to answer the following
- which tracking algorithm(s) were running in this job?
- what is the tracking efficiency of each?
- what is the fake-rate of each?
- which trackfinder is the best, based only on efficiency and fake rate?
- Check if anyone used a different release than you. Are the results the same for different releases? Is the same trackfinder best in all releases tested?
Exercise 2: Change input file, (if time produce ESD & AOD)
In this exercise we will try changing the default configuration of InDetRecExample to achieve different tasks
- modify jobOptions.py to use a different input file: use a 100GeV/c single muon RDO file as input (FIXME: add file list at bottom of this page)
- also disable the creation of ESD and AOD files during the job (this will speed up your code)
- run InDetRecExample again, but redirect the output log into a different file than previously
- compare the output of default and modified example jobs.
- Which run (default example or single muons) gave higher efficiency? Higher fakerate? Why?
- If you have time, again open jobOptions.py in an editor and try to produce AOD and ESD files?
- Give it a try, and see if you are able to produce AOD and ESD output files.
- You can produce both at the same time.
- When done, turn AOD and ESD production off again for the remainder of the tutorial, as it is slow.
- Use the command "checkFile.py" in the shell to look at the content of the various data files in this exercise: the single muon digit (RDO) file, and the AOD and ESD files if you produced them.
- Do they contain the same number of events? How does the content compare?
Exercise 3: Produce and investigate an InDetRecStatistics ntuple
We will produce an InDetRecStatistics ntuple. This ntuple contains tracks (and their hits) returned by the different trackfinders, as well as some Monte Carlo information which we will use for comparison. We will now look at this ntuple and others in more detail in following exercises. ROOT is recommended for that, but if you prefer, PAW should work fine as well. (Our example solutions will all be for root, however.).
If something goes wrong with the ntuple production, or if you run out of time, you can complete the tutorial by downloading pre-made ntuple from the RTT system. A sample of 200 GeV/c single muons: http://www.hep.ucl.ac.uk/atlas/NightlyTests/opt/N.0.X/kit/12.0.6/InDetRTT/AthenaHighPtMu/InDetRTT_Hits_1203_jobOptions/213/InDetRecStatistics.root (made from input sample calib0_csc11.007234.singlepart_mu200.digit.RDO.v12000301, running 12.0.6 InDetRecExample) You can find more samples at the following link: http://www.hep.ucl.ac.uk/atlas/NightlyTests/opt/N.0.X/kit/12.0.6/InDetRTT/page3.xml (navigate to specific sample and download file InDetRecStatistics.root)
- Uncomment (activate) the line
#InDetFlags.enableStatistics(doStat=True, doStatNtuple=True, StatNtupleName="InDetRecStatistics.root")
in jobOptions.py by removing the leading "#".
- re-run InDetRecExample, again saving the output into a logfile
- Use checkFile.py to verify that the production was successful: How many events are in the ntuple?
- Start up root. Open up the TBrowser
- Locate the ntuple and browse through it graphically
- Note that the root-tree has several branches. (How do these branches relate to the InDetRecStatistics tracking performance summary in the log file from the same job?)
- The same variables are available in each branch. Have a look and play around a bit.
- Are the variable names suggestive? Can you guess what the variables contain?
- Plots the following (each plot corresponds to a one-liner in the root command line):
- z0 of reconstructed and generated tracks. What is the RMS? What determined the width of each distribution?
- d0 of reconstructed and generated tracks. What is the RMS? What determined the width of each distribution?
- what is the transverse impact parameter resolution for tracks at normal incidence, measured in microns?
- p_T of reconstructed and generated tracks. What is the RMS? What determined the width of the distribution?
- 3D plot of all hits in the ntuple
- How can you plot just the hits in the Pixel Barrel?
- Plot the residual distribution of those hits. What is the RMS, measured in microns?
- Make all these plots for the misaligned and the aligned detector and find out how much each quantity is affected by the alignment.
For just plotting one variable you can do the following:
0-16-cb-99-a6-66:~/atlas/jamboree beate$ root InDetRecStatistics.root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.12/00e 6 September 2006 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
FreeType Engine v2.1.9 used to render TrueType fonts.
Compiled on 6 October 2006 for macosx with thread support.
CINT/ROOT C/C++ Interpreter version 5.16.13, June 8, 2006
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
Attaching file InDetRecStatistics.root as _file0...
root [2] Tracks->Draw("track_phi");
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [5]
You can also write code that makes a few of these plots in a more automated way. For this you can use the makeclass function of root:
TFile* f = TFile::Open("InDetRecStatistics.root");
TTree* t = (TTree*)f->Get("Tracks");
t->MakeClass("Ana");
Then you can edit Ana.C to include some histograms and then do:
root root[0] .L Ana.C root[1] Ana a root[2] a.Loop()
An example for code making a plot inside Ana.C is here.
Exercise 4: more advanced plots: efficiency, fake-rate, and resolution
The following plots cannot be made with one-line ROOT commands. We recommend you make a ROOT script for each exercise.
- Make the plot of tracking-efficiency versus p_T in Sven's talk for single muons and more complicated events. For more complicated events, what cuts do you need to apply to the truth tracks? (Hint: see Andrei's talk, and InDetRecStatistics trackfinding summary table)
- Make plots of the fake-rate verus p_T, compare the trackfinders
- Make the plot of d0-resolution versus eta in Sven's talk. Start by making just one of the bins
- How would you extend this for an event sample where the resolution is not Gaussian?
- Discuss your results
Input files at SLAC
- SLAC local copy of default input file to InDetRecExample: /afs/slac/g/atlas/work/s/sevahsen/testIdeal_07.005200.T1_McAtNlo_Jimmy.digit.RDO.v12000201_tid002760._00002.pool.root.1
- Many RDO files are available at SLAC. View all available RDO files with the following command:
find /nfs/farm/atlas/data1/dq2 -name "*.RDO*"
- e.g., to search for single-particle RDO files, use
find /nfs/farm/atlas/data1/dq2 -name "*.RDO*" | grep single
- Multimuon files:
For these files you have to set the detector geometry flag in the jobOptions file differently:
DetDescrVersion = "ATLAS-CSC-01-02-00"
We made a local copy of some files at SLAC
ls /afs/slac/g/atlas/work/s/sevahsen/MultiMuons/
- at BNL they are in ~holloway/workarea/Jamboree
- at CERN they are on castor at /castor/cern.ch/grid/atlas/caf/misal1_mc12/misal1_mc12.007270.MultiMuonsGeneration.digit.RDO.v12003102_tid003678/)
You can reconstruct them either with the aligned or unaligned geometry:
# setup database access include( "IOVDbSvc/IOVRecExCommon.py" ) #set the alignment used for the reconstruction: # 00 means default geometry, i.e. a perfectly built detector # 01 means misaligned geometry, i.e. a detector with realistic initial # misalignments (as used for CSC alignment challenge) IOVDbSvc.GlobalTag = "OFLCOND-CSC-00-00-00" #IOVDbSvc.GlobalTag = "OFLCOND-CSC-00-01-00"
If you run out of time to make all the ntuples yourself you can also use the ones we prepared in advance:
- Multimuon ntuples:
- lxplus:~beate/public/InDetRecStatistics-muons-00.root uses misaligned MC and reconstructs assuming no misalignement
- lxplus:~beate/public/InDetRecStatistics-muons-01.root uses misaligned MC and reconstructs using the knowledge of the misalignment
- SLAC:/afs/slac/g/atlas/work/s/sevahsen/MultiMuons/ntuples/InDetRecStatistics-muons-00.root
- BNL: ~nielsenj/datasets/Jamboree/ntuples
Example solutions to exercises
d0-resolution versus eta: See /afs/slac/g/atlas/work/s/sevahsen/solutions/
Instructions:
- copy the whole directory "solutions" above to your local area
- cd into your copy of the directory
- start root
- from within root, do
.x doall.cc
--> The d0-resolution plot (which involves repeated gaussian fits that you should see flash by in real time) will be created. It is written out as an .eps file.
Disclaimer: there may be bugs in these script - check carefully before making plot for public use.
Some more studies we suggest if you have time
- find out the hit efficiencies, i.e. the efficiency for a hit to be attached to a track as function of layer number for the aligned and misaligned files
- find out how the resolutions on the track parameters depend on the hit content, e.g. whether a track has pixel hits or not
- determine the tracking efficiency as function of eta and pt
- determine resolution of track parameters as function of eta and pt
- evaluate which track and hit properties are affected by a misalignment
- do you find that negatively and positively charged tracks behave the same in the aligned and misaligned files?
- which quantities would you use to monitor that the detectors and the track reconstruction work properly?
- form the invariant mass of the muons from Z decays and compare that to the resolution you obtain by comparing the reconstrcuted over the true momentum. Do you obtain the same resolution both ways?
- advanced example from Weiming