A Quick Tour of the BaBar Offline World
This section of the Workbook will take you through your first BaBar offline analysis job.
It assumes that you have already set up your account as described in the previous Workbook section, Account Setup.
By the end of this first job you will have analyzed and histogrammed BaBar data.
This will be accomplished using the software release analysis-50 (24.3.2) and reading actual BaBar data from the one of the databases.
Commands for the user to enter are written in red to make it easier to find commands on later browsing.
If you get stuck in the Quicktour, refer to the Quicktour help page.
Click on the following link for a Summary of Quick Tour Commands.
Contents
This section will be somewhat different from the other sections of the workbook
in that it will ask you to type some commands without explaining exactly what they do.
All later sections of the workbook will introduce concepts in a more detailed way and will provide references for still more detailed reading.
We hurry you through some explanations in this first section because we want you to get your hands on actual BaBar data right away,
and we want you to get a general sense that you can run something.
Users who are new to Unix should review the Workbook's section on How to Enter Unix Commands before proceeding.
To be on the safe side you should make sure that there is at least 80MB of free
space in your unix account before starting the quick tour.
**NOTE!** If you are returning to the quick tour after having left in the middle,
then there are a few commands you need to issue now, before you forget:
If you have logged off since you were last here:
> cd ~/ana50
ana50> srtpath <enter> <enter>
ana50> anal50boot
The command srtpath tells the system what release and architecture you are working with, and anal50boot sets up a path to the database.
If you have not logged off, and have been away for more than 24 hours, then you need to enter:
> klog
The system will then prompt you for your password (the same password that you use to login to a SLAC computer).
Klogging renews your AFS token (see the unix section of the workbook).
In certain cases, the srtpath, anal50boot and klog commands may be redundant, but they can't hurt, and will save you much confusion and frustration.
Select a Host Computer:
It is recommended that you log onto a yakut machine to run the QuickTour at SLAC as this runs the Scientific Linux 3 operating system required for release analysis-50.
If you are running the quicktour at your local institution, you should speak to a computing expert to find an appropriate machine to run the quicktour.
Help - I can't log in
Create a Test Release
A test release is a version of the BaBar code which typically contains a small amount of private user code,
with the remainder coming from a full BaBar release, that is, a consistent set of all the BaBar code.
You are about to create a new "release directory" for your work, which we will call ana50.
You will build the rest of your job in this release directory.
Start by going to to your home directory:
> cd
The unix prompt will be indicated by ">" unless the command must be issued from a particular directory, in which case the deepest subdirectory will appear.
For example, if the command must be entered from "A/B/C >", the prompt will be shown as "C >".
Now create the new release directory, and specify the scratch area
to be used for the library and binary files:
> newrel -s $BFROOT/build/<first_letter>/<username> -t analysis-50 ana50
Note: since you have to put in your own username and initial, you cannot simply cut and paste the above command.
For example, if your username is "zephir", then you use the "-s $BFROOT/build/z/zephir" option to put the test release in your scratch directory.
If you do not have a scratch directory, from a flora machine (ssh flora)
run the command "kinit" and then the build command "bbrCreateBuildArea" to create it.
Then you should be able to run the newrel command above.
analysis-50 is the name of the release. (Note that this release is also known as 24.3.2.)
The last argument (ana50) is the (arbitrary) name that you choose for your copy of the release.
The system should respond with something like:
newrel version: 1.16
GNU Make 3.80
Build OPTIONS = Linux24SL3_i386_gcc323-Debug-native-Objy-Optimize-Fastbuild-Ldlink2-SkipSlaclog-Static-Lstatic
Linux bbr-dev107 2.6.9-55.0.12.ELsmp #1 SMP Thu Nov 1 08:41:34 CST 2007 i686 i686 i386 GNU/Linux [uname -a]
-> installdirs:
test does not exist, remake it
tmp/Linux24SL3_i386_gcc323 does not exist, remake it
shtmp/Linux24SL3_i386_gcc323 does not exist, remake it
Creating database/GNUmakefile from release 24.3.2
next, addpkg, checkout or ln -s to your packages, then gmake installdirs
remember to run srtpath. (see man page of srtpath about setting it up)
Setting up the machine architecture to use
Now, change into the test release directory:
> cd ana50
Next, select the machine architecture you will use.
**NOTE!** You need to do this every time you have logged out and back in again:
ana50> srtpath <enter> <enter>
where <enter> means you should hit the "enter" key to accept the release number
(it should say 24.3.2 - if you are offered "newest", you are not in the test release directory!) and the default operating system that you are offered.
The system should respond with something like:
enter release number (CR=24.3.2):
> enter
Select/enter BFARCH (CR=1):
1) Linux24SL3_i386_gcc323 [prod][test][active]
2) Linux24SL3_i386_gcc323-noOptimize-Debug [prod]
3) Linux26SL4_i386_gcc346 [default]
> enter
The "srt" in srtpath stands for Software Release Tools.
You will learn about it at the Workbook's Packages and Releases page.
Now that you have your own copy of a release, you need to add software packages to help with your analysis.
BaBar's software packages for analysis-50 are stored in:
$BFDIST/releases/analysis-50
You will need to add the following packages to your test release:
- workdir - the base package from which analysis jobs are run.
- BetaMiniUser - a standard package for analysis of BaBar data.
- Extra Tags - some updated packages with code improvements
To add a software package to your test release, you use the command "addpkg."
This checks out the package from the Software Release system, and modifies the various subdirectories of the release as required to incorporate the package.
To begin, add workdir to your release directory by issuing the command:
ana50> addpkg workdir
The system should respond:
Offline Release 24.3.2 uses workdir version V00-04-21, will check that out
cvs checkout: Updating workdir
U workdir/.cvsignore
U workdir/.rootrc
U workdir/GNUmakefile
U workdir/README
U workdir/RooAlias.C
U workdir/RooLogon.C
U workdir/pawlogon.kumac
cvs checkout: Updating workdir/exercise_KstarGamma_BR
cvs checkout: Updating workdir/kumac
U workdir/kumac/babar.kumac
U workdir/kumac/bbrpath.kumac
U workdir/kumac/mkportrait.kumac
U workdir/kumac/psportrait.kumac
cvs checkout: Updating workdir/results
GNU Make 3.80
Build OPTIONS = Linux24SL3_i386_gcc323-Debug-native-Objy-Optimize-Fastbuild-Ldlink2-SkipSlaclog-Static-Lstatic
Linux bbr-dev107 2.6.9-55.0.12.ELsmp #1 SMP Thu Nov 1 08:41:34 CST 2007 i686 i686 i386 GNU/Linux [uname -a]
-> installdirs:
Now set up some symbolic links and create some required directories in the workdir package directory by issuing the command:
ana50> gmake workdir.setup
The system should respond with something like:
This release based on 24.3.2, overriding BFCURRENT value of current
GNU Make 3.80
Build OPTIONS = Linux24SL3_i386_gcc323-Debug-native-Objy-Optimize-Fastbuild-Ldlink2-SkipSlaclog-Static-Lstatic
Linux bbr-dev107 2.6.9-55.0.12.ELsmp #1 SMP Thu Nov 1 08:41:34 CST 2007 i686 i686 i386 GNU/Linux [uname -a]
-> workdir.setup: (Sat Dec 29 08:56:10 PST 2007)
RELDIR not specified. Defaults to ../
Release directory set to ../
Now it is time to add BetaMiniUser, the analysis package, to your test release. Still from your release directory, add the BetaMiniUser package using the command
ana50> addpkg BetaMiniUser
The system should respond with something like:
Offline Release 24.3.2 uses BetaMiniUser version V00-04-05, will check that out
cvs checkout: Updating BetaMiniUser
U BetaMiniUser/.cvsignore
U BetaMiniUser/AppUserBuild.cc
U BetaMiniUser/AppUserBuildBase.cc
U BetaMiniUser/AppUserBuildBase.hh
U BetaMiniUser/AppUserBuildRoo.cc
U BetaMiniUser/BetaMiniBackgroundFrameCounter.cc
U BetaMiniUser/BetaMiniBackgroundFrameCounter.hh
U BetaMiniUser/BetaMiniBackgroundFrameCounter.tcl
U BetaMiniUser/BetaMiniPatches.tcl
U BetaMiniUser/BetaMiniPidKilling.tcl
U BetaMiniUser/BetaMiniUserProduction.tcl
U BetaMiniUser/GNUmakefile
U BetaMiniUser/History
U BetaMiniUser/MyDstarAnalysis.cc
U BetaMiniUser/MyDstarAnalysis.hh
U BetaMiniUser/MyDstarAnalysisSnippet.tcl
U BetaMiniUser/MyDstarMicroAnalysis.tcl
U BetaMiniUser/MyDstarMiniAnalysis.tcl
U BetaMiniUser/MyDstarPhysics.tcl
U BetaMiniUser/MyHistManager.cc
U BetaMiniUser/MyHistManager.hh
U BetaMiniUser/MyK0Analysis.cc
U BetaMiniUser/MyK0Analysis.hh
U BetaMiniUser/MyK0MicroAnalysis.tcl
U BetaMiniUser/MyK0MiniAnalysis.tcl
U BetaMiniUser/MyMiniAnalysis.cc
U BetaMiniUser/MyMiniAnalysis.hh
U BetaMiniUser/MyMiniAnalysis.tcl
U BetaMiniUser/MyReadList.cc
U BetaMiniUser/MyReadList.hh
U BetaMiniUser/MyReadList.tcl
U BetaMiniUser/MyReadListSnippet.tcl
U BetaMiniUser/MyReskimStreamPhysics.tcl
U BetaMiniUser/MyTimePointAnalysis.cc
U BetaMiniUser/MyTimePointAnalysis.hh
U BetaMiniUser/MyTimePointAnalysis.tcl
U BetaMiniUser/NamedScalers.cc
U BetaMiniUser/NamedScalers.hh
U BetaMiniUser/README
U BetaMiniUser/RewriteMini.tcl
U BetaMiniUser/bdbMini.tcl
U BetaMiniUser/bdbMiniPhysProdSequence.tcl
U BetaMiniUser/bdbMiniPhysics.tcl
U BetaMiniUser/bdbMiniQA.tcl
U BetaMiniUser/bin_BetaMiniApp.mk
U BetaMiniUser/bin_BetaMiniRooApp.mk
U BetaMiniUser/bin_BetaMiniUser.mk
U BetaMiniUser/binlist
U BetaMiniUser/btaMini.tcl
U BetaMiniUser/btaMiniPhysProdSequence.tcl
U BetaMiniUser/btaMiniPhysics.tcl
U BetaMiniUser/btaMiniQA.tcl
U BetaMiniUser/link_BetaMiniUser.mk
GNU Make 3.80
Build OPTIONS = Linux24SL3_i386_gcc323-Debug-native-Objy-Optimize-Fastbuild-Ldlink2-SkipSlaclog-Static-Lstatic
Linux bbr-dev107 2.6.9-55.0.12.ELsmp #1 SMP Thu Nov 1 08:41:34 CST 2007 i686 i686 i386 GNU/Linux [uname -a]
-> installdirs:
Incorporating the latest code fixes in your release
BaBar code is constantly improving.
Unfortunately, this means that software is often made available before it is perfect.
So before you begin, you need to check if there are additional packages required for your test release.
These additional packages are called "extra tags".
They might be bug-fixes, or improvements related to specific aspects of the code.
The complete list of extra tags of packages recommended to be used with each release can be found by following the link
Extra Tags page
Looking under "analysis-50", you see that there are no "core bug fixes".
So you do not have to add any extra tags.
There are a few "optional" packages, but you need check out optional packages only if your analysis job specifically requires the fix they are described as providing.
In this case, you do not need the optional tags.
If someday you are using a release that does require extra tags, the required syntax is
ana50> addpkg PackageName V0X-YY-ZZ
For each "addpkg" command you use the system will respond with a long message similar to the ones for BetaMiniUser and workdir.
The labels like "V0X-YY-ZZ" are called tags.
Because BaBar code is always changing, there is more than one version of each package, and each one has its own tag.
When you add extra numbered tags you replace your test release's default packages with newer packages that have code improvements.
When you add extra tags, make sure you also check your dependencies with the checkdep command, following the instructions at the top of
the Extra Tags page.
To see a list of all your packages and their tags, type:
ana50> showtag
The system should respond with something like:
BetaMiniUser V00-04-05
workdir V00-04-21
Once you have carried out any compulsory instructions on the Extra Tags page, you have an up-to-date, working copy of analysis-50 and can start to do some physics analysis.
Add or modify analysis code
The point of having your own test release is that you can modify its code to carry out your own analysis.
You will learn more about how BaBar code works and how to modify it later in the workbook.
For now, just use the following commands to copy the code you need for the quicktour to your BetaMiniUser directory:
ana50> cp BetaMiniUser/AppUserBuildBase.cc BetaMiniUser/AppUserBuildBase.ccold
ana50> cp BetaMiniUser/MyMiniAnalysis.tcl BetaMiniUser/MyMiniAnalysis.tclold
ana50> cp $BFROOT/www/doc/workbook/examples/ex0/* BetaMiniUser/
Now move one of these files, snippet.tcl, to workdir:
ana50> mv BetaMiniUser/snippet.tcl workdir/
Before You Compile and Link - set the OO_FD_BOOT variable, and make a .bbobjy file
Before you can run an analysis job you need to set the conditions database environment.
This database contains information about the status of the machine at the time that data was analysed
(for example the precise alignment of the detector components).
**NOTE**, if you have logged out and back in, this command is necessary to reestablish the conditions database environment.
To do this, you need to set your OO_FD_BOOT environment variable to point to the database where the data you will use is stored.
You set the database conditions to use by typing:
ana50> anal50boot
The system should respond with:
Setting CDB_ROO_BOOT to kanga::/anal50boot/full/cdb_boot.root
Now there is just one more thing to do.
In your releasea directory (ana50 in this example), make a file called .bbobjy.
This file will contain a single line with a FDID number that has been assigned to you.
To find your FDID numbers, enter:
> GetFDID
You can create your .bbobjy file with the following command:
ana50> echo "FD_NUMBER = ****" > .bbobjy
where **** is one of the 4- or 5-digit FDID numbers assigned to you.
This file is needed in order for part of the gmake command used below (specifically, the gmake database.import part) to work.
In the next two sections you are going to ask the system to perform some CPU-intensive tasks.
When you have a job that requires heavy use of computing resources, you should send it to the batch queue.
This ensures that you "wait your turn" to use CPU resources.
The command to submit a job to the batch queue is:
bsub -q QUEUE -o LOGFILE JOB_COMMAND
JOB_COMMAND is the command that you would type at the prompt if you were submitting the job directly.
LOGFILE is your choice of name for the log file.
QUEUE is the name of the queue.
In general, you should use the bldrecoq queue to compile and link (next section) and the kanga queue to run your job.
For more information about submtting jobs to the batch system, see the batch processing section of the Workbook.
You are now ready to compile and link the job.
To compile and link, you will use the command gmake all.
This is a "smart" command that executes several gmake commands in the correct order:
- gmake installdirs
- gmake database.import
- gmake schema
- gmake include
- gmake lib
- gmake bin
- gmake javalinks
- gmake python
Each of these gmake commands is called a target.
The most important targets are lib to compile your code, and bin to link your code.
Many of these targets are not needed for your simple BetaMiniUser job.
Experienced users are able to select only the targets that they need.
But unless you are quite sure of what you are doing, it is best to use gmake all just to be safe.
Users on SLAC machines should compile by using the batch queue bldrecoq.
Users working at other sites should ask their local system experts which queue to use, and which commands are required to submit jobs.
Compile and link the Job
Submit the job for batch compilation and linking by using the following command:
ana50> bsub -q bldrecoq -o all.log gmake all
This command sends the job "gmake all" to the bldrecoq queue, and writes the output of the compilation step to the file all.log in your workdir directory.
The system should respond with something like:
Job <563645> is submitted to queue <bldrecoq>.
Note that you can kill the batch job with the command;
ana50> bkill <your_jobid>
You can also kill all of your jobs with the command
ana50> bkill 0
(This can be a particularly useful command at times.)
You can check progress of a SLAC batch job with the command
ana50> bjobs
The system should respond with something like:
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME
563645 username RUN bldrecoq yakut06 bldlnx06 gmake all Apr 20 21:13
For more information about submitting and checking batch jobs, see:
Your job is done when bjobs responds:
No unfinished job found
Once the compilation is finished check that the lib files (files ending in ".a") have been generated by your gmake lib command:
ls -l lib/$BFARCH/
The system should respond with something like:
total 2520
-rw-r--r-- 1 username br 2577960 Apr 20 21:17 libBetaMiniUser.a
drwxr-xr-x 5 username br 2048 Apr 20 21:05 templates
Also check that the executable have been generated:
ls -l bin/$BFARCH/
The system should respond with something like:
total 69009
-rwxr-xr-x 1 username br 70663891 Apr 20 21:21 BetaMiniApp
-rw-r--r-- 1 username br 72 Apr 20 21:23 Index
You should always use the long list command (ls -l) to check the date and time, and make sure that a new binary file was produced.
Accidentally using an old binary is a common mistake.
(Note: "executable", "binary", and "application" are all names for the program created when you compile and link your code.
In this case, BetaMiniApp is the name of the executable.)
As another check, compare you all.log file with the sample all.log.
BaBar code usually gives lots of confusing warning messages.
Ignore anything that says "warning." Worry only about things that say "error."
This section contains a brief walk-through of how to find data for your analysis.
There is more information about finding data (both real and simulated) in the Workbook section Find Data.
The basic tool for finding and accessing data is
BbkDatasetTcl.
To find out what real and Monte Carlo (simulated) data sets are available, from any SLAC computer you can type
ana50> BbkDatasetTcl
This will produce a long list of data sets.
(To keep the list from flying by too fast to be read, you may wish to pipe this command to less ("BbkDatasetTcl | less"),
or send the output to a file ("BbkDatasetTcl >& BbkDatasetTcl.txt").)
A sample of the output from this command is here:
AllEventsSkim-Run5-OnPeak-R18c-v07
AllEventsSkim-Run5-OnPeak-R18d
AllEventsSkim-Run5-OnPeak-R18d-v05-diff-v06
AllEventsSkim-Run5-OnPeak-R18d-v05-diff-v06-v07
AllEventsSkim-Run5-OnPeak-R18d-v07
AllEventsSkim-Run5-OnPeak-R22a
AllEventsSkim-Run5-OnPeak-R22a-v02
AntiDeuteron-Run1-OffPeak-R18b
AntiDeuteron-Run1-OffPeak-R18b-v02
AntiDeuteron-Run1-OffPeak-R18b-v03
AntiDeuteron-Run1-OffPeak-R18b-v04
AntiDeuteron-Run1-OffPeak-R18b-v05
AntiDeuteron-Run1-OffPeak-R18b-v06
AntiDeuteron-Run1-OffPeak-R18b-v07
AntiDeuteron-Run1-OnPeak-R18b
The names of the different data sets give you a good idea of what they are for.
"AllEvents" and "AllEventsSkim" are generic large data sets, with a minimum of selection.
Sets with the names of specific decays or particles, like "AntiDeuteron" above,
are skims subsets of AllEventsSkim produced with a special selector for a particular analysis.
Monte Carlo (simulated) data sets are also listed by BbkDatasetTcl.
Their names begin with the prefix "SP-". For example, further down in the list you have:
SP-1235-XiMinus-Run3-R22a
SP-1235-XiMinus-Run4-R18b
SP-1235-XiMinus-Run4-R18d
SP-1235-XiMinus-Run5-R18b
SP-1235-XiMinus-Run5-R18d
SP-1235-XiMinus-Run5-R22a
SP-1237
SP-1237-A0-R18b
SP-1237-A0-R22b
SP-1237-A0-Run1-R18b
SP-1237-A0-Run2-R18b
SP-1237-A0-Run2-R18b-G4Bug
SP-1237-A0-Run3-R18b
SP-1237-A0-Run3-R18b-G4Bug
SP-1237-A0-Run3-R22b
SP-1237-A0-Run4-R18b
SP-1237-A0-Run5-R18b
These are all Monte Carlo sets of various types.
1235 and 1237 are mode numbers that tell you what kind of decay is being simulated.
For example, 1237 is one of the most popular mode numbers: the mode number for generic B0B0bar decays.
You will learn more about the different data and Monte Carlo sets in the Find Data section of the Workbook.
As an example, we will study Monte Carlo simulated B0-B0bar meson decays appropriate to the Run4 (approximately 2004) data-taking period.
From the above list, we see that the appropriate set is SP-1237-Run4.
The next step is to produce a file that will tell your BetaMiniApp executable where the SP-1237-Run4 collections are.
To do this, from your workdir enter the command:
ana50/workdir> BbkDatasetTcl -ds SP-1237-Run4
The output from this command should look something like:
BbkDatasetTcl: wrote SP-1237-Run4.tcl
Selected 1435 collections, 167982000/167982000 events, ~0.0/pb, from bbkr18 at slac
In the directory from which you ran the BbkDatasetTcl command there should now be a file called SP-1237-Run4.tcl
The file looks like this:
## This file was generated automatically on 2007/04/20-22:01:53-PDT
## by user username on host yakut06 from /u/br/username/ana50/workdir
## using: BbkDatasetTcl -ds SP-1237-Run4
## version Id: BbkTcl.pm,v 1.57 2006/06/22 17:44:05 adye Exp
## Selected dataset from bbkr18 at slac:
## SP-1237-Run4 (update of production datasets) created 2005/04/13-16:47:04-PDT by douglas
# 138000/138000 events selected from 69 on-peak runs, added to dataset at 2005/11/04-22:50:14-PDT, lumi = ~0.0/pb
lappend inputList /store/SP/R18/001237/200309/18.6.0b/SP_001237_013238
# 138000/138000 events selected from 69 on-peak runs, added to dataset at 2005/11/04-22:50:14-PDT, lumi = ~0.0/pb
lappend inputList /store/SP/R18/001237/200309/18.6.0b/SP_001237_013239
# 48000/48000 events selected from 24 on-peak runs, added to dataset at 2005/11/05-04:48:59-PDT, lumi = ~0.0/pb
...
...
lappend inputList /store/SP/R18/001237/200407/18.6.1a/SP_001237_068943
# 124000/124000 events selected from 62 on-peak runs, added to dataset at 2006/03/13-23:47:30-PDT, lumi = ~0.0/pb
lappend inputList /store/SP/R18/001237/200407/18.6.1a/SP_001237_068944
# 92000/92000 events selected from 46 on-peak runs, added to dataset at 2006/03/14-00:47:24-PDT, lumi = ~0.0/pb
lappend inputList /store/SP/R18/001237/200407/18.6.1a/SP_001237_068945
## Total selected: 1435 collections, 167982000/167982000 events, ~0.0/pb
## (Note! The luminosity reported here is approximate. The full
## and accurate value must be obtained using BbkLumi.
## In addition, the event count and luminosity reported in each Tcl
## file are based on the values in the entire original collection(s),
## and not the subset (e.g. ...%selectEventSequence=1-50000) used to
## define the Tcl file.)
## Last collection added to dataset: 2006/10/12-04:47:31-PDT
Each of the "lappend inputList" lines is a command (in tcl-language) that tells BetaMiniApp the location of a Monte Carlo collection.
This file is used as input into your BetaMiniApp job.
BetaMiniUser contains a lot of tcl files that control the BetaMiniApp executable when it is run.
For a specific analysis, you will need a few more tcl files to control the specific details of your jobs.
You have already copied the tcl files you need from $BFROOT/www/doc/workbook/examples/ex0/.
- MyMiniAnalysis.tcl A modified version of the MyMiniAnalysis.tcl file found in BetaMiniUser.
- snippet.tcl A "snippet" tcl file used to perform some setup.
If you take a look at the file snippet.tcl, you will see that it performs three tasks.
First, it sets some important tcl parameters:
set ConfigPatch MC
set levelOfDetail cache
set BetaMiniTuple root
set histFileName myHistogram.root
This tells BetaMiniApp that you are using Monte Carlo (MC) events and that you want the result in a root-format ntuple called myHistogram.root.
(cache refers to the level of detail, which you will learn about later.)
Important: If you were running on real data instead of Monte Carlo simulated data, you would have to change the ConfigPatch from MC to Run1 or Run2.
Finally, snippet.tcl passes the job to BetaMiniUser/MyMiniAnalysis.tcl:
sourceFoundFile BetaMiniUser/MyMiniAnalysis.tcl
MyMiniAnalysis.tcl in turn does some more setup and then passes the job to btaMini.tcl, which is the main tcl file.
Run the job
You are now ready to run the job.
Remember that if you come to this step after a fresh login, you need to go to the release directory (cd ana50),
execute the srtpath script, and reenter the anal50boot command.
Jobs are always run from workdir. Make sure you are in the workdir directory. To start the job, type:
ana50/workdir> BetaMiniApp snippet.tcl
The system should start to respond very quickly with a chunk of output which looks something like this:
set BetaMiniReadPersistence Kan ;# not set, using default
set levelOfDetail cache ;# set to default
set ConfigPatch MC ;# set to default
# NEvent not set
set BetaMiniTuple root ;# set to default
set histFileName myHistogram.root ;# default is MyMiniAnalysis.root
BetaMiniOptions.tcl::Warning: ConfigPatch is obsolete. Please set MCTruth directly
BetaMiniOptions.tcl::Warning: levelOfDetail "cache"
BetaMiniOptions.tcl::Warning: MCTruth "true"
BetaMiniOptions.tcl::Warning: ErrLoggingSeverity "warning"
BetaMiniOptions.tcl::Warning: BetaMiniTuple "root"
BetaMiniOptions.tcl::Warning: histFileName "myHistogram.root"
WARNING: BtaFixMultiBumps: unknown module
BtaProdCreateSequence.tcl done
BetaMiniSequence.tcl::Error: Turning off broken physics code
BetaMiniSequence.tcl::Error: Disabling TrkEffTableCreateor: this module looks for a track efficiency file on beginJob
# MyMiniQA not set
Everything (enabled)
BetaMiniSequence (enabled)
BetaMiniInitSequence (enabled)
BetaMiniEnvSequence (enabled)
RecEventControlSequence (enabled)
EvtCounter (enabled) event counter
RecTimeStampFilter (enabled) timestamp filter
GenBuildEnv (enabled) Build General Environment
MatBuildEnv (enabled) Build Materials
CdbApiInitSequence (enabled)
BdbTclProxyRegister (enabled) Manages operations with BdbTclModuleParmList
CdbApiInitModule (enabled) Set up parameters of Conditions/DB API implementations
CdbEvtLoadStateId (enabled) Load Cdb StateId into transient eventstore
CfgInitSequence (enabled)
CfgBuildEnv (enabled) Build configDB Environment
CfgSetKeyModule (enabled) stores configKey in the environment
PepBuildEnv (enabled) build Pep environment
L3TBuildEnv (enabled) Build L3Trigger environment
L3TConfigModule (enabled) Create L3 configuration
SvtInitSequence (enabled)
SvtBuildEnv (enabled) initialize Geometry for the Svt
DchInitSequence (enabled)
DchBuildEnv (enabled) Build Dch environment
DchCondMonitor (disabled) Dch conditions monitor
DrcInitSequence (enabled)
DrcEnvModuleSequence (enabled)
DrcBuildEnv (enabled) DIRC - Setup environement for the DIRC
DrcBuildGeom (enabled) DIRC - Create the DrcDetector
DrcInitEvent (enabled) DIRC - Initializations at the beginning of an Event
EmcInitSequence (enabled)
EmcBuildEnv (enabled) Build Emc Environment
EmcBuildGeom (enabled) Builds Emc detector model
EmcLoadPid (enabled) Loads environmenty with Emc PID factory
EmcEdgeCorrLoader (enabled) Load Emc Edge Correction into environment
EmcNeutCorrLoader (enabled) Load Neutrals Correction into environment
EmcLoadCalibToo (enabled) Loads environment with relevant EMC calibrator(Too) proxy
EmcLoadDigiCalib (enabled) Loads environment with relevant EMC digi calibrator proxies
IfrInitSequence (enabled)
IfrBuildEnv (enabled) IFR - build IfrEnv
IfrVstModule (enabled) IFR - visitor manager
IfrPidObjyLoader (enabled) IFR - read Pid Calibration from CDB
IfrMuCalib (enabled) IFR - mu/pi calibration procedure
IfrNeutralCalib (enabled) IFR - neutral calibration procedure
TrkBuildEnv (enabled) Build Tracking environment
HbkTupleEnv (disabled) Build HbkTuple Manager
RooTupleEnv (enabled) Build RooTuple Manager
PdtInit (enabled) initialize Particle Data Table
BtaBuildEnv (enabled) Put the BtaEnv object into the environment
BtaInitEvent (enabled) Beta- event initialisation
EffTableSequence (enabled)
EffTableLoader (enabled) Load Efficiency Table Proxies
BetaMiniReadSequence (enabled)
CdbEvtLoadStateIdHistory (enabled) CdbEvtLoadStateId clone
KanCreateCM (enabled) Create KanConversionManager
HdrKanLoadHdr (enabled) HdrKanLoad clone
TagKanLoadTag (enabled) TagKanLoad clone
KanEventUpdateTag (enabled) KanEventUpdate clone
BetaMiniTagFilterSequence (enabled)
G4KanLoadTru (enabled) G4KanLoad clone
L1FctKanLoadTru (enabled) L1FctKanLoad clone
TrkKanLoadAod (enabled) TrkKanLoad clone
EmcKanLoadAod (enabled) EmcKanLoad clone
IfrKanLoadAod (enabled) IfrKanLoad clone
PidKanLoadAod (enabled) PidKanLoad clone
L1FctKanLoadAod (enabled) L1FctKanLoad clone
L1GltKanLoadAod (enabled) L1GltKanLoad clone
RecoKanLoadAod (enabled) RecoKanLoad clone
BtaMiniKanLoadCnd (enabled) BtaMiniKanLoad clone
KanEventUpdateAllTheRest (enabled) KanEventUpdate clone
BetaMiniDetectorSequence (enabled)
BetaMiniPidSequence (enabled)
PidExpandChargedSummary (enabled) Expand PidChargedSummary to separate lists
PidMakeTrkMap (enabled) Make and fill map from Tracks to PidInfo objects
BetaMiniTrkSequence (enabled)
KalFit (enabled) Kalmanize Mini tracks
KalMiniRX (enabled) Repair Mini tracks
TrkMakePid (enabled) Pid info from tracks
BetaMiniDrcSequence (enabled)
DrcCreatePidInfoFromMini (disabled) DIRC - create DrcPidInfo from DrcTrack
DrcIdentify (disabled) DIRC - Particle Id Module - first pass
DrcCleanAssociation (disabled) DIRC - Clean Associations
DrcSecondPass (disabled) DIRC - Particle Id Module - second pass
DrcCheckReco (disabled) DIRC - check Reco (NA)
BunchT0MiniSequence (enabled)
InitBunchT0 (disabled) MC Truth Bunch time
DchTrkBunchT0 (disabled) Track Bunch T0 Finder
DrcCheckEventT0 (disabled) DIRC - Check Event T0 using Dirc data
TrkT0Faker (enabled) Add T0 from tag-db to BunchList
BunchT0TagSet (disabled) Set bunch T0 tags
PrintBunch (disabled) Printout Bunch t0s
BetaMiniSvtSequence (enabled)
SvtHitReco (disabled) makes Clusters and Hits from rootClusters
SvtMakePid (disabled) Create SvtPidInfo list
BetaMiniDchSequence (enabled)
DchMiniHitsSequence (disabled)
DchMiniMakeHits (enabled) Reconstitute Default DchHit list
DchMakeHitMap (enabled) Create map of DchHit pointers to cells
DchPidMakeHitMap (disabled) Create dE/dx list
DchMakePid (disabled) Create DchPidInfo list
DchMakePidMap (enabled) Index PID vs. tracks
BetaMiniEmcSequence (enabled)
EmcMakeMiniReco (enabled) Creates Bump, Cluster, and shared digi lists
EmcSetClusterCalibrator (enabled) change cluster calibrator for EmcCands
EmcTrackMatch (enabled) Match tracks to bumps
EmcCreateUniqueList (enabled) Make a unique list of EmcCands
EmcMakeMiniCandLists (enabled) Creates the various lists of EmcCands from EmcListBank
BetaMiniIfrSequence (enabled)
IfrMakeExpansion (enabled) Expand compactified minis
BetaMiniNeutralHadSequence (disabled)
NeutralHadSequence (enabled)
NeutralHadMatch (enabled) Emc and Ifr match
MakeNeutralHad (enabled) make IFR neutral hadrons
NeutralHadMatchAll (enabled) Emc and Ifr match method2
MakeNeutralHadAll (enabled) make all neutral hadrons
NeutralHadNtuple (disabled) neutral hadrons Ntuple
BetaMiniTruSequence (enabled)
GTrkFillDaughters (enabled) Fill daughters field of GTracks
BtaLoadMcCandidates (enabled) Load Default MC Beta Candidates
BtaLoadGHitAssoc (enabled) Beta - MC GHit associator
BetaMiniBtaSequence (enabled)
BtaProdCreateSequence (enabled)
BtaLoadEvtInfo (enabled) Load default EventInfo
PhysInitEvent (enabled) Beta- event initialization
PhysCreateAlias (enabled) create aliases for ALists
BetaLoadMiniSequence (enabled)
BtaLoadBeamSpot (enabled) load the BeamSpot into the EventInfo
LoadMiniBtaCandidates (enabled) load Beta lists from mini objects
LoadEventInfoSequence (enabled)
BtaLoadBeamSpot (enabled) load the BeamSpot into the EventInfo
BtaGoodTrackSequence (enabled)
LoadBetaTracksLists (enabled) Create BetaCandidate Lists
GoodTrackVeryLooseSelection (enabled) Selection of good track for primary vertex
GoodTrackAccSelection (enabled) Selection of good track within acceptance
GoodTrackLooseSelection (enabled) Selection of good track for primary vertex
GoodTrackAccLooseSelection (enabled) Selection of good track within acceptance plus loose cuts
GoodTrackTightSelection (enabled) Selection of good track for primary vertex
GoodPhotonLooseSelection (enabled) Selection of loose good photons
GoodNeutralLooseAccSelection (enabled) Selection of loose good photons
GoodPhotonDefaultSelection (enabled) Selection of default good photons
TrkMicroDispatch (enabled) Create bitmaps for tracks
TrkEffTableCreator (disabled) Create tracking efficiency tables
VtxEvent (enabled) search the vertex of the event
BetaMiniUtilitySequence (enabled)
CpuCheck (enabled) Check CPU time remaining
Signal (enabled) intercept ^C
PrintParms (disabled) print parameter values
ReportFPE (enabled) handle and report floating point exceptions
MyMiniAnalysis (enabled) MyMiniAnalysis
QExample (enabled) Workbook example module
You can ignore the warning and error messages for now provided our output ends with the last few lines shown above.
At this point, BetaMiniApp realizes that it needs user input, so it pauses the job.
Each of the names above (before each "enabled") is the name of a module.
Modules are the basic building blocks of BaBar code.
You will learn more about them in the modules section.
The prompt ">" indicates that now you are "inside" your job, or inside the Framework.
When you are inside the framwork you can change settings, query the executable and control the analysis job.
To begin, you need to set the collection to tell the executable where to find the data you are going to run on.
To do this you need to talk to an input module:
> mod talk KanEventInput
This should give you a KanEventInput prompt:
KanEventInput>
Now you enter commands from the tcl file SP-1237-Run4.tcl.
To pass a collection name to KanEventInput, you use the command:
KanEventInput> input add /store/SP/R18/001237/200309/18.6.0b/SP_001237_013238
To confirm that the collection has been added to the input list, type:
KanEventInput> input list
To which the program responds:
KanEventInput> input list
Collections:
/store/SP/R18/001237/200309/18.6.0b/SP_001237_013238
Components:
hdr
tag
tru
aod
cnd
Now you are done talking to KanEventInput, so you can return to the framework (">");
KanEventInput> exit
>
Next, you need to start the job, and tell the system how many events to process. Let's begin with three:
> ev beg -nev 3
The system should respond with:
CdbApiInitModule::CdbApiInitModule.cc(224):CdbApiInitModule: Using CDB technology "Roo".
CdbApiInitModule::CdbApiInitModule.cc(231):CdbApiInitModule: Using CDB implementation "Readonly".
CdbApiInitModule::CdbApiInitModule.cc(264):CdbApiInitModule: Using CDB database "kanga::/cond22boot/full/cdb_boot.root".
CdbApiInitModule::CdbApiInitModule.cc(284):CdbApiInitModule: Using CDB view "::".
Warning in :
The StreamerInfo of class IfrStripDataCdbR read from file root://kanolb-a//store/...
has the same version (=1) as the active class but a different checksum.
You should update the version to ClassDef(IfrStripDataCdbR,2).
Do not try to write objects with the current class definition,
the files will not be readable.
EmcBuildGeom::BdbTclModuleManager.cc(110): CONTAINER DOES NOT EXIST
IfdStrKey(EmcEdgeCorrTheta)IfdStrKey(EmcEdgeCorrPhi)IfdStrKey(EmcEdgeCorrThetaSigma)IfdStrKey...
EmcNeutCorrLoader:begin Job
BtaBuildPidEnv::AbsEnv.cc(399):Overriding BtaEnv object in global environment.
CompPi0ListMerger:CompPi0ListMerger begin Job
KanEventInput::KanFileReg.cc(341):KanFileReg: read UUID c574a7e0-4bc0-11da-82cd-d80a67dede29
Adding /store/SP/R18/001237/200309/18.6.0b/SP_001237_013238
KanEventInput::KanEventInput.cc(603):Opening collection /store/SP/R18/001237/200309/18.6.0b/SP_001237_013238
KanEventInput::KanTreeBase.cc(241):No Branch called Emc
KanEventInput::KanTreeBase.cc(241):No Branch called Emc_CandListBank
KanEventInput::KanTreeBase.cc(241):No Branch called L1Glt
KanEventInput::KanTreeBase.cc(241):No Branch called Reco_EmcCands
KanEventInput::KanTreeBase.cc(241):No Branch called Bta
EvtCounter: processing event # 1 [ 1d:ffffffff:0572ea/49a0ef99:K ]
EmcDetector::applyGlobal: The following alignment constants are loaded:
Alignment for element 0Emc Global Barrel
Translation vector = (0,0,0)
Rotation vector = (0, 0, 0)
Alignment for element 0Emc Global Endcap
Translation vector = (0,0,0)
Rotation vector = (0, 0, 0)
These constants will be used to align the EMC
EmcNeutCorrLoader:EmcMkIINeutCorrCalibrator is switching Neutral corrections (to Monte Carlo) OFF
EmcDigiCalib Constants Info for /emc/EmcSrcCalType:
Begin: Tue Jan 1 16:00:01 1901 (local time) 0 ns, End: Tue Jan 1 16:00:01 1991 (local time) 0 ns, Created:...
EmcDigiCalib Constants Info for /emc/EmcBhabhaType:
Begin: Tue Jan 1 16:00:01 1901 (local time) 0 ns, End: Fri Jan 1 00:00:01 1999 (local time) 0 ns, Created:...
EmcTrackMatch::EmcPocaMatchMethod.cc(877):Use track match constants from ASCII file.
EvtCounter: processing event # 2 [ 1d:ffffffff:0572ea/49a0f302:R ]
EvtCounter: processing event # 3 [ 1d:ffffffff:0572ea/49a0f66b:X ]
>
Again, you can ignore any warning messages, but should investigate any error messages you see.
Buoyed by this success, let's run a few more events:
> ev cont -nev 37
making 40 in all. You should see something like:
EvtCounter: processing event # 4 [ 1d:ffffffff:0572ea/49a0f9d4:L ]
EvtCounter: processing event # 5 [ 1d:ffffffff:0572ea/49a0fd3d:S ]
...
...
EvtCounter: processing event # 39 [ 1d:ffffffff:0572ea/49a1712f:S ]
EvtCounter: processing event # 40 [ 1d:ffffffff:0572ea/49a17498:Y ]
>
You may also see some messages like this:
LoadMiniBtaCandidates::BtaCandBase.cc(627): attempt to call BtaCandBase::setType("Upsilon(4S)") for a composite
BtaCandidate whose 9 daughters have total charge -1
Don't worry about those messages.
Finally, end the Beta analysis session by typing:
> exit
The system should respond very quickly with:
TagBGFMultiHadron:TagBGFMultiHadron: endJob summary:
Events processed: 0
Events passed : 0
Events prescaled: 0
TagInspector:TagInspector: endJob summary:
Events processed: 0
MyMiniAnalysis::MyMiniAnalysis.cc(116):
match vs charge
*-----*-----*-----*
0.5| 220| 585| 239|
-0.5| 0| 52| 0|
*-----*-----*-----*
-1.5 -0.5 0.5
UsrCandRefCheck:end job
GoodPhotonLooseUsernameSelection:GoodPhotonLooseUsernameSelection selected 0 of 0 candidates.
GoodPhotonSemiLoose_BFlav:GoodPhotonSemiLoose_BFlav selected 0 of 0 candidates.
KLHNotPionGTL_BFlav:KLHNotPionGTL_BFlav selected 0 of 0 candidates.
KLHNotPion_BFlav:KLHNotPion_BFlav selected 0 of 0 candidates.
KLHVeryTight_BFlav:KLHVeryTight_BFlav selected 0 of 0 candidates.
KLHTight_BFlav:KLHTight_BFlav selected 0 of 0 candidates.
KLHLoose_BFlav:KLHLoose_BFlav selected 0 of 0 candidates.
KLHVeryLoose_BFlav:KLHVeryLoose_BFlav selected 0 of 0 candidates.
GoodTracksLoose_BFlav:GoodTracksLoose_BFlav selected 0 of 0 candidates.
GoodTracksVeryLooseHard_BFlav:GoodTracksVeryLooseHard_BFlav selected 0 of 0 candidates.
...
...
NNLooseMuonSelectionFakeRate:NNLooseMuonSelectionFakeRate selected 0 of 0 candidates.
NNVeryLooseMuonSelectionFakeRate:NNVeryLooseMuonSelectionFakeRate selected 0 of 0 candidates.
NNVeryTightMuonSelection:NNVeryTightMuonSelection selected 0 of 0 candidates.
NNTightMuonSelection:NNTightMuonSelection selected 0 of 0 candidates.
NNLooseMuonSelection:NNLooseMuonSelection selected 0 of 0 candidates.
NNVeryLooseMuonSelection:NNVeryLooseMuonSelection selected 0 of 0 candidates.
LikeTightMuonSelection:LikeTightMuonSelection selected 0 of 0 candidates.
LikeLooseMuonSelection:LikeLooseMuonSelection selected 0 of 0 candidates.
LikeVeryLooseMuonSelection:LikeVeryLooseMuonSelection selected 0 of 0 candidates.
VeryTightMuonMicroSelection:VeryTightMuonMicroSelection selected 0 of 0 candidates.
TightMuonMicroSelection:TightMuonMicroSelection selected 0 of 0 candidates.
LooseMuonMicroSelection:LooseMuonMicroSelection selected 0 of 0 candidates.
VeryLooseMuonMicroSelection:VeryLooseMuonMicroSelection selected 0 of 0 candidates.
MinimumIoniziongMuonMicroSelection:MinimumIoniziongMuonMicroSelection selected 0 of 0 candidates.
GoodTrackAccSelection:GoodTrackAccSelection selected 436 of 459 candidates.
GoodTrackVeryLooseSelection:GoodTrackVeryLooseSelection selected 370 of 459 candidates.
IfrMakeChargedPid:IfrMakeChargedPid end Job
IfrMuMuCalib::IfrMuMuCalib.cc(130):_mumucal is null!
TagFilterByValue:TagFilterByValue: endJob summary:
Events processed: 0
Events passed : 0
TagFilterByName:TagFilterByName: endJob summary:
Events processed: 0
Events passed : 0
Events prescaled: 0
EmcNeutCorrLoader: end Job
EmcEdgeCorrLoader: end Job
DchBuildEnv::AbsEnv.cc(241):Overriding DchEnv object in global environment.
EvtCounter:EvtCounter: total number of events=40
total number of events processed=40
total number of events skipped=0
EvtCounter:Total CPU usage: 10 User: 8 System: 2
Framework is exiting now.
DrcDetector: number of sets to destroy: 51
Two very useful commands to know are "help" and "exit."
If you get stuck, you can type "help" for a list of options, or "exit" to exit, at the framework prompt (">") or any module prompt ("ModuleName>").
The example job will create an ntuple named myHistogram.root
Files ending in ".root" are meant to be analyzed with ROOT, a physics analysis package.
You will be learning more about how to use ROOT in the ROOT tutorial.
For now you'll just do one simple task: start ROOT, open the ntuple file, and look at a histogram.
To start a ROOT session, type:
ana50/workdir> bbrroot
(Note: "bbrroot" accesses a BaBar wrapper script for the ROOT package.
In standard installations of ROOT, you just use the command "root".)
This should give you a popup window showing a naked lady with tree roots instead of legs.
Then the system will say:
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.16/00 27 June 2007 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
Compiled on 1 August 2007 for linux with thread support.
CINT/ROOT C/C++ Interpreter version 5.16.21, June 22, 2007
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
...using style 'Plain'
...found RELEASE directory
...found PARENT directory
...running in release 24.3.2
For approved plots use: gROOT->SetStyle("BABAR");
To add a BABAR label use: BABARLabel();
To add a better-scaling BABAR label use: BABARSmartLabel();
Type "BABARSmartLabel(-2);" for options
root [0]
Open the file:
root[0] TFile f("myHistogram.root");
root[1]
If the file is found, there will be no response.
If you instead get an error message about the file not being found,
check that you started ROOT from the workdir directory or check that the run output matched the log files shown earlier.
List the available histograms:
root[1] f.ls();
The system should respond:
TFile** myHistogram.root Created for you by RooTupleManager
TFile* myHistogram.root Created for you by RooTupleManager
KEY: TH1F h1d1;1 MC reco abs mtm difference
KEY: TH1F h1d2;1 Reco track momentum
KEY: TH1F h1d3;1 Tracks per Event
KEY: TH1F h1d4;1 TagInspector Status
Each TH1F is a 1-dimensional histogram of floats.
"Tracks per Event", is the one that was created by the QExample code that you added to BetaMiniUser.
root[2] h1d3->Draw();
If you wait a few seconds, then a new window with the histogram should appear. It should look like this:

After your heart stops beating wildly at this sight, you can end the ROOT session using the command:
root[3] .q
The system will return to your yakut prompt.
The example root file generated from this exercise is here.
We will revisit this file in the Workbook's ROOT Tutorial.
Conclusion
You have now demonstrated that you can run BaBar Offline software from your desktop.
You have created a release directory, set up to use the database, compiled, linked and run a standard analysis job.
You have viewed the resulting histograms using ROOT.
These are the basic steps in a running a BaBar analysis.
The rest of the Workbook Core sections will explain each step in much more detail.
Congratulations on having come this far.
Page maintained by Adam Edwards
Last modified: August 2008
|