SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Comp. Search
Who's who?
Meetings
FAQ Homepage
Archive
Environment
Administration
New User Info.
Web Info/Tools
Monitoring
Training
Tools & Utils
Programming
C++ Standard
SRT, AFS, CVS
QA and QC
Remedy
Histogramming
Operations
PromptReco
Simulation Production
Online SW
Dataflow
Detector Control
Evt Processing
Run Control
Calibration
Databases
Offline
Workbook
Coding Standards
Simulation
Reconstruction
Prompt Reco.
BaBar Grid
Data Distribution
Beta & BetaTools
Kanga & Root
Analysis Tools
RooFit Toolkit
Data Management
Data Quality
Event display
Event Browser
Code releases
Databases
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)
Recipe to read KanGA files

Release : 8.6.3c-physics-1 or any later physics release

How To Produce the Executable
How To Run the Executable

How To Produce the Executable

Start from a test release (replace 8.6.3c-physics-1 by any later physics release):

 newrel -s <myScratchArea> -t 8.6.3c-physics-1 8.6.3c-physics-1
 cd 8.6.3c-physics-1
 srtpath <ret> <ret>
 addpkg BetaUser
 addpkg workdir
 gmake workdir.setup

Then compile :

 bsub -q bldrecoq -o logFile "gmake lib ROPT=-noDebug"

Set the environment variables to select which options you want to include in your executable (they can be later disabled at run time). The values used below are the recommended setup to get started. Replace "yes" with "no" and vice versa to build an executable using different options. Note that only the first two options refer specifically to kanga or objectivity. The other options have the same effect, independent of the event format you are reading. Instead of typing in the commands below, you can download and source this file.

 setenv BetaKanga         yes

If you don't want your executable to be able to read data from the BaBar Event Store

 setenv BetaBdbMicro      no

If you want to have access to the Beta Physics Toolkit (VertexingTools, PidTools, CompositionTools, Cornelius++)

 setenv BetaPhysMicro     yes

If you don't want to include Micro-level display

 setenv BetaDisplayMicro  no

If you want the ability of accessing the micro-truth (produces a slightly larger executable)

 setenv BetaMCMicro       yes
 setenv BetaMCAll         no

If you want your histograms dumped in a ROOT file rather than in an HBOOK file

 setenv BetaRootTuple     yes

You're ready to link

 bsub -q bldrecoq -o logFile "gmake BetaUser.bin ROPT=-noDebug"

Your log file should look something like this and the build job should only take about 80 seconds of CPU. The result will be a program BetaApp in your test release's bin/$BFARCH subdirectory.
 

How to Run the Executable

The first step for running an analysis is to determine which data to read. Use the skimData program to find Kanga data at SLAC. For example, to read the Kpi skim for good runs in the range 12000-12150, use this command:

 cd workdir
 skimData -s KpiKanga -g 12000-12150 --tcl

This command creates a file, KpiKanga.tcl, which can be used to configure your job to read the selected runs.

Note: Using the environment variable "KangaRooTcl" is not supported any more. Rather put the following line somewhere into your myAnalysis.tcl file to set the input collections:

  source KpiKanga.tcl

If you got used to KangaRooTcl or have scripts using this variable you can also insert the following in your myAnalysis.tcl file:

  source $env(KangaRooTcl)

Next, make any changes to the options you actually want to use when you run your job. For your first kanga job, I recommend the following so that you aren't running the full micro physics sequences:

 setenv BetaPhysMicro no

and since you are reading data:

 setenv BetaMCMicro no

Finally, copy and edit a template tcl file from the BetaUser package into your workdir. For example:

 cp ../BetaUser/kanga.tcl .

Edit this file by adding the following line at the end (this instructs your job to process all the events in batch mode):

 ev begin

Note: You should carfully check that you are using the right value of the B field.  The value is automatically set in kanga.tcl depending on the environment variable BetaMCMicro. If you are running with Monte Carlo events the value should be 1. 508. When running with real data the value should be  1.51007.

Now you are ready to run your first Kanga job:

 bsub -q kanga -o run.log BetaApp kanga.tcl

Note that the job was submitted to the "kanga" queue which can support 24 jobs running on shire02 simultaneously. You can also use the other queues (e.g. long) to run kanga jobs. Your log file should look something like this, and will include some 'normal' warning and error messages. If your log file has other errors, or you have not made it this far, try posting to the kanga hypernews with a description of the problem and the output from your job. Before posting, please check that you do not have the LD_LIBRARY_PATH environment variable pointing to a conflicting version of ROOT. The easiest way to do this is:

 unsetenv LD_LIBRARY_PATH

and then try running again. BetaApp reads the micro for every event and runs the Workbook1 analysis on it. Instead of building and running in the SLAC batch queues, you can also use your desktop computer. Just leave out the batch instructions in the build and run steps above:

 gmake BetaUser.bin
 ...
 BetaUser

The steps above describe how to run on data and read every event. To run on Monte Carlo instead, you should instead set at runtime:

 setenv BetaMCMicro yes

so that your job will load the micro truth (and use the SPKanga stream and the 'spruns' option of skimData to prepare your tcl file). For simulated data, if the MC micro-truth is present, and if BetaMCMicro is set to "yes", the decay tree should be printed-out for the first 10 events.

To skim on tag variables instead of reading all events, you need to copy and modify a different tcl file into your workdir:

 cp ../BetaUser/kangaFilterMicro.tcl .

Make the same changes as described above for kanga.tcl. To configure the tag filtering also copy these to files to your workdir:

 cp ../BetaUser/TagFilterSequence.tcl .
 cp ../BetaUser/MicroFilterSequence.tcl .

Edit these files to add your own sequences, modules and customizations as usual.

Finally here are a few more things you should know:

  • You can also specify the input collection via the RooInputCollection environment variable :

  •  setenv RooInputCollection $BFROOT/kanga/EventStore/groups/.../allevents

    Note : "-micro.root" will be automatically appended to the name, don't put it.
     

  • If you don't want to have all the Physics sequences appended in your path:

  •  
     setenv BetaPhysMicro no

    If BetaPhysMicro is set to yes, your path will include the full micro-level Physics sequences, which takes a fair amount of time per event : you probably want to disactivate the modules that you don't need for your analysis. Another solution is to set BetaPhysMicro to "no" and to append the Physics modules that you need in your own analysis sequence.
     

  • The conditions will be read from the Root Conditions Database. At the moment, there are three different Root Conditions Databases, one for the data, one for SP2 and one for SP3. You can switch from one to the other by talking to the RooBuildEnv module. Also the magnetic field strength needs to be adjusted ( e.g. data = 1.51007 T, MC = 1.508 T, this should be done automatically for releases 8.6.3c-physics-1 and  later.  But to be on the safe side you should check that you are running with the correct settings)  :

  •  module talk RooBuildEnv
       RootConditionsFile set kanga/CondDB/SP3Conditions.root
       FixedFieldStrength set 1.508
     exit



This page is maintained by Gautier Hamel de Monchenault
Last update : July 18th 2000, L. Wilden