Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

...

lcio.desy.de

...

ROOT

...


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
{noformat}

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
export LCIO=`pwd`
export LD_LIBRARY_PATH=$LCIO/lib:$ROOTSYS/lib
{noformat}

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
{noformat}

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

{
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")
{noformat}

h2. Example Event Dump

The 

Example Event Dump

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
---------------------------------------------------------------------------
{noformat}

h2. Example Analysis

I have modified the LCIO copy of 

Example Analysis

I have modified the LCIO copy of anajob.C

...

to

...

produce

...

some

...

histograms

...

from

...

Track

...

information.

...

This

...

script

...

can

...

be

...

accessed

...

here.

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.

No Format

|http://www.slac.stanford.edu/~jeremym/hps/anajob.C].

It can be used as a basis for further analysis work.

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

No Format

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

No Format


TBrowser b;

Or

...

try

...

to

...

read

...

it

...

back.

No Format

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