Previous PagePrevious Page
anapaw 46
  • 14 Oct 2010 18:54:29

ANAPAW is a combination of the Analys and PAW programs. It is mostly using FORTRAN, which personally I dislike. In any case, I host some source code here and explain how to install it.

I should note that the official version uses g77 to be compiled, and this version here uses gfortran. g77 is deprecated and no longer supported in gcc, so this version of ANAPAW can run on a new system. If you still host or release any code that requires f77 please realize it was dropped from gcc starting at version 4 because no one wanted to continue working on the project; guys—it's time to get out of the stone age. In any case, most of the porting to gfortran was done by Yamaguchi Hidetoshi (and a little by myself) for CRIB experiments.

Source Code

ANAPAW v 2.3.1 (using gfortran): Download

Unpacking the source code

I like to put this kind of code into /usr/local (you may need to use sudo here)

$ cd ~/Downloads
$ mv anapaw_v2-3-1_daid.tar.gz /usr/local
$ cd /usr/local
$ tar xvzf anapaw_v2-3-1_daid.tar.gz
$ ln -s anapaw_v2-3-1 anapaw

Now it's unpacked.

Avoid sudo with ANAPAW

If you are the only user on the local machine and you don't want to use sudo all the time, it is safe to change the file permissions.

$ cd /usr/local/
$ chown -R daid:daid anapaw

Replace daid with your user name. The syntax of chown is user:group and usually in Linux there is a group with your username as well.

Avoiding tcsh and setting up aliases and environment variables

You will eventually need a varient of csh to use ANAPAW, so make sure that is installed:

$ which tcsh

If it is not found, you will need to install it through some repository (portage, apt-get, rpm, etc.).

Personally I use bash or zsh by default, so instead of assuming I am using tcsh all the time, I do something a little different. Open (or create the file) ~/.tcshrc with your favorite editor (I use vi)

$ cd && vi .tcshrc

alias analogin 'source /usr/local/anapaw/Setup/setupanapaw'

Make sure ANAPAW_WORK is something for your computer (the above is my example). I use the last line, because I will only use tcsh to run anapaw. Therefore, I also edit my .bashrc

$ vi .bashrc

alias analogin="tcsh"

So this way, if I am in bash, I can enter "analogin" and it will switch to tcsh and run analogin! If you want to do this on the same terminal you just made the changes, you need to do:

$ source ~/.bashrc

Or just open a new Terminal or start a new bash session:

$ bash


You will need cernlib installed. However, I don't recommened to install it from source code, because it is very tricky! Instead, most repositories for Linux contain cernlib, so you can install it appropriately from there. On Ubuntu it's like

$ sudo apt-get install cernlib

Or on Gentoo:

$ sudo emerge -av cernlib

On Mac OS 10.5 I remember this being a huge pain in my ass (and 10.6 is absurd...gee, let's make universal binaries for x86 and x86_64!). In any case, I think out of the five ways I attempted to install it, it was most effective using fink and first installing the package patchy5-gfortran—last I knew that was in the unstable branch of fink, so you'd need to enable that too. If you previously installed cernlib from fink, which apparently cannot resolve its own dependencies, then you need to rebuild cernlib with fink.

Anyway, so I am over my head actually explaining how to install cernlib from anything other than a repository, because it's not very easy in my humble opinion.

We need to edit the file /usr/local/anapaw/Setup/setupanapaw to our system. But first we should find out where cernlib was installed.

The easiest way is again

$ which cernlib

For my case in Gentoo, I get:

daid@flux ~ % which cernlib

That tells me that the cernlib root is at simply /usr

However, if for example you get something like:

daid@flux ~ % which cernlib

Then the cernlib root is /cern/pro

THE RESULTS OF `which cernlib` ARE NOT WHERE THE CERNLIB LIBRARIES ARE AT—BUT IT WILL HELP YOU TO FIGURE IT OUT. To be more specific, take the results you get from `which cernlib` and remove the /bin/cernlib part, and add a /lib to it. That will tell you where the cernlib libraries are. Sorry if it sounds confusing, but I'm tryin to write this to be fool-proof, and I don't know how else to explain to you how to find your own cernlib installation.

For the CERNLIB environment variable in ANAPAW, it wants to know where the cernlib libraries are at. If your cernlib binary was at /usr/bin/cernlib then in ANAPAW you need:


Where as if you found the cernlib binary at /cern/pro/bin/cernlib then you should use:


And so on.

Customizing setupanapaw

Now that you know the correct value of CERNLIB for anapaw, go ahead and edit the file /usr/local/anapaw/Setup/setupanapaw with your favorite editor:

$ cd /usr/local/anapaw/Setup
$ vi setupanapaw

You should confirm at least these three items in the file:

setenv CERNLIB /usr/lib

setenv ANAPAW_HOME /usr/local/anapaw

setenv ANAPAW_WORK $HOME/data/s30_july09_anapaw

Of course, ANAPAW_WORK should be a location on your computer where you analysis code is located, and CERNLIB we determined for your computer above. There is no reason at all you will actually enter what I have shown you for ANAPAW_WORK

Installing the ANAPAW libraries

Now we can attempt to install anapaw

$ analogin
$ makelib

Installing ANAPAW

If there were no errors, then now you can compile your local anapaw! This code you will need to get for your particular experiment. If you are following directly from the above step, there is no purpose in running analogin again, but I put it here in case you got some bugs in the makelib step and forgot.

$ analogin
$ makeana

There might be some differences of your makefile with mine in ANAPAW_WORK/src so you can download my makefile for anapaw and replace yours.

Once this is successful, you should be able to run anapaw:

$ anapaw

If you got some errors, I list some debugging tips below.

A test case for ANAPAW

Here I host the ANAPAW setup for one of my experiments, so you can check if it works: Download

Xaw3d compile error

This error results if you do not have Xaw3d installed. It will first appear from viewana.c and look like

daid@flux:/usr/local/anapaw/src % sudo make all install
make: Nothing to be done for `all'.
make viewana
make[1]: Entering directory `/usr/local/anapaw_v2-3-1/src'
make -C /usr/local/anapaw/src/vana
make[2]: Entering directory `/usr/local/anapaw_v2-3-1/src/vana'
gcc viewana.c -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXt -lXaw -o viewana
viewana.c:19:31: error: X11/Xaw3d/Command.h: No such file or directory

So now you should install it from a repository. For Gentoo Linux, I just do

# emerge -av Xaw3d

Now you can try makelib again.

libtermcap compile error

This error results if you do not have libtermcap installed. It will first appear when you try to compile the local anapaw code

daid@flux:~/data/s30_july08_anapaw/src % makeana
make: Entering directory `/home/daid/data/s30_july08_anapaw/src'
rm -f anapaw *.f~ *.c~ *~
make: Leaving directory `/home/daid/data/s30_july08_anapaw/src'
make: Entering directory `/home/daid/data/s30_july08_anapaw/src'
gcc -O -rdynamic -o anapaw usersrc.f usersub.f add_ntuple.f enc_beam.f enc_ppac.f beam_prm.f ppac_prm.f user_ppac.f enc_ssd.f enc_psd.f psd_prm.f enc_psd_vme.f dec_vme.f enc_coin.f enc_recoil.f enc_psdpd.f enc_dali.f dali_prm.f /usr/local/anapaw/lib/anapaw.o -L/usr/X11R6/lib -lX11 -ldl -lcrypt -L/usr/local/anapaw/lib -lanalib -lXt -lXaw -lpthread -L/usr/ -lpawlib -lgraflib -lgrafX11 -lpacklib -lmathlib -lkernlib -Icern -lnsl -lreadline -ltermcap
/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../../../i686-pc-linux-gnu/bin/ld: cannot find -ltermcap
collect2: ld returned 1 exit status
make: *** [anapaw] Error 1
make: Leaving directory `/home/daid/data/s30_july08_anapaw/src'

So you should install the missing libraries. For Gentoo it can be installed as follows:

$ sudo emerge libtermcap-compat

It may continue to complain about -ltermcap dependency if the compiler is looking for and not, say, or or whatever. In that case just make the symlink yourself:

# cd /lib && sudo ln -s

If that happened, you will need to do this again if you have a major version update of libtermcap.

LAPACK errors

This error results if you do not have the linear algebra package (LAPACK) installed. It appears when you try to compile the local anapaw code

daid@flux:~/data/s30_july08_anapaw % makeana
make: Entering directory `/home/daid/data/s30_july08_anapaw/src'
rm -f anapaw *.f~ *.c~ *~
make: Leaving directory `/home/daid/data/s30_july08_anapaw/src'
make: Entering directory `/home/daid/data/s30_july08_anapaw/src'
gfortran -O -rdynamic -o anapaw usersrc.f usersub.f add_ntuple.f enc_beam.f enc_ppac.f beam_prm.f ppac_prm.f user_ppac.f enc_ssd.f enc_psd.f psd_prm.f enc_psd_vme.f dec_vme.f enc_coin.f enc_recoil.f enc_psdpd.f enc_dali.f dali_prm.f /usr/local/anapaw/lib/anapaw.o -L/usr/X11R6/lib -lX11 -ldl -L/usr/local/anapaw/lib -lanalib -L/usr/lib -lpawlib -lgraflib -lgrafX11 -lpacklib -lmathlib -lkernlib -Icern -lreadline -ltermcap -llapack -lblas
/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../../../i686-pc-linux-gnu/bin/ld: cannot find -llapack
collect2: ld returned 1 exit status
make: *** [anapaw] Error 1
make: Leaving directory `/home/daid/data/s30_july08_anapaw/src'

I solve this problem by installing these libraries, which in Gentoo is just

# emerge lapack-atlas

Of course whether your makefile needs the flag -llapack or -llapack3 I am not sure. If you used my makefile, then you can see there is a line commented out using llapack3, so you could try that if the problem continues after you installed lapack.

Errors running ANAPAW

These are errors that will occur after you successfully compile and install ANAPAW, but get when running anapaw itself.

If you failed to copy the hidden files for the experiment directory, you may be missing somethings relating to pawlogon.kumac, analogon.kumac, and/or viewana.prm

For the first case, it complains that you are missing the PAWLOGON file: /home/daid/.pawlogon.kumac

I have hosted my own .pawlogon.kumac: Download

However, you can also find this file in the home directory of your experimental machines at the laboratory's data room, and then using scp, a USB flash drive, or email to yourself, that file. Just make sure you put it in your home directory!

ANAPAW may also complain that you are missing two other files in your working experiment directory:


If you go to your data room machine and issue analogin then those files are found in that directory. Just copy them over.

I have also hosted them here.

.analogon.kumac: Download
.viewana.prm: Download

If you have more problems compiling that are like "cannot find -lgoatface" then what you need to do is Google your operating system and libgoatface. In lgoatface the "L" stands for library which lib is short for. Don't ask my why compiler flags use "l" and filenames use "lib" because I didn't invent this nomenclature

Still stuck?

Well, you should probably ask someone locally at a laboratory to help you instead of reading my website. I'm just a random person who had the pain of installing ANAPAW myself, without almost any help.

Otherwise, if you really tried to Google your problem and solve it yourself for more than one hour, you can go to the about page to find my email address and email me. But, just for the record, I am, and have never been, officially affiliated with this project, nor would I choose to be. And please try starting from the top of my website and starting entirely over at least once, and make sure you actually understand what I've said, too.

        (__)               __(^^)              /   /    (__)      / PhD  \  (oO)     /|  /---^^---/     / | /| daid  ||    *  || ||------||
Next page