TBRootAna Users Guide v 0.7
Goes with TBRootAna: v0r19 and HEAD
What is TBRootAna and what is it good for?
TBRootAna is a root application that can be used to analyze ntuples
created from the Athena framework. It provides easy access to the data
in the ntuples via a number of classes. Through the modification of
the UserAlg class users can create their own analysis code.
The current version works for 2002 Combined Test Beam Data.
Checking out the code from the cvs Repository
This Option is best for people who intend on adding to the code in such
a way that it will be useful and readable to others. If you intend
of simply using TBRootAna do something simple and don't want to bother
learning cvs and configuring for CVS checkouts please download a
release from the release
tarballs page. Note that the tarballs are not always up to
date.
- Log onto fate-2 or fate-3 or another suitable machine with cvs and ROOT
installed.
- At the command line type: 'cvs -d /homes/cvs-atlas/cvsroot
checkout -P TBRootAna' . This will produce a directory called TBRootAna
that contains all the source code for the TBRootAna application. The
'-d' option indicates the location of the repository. This option can be
avoided if the environment variable, $CVSROOT, is set to
'/homes/cvs-atlas/cvsroot'. The '-P' option tells cvs not to
create any empty directories in your local space. This will make the
checkout cleaner.
- TBRootAna works with root 3.05 to 4.02 inclusive. It does not currently
work with root 4.04.02. So make sure you have the right root version, for example
using
export ROOTSYS=/net/cern/root-4.02
- Type './configure' to configure the package. Then type
'make' to build it. It will crash because of out-of-sync time stamps. At this point, type again
'./configure' to configure the package, and then
'make' to build it.
The executable called 'tbrootana' will be produced
in the src directory. If you happen to trying to build the software
outside of CERN or Uvic please consult the testing webpage for suggestions on how
to set up your environment.
I would recommend reading up on CVS at the cvs homepage. Note that you can
checkout a particular version by specifying the tag you wish to checkout
by adding the option '-r tag' where tag is some symbolic tag. For
example you could use the command 'cvs checkout -P -r v0r19 TBRootAna' to
checkout version 0 release 19.
Obtaining Source Tarballs
This option is best for those people not interested in dealing with CVS
and who wish to make modest modifications to the code without ever
having the intention of checking them in.
- Go to the release
tarballs page to download the code.
- Make sure you are using the right version of root
- Type './configure' to configure the package. Then type
'make' to build it. It will crash because of out-of-sync time stamps. At this point, type again
'./configure' to configure the package, and then
'make' to build it.
Running the code
- Once the code has been built the tbrootana application can be
run directly from a shell. One does not need to start root before hand.
- To run the app type: './tbrootana -h HecNTupleFile -e
EmecNTupleFile' where HecNTupleFile is the file name Hec Portion of the
2002 combined NTuple, and EmecNTupleFileName is EmecPortion. See
the command line options page for
a complete listing of available options.
Modifying the Code
The only place that you will need to make changes is in the UserAlg
class. You will need to modify both the .h and .cxx files. UserAlg
functions in a manner very similar to a Athena algorithm in that
the user must modify only three methods, initialize(), execute()
and finalize(). Three important objects are made available to you in
UserAlg; Event, Header, and Geometry.
From these three objects all the information contained in the NTuple
and the geometry information can be accessed. The Event object can be
accessed via the pointer m_event. Before the execute method is
run in UserAlg the information contained in m_event is updated for the
current event. The Headers object provides access to all the
information contained in the run headers (Global, Slow Control, Hec and
Emec).
Full doxygen class documentation is
provided for these three objects.
Steps to modify the code
- Open UserAlg.h with an editor and add any new member variables
you wish to have in the clearly marked area. This could be, for example,
a histogram which you wish to fill.
- Open the .cxx in with an editor and add code to the initialize
method. The initialize method is run once before any of the events
are loaded. Here, for example, you would instantiate your
histogram object.
- Add code to the execute method. The execute method is run for
every event. Here you go about filling your histogram
- Add code to the finalize method, which is run at the end of
the event loop. Here you would draw your histograms and perhaps write
them to file.
Important things made available to you in UserAlg
- m_event: this is a member variable which is a pointer to a
Event object. See the documentation for information on what methods it
provides.
- m_runHeader: this is a member a variable which is a pointer
to a Headers object.
- m_hecGeo: this is a member variable which is a pointer to a
Geometry object.