Overview

LCIO collections of Tracks and other objects can be read into ROOT using the LCIO C++ API.

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

Packages

LCIO
ROOT
CMake

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.

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.

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...

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/
export LD_LIBRARY_PATH=$LCIO/lib:$ROOTSYS/lib

You can call this script 'mysetup.sh'. This should allow you to execute the examples covered below. You will need to execute 'source mysetup.sh' from your shell before proceeding with your analysis session.

Basic Analysis Test

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

Example Event Dump

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

///////////////////////////////////
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
---------------------------------------------------------------------------

Example Analysis

I have modified the LCIO copy of anajob.C to produce some histograms from Track information.  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.

Writing and Reading ROOT Files

The example writeEventTree.C can be used to produce a ROOT output file.

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

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

Then from the ROOT command line...

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

This will write the file lcioEventTree.root in the current directory.

Now load a browser to look at the file.

TBrowser b;

Or try to read it back.

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

Further Information

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

  • No labels