Babar logo
Workbook HEPIC Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Wkbk. Search
Wkbk. Sitemap
Logging In
Info Resources
Software Infrastructure
CM2 Introduction
Event Store
Modifying Code
Writing and Editing
Framework II
Find Data
Batch Processing
Advanced Infrastructure
New Releases
Main Packages
Event Displays
Contributing Software
Advanced Topics
Make CM2 Ntuples
New Packages
New Packages 2
Persistent Classes
Site Installation
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

Workbook for BaBar Offline Users - Analysis in PAW II

Further use of PAW for BaBar physics analyses.


This workbook chapter follows on from the first Workbook section about analysis in PAW. In this section you will learn how to set a default macros directory and how to produce publication-read plots in PAW.


Set up a directory to store your PAW macros

It is convenient to set up a directory to store general-purpose PAW macros. This can be done by adding a line to the .pawlogon.kumac file in your home directory. If you don't have such a file, create one with the single line:

macro/default '.,~/pawmacros' -auto

This means that PAW will look for macros first in the current directory (.), then in the directory ~/pawmacros.

While you're editing .pawlogon.kumac , you should probably also add the line:

filecase keep

This command forces PAW to retain information about capitalisation in all files it reads in and write out. Otherwise PAW tends to assume that all filenames are given in lower-case characters - unlike unix.

You can also add the other command lines that are discussed in the pawlogon section of PAW I.

Define several macros in a single file

So far all the macros we have used have been contained in a file with the same name as the macro, and there has only been one macro per file. You can actually have more than one macro defined in a given file. To do this, you start each macro in the file with:
macro myfirstmacro

where myfirstmacro doesn't have to have the same name as the file. You then place the macro code below this line in the usual way, and you define the end of the macro with


Any code after this will be ignored until another macro is defined with, say,

macro mysecondmacro

You should put a return at the end of your final macro in your file also.

The macros are then executed from within a PAW session with

exec mymacrocollection#mysecondmacro

Where mymacrocollection is the name of the file (i.e. mymacrocollection.kumac), and mysecondmacro is the name of one of the macros defined in that file. We shall see several examples of this in the sections below.

Producing publication-ready plots in PAW

This section contains instructions for making attractive-looking plots, with the BABAR logo, rather for publications and presentations. There is one basic example and two complicated ones. The complicated examples are intended primarily as a reference so that the reader can see what else can be done.

Useful presentation macros

You will need two general-purpose macros

  • pub-plot.kumac - this kumac sets up PAW with nice fonts and line widths and so forth, and is based on work originally done by Gautier Hamel de Monchenault.
  • makeps.kumac - writes a plot to a postscript file
Put both of these in your ~/pawmacros directory.

Simple example

For each plot you will want to have a single macro that generates the plot of interet. Here is one that makes a mass distribution of Psi2s->mu+mu-: psi2smm-mass.kumac.

You will need the hbook file inclusive-fits-p52.hbook

There is not much to the kumac code. In this case, I find the defaults put the left title a little too close to the axis number labels, so I moved it a bit. Also, there is a bit of code to convert the ps file to an eps file with no preview. PAW believes it can directly produce an eps file, but I find that the bounding box is wrong.

Create the plot

[~/Work/text/temp]: paw
  *                                                    *
  *            W E L C O M E    to   P A W             *
  *                                                    *
  *       Version 2.13/08      19 September 2002       *
  *                                                    *
  Workstation type (?=HELP) <CR>=1 :
  Version 1.28/07 of HIGZ started
  *** Using default PAWLOGON file "/Users/hearty/.pawlogon.kumac"

  In private pawlogon.kumac.
PAW > exec pub-plot psi2smm-mass 1. 0.7
  now calling psi2smm-mass.kumac
  Postscript Output File =

The first argument passed to pub-plot is the name of the macro that draws the specific plot. The other two arguments give the size of the plot in x and y, where 1. = 15cm. This aspect ratio is nice for PRL and PRD single-column figures.

Note that what you see on screen psi2smm-mass-screen.tiff is not the same as the final plot psi2smm-mass.eps which has the full formatting with superscripts and Greek characters.

Note that if you want to include the BaBar logo in this plot, and in the two examples below, you will need to include a line in the kumac before the lines which create the images (the exec makeps... command to call the babar macro from within your plot macro.

Adding "BaBar" to your plot

To add the "BaBar" logo to the top-right corner of your plot, you can use one of the macros defined in pub-plot.kumac. After producing a plot in PAW, for example by running the simple example below, you issue the command
exec pub-plot#babar 
If you wish to change the position where the BaBar word appears and the size of the word, you can pass three arguments when you execute the babar macro. The defaults are 1. (scale), 68. (x-position) and 85. (y-position).

There's also a similar macro defined in pub-plot.kumac for adding the word "PRELIMINARY" below "BABAR". It is run using the same syntax as pub-plot#babar:

exec pub-plot#preliminary .5 58. 79.
where in this example, the defaults parameters are passed to the macro.

More complicated example

Here is a more complicated example from PRL 90 231801, projdata3.kumac.

In this case, we create an ntuple from an ascii list in the file, then fill a 2D histogram from this ntuple. In this way, we get the exact (mes, DeltaE) locations, instead of the PAW default, which plots a random location within the histogram bin. We then create projections of mes and DeltaE and plot those as well. This is done for two different final states, giving six plots in one figure.

To generate the plot, use the command:

exec pub-plot projdata3 1. 1.
The square aspect ratio (15cm by 15cm) is more appripriate in this case. The resulting plot is here: projdata3.eps

Another example

Here is another example from the same paper pstarjpl.kumac.

In this case we read three p* plots from an hbook file, then plot them beside each other. Run it using

exec pub-plot pstarjpl 1. 1.

You will need the hbook file pstarjpl.hbook.

General Related documents:

Back to Workbook Front Page

Author: Chris Hearty

Last modification: 13 June 2005
Last significant update: 6 February 2004 (page created).