RecExample
The aim of RecExample is
to provide examples and instructions for running full Reconstruction in
Athena. So far only one example is provided, RecExCommon, without
any user analysis, which run all the reconstruction algorithms currently
available and output a combined ntuple. This package is run very frequently
to test the code and is the basis of reconstruction production. (Basic familiarity
with Athena concepts acquired by reading the Athena user and developers
guide available here is implied
below, but it is also possible to run somehow blindly, also in batch).
The user HowTo indicated at the top of Software
Developer page also indicates a lot of useful tricks.
Instructions have been checked to work (i) on CERN atlas linux machines
(ii) with the recommended zshell shell (although most of the time c shell
scripts have been provided). These instructions are kept uptodate (towards
simplicity!) so check this page regularly.
AthAsk is a new Graphics
User Interface on top of CMT now allows to do the things described below.
See in particular the web page corresponding to the reconstruction tutorial.
Getting started
- Check which
release you want to use (see the Release
Status web page) Let's suppose now you want to use release 7.0.0.
- Set up the
Atlas/CMT environment (more detailed there
but the minimum instructions are given below)(note also that it is
preferable to remove all atlas definitions previously defined in the
.zshenv):
- Download
the home requirements file in a
dedicated directory, for example ${HOME}/cmthome.
Then edit this file according to your need, in particular:
- Possibly
set the correct release number (starting with release 6.1.0 it is mandatory to make the release selection in that file in
order to get the right compiler definition)
- macro ATLAS_RELEASE 7.0.0
- Possibly
define the area where you will be working
- set TestArea "${HOME}/MyTest"
- the CMT version
to be used is release v1r14, independently of the release you use (a
mail is sent to sw-developers when this need to be changed). Which
patch to use is indicated also on the Release
Status web page, this is v1r14p20030620 for release 7.0.0.
- from ~/cmthome
directory: source /afs/cern.ch/sw/contrib/CMT/v1r14p20030620/mgr/setup.sh
- cmt config
These two commands should be done only once (almost) for ever,
until the next change of CMT version. If you see a message on sw-developers
mailing list: "please use cmt version v1rnnqwerty", you should retype these
two commands, with v1rnnqwerty.
- source setup.sh
(this could be done in your .zshrc ,otherwise it needs to be repeated
in any new login window), and should be redone whenever your modify
the requirement file, for example to change the release number or your
working area). The correct syntax in the .zshrc file is the following:
- source ~/cmthome/setup.sh –tag=opt
- adding -tag=opt allows to select the optimised build which runs typically
4-5 times faster and use 5 times smaller binaries than the debug build.
- a few tests
maybe now:
- echo $CMTCONFIG indicates
the chosen directory name for compilation results (typically i686-rh73-gcc32-opt
or i686-rh73-gcc32-dbg )
- echo $CMTPATH : should list two paths: your own and the Atlas
release. A third path with Gaudi is appended once you use your first
package. Note that it is possible to specify your own path CMTPATH by hand : export CMTPATH=…provided this is done after source ~/cmthome/setup.sh. This allows an easier switch between test directory.
But note that starting with 6.1.0, it is no more possible to switch
releases this way.
- cmt : should give
you a list of cmt command
- cmt show path list areas where packages are taken in order of priority
Run Athena reconstruction
- Create a clean
working directory (only a few megabytes quota is needed) with the path
you have specified in TestArea above, and cd to it
- Checkout the
code (in fact there is no C++ code in this package)
(ignore message about incompatible version of CLHEP and HTL).
- Check which
version of RecExample correspond to the release:
- ls /afs/cern.ch/atlas/software/dist/7.0.0/Reconstruction/RecExample/RecExCommon/
RecExCommon-00-01-21
- so this
is version RecExCommon-00-01-21
- Checkout
the code (ignore message about incompatible version of CLHEP and HTL)
- cmt co -r RecExCommon-00-01-21
Reconstruction/RecExample/RecExCommon
- Build
- cd Reconstruction/RecExample/RecExCommon/**/cmt
- source setup.sh
- gmake
- Define environment
variables (to be repeated in any new window)
- cd ../run
- source ../cmt/setup.sh
- Setup auxilliary
files (only once in a given directory, and whenever new packages are
checked out)
- source ../share/RecExCommon_links.sh
- And finally
run:
- athena RecExCommon_jobOptions.txt > athena.log
- If it seems
to do something for a few minutes, if you have no error messages, if
at the end you see in your directory a few Megabytes root file ntuple.root
(or HBOOK file ntuple.hbook before 6.6.0) and a sizeable log file athena.log,
congratulations! You've just run successfully a few events through
athena reconstruction! If it does not work:
- make sure
your environment variables are clean.
- Problems
have been reported from people who are working on Atlas with the same
account as for their previous experiment. If it is your case, you
should get a new, Atlas-specific, account.
- If it still
does not work, contact me.
The secret instruction
to be run in an
empty directory, without any prior setup instruction:
- source /afs/cern.ch/atlas/software/dist/7.0.0/Reconstruction/RecExample/RecExCommon/**/share/RecExCommon_doall.sh
- …this does
all the steps described above in one go. If you replace 7.0.0 by any
release number (even a nightly e.g.: dist/nightlies/rel/atlrel_1) it
will automatically set correctly CMTPATH and pick up the right tag for
RecExCommon. It is useful to quickly setup a RecExCommon diectory, but
it does not teach you much!
What it does
- RecExCommon_links.sh
copy or create links to all the needed files including (answer "y"
when you're prompted ):
- RecExCommon_jobOptions.txt: this is the main jobOptions used to drive
Athena reconstruction. This file has been copied, not linked, into
your work directory since you're bound to modify it to your needs.
- This file
"include" a number of XXX_jobOptions.txt files (where XXX is a package among those listed there) is the
jobOptions fragment driving package XXX. To be modified with
care. These files are taken directly in the release, and should be
considered as carefully as the code itself. If you need to modify one
of these files there is two options:
- If it is
only an algorithm property to be modified, easiest is to set this property
at the bottom of your RecExCommon_jobOptions.txt file (since if a property is specified twice
it is the last one that counts)
- It is possible
to disable a CBNT subalgorithm with the line CBNT_YYY.Enable = false ;
- Starting
with release 6.1.0 it is possible to disable an algorithm YYY with
the line YYY.Enable = false ;
- If it is
not possible to make modifications just by appending properties at
the end of your RecExCommon_jobOptions.txt, best is to copy the file in the run directory
and change the corresponding #include line in
RecExCommon_jobOptions.txt to use it.
- CBNT_jobOptions.txt: specifies all the combined ntuple blocks corresponding
to each package
- CBNT_Truth_jobOptions.txt: specifies the combined ntuple blocks dealing
with the truth
- slug.car, fieldmap.dat, amdb_simrec*.dat,
Fcal*.dat, *.xml files are data files
needed by the different packages
- ZEBRA_HEEMM_DC1.P is a recent Data Challenge 1 file with fully simulated Higgs®ZZ*®e+e-m+m- (which is used by default) This type of data
was chosen as an example since it involves various parts of Atlas
. ZEBRA_HEEMM_TDR.P
is a similar
"TDR" data Zebra file (tape Y01601 file 1)
- ZEBRA.P
is a soft link on the input data file used (this name is specified
in line ApplicationMgr.EvtSel = "FILE ZEBRA.P"; in RecExCommon_jobOptions.txt)
- when athena
is run:
- athena RecExCommon_jobOptions.txt > athena.log
athena is
the standard athena executable which is application independent. As
usual, using ">&" instead of ">" would put the error
messages in the log file rather than on the screen.
- The following
files are produced:
- athena.log is the log file,
to be compared with a reference log file, available in ../Testing/Reference_RecExCommonTesting.log . Yours should be almost identical.
- ntuple.hbook is an hbook file containing the combined ntuple with the output from all packages (for example in paw: his/file 20 ntuple.hbook ; nt/plo //lun20/cbnt/3333.1./ptinvvert to plot the pt of all reconstructed tracks.
exec ../share/dump.kumac runs a very simple kumac plotting a few quantities ). Alternatively a root file can be produced with
a few modifications to RecExCommon_jobOptions.txt (see below) (this
is in fact the default since release 6.6.0)
- ntuple.root is a root file containing the combined ntuple with the output from all packages
(example to use it: enter root by typing root , then TFile f("ntuple.root"); f.cd("CBNT");
t3333->Draw("1./PTInvVert"); t3333->Show(0);). A simple macro histogramming
a few variables can also be used: root
then .x ../share/dump.C . Alternatively an HBOOK file can be
produced with a few modifications to RecExCommon_jobOptions.txt (see below) (hbook file was the default before release
6.6.0).
- histo.hbook is an hbook histogram file (empty at the moment)
- other files
can be safely ignored
Customizing
All files have lots of comments and can be customized easily. A
few tips are given below
Running on one's own data
To run on a different data file, one simply has to change ZEBRA.P to point to it: ln -fs myfile ZEBRA.P. One should be careful though that RecExCommon cannot run on all
the data generated in the lifetime of atlas. One can expect good results
with Physics TDR data and DC1 data. Support to run on Physics TDR data has
been discontinued after release 6.0.4. Running on several files in one go
is possible and is explained in the batch script below.
Running only selected
modules
Modules to be run are included by the line (e.g.) #include "$TAURECROOT/share/tauRec_jobOptions.txt"
. (Starting with release 6.6.0 this is
done through #include
"tauRec/tauRec_jobOptions.txt" , but the
migration is not completed yet. This includes the jobOptions fragment which
(i) load dynamically the module code (ii) add it to the list of Algorithm
to be run (iii) sets the algorithm parameters.
It is usually immediately followed by the line CBNT_Athena.Members += { "CBNT_tau"
}; which adds the corresponding ntuple
block to the combined ntuple. To disable a module both lines should be commented
out. The combined ntuple block can be removed while still running the module
by commenting out the CBNT_Athena... line.
Commenting the #include "...tauRec..." line while leaving the CBNT_Athena... will cause
an error, as the library for CBNT_tauRec will not be loaded in.
It is also possible to disable an algorithm while still loading
its library with the line XXX.Enable = false ;
Some modules depend
on others. For example commenting #include "LArCellRec/LArCell_jobOptions.txt" will cause LArCluster to fail and the job will stop.
Also the order
in which the modules are listed is the order in which they are run, which
cannot be random.
Writing out HBOOK ntuple
Commenting three lines in RecExCommon_jobOptions.txt and uncommenting three others, a root ntuple file
ntuple.root will be produced in place of the hbook ntuple. (example
of use: TFile f("ntuple.root");
f.cd("FILE1;1/CBNT;1"); t3333->Draw("1./PTInvVert");).
(for example in paw: his/file 20 ntuple.hbook ; nt/plo //lun20/cbnt/3333.1./ptinvvert to plot the pt of all reconstructed tracks. exec ../share/dump.kumac runs a very simple kumac plotting a few quantities ).
WARNING : if you want to analyse the ntuple with a fortran
file, you might find that paw does not want to create the correct include
file (message HUWFUN: Not space to store COMMON definition ). To avoid this,
a private version of paw is provided by Pavel Nevski on a suggestion by
Guillaume Unal: /afs/cern.ch/user/n/nevski/scratch0/QA/paw.exe.
Using my own version of a given package
If you want to use your own, possibly modified, version of a given
package:
- Check which
version of the package you want to use (as for RecExCommon package
as indicated at the top of this page)
- cd to the
top of your working directory
- From the top
of your TestArea, checkout the package, possibly modify it (as for
RecExCommon) Suppose the package is tauRec and you want to use the
version with tag <tauRec-tag>:
- cmt co -r <tauRec-tag> Reconstruction/tauRec
- Go back to
the RecExCommon/*/cmt directory, and add one line in the requirements
file to use the new package (if not already there), e.g., use tauRec tauRec-* Reconstruction
- source setup.sh
- cmt broadcast gmake // this runs gmake also in all the packages
you have checked out which are used directly or indirectly
by RecExCommon . It will make sure the packages are recompiled in the
right order.
- It is also possible to run cmt config and gmake in each package and in RecExCommon
individually, but using cmt
broadcast is safer
when several packages need to be built in the right order.
- Note : possible
additional options to gmake : QUIET=yes to reduce output,
-j6 to run parallel processes
- Then run athena
as before.
- To check which
version of the library is used, different possibilities:
- cmt show uses print
all the packages used with their full path
- echo $TAURECROOT :
output the full path to one given package. Note that this mechanism
allows the jobOption fragment TauRec_jobOptions.txt to be taken from your own version of the package rather than
from the release.
- ls <your test area>/InstallArea/i686-rh73-gcc32-opt/lib
shows directly the symbolic
link to library used. If not there, the library from the release is used.
Writing my own package: ZeeRec
An example package of a user analysis is available in the release
(since 6.3.0): Reconstruction/RecExample/ZeeRec. This package, used in reconstruction
tutorial, is a simple example on how to access the output of reconstruction
and is a good starting point for user analysis.
Running in batch
Scripts are provided
in RecExCommon/doc to run Athena reconstruction in batch at CERN.
It runs the standard
RecExCommon package, taken either directly or from a release or from a user
area. The code which is run is by default taken directly from the release
but modified packages can be used if properly recompiled in a user area.
New packages can also be used provided they have been compiled beforehand,
and "use"d from a user RecExCommon.
The data to be processed are either DC1 files
taken directly from castor, or any other data file if soft links are constructed
by hand. It is possible to run on several files within the same job.
To use these scripts,
- download them: athenarec.sh,
subm.sh
and submall.sh
(you can also copy them from /afs/cern.ch/atlas/software/dist/HourlyHeadFromCVS/Reconstruction/RecExample/RecExCommon/doc/*
)
- edit athenarec.sh according to
your need (follow the comments)
- use subm.sh to submit conveniently
the batch job
- use submall.sh as an example
to submit a set of batch to run on a full dataset
Writing/Reading
Reconstruction output (only release 7.0.0 and above)
Since release 7.0.0 it is
possible to write reconstruction output into POOL, the new C++ database
in development. It allows to write out full fledge objects rather than just
ntuple. It is so far experimental, only a few objects can be written in 7.0.0:
EventInfo (run/event number), MissingEt (missing energy) and SimpleTrack
(InnerDetector tracks). What developers need to do to make their own objects
writeable is explained there.
To write reconstruction
output:
- uncomment the block at the bottom of RecExCommon_jobOptions.txt and
comment out the two lines with “NOVA” (this is a bug to be corrected
soon)
- run as described above (only in optimised mode,
there is a problem in debug mode to be corrected). A file SimplePoolFile.root is created.
To read reconstruction output:
- athena RecExCommon_read_jobOptions.txt > Athena_read.log
- this also writes a combined ntuple root tree
and you can check that, for the objects listed above, the contain is
exactly the same.
When more reconstruction
objects are available it will be possible to run one’s own analysis in Athena
without rerunning reconstruction upstream.
Using valgrind
(only release 6.3.0 and above)
valgrind is a tool
to find memory leaks and other run time errors like branch on uninitialized
variables. Using it is rather simple
To use these scripts,
- configure your run time environment as above with a few modifications:
1. valgrind cannot run directly on
files on castor, so either use ZEBRA_HEEMM_EXTRACT.P or copy yourself your file on disk
2. RecExCommon in valgrind only runs
in optimised mode
3. given the monitoring valgrind is
doing, it is very slow. So either run only your favourite algorithms, or
run in batch (there is a switch in athenarec.sh to use valgrind). You can run in valgrind the
complete RecExCommon_jobOptions.txt on two events (which is enough to spot
most errors) in a 8nh job.
- ./runvalgrind athena.exe RecExCommon_jobOptions.txt
> athena.log
- in the output,
valgrind errors are preceded by a string like “==<error number>==”
Feedback
from users is essential. Please send comments, suggestions to me (rousseau@lal.in2p3.fr).
Back to reconstruction
main page
Last modified, 12th September 2003