Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

These are instructions for setting up LCIO and ROOT to work with each other.

Packages

LCIO
lcio.desy.deROOT
root.cern.ch
CMake cmake.org

I use the LCIO trunk from June 28 2012, ROOT version 5.34, and CMake 2.8.6, and I am building on a 64-bit RHEL 5.8 machine.

These instructions should work on most varieties of Linux, will probably work on OSX (not tried yet), and might work on Windows with some modifications (not covered here).

Setup and Build Commands

Any command that starts with "export" will generally need to be re-executed to run the various examples that I cover below.

Setup the ROOT environment. I do not cover how to build and install ROOT.

No Format

export ROOTSYS=/my/root # put path to your ROOT here
source $ROOTSYS/bin/thisroot.sh
export PATH=$ROOTSYS/bin:$PATH

Build LCIO with the ROOT class dictionaries.

No Format

cd /a/work/dir
svn co svn://svn.freehep.org/lcio/trunk lcio/trunk
cd lcio/trunk
mkdir build; cd build
cmake -D BUILD_ROOTDICT=1 -D ROOT_DIR=$ROOTSYS ..
make install
cd ../
export LCIO=`pwd`
export LD_LIBRARY_PATH=$LCIO/lib:$ROOTSYS/lib

Once ROOT and LCIO are setup, you'll want to create a setup script that contains something like the following...

No Format

export ROOTSYS=/my/root # put path to your ROOT here
source $ROOTSYS/bin/thisroot.sh
export PATH=$ROOTSYS/bin:$PATH
export LCIO=/path/to/lcio/trunk/build
export LD_LIBRARY_PATH=$LCIO/lib:$ROOTSYS/lib

...

Basic Analysis Test

No Format

cd ../examples/cpp/rootDict
root
.L anajob.C
anajob("/nfs/slac/g/hps3/data/testrun/runs/recon/hps_001365.evio.0-rec.slcio")

...

The anajob.C example should produce event dumps that look like this...

No Format

///////////////////////////////////
EVENT: 442
RUN: 0
DETECTOR: HPS-TestRun-v2
COLLECTIONS: (see below)
///////////////////////////////////

---------------------------------------------------------------------------
COLLECTION NAME               COLLECTION TYPE          NUMBER OF ELEMENTS 
===========================================================================
ConfirmedMCParticles          MCParticle                       0
EcalCalHits                   CalorimeterHit                   0
EcalClusters                  Cluster                          0
EcalReadoutHits               RawCalorimeterHit                3
FPGAData                      LCGenericObject                  7
HelicalTrackHitRelations      LCRelation                      10
HelicalTrackHits              TrackerHit                       5
HelicalTrackMCRelations       LCRelation                       0
MatchedTracks                 Track                            1
RotatedHTHRelation            LCRelation                       5
RotatedHelicalTrackHits       TrackerHit                       5
RotatedMCRelations            LCRelation                       0
SVTFittedRawTrackerHits       LCRelation                     135
SVTRawTrackerHits             TrackerRawData                 135
SVTShapeFitParameters         LCGenericObject                135
SeededMCParticles             MCParticle                       0
StripClusterer_SiTrackerHitStrip1DTrackerHit                  10
TriggerBank                   LCGenericObject                  1
---------------------------------------------------------------------------

...

I have modified the LCIO copy of of anajob.C to produce some histograms from Track information. This script can be accessed here.  This example reads a collection from an LCIO file and creates a collection of Tracks.  Then it histograms some basic information from these objects.  It can be used as a basis for further analysis work.

...

First the environment needs to be setup so that ROOT can find the LCIO class dictionary.

No Format

gSystem->Load("${LCIO}/lib/liblcio.so"); 
gSystem->Load("${LCIO}/lib/liblcioDict.so");

Then from the ROOT command line...

No Format

.L writeEventTree.C
writeEventTree("/nfs/slac/g/hps3/data/testrun/runs/recon/hps_001365.evio.0-rec.slcio");

...

Now load a browser to look at the file.

No Format

TBrowser b;

Or try to read it back.

No Format

.L readEventTree.C
readEventTree("lcioEventTree.root")

Further Information

Should you want to dive deeper into analysis, investigate the LCIO C++ API