[ - OU HEP ATLFAST Help Files - ]
 [ - M E N U - ] 
  Basic Linux Commands
  Tutorial 1
  Tutorial 2
 [ - L I N K S - ] 
  OU HEP Home
  Linux Newbie
  KDE User Guide
  CERN Home
  Fermilab Home
  Atlfast Home
Tutorial 1: The Basics
In this tutorial, I will go over the details of a simple kuip macro file and paw++ fortran file. These instructions assume a very basic working knowledge of Linux command syntax and directory structure. You will need to be physically logged in on the OUHEP cluster so that you can be sure to avoid any possible problems or complications associated with using telnet, ssh, X11 forwarding, or Windows.


First, download the files for this tutorial here:   sample1.tar.gz

Save the file in your atlas directory, then unpack the tarball like this:
$ cd ~/atlas
$ tar -xzvf sample1.tar.gz
You will now have several new files in your atlas directory:
The one's we'll be looking at for this tutorial are sample1.kumac and sample1.for. For now, there is no need to open or edit any of the others.


The files you've just unpacked are all required for your macro to run, and to output useful plots. Here's a brief description of the files themselves and how they interact with one another:
This is your main macro file, where you'll make any changes in which ntuples you'd like to load, which fortran file to process, which histograms to create, how many to print on each page, and what to call the postscript files, to name a few.

This is your fortran file, where all of the actual data calculation for your ntuples, and histogram filling occurs. For the most part, it uses pure, normal fortran syntax.

This macro is called by your main macro when you'd like to create a cross section. It scales your histogram according to the scale factor used for isajet or pythia ntuples.

This macro is also called by your main macro, and is used to convert your paw++ graphics window output to a postscript file so you can print it.


Now it's time to open up your macro file and see what it does. For this tutorial, I'll be using NEdit, but you can use any text editor you like. If you'd like to use NEdit, there is a pre-compiled binary located in my home directory which you can copy into your own directory and run from there:
$ cd ~
$ cp ~/../hegarty/src/nedit-5.3RC1/nedit .
$ ./nedit &
Otherwise, open sample1.kumac in your favorite text editor.

The first thing you should notice is that this macro file is heavily commented.READ THE COMMENTS!

If you're using NEdit, you can use its syntax highlighting function to make more sense of what you're looking at. To do this, use the top menubar to select Preferences > Language Mode > Fortran. Although the macro isn't written in Fortran, I've found that this mode works best for macro syntax highlighting. If the comments don't immediately become italicized, select Preferences > Highlight Syntax. Turning Line Numbers on from this menu will also prove beneficial later when you have to find problems in your script. [hint hint ...]

The comments within the macro will explain everything the macro is doing while it runs in paw++ for each command in the script. Read through them carefully, and when you're confident that you know what each command does, move on to the next section.


With NEdit, choose File > Open and select your sample1.for file. A new window will pop up containing your Fortran file, and the syntax will automatically be recognized and highlighted. Otherwise, use your favorite text editor to open this file.

You should notice that this file is also heavily commented. READ THE COMMENTS! This Fortran file is written in standard Fortran syntax. It fills two histograms, then calculates the invariant mass of muons and jets, and fills two more histograms. The comments will explain what each section does as it happens, so read through them carefully. When you're confident that you know what each part of the code does, move on to the next section.


Finally, you get to start paw++ and see what all this stuff does! From your terminal:
$ cd ~/atlas
$ paw++ &
In the paw++ Main Browser window, select Macros, then double-click "sample1.kumac". A few seconds later, you should see 6 cute little plots sitting in the graphics window. So what now?

You should remember the comments near the end of your macro file (or if you still have it open you can switch to that window and check). Provided your terminal is still in the atlas directory, you can issue a directory listing to see what's new:
$ ls -ao
You should have a brand new file called "sample1.ps". This is the postscript file created at the end of your macro's run, which you can use to print your plots. In your terminal:
$ lpr sample1.ps
All you need to do is go to the printer and pick up your plots!


Now that you know how a simple macro and Fortran file interact with each other and with paw++, do the following:

1. Edit sample1.kumac - Add 2 more histograms to the macro to represent Muon pt and Jet pt. Use the same parameters as used for the Muon pair and Jet pair masses. Also change the zone to display only 4 histograms per page, on two pages [hint: you'll need to end up with two unique postscript files].

2. Edit sample1.for - Add one function to calculate Muon pt, and one to calculate Jet pt. Make sure the result fills the histograms you've created in #1.

3. (optional) Fix the broken files - Download broken1.kumac and broken1.for to your atlas directory, and open them for editing. If you try to run these files in paw++, you will notice that they do not work properly. Use the paw++ output log along with your newfound understanding of macros and Fortran to fix them. [hint: there are three errors in each file]


If you need any help with this tutorial, please visit the resources listed on the menu and links above, or email hegarty@nhn.ou.edu.