Project

General

Profile

Larlite Evd

These instructions should be reasonably complete as of 11/11/15. Please contact Corey Adams at corey.adams [at] yale.edu ASAP if there are issues.

Background

The larlite event display is built on Qt4, PyQt4, and pyqtgraph. Qt4 and PyQt4 are a gui manager and python bindings, respectively, and don't have direct impact on the images created. However, pyqtgraph is a graphics rendering program built in python on PyQt4, and that is what makes the high quality images (in a timely manner). Read more about pyqtgraph at its website: http://www.pyqtgraph.org/

Larlite is a development and analysis framework built on root and python. Check out docdb 3183 for installation details (http://microboone-docdb.fnal.gov:8080/cgi-bin/ShowDocument?docid=3183). Here, I will just give a barebones set of instructions for installation.

There have been reports of problems when users use brew (on mac) to get some of the dependencies for this. I don't really recommend using brew, especially for root and PyQt4. No issues have been found yet using apt-get (on linux) or port (on mac), that I know of.

Prerequisites

To run the larlite event display, you will need larlite, numpy and PyQt4. This page gives complete instructions for installing PyQt4. This page gives basic instructions for larlite. Larlite requires root with python (PyROOT), so make sure you have root installed and test pyroot by opening python and importing ROOT:

user$ python

import ROOT

If "import ROOT" works, pyROOT is installed. If you are using ups to get root and larsoft, this should not be an issue for you. If you have root installed from source with a recent version, it should have included pyroot by default too. If you installed root from a package manager, it might not have pyroot.

Installation

Assuming you have root with pyROOT installed, install larlite first. It's recommended you encapsulate all of these installations if you are installing on your laptop so that you don't conflict with anything else. Don't use brew (if mac); there are reports that brew will cause issues if you also try to run larsoft. In this set of instructions, we assume that $INSTALL_DIR is the location of your top level installation area. Everything else will be inside of that, and I assume you've used the absolute path for $INSTALL_DIR and not a relative path.

Install numpy

I highly recommend you follow the official instructions for installing numpy (http://www.scipy.org/scipylib/download.html). However, if you want more detailed help contact me (corey.adams [at] yale.edu) for some tips. Make sure you get the header files too (they're needed for the c++ code of the display)

Installing Larlite

Move to the installation directory and check out the larlite repository from github:
cd $INSTALL_DIR
git clone git@github.com:larlight/larlite.git

or, if you don't have ssh access to git hub, do a read only checkout:
git clone https://github.com/larlight/larlite.git

After the clone, you should have a folder named larlite inside of $INSTALL_DIR. cd into larlite and make sure you are on branch "trunk":
cd $INSTALL_DIR/larlite
git checkout trunk

Next, run the larlite setup script and then build larlite:
cd $INSTALL_DIR/larlite
source config/setup.sh
make -j4

If you want to use the larlite display for reconstructed products, you should run an auxiliary setup script:
source config/setup_reco.sh

Larlite will compile for some time. If there are compilation errors with larlite, please contact the maintainers of larlite. In the future it will be a ups product. For now, we will help you install.

Once larlite has built, you have to compile the extra tools for the display. This requires numpy so make sure that is installed first. Build it as:
cd $INSTALL_DIR/larlite/UserDev/DisplayTool
make

Install PyQt4

PyQt4 is distributed from riverbank software, and requires both qt and sip to be installed on your computer. qt is fairly common. Test by looking for qmake, on my laptop for example:
cadams@cadams-UX303LN:DisplayTool$ which qmake
/usr/bin/qmake

If there is no qmake, you will have to install qt4. There is not a good reason to install qt4 from scratch. You can use port (on mac) or apt-get install (linux) or whatever means you choose for installing qt.

With qt installed, install sip. We'll make a directory to install sip into, as well.
cd $INSTALL_DIR
mkdir sip
cd sip
wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.9/sip-4.16.9.tar.gz
tar -zxvf sip-4.16.9.tar.gz
cd sip-4.16.9
python configure.py -b $INSTALL_DIR/sip -d $INSTALL_DIR/sip -e $INSTALL_DIR/sip -v $INSTALL_DIR/sip
make
make install

Check that sip is installed by doing this:
cd $INSTALL_DIR/sip/
python -c "import sip"

If that worked (no error messages) sip is installed correctly.

We'll need to set up sip to build PyQt4. Later, this will be done with an install script but for now copy and paste:
cd $INSTALL_DIR
export PYTHONPATH=$INSTALL_DIR/sip/:$PYTHONPATH
export PATH=$INSTALL_DIR/sip/:$PATH

With sip and qt installed, we can install pyqt4.


cd $INSTALL_DIR
mkdir PyQt4
cd PyQt4

For mac:
wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt-mac-gpl-4.11.4.tar.gz
tar -zxvf PyQt-mac-gpl-4.11.4.tar.gz
cd PyQt-mac-gpl-4.11.4

For linux:
wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt-x11-gpl-4.11.4.tar.gz
tar -zxvf PyQt-x11-gpl-4.11.4.tar.gz
cd PyQt-x11-gpl-4.11.4

Then, for both mac and linux:
python configure.py -b $INSTALL_DIR/PyQt4 -d $INSTALL_DIR/PyQt4

Type yes to accept the license. This script takes awhile to generate the files for your PyQt4 build. When it's done:

make
make install

For Ubuntu users, also do: sudo apt-get install python-qt4-gl

Setting up run after the first time

It's a good idea to set up a script to set all the environment variables you need for subsequent times you want to run the display. The commands below should be sufficient as long as you replace the directory appropriately. I recommend you copy them into a script that you can source each time you want to run.

@export INSTALL_DIR=/path/to/top/level/of/install/

#[Do whatever you need for numpy and qmake. If you used an installed, likely you don't need to do anything]

#Set up PyQt4
export PYTHONPATH=$INSTALL_DIR/PyQt4/:$PYTHONPATH

#Set up larlite:
source $INSTALL_DIR/larlite/config/setup.sh

#Set up the larlite display tool
source $INSTALL_DIR/larlite/UserDev/DisplayTool/setup_evd.sh

Running

Running the display has a few options. Use the command 'evd.py' for the larlite file viewer, and 'evd_larsoft.py' to use the larsoft file viewer. There is also a command 'ubdaq.py' which draws raw binaries for the control room, but that requires significantly more installation due to the extra overhead of reading in the binaries. In general, though, all the viewers can accept a file to draw on the command line OR you can run them without arguments and use the gui to select a file. For microboone, run the commands with the argument '-u' or '-U', and '-a' for argoneut and '-l' for lariat. That is,

Draw larlite file format:
evd.py -u [input_larlite_file.root]

Draw larsoft file format:
evd_larsoft.py -u [input_larsoft_file.root]