ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni,...

241
ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b
  • date post

    15-Jan-2016
  • Category

    Documents

  • view

    236
  • download

    0

Transcript of ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni,...

Page 1: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

ALICE Offline Tutorial

F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz

June 11, 2007 – v1.4b

Page 2: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

Part I: AliRoot

Page 3: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 3

References

AliRoot “Primer” http://aliceinfo.cern.ch/Offline/AliRoot/primer.htmlPresentation of A.Morsch during the International Workshop on Computing for Heavy Ion Physics (April 26th 2005)Tutorial prepared by B.NilsenPresentations of Yu.Belikov and P.Christakoglou: Alice offline week (March 2006)

Page 4: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 4

Outline

AliRoot installationRootGeant3FlukaAliRoot

Page 5: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 5

Outline I

Versioning systemsConcurrent Versions System (CVS)

Debugging toolsCompilersDebuggersProfilersRun time and memory management tools

Page 6: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 6

Outline II

SimulationGeneratorsConfiguration (Config.C)

Reconstruction

AnalysisESD classesSelectors

Page 7: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 7

Environment Variables

# ROOT export ROOTSYS=<prefix>/root export PATH=$PATH\:$ROOTSYS/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH\:$ROOTSYS/lib

# AliRoot export ALICE=<prefix>/alice export ALICE_ROOT=$ALICE/AliRoot export ALICE_TARGET=`root-config --arch` export PATH=$PATH\:$ALICE_ROOT/bin/tgt_${ALICE_TARGET} export LD_LIBRARY_PATH=$LD_LIBRARY_PATH\:$ALICE_ROOT/lib/tgt_${ALICE_TARGET}

# GEANT 3 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH\:$ALICE/geant3/lib/tgt_${ALICE_TARGET}

# FLUKA export FLUPRO=<prefix>/fluka

For Mac OSX replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH

Page 8: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 8

Installation of AliEn

Download and execute the AliEn installer

wget http://alien.cern.ch/alien-installerchmod a+x alien-installer./alien-installer

Install client and gshell API

Page 9: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 9

Root Download (CVS)

Login (once) to the ROOT CVS repository

cvs –d :pserver:[email protected]:/user/cvs loginCVS password: cvs

Download (check out) the needed ROOT version (v5-14-00 in the example):

cvs -qz9 -d :pserver:[email protected]:/user/cvs co -r v5-14-00 root

Page 10: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 10

Root Configuration: Example script

#!/bin/sh

ALIEN_ROOT=<prefix>/alien

./configure \ --with-pythia6-uscore=SINGLE \ --enable-cern --enable-rfio \ --enable-mathmore --enable-mathcore --enable-roofit \ --enable-asimage --enable-minuit2 \ --enable-alien \ --with-alien-incdir=${ALIEN_ROOT}/api/include \ --with-alien-libdir=${ALIEN_ROOT}/api/lib

Note that you MUST have installed AliEn before!

Page 11: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 11

Root: Compilation, Tests

After the configuration optionally edit $ROOTSYS/MyConfig.mk (for example add there OPT += -g)

Do “cd $ROOTSYS; make; make map”

Do “cd test; make”

Add “.” (dot) to (DY)LD_LIBRARY_PATH

Run “stress”, ”stressGeom”, ”stressLinear”, “stressVector”, etc.

Now you have fully operational Root

Page 12: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 12

Installation of Geant3

Download (must be in $ALICE/geant3!)cd $ALICEcvs -qz9 -d :pserver:[email protected]:/user/cvs co -r v1-6 geant3cd geant3make

Expect some warnings!Needs root to be installed before!

Page 13: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 13

Fluka

Register and get the Fluka library from http://www.fluka.org

Unpack the library in $ALICE/flukacd $ALICE/flukatar xvfz ~/fluka….tgzln -s neuxsc_72.bin neuxsc.bin

Page 14: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 14

AliRoot

Login (once) to the AliRoot CVS repositorycvs –d :pserver:[email protected]:/soft/cvsroot loginCVS password: cvs

cd $ALICE

Download (check out) the needed AliRoot version (v4-04-Release in the example)

cvs -qz9 -d :pserver:[email protected]:/soft/cvsroot co -r v4-04-Release AliRoot

cd AliRoot; make

Expect warnings!

Page 15: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 15

.rootrc

Defines ROOT/AliRoot default settingcp $ALICE_ROOT/.rootrc ~/vi ~/.rootrcAdd to “Unix.*.Root.MacroPath:” “$ALICE_ROOT/macros” and any other directory where you want to use macros fromAdd “Unix.*.Root.IncludePath:” with directories where include files you want are kept

Page 16: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 16

AliRoot make options

make [module]If no module given, check dependencies and compile everything that might have changedCheck dependencies in given module and then compile everything that has changed thereNon default targets: htmldoc, alilibs, aliroot, makedistr, profile, depend, TFluka

Cleaning upclean-all clean up everything including cern librariesclean-module ITS,TPC,… just that subdirectoryclean-modules clean all modules (not cern libraries)clean-libs clean all libraries (not object files)clean-aliroot clean up all aliroot librariesdistclean clean as if fresh install

make -k clean-XXXX is suggested

Page 17: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 17

AliRoot update & make “quirks”

Update your distribution to the latest patches of a release

cd $ALICE_ROOT; cvs -qz9 up -Pd; make

Update your distribution to a given tagcd $ALICE_ROOT; cvs -qz9 up -Pd -r <revision tag>; make

Sometimes (deleted files) it fails with the message (e.g.)“No rule to make XXXX needed by YYYY”Just clean and remakemake -k clean-<the culprit module>; make

If everything else failsmake -k clean-aliroot ; make

If you are getting desperatemake -k clean-all ; make

QuickTime™ and aTIFF (Uncompressed) decompressor

are needed to see this picture.

Page 18: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 18

Concurrent Versions System (CVS)

http://www.cvshome.org/ CVS facilitates parallel/concurrent code developmentEasy support and simple accessPossibility to establish group permissions

e.g. only detector experts and CVS administrators can commit code to given detector module

Rich set of commandsA lot of visualization/logging/control tools

Page 19: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 19

Common CVS Commands

export CVSROOT=:pserver:[email protected]:/soft/cvsrootOnly for fist c[heck]o[ut]

login stores password in .cvspass

checkout retrieves the source filescvs -qz9 co -r v4-04-Release AliRoot

update retrieves modifications from the HEAD in the repository and merges them to the local ones

cvs -qz9 up -AdP STEER

diff shows differences between the local and repository versions

cvs -qz9 diff STEER

Page 20: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 20

Common CVS Commands

add adds files or directories to the repositorycvs -qz9 add AliTPCseed.*You still have to commit to have the files actually added

remove (rm) removes old files or directories from the repository

cvs -qz9 remove -f CASTOR

commit (ci) checks in the local modifications to the repository and increments the version

cvs -qz9 ci -m “Coding convention” STEERPlease use meaningful comments!

log finds the story of mods for a file cvs -qz9 log STEER/AliRun.h

Page 21: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 21

Main CVS Commands

tag creates new tags and/or branchescvs -qz9 tag -b v4-04-Release # this creates a branchcvs -qz9 tag v4-04-Rev-11 # this creates a tagTags are cheap!!

status returns the actual status of a file: revision, sticky tag, dates, options, and local modifications

cvs -qz9 status [-v] Makefile

logout removes the stored passwordHardly ever used

Page 22: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 22

cvs structure for AliRoot

v4-01-00

v4-01-01

v4-01-Rev-00

v4-01-Release

v4-02-00

v4-02-00

v4-01-Rev-01v4-01-Rev-02

HEAD

cvs -qz9 up -r v4-01-00 -Pd

cvs -qz9 up -r v4-01-Rev-01 -Pd

cvs -qz9 up -r v4-01-Release -Pd

cvs -qz9 up -APd

Page 23: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 23

CVS Visualization/Logging/Control Tools

TkCVShttp://www.twobarleycorns.net/tkcvs.html

CVSWebhttp://www.freebsd.org/projects/cvsweb.html

Cervisia: KDE distributionhttp://www.kde.org/apps/cervisia/

cvs2cl.pl: Producing ChangeLoghttp://www.red-bean.com/cvs2cl/

Page 24: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 24

TkCVS Tool

Page 25: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 25

CVSWeb

http://aliceinfo.cern.ch/alicvs/viewvc

Page 26: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 26

CVS Repository

alisoft.cern.chalicvs01: main serveralicvs02: mirror

ADMS backup

aliceinfo.cern.chViewCVS access

Page 27: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 27

Code Maintenance

Supported platforms:Linux (Pentium, Itanium, and Opteron with gcc and icc compilers)Sun: SPARC, x86 (Solaris with CC compiler)Alpha (was OSF with cxx compiler, now Linux with gcc)Mac/ppc and Mac/Intel (Darwin with gcc and icc compilers)

Page 28: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 28

Compilers

Linux:gcc (versions 3.2 - 3.4.6). GNU license, free source distribution. Not very strict or ANSI compliant by default. Works also with 4.0.xicc (Intel) versions 7.0 – 9.0. Free for non-commercial use, high performance compiler. Gives 20-30% improvement during the execution of AliRoot/Root. More difficult to debug.

Sun CC: extensive warnings, capable to detect non-initialized variables, etc. Integrated in Forte with debugger, profiler, and memory checker.Alpha cxx: strict compiler (relatively old), finds come problems not indicated by any other compilerMac gcc 4.0.x and icc: FORTRAN now OK, using g95, but gfortran is also getting there

Page 29: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 29

Debugging

Errors during the execution Floating point exceptions

• Illegal operations: division by zero, sqrt of negative argument, assignment of NaN, etc.

Segmentation violations/faults• Attempt to access a forbidden memory

location

Bus error• Attempt to access memory that the

computer cannot address

Page 30: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 30

Debugging

Using printf(...), cout and assert(...)Often the only easy way to find the problemassert(...) aborts the program execution if the argument is FALSE. Is is a macro from assert.h, you can remove its action by compiling with -DNDEBUG

Using gdbNeeds compilation with -g -O0 option

• Optimisation prevents proper debugging

One can use it directly (gdb aliroot) or attach it to a process (gdb aliroot 12345)FORTRAN support is very bad

Page 31: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 31

Main GDB Commands

run starts the execution of the program

where prints the program stack

quit exits the gdb session

break sets break pointbreak AliLoader.cxx:100

break 'AliLoader::AliLoader()’

delete removes break point

cont continues the run

watch sets watchpoint: watch *fData (slow!)

list shows the source code

print evaluates and prints expression

help for the rest of the commands...

Page 32: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 32

Profiling

Linuxgprof: compilation with -pg option, static librariesOprofile: uses kernel moduleVTune: instruments shared libraries

SunSun workshop (Forte agent): needs compilation with profiling option (-pg)

AlphaPixie profiler: instruments shared libraries for profiling

Page 33: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 33

VTune Profiling Tool

Available from Intel Web site, free for non-commercial use on Linux

Unavailable elsewhere

Possibility for call-graph and sampling profiling

Instruments shared libraries, needs only -g option

Example sessionvtl activity stress -c callgraph -app $ROOTSYS/test/stress,” -b” -moi $ROOTSYS/test/stressvtl run stressvtl showvtl view stress::r1 -gui

Page 34: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 34

VTune

Page 35: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 35

Valgrind: detection of run time errorshttp://www.valgrind.org/

Set of tools Memcheck for memory management problems Addrcheck: lightweight memory checker Cachegrind: cache profiler Massif: heap profiler Hellgrind: thread debugger Callgrind: extended version of Cachegrind

Page 36: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 36

Valgrind: Memcheck

Memcheck can detect:Use of non-initialised memoryReading/writing memory after it has been free'dReading/writing off the end of malloc'd blocksReading/writing inappropriate areas on the stackMemory leaks - where pointers to malloc'd blocks are lost foreverMismatched use of malloc/new/new [] vs free/delete/delete []Overlapping src and dst pointers in memcpy() and related functionsSome misuses of the POSIX pthreads API

Page 37: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 37

Valgrind Example

valgrind --tool=addrcheck --error-limit=no aliroot -b -q sim.C

Page 38: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 38

Root Memory Checker

Detection of memory leaks, statistics of memory usage

Fast, easy to useRe-link aliroot with -lNew

• Modify the $ALICE_ROOT/Makefile• rm $ALICE_ROOT/tgt_${ALICE_TARGET}/aliroot• make

Add ”Root.MemCheck: 1” in .rootrcRun the program: aliroot -b -q sim.CRun “memprobe -e aliroot”Check *.info files

Does not work with the latest version of root – being fixed

Page 39: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 39

Code Checking and Reverse Engineering Tool

General description: http://aliceinfo.cern.ch/Offline/AliRoot/Coding-Conventions.htmlInstallation: unpack the tarball from /afs/cern.ch/alice/library/local/IRSTCodeAnalysisTool.tgz, in the directory $ALICE/local/IRSTDo “make check-all” in $ALICE_ROOTDo “make reveng-all” in $ALICE_ROOTDo “make revdisp-all” in $ALICE_ROOT

Page 40: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 40

Release Policy

The code compiles on all the platforms.Extensive tests on Linux (Pentium, Itanium, Opteron; gcc and icc)Root memory checker: no significant memory leaksTag (no branch): monthlyValgrind: fixes for run-time errorsProfiling: gprof and Vtune

Fix algorithms using abnormal quantities of memory or CPU

Tag with branch => release every 6 months

Page 41: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 41

AliRoot: General Layout

General- Base classes- Steering- IO control

Simulation- Interface classes- Event generators- Geometry & Materials

Reconstruction- Clusterization- Tracking- PID

Analysis- ESD classes- HBT- Charm, jets, etc.

AliRoot classes

G e ne ra lS T E E RE V G E NA N A L Y S IS

D e te c to rsIT ST P CT R D

G e n era to rsH IJ IN GP Y T H IA 6H E R W IG

"O n -lin e"H L TR A WM O N IT O R

A liR oo t m od u les

Page 42: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 42

AliRoot Layout

ROOT

CINT HIST GRAPH TREES CONT IO MATH …

ALIEN

GRID ITS TPC TRD TOF PHOS EMCAL RICH MUON

FMD

PMD

START

VZERO

ZDC

CRT STRUCT

STEERAliSimulation

AliReconstructionESD classes

G3 G4 Fluka

Virtual MC

HIJING

PYTHIA6

DPMJET

ISAJET

PDF

EVGEN

Analysis

HLT

RAW Monit

HBTAN JETAN

Page 43: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 43

AliRoot: Execution Flow

InitializationEvent

GenerationParticle

TransportHits

SummableDigits

Event merging

Digits/Raw digits

Clusters

Tracking PID ESD Analysis

AliSimulationAliReconstruction

Page 44: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 44

Config.C: Steering the Simulation

Sets random seed

Creates transporter

Creates RunLoader

Replaces MC particle decay model by Pythia6

Set up transporter

Creates and sets up event simulator

Defines ALICE Magnetic Field

Defines All materials and geometries/detectors

Void Config(){gRandom->SetSeed(123456789);new TGeant3TGeo(“Transporter”);AliRunLoader *rl =

AliRunLoader::Open( “galice.root”,defaultFileNames,”recreate”);

gAlice->SetRunLoader(rl);TVirtualMCDecayer *dec = AliDecayerPythia();dec->Init();gMC->SetExternalDecayer(dec);…gMC->SetCut(“CUTGAM”,1.e-3);…AliGenHIJINGpara *gen = new AliGenHIJINGpara(100);gen->Init(); // Registers its self to gAlicegAlice_>SetField(new AliMagFMaps(…);AliBody *BODY = new AliBODY(“BODY”,”Alice

envelope”);// Registers itself to gAlice

Page 45: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 45

External Generators: HIJING

HIJINGHIJING (Heavy Ion Jet INteraction Generator) combines

• A QCD-inspired model of jet production with the Lund model for jet fragmentation

• Hard or semi-hard parton scatterings with transverse momenta of a few GeV are expected to dominate high energy heavy ion collisions

• The HIJING model has been developed with special emphasis on the role of mini jets in pp, pA and AA reactions at collider energies

Page 46: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 46

HIJING

Hijing used asUnderlying event

• Realistic fluctuations (N,E) from mini-jets• Pessimistic multiplicity (dN/dy ~ 6000)

Particle Correlation studies• Inclusive • And in reconstructed jets

Nuclear effects• Shadowing• Quenching (parton energy loss)

Page 47: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 47

Other External Generators

DPMJETDPMJET is an implementation of the two-component Dual Parton Model for the description of interactions involving nuclei based on the Glauber-Gribov approachDPMJET treats soft and hard scattering processes in an unified way The fragmentation of parton configurations is treated by the Lund model PYTHIA

SFM (String Fusion Model)The soft interactions are described by the Gribov-Regge theory of multipomeron exchangeThe hard part of the interaction is simulated by PYTHIA and the strings formed by gluon splitting are fragmented with JETSETFusion of soft strings is included

Page 48: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 48

Ultra-peripheral Collisions

K. Hencken et al.

TPHICMassive particle production described in Equivalent Photon Approximation

TEPEMElectron positron pair production in UPC

AA AA AA X

AA AA e+e-

AA AA AA X

AA AA e+e-

Page 49: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 49

pp

Minimum BiasPythia, Herwig, ISAJETPythia with ATLAS Tuning

Hard ProbesPythia tuned to NLO (MNR)

• NLO topology

Modification of nuclear structure functions via EKS in PDFlib

Page 50: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 50

PYTHIA preconfigured processes

Heavy Flavors (open)kPyCharm, kPyBeautykPyCharmUnforced, kPyBeautyUnforced

kPyCharmPbPbMNR, kPyD0PbPbMNR, kPyDPlusPbPbMNR, kPyBeautyPbPbMNR, kPyCharmpPbMNR, kPyD0pPbMNR, kPyDPluspPbMNR, kPyBeautypPbMNR, kPyCharmppMNR, kPyD0ppMNR, kPyDPlusppMNR, kPyBeautyppMNRHeavy Flavor (resonances)

kPyJpsi, kPyJpsiChi

Minimum BiaskPyMb, kPyMbNonDiffr

Jets and high-pT gammaskPyJets, kPyDirectGamma,

W kPyW

Page 51: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 51

Event Generator Interfaces

Cocktail class to assemble events, for example:

Underlying event + hard processDifferent muon sourcespA + slow nucleons

Page 52: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 52

Event Generator Interfaces: Parameterizations

// The cocktail generator AliGenCocktail ∗gener = new AliGenCocktail();

// Phi meson (10 particles) AliGenParam ∗phi = new AliGenParam(10,new AliGenMUONlib(),AliGenMUONlib::kPhi,"Vogt PbPb"); phi−>SetPtRange(0, 100); phi->SetYRange(1., +1.); phi−>SetForceDecay(kDiElectron);

// Omega meson (10 particles) AliGenParam ∗omega = new AliGenParam(10,new AliGenMUONlib(),AliGenMUONlib::kOmega,"Vogt PbPb");omega−>SetPtRange(0, 100);omega−>SetYRange(−1., +1.);omega->SetForceDecay(kDiElectron);

// Adding all the components of the cocktailgener −>AddGenerator(phi,"Phi",1);gener −>AddGenerator(omega,"Omega",1);

// Settings, common for all componentsgener −>SetOrigin(0, 0, 0); // vertex positiongener −>SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP positiongener −>SetCutVertexZ(1.); // Truncate at 1 sigmagener −>SetVertexSmear(kPerEvent);gener −>SetTrackingFlag(1);gener >Init();

Page 53: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 53

Parameterisations:kPhi, kOmega, kEta, kJpsi, kJpsiFamily, kPsiP, kJpsiFromB,kUpsilon, kUpsilonFamily, kUpsilonPP, kCharm, kBeauty,kPion, kKaon

Example: MUON Library

Page 54: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 54

Run MC: Particle Transport

Particles are transported though geometry

At each step, a call to StepManager of the class whose volume the particle is in

Example: AliITSvPPRasymmFMD::StepManagerIf not sensitive volume returnIf not charged returnRecord Hit, particle Position (start & end of this step), Momentum, Energy lost during last step, Sub-detector in, Time of Flight, Status, Charge, and Track NumberIn the ITS, hits can also be “merged”

Hits are typically are deleted after SDigitization

Page 55: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 55

Simulation: Summable Digits

Apply all detector response simulation which allows results to be “merged”

Do not add noiseDo not convert AtDDo not apply thresholds

Some detectors use hits as SDigits

For PHOS, EMCAL the hits are already summedRICH saves rings/photons

Page 56: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 56

Digitization

Adds noiseRandom for SPD, SSDCorrelated for SDD

Applies thresholdSimple threshold for SPD,SSD2 level threshold for SDD

Applies ADC-ing10 bit for SDD, SSD108 conversion for SDD

Zero suppression2 integer coordinates, 1 integer signalSimulation + info by detector type

Page 57: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 57

Reconstruction

Possible inputsDATE DDL files (only for test)RAW DATE file (only for test)RAW rootified file (standard format)MC/Digit files (standard for simulated data)

Local/Detector reconstruction (Files <DET>.RecPoint.root)CalibrationClusterisationCluster splitting…

Vertex finder (Fills ESD)Primary vertex (Z coordinate) found in SPD, and/or T0.

Tracking (HLT and/or Barrel), filling of ESDGives final vertex from tracks and secondary vertecies.HLT uses Conformal mapping (or similar) or a fast KalmanFinal tracking is a full Kalman

• {TPC→ITS→TPC} →{TRD→TOF →{EMCAL|HMPID|PHOS}→TOF→TRD→TPC→ITS)

• MUON.

Combined PID (Fills ESD)

Page 58: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 58

Ideally: user@host> root.exe ……………………… root[0] gSystem->Load(“libESD”) root[1] .x AnyAnalysisMacro.C

ESD classes, ESD shared library

AliESD AliExternalTrackParam AliESDtrack AliESDMuonTrack AliESDPmdTrack AliESDHLTtrackAliESDVertex AliESDv0 AliESDV0MI AliESDcascade AliESDkinkAliESDpid AliPID

AliKalmanTrack AliHelix AliESDV0MIParams AliTracker AliCluster AliTrackPointArray (reconstruction classes)AliRunTag AliLHCTag AliDetectorTag AliEventTag AliTagCreator AliTagAnalysis AliEventTagCutsAliXMLCollectionAliLog

Page 59: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 59

The ESD

ESD

ESDVertex

Estimated with SPD

ESDVertex

Estimated with ESD tracks

Multiplicity

SPD tracklets

ESDTrack

Detailed information in central barrel

ESDHLTTrack

Hough method

ESDHLTTrack

Conformal mapping

ESDV0

V0 vertices

ESDCascade

Cascade vertices

ESDKink

Kinks

ESDMuonTrack

Tracks in MUON arm

ESDPmdTrack

Tracks in PMD

ESDTrdTracks

Triggered tracks in TRD

ESDCaloClusters

PHOS/EMCAL clusters

ESDFMD

FMD multiplicity

Page 60: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 60

AliESD and AliESDtrack classes

Accumulation and exchange of tracking information among the barrel detectors

Contained in the ESD and used for physical analysis

Class AliESDtrack : public AliExternalTrackParamfinal paramsreconstruction status flagslength, time, combined PIDvertex constrained params impact parameters & cov.matrixparams at the outer TPC wallparams at the inner TPC wall…detector specific info (chi2, num.of clusters, PID…)

Page 61: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 61

AliESD *event=…; //The reconstructed events areTTree *esdTree = …; //stored in TTrees (and so can be “chained”)

Int_t i=0;while (esdTree->GetEvent(i++)) { //loop over the reconstructed events … //select run, event number etc… if (event->GetTrigger() != … ) continue; //select the trigger AliESDvertex *primary=event->GetVertex(); if (/* some cuts on the primary vertex */) continue;

Int_t ntracks=event->GetNumberOfTracks(); for (i=0; i<ntracks; i++) { //loop over ESD tracks (or kinks, V0s …) AliESDtrack *track=event->GetTrack(i); if (track->GetStatus()==…) //select tracks with the proper status if (/* any other selection (quality) criteria */) { … //do whatever with the selected tracks } } … AliESDv0 *v0=event->GetV0(13); //retrieve the 13th V0 Int_t ip=v0->GetPositiveIndex(), in=v0->GetNegativeIndex(); //together with its AliESDtrack *ptrack=event->GetTrack(ip); //positive daughter track AliESDtrack *ntrack=event->GetTrack(in); //and negative daughter track …

ESD Example: Loop on the tracks

Page 62: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 62

AliESD *event=…; //The reconstructed events areTTree *esdTree = …; //stored in TTrees (and so can be “chained”)Int_t i=0;while (esdTree->GetEvent(i++) { //loop over the reconstructed events … //event selection…

Double_t priors[AliPID::kSPECIES]={…} //A set of a priori probabilities AliPID::SetPriors(priors);

Int_t ntracks=event->GetNumberOfTracks(); for (i=0; i<ntracks; i++) { //loop over ESD tracks (or kinks, V0s …) AliESDtrack *track=event->GetTrack(i); ULong _t status=AliESDtrack::kTPCpid | AliESDtrack::kTOFpid; if ((track->GetStatus()&status) != status) continue; //select tracks with the proper status if ( … ) continue; //some other selection (quality) criteria

Double_t probDensity[AliPID::kSPECIES]; track->GetESDpid(probDensity); AliPID pid(probDensity); Double_t pp=pid.GetProbablity(AliPID::kProton); // probability to be a proton Double_t pk=pid.GetProbability(AliPID::kKaon); // probability to be a kaon … if (pp > 1./AliPID::kSPECIES) { /* this is a proton */} }}

ESD Example: PID

Page 63: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 63

Visualization

Usagealieve.x alieve_init.CUse then the macros in the EVE folder in TBrowser

Page 64: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 64

Exercises

Event merging

Page 65: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 65

Event mixing – test500

Generate & reconstruct underlying events (./backgr)Simulation (full chain up to Digits)

• AliSimulation sim;• sim.Run(2);

Reconstruction• AliReconstruction rec;• rec.Run();

Generate, merge & reconstruct signal events (./signal)Simulation (with event merging)

• AliSimulation sim;• sim.MergeWith(“../backr/galice.root”,3);• sim.Run(6);

Reconstruction• AliReconstruction rec;• rec.Run();

Page 66: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 66

Event mixing – test500void test(const char * sdir ="signal",

const char * bdir ="backgr") {

TStopwatch timer; timer.Start(); TString name;

// Signal file, tree, and branch name = sdir; name += "/AliESDs.root"; TFile * fSig = TFile::Open(name.Data()); TTree * tSig = (TTree*)fSig->Get("esdTree"); TBranch * bSig = tSig->GetBranch("ESD");

AliESD * esdSig = 0; // The signal ESD object is put here bSig->SetAddress(&esdSig);

// Run loader (signal events) name = sdir; name += "/galice.root"; AliRunLoader* rlSig = AliRunLoader::Open(name.Data());

// Run loader (underlying events) name = bdir; name += "/galice.root"; AliRunLoader* rlUnd =

AliRunLoader::Open(name.Data(),"Underlying");

// gAlice rlSig->LoadgAlice(); rlUnd->LoadgAlice(); gAlice = rlSig->GetAliRun();

// Now load kinematics and event header rlSig->LoadKinematics(); rlSig->LoadHeader(); rlUnd->LoadKinematics(); rlUnd->LoadHeader(); // Loop on events: check that MC and data contain the same number

of events Long64_t nevSig = rlSig->GetNumberOfEvents(); Long64_t nevUnd = rlUnd->GetNumberOfEvents(); Long64_t nSigPerUnd = nevSig/nevUnd;

cout << nevSig << " signal events" << endl; cout << nevUnd << " underlying events" << endl; cout << nSigPerUnd << " signal events per one underlying" <<

endl;

for (Int_t iev=0; iev<nevSig; iev++) { cout << "Signal event " << iev << endl; Int_t ievUnd = iev/nSigPerUnd; cout << "Underlying event " << ievUnd << endl;

// Get signal ESD bSig->GetEntry(iev); // Get underlying kinematics rlUnd->GetEvent(ievUnd);

// Particle stack AliStack * stackSig = rlSig->Stack(); Int_t nPartSig = stackSig->GetNtrack(); AliStack * stackUnd = rlUnd->Stack(); Int_t nPartUnd = stackUnd->GetNtrack();

Int_t nrec = esdSig->GetNumberOfTracks(); cout << nrec << " reconstructed tracks" << endl; for(Int_t irec=0; irec<nrec; irec++) { AliESDtrack * track = esdSig->GetTrack(irec); UInt_t label = TMath::Abs(track->GetLabel()); if (label>=10000000) {

// Underlying event. 10000000 is the// value of fkMASKSTEP in AliRunDigitizer

label %=10000000;if (label>=nPartUnd) continue;TParticle * part = stackUnd->Particle(label);

} else {

cout << " Track " << label << " from the signal event" << endl;if (label>=nPartSig) continue;TParticle * part = stackSig->Particle(label);if(part) part->Print();

}

}

} fSig->Close();

timer.Stop(); timer.Print();}

Page 67: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

Part II: PROOF

Jan Fiete Grosse-Oetringhaus, Marco Meoni

Page 68: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 68

PROOF

Parallel ROOT Facility

Interactive parallel analysis on a local cluster

PROOF itself is not related to GridCan be used in the GridCan access Grid files

The usage of PROOF is transparentThe same code can be run locally and in a PROOF system (certain rules have to be followed)

PROOF is part of ROOT

Page 69: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 69

root

Remote PROOF Cluster

Data

Data

Data

proof

proof

proof

Client - Local PC

$ root

ana.Cstdout/result

node1

node2

node3

node4

$ root

root [0] tree->Process(“ana.C”)

$ root

root [0] tree->Process(“ana.C”)

root [1] gROOT->Proof(“remote”)

$ root

root [0] tree->Process(“ana.C”)

root [1] TProof::Open(“remote”)

root [2] chain->Process(“ana.C”)

ana.C

proof

PROOF Schema

Data

master

slave

slave

slave

Page 70: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 70

Terminology

ClientYour machine running a ROOT session that is connected to a PROOF master

MasterPROOF machine coordinating work between Slaves

SlavePROOF machine that processes data

QueryA job submitted from the client to the PROOF system.A query consists of a selector and a chain

SelectorA class containing the analysis code (more details later)

ChainA list of files (trees) to process (more details later)

Page 71: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 71

TTree

A tree is a container for data storage with disk “overspill”

It consists of several branches

These can be in one or several filesBranches are stored contiguously (split mode)When reading a tree, certain branches can be switched off speed up of analysis when not all data is needed

TreeB

ran

ch

Bra

nc

h

Bra

nc

h

Page 72: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 72

TTree#include "TTree.h"#include "TFile.h"#include "TRandom.h"

class point {public: void Set() {x=gRandom->Rndm();y=gRandom->Rndm();z=gRandom->Rndm();}private: Float_t x, y, z; ClassDef(point, 1)};

Int_t t() { point *pp = new point(); TTree *tree = new TTree("Test","Test Tree",99); TFile *file = new TFile("test.root","recreate"); tree->Branch("point",&pp); for(Int_t i=0; i<100; ++i) { pp->Set(); tree->Fill();} tree->Write(); file->Close(); // file=new TFile("test.root","read"); tree->Print(); // return 0;}

Page 73: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 73

TTree (2)*******************************************************************************Tree :Test : Test Tree **Entries : 100 : Total = 4090 bytes File Size = 0 ** : : Tree compression factor = 1.00 ********************************************************************************Branch :point **Entries : 100 : BranchElement (see below) **............................................................................**Br 0 :x : **Entries : 100 : Total Size= 1006 bytes One basket in memory **Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 **............................................................................**Br 1 :y : **Entries : 100 : Total Size= 1006 bytes One basket in memory **Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 **............................................................................**Br 2 :z : **Entries : 100 : Total Size= 1006 bytes One basket in memory **Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 **............................................................................*

point

x

y

z

x x x x x x x x x x

y y y y y y y y y y

z z z z z z z z z z

BranchesFile

Page 74: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 74

How to use PROOF

Files to be analyzed are put into a chain ( TChain)

Analysis written as a selector ( TSelector, AliSelector, AliSelectorRL)

Input/Output is sent using dedicated lists

If additional libraries are needed, these have to be distributed as a “package”

Analysis(TSelector)

Input Files(TChain) Output

(TList)Input (TList)

Page 75: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 75

TChain

A chain is a list of trees (in several files)

Normal TTree functions can be used

Draw(...), Scan(...) these iterate over all elements of

the chain

Selectors can be used with chainsProcess(const char* selectorFileName)

After using SetProof() these calls are run in PROOF

Chain

Tree1 (File1)

Tree2 (File2)

Tree3 (File3)

Tree4 (File3)

Tree5 (File4)

Page 76: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 76

once on your client

once on each Slave

TSelector

for each tree

for each event

Classes derived from TSelector can run locally and in PROOF

Begin()

SlaveBegin()

Init(TTree* tree)

Process(Long64_t entry)

SlaveTerminate()

Terminate()

Page 77: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 77

Input / Output

The TSelector class has two members of type TList:

fInput, fOutputThese are used to get input data or put output data

Input listBefore running a query the input list is populatedproof->AddInput(myObj)In the selector (Begin, SlaveBegin) the object is retrieved: fInput->FindObject(“myObject”)

Page 78: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 78

Input / Output (2)

Output listAfter processing, the output has to be added to the output list on each Slave (in SlaveTerminate)fOutput->Add(fResult)PROOF merges the results from each query automatically (see next slide)On your client (in Terminate) you retrieve the object and save it, display it, ...fOutput->FindObject(“myResult”)

Page 79: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 79

Input / Output (3)

MergingObjects are identified by nameStandard merging implementation for histograms availableOther classes need to implement Merge(TCollection*)When no merging function is available all the individual objects are returned

Result fromSlave 1

Result fromSlave 2

Final result

Merge()

Page 80: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 80

Chain

Tree1 (File1)

Tree2 (File2)

Tree3 (File3)

Tree4 (File3)

Tree5 (File4)

Workflow Summary

Analysis(TSelector)

Input (TList)

proof

proof

proof

Page 81: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 81

Workflow Summary

Analysis(TSelector)

Input (TList)

proof

proof

proof

Output(TList)

Output(TList)

Output(TList)

MergedOutput

Page 82: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 82

Packages

PAR files: PROOF ARchive. Like Java jar

Gzipped tar filePROOF-INF directory

• BUILD.sh, building the package, executed per Slave

• SETUP.C, set environment, load libraries, executed per Slave

API to manage and activate packages

UploadPackage(“package.par”)EnablePackage(“package”)

Page 83: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 83

Accessing ESD

Use local ROOT

To access AliESDs.root, the ESD.par package has to be uploaded into the PROOF environment

Selector derives from AliSelector (in STEER)

Access to data by member: fESD

TSelector

AliSelector

<YourSelector>

Page 84: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 84

Accessing the RunLoaderUse local AliRootAccess to Kinematics, Clusters, etc. requires access to the RunLoaderTherefore (nearly) full AliRoot needs to be loadedA AliRoot version is already deployed on the CAF test system and can be enabled by a 3 line macro(part of the tutorial files, see later)ESD package is not allowed to be loadedSelector derives from AliSelectorRL (in STEER)

GetStack(), GetRunLoader(), GetHeader()

TSelector

AliSelector

AliSelectorRL

<YourSelector>

Page 85: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 85

CERN Analysis Facility

The CERN Analysis Facility (CAF) will run PROOF for ALICE

Prompt analysis of pp dataPilot analysis of PbPb dataCalibration & Alignment

Available to the whole collaboration but the number of users will be limited for efficiency reasons

Design goals500 CPUs100 TB of selected data locally available

Page 86: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 86

Evaluation of PROOF

Test setup since May 200640 machines, 2 CPUs each, 200 GB disk

Tests performedUsability testsSimple speedup plotEvaluation of different query typesEvaluation of the system when running a combination of query types

Goal: Realistic simulation of users using the system

Page 87: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 87

Query Type Cocktail

A realistic stress test consists of different users that submit different types of queries

4 different query types20% very short queries40% short queries20% medium queries20% long queries

User mix33 nodes available for the testMaximum average speedup for 10 users = 6.6 (33 nodes = 66 CPUs)

Page 88: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 88

Relative Speedup

Speed up more than “theoretical” number of CPUs per user(due to pauses in the query resubmission) Cluster exploitation higher than with explicit usage (eachuser gets 6.6 CPUs)

Page 89: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 89

Hands-On

Getting ready...

Run selectors that access ESDLocallyPROOFModify it...

Run selectors that access RunLoader

PROOFModify it...

Create your own selector

Page 90: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 90

Warm up

PreconditionsCopy files from http://aliceinfo.cern.ch/Offline/Analysis/Tutorial/to a local directory and extract it

Set up environmentsource /afs/cern.ch/alice/caf/caf-tutorial.shNB: This works only for the tutorial machines, i.e. SLC3 i686How to enable it on LXPLUS is explained later in the tutorial

Check ROOT/AliROOTStart it. Does it show ROOT version 5.15/04?$ALICE_ROOT/STEER/AliSelector.h available?

Add AliROOT include pathTo ~/.rootrc addACLiC.IncludePaths: -I$(ALICE_ROOT)/includeGo to the local directory from aboveOpen AliROOT and test if selector can be compiled.L AliMultiplicityESDSelector.cxx+

Page 91: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 91

Files to be usedCreateESDChain.C Creates a chain from a list of file namesESD100_110_v2.txt List of prod2006_2 PDC06 files distributed on the CAFESD.par Par archive for PDC06 dataProofEnableAliRoot.C Enables an installed AliROOT on the CAF clusterAliMultiplicityESDSelector.{cxx,h} Selector that creates a uncorrected multiplicity histogram from the ESDAliMultiplicityMCSelector.{cxx,h} Selector that creates a multiplicity histogram from the MCAliEmptySelector.{cxx,h} Empty selector that can be used as a skeleton for your own analysis

Page 92: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 92

Run selector locally

Start AliRoot

Create a chainchain = new TChain(“esdTree”)chain->Add(“root://lxb6046.cern.ch//proofpool/

pdc06/100/002/root_archive.zip#AliESDs.root”)chain->GetEntries() // Should return 100

Execute a selector locallychain->Process(“AliMultiplicity

ESDSelector.cxx++”)

NB: Instead of AliRoot, use root androot [0] gSystem->Load("libGeom") // pointer to geometryroot [1] gSystem->Load("libEG") // pointer to PDG databaseroot [2] gSystem->Load("libESD”) // ESD library

Page 93: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 93

Run selector with PROOF

Start ROOT and create chain as beforechain = new TChain(“esdTree”)chain->Add(“root://lxb6046.cern.ch//proofpool/ pdc06/100/002/root_archive.zip#AliESDs.root”)

Connect to PROOF serverproof = TProof::Open(“<username>@lxb6046”)

Upload the ESD packageproof->UploadPackage(“ESD.par”)proof->EnablePackage(“ESD”)

Execute with PROOFchain->SetProof()chain->Process(“AliMultiplicity

ESDSelector.cxx++”)

Page 94: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 94

Run with a long chain

Create longer chain.L CreateESDChain.Cchain = CreateESDChain(“ESD100_110_v2.txt”)

Execute the selector with PROOFchain->SetProof()chain->Process(“AliMultiplicityESDSelector.cxx+

+”)

NB: Without CreateESDChain.C, do the following:chain = new TChain("esdTree")int count=0; TString file; ifstream in;in.open("ESD100_110_v2.txt")while((++count<201) && (in>>file)) chain->Add(file.Data());

Page 95: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 95

Looking at the Selector

SlaveBeginCalled once per Slave before processingMultiplicity histogram is created

ProcessCalled once per eventTracks are counted, histogram filled

SlaveTerminateCalled once per Slave after processingMultiplicity histogram is filled into the output list

TerminateCalled once on the client (your laptop/PC)Multiplicity histogram is read from the output list and displayed

Page 96: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 96

Changing the Selector

Add a || < 0.5 cutInt_t nGoodTracks = 0;for (Int_t i=0; i<fESD->GetNumberOfTracks(); ++i) { AliESDtrack* track = fESD->GetTrack(i); Double_t p[3]; track->GetConstrainedPxPyPz(p); TVector3 vector(p); Float_t eta = vector.Eta(); if (TMath::Abs(eta) < 0.5)

nGoodTracks++; }fMultiplicity->Fill(nGoodTracks);

Page 97: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 97

Changing the Selector (2)

Add a second plot: distributionHeader file (.h file)

• Add new member: TH1F* fEta; // eta distribution

Constructor• Initialize member: fEta(0)

SlaveBegin• Create histogram

fEta = new TH1F("fEta", "#eta distribution", 20, -2, 2);

Process• Get like in previous example• Fill histogram: fEta->Fill(eta);

Page 98: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 98

Changing the Selector (3)

SlaveTerminateAdd histogram to the output list: fOutput->Add(fEta);

Terminate Read histogram from the output listfEta = dynamic_cast<TH1F*> (fOutput->FindObject("fEta"));Introduce an if statement if the object was retrievedif (!fEta) { AliDebug(AliLog::kError, “fEta was not found”); return; }Draw the histogramnew TCanvas;fEta->DrawCopy();

Page 99: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 99

Learning about Branches

The ESD tree consists of several branchesSwitching off not needed branches increases speed of analysis significantlyLooking at the available brancheschain = new TChain(“esdTree”)chain->Add(“root://lxb6046.cern.ch//pool/proofpool/

pdc06/100/002/root_archive.zip#AliESDs.root”)chain->Print()

Disable all branches (in Init)tree->SetBranchStatus("*", 0)

Enable a needed branch (in Init)tree->SetBranchStatus(“fTracks.fCp”, 1)

Try this! What is the increase in processing speed?

Page 100: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 100

Running with full AliROOT

Start AliROOTConnect to PROOF serverproof = TProof::Open(“<username>@lxb6046”)

Enable AliROOT.x ProofEnableAliRoot.C

Create Chain.L CreateESDChain.Cchain = CreateESDChain(

“ESD100_110_v2.txt”)Execute the selector that accesses MCchain->SetProof()chain->Process(“AliMultiplicity

MCSelector.cxx++”)

Page 101: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 101

Accessing the event header

AliSelectorRL::GetHeader returns the headerRetrieve the header (in Process)AliHeader* header = GetHeader();if (!header) { AliDebug(AliLog::kError, "Header not available"); return kFALSE;}

Retrieve a value from the headerprintf("This is run %d.\n", header->GetRun());

Run it and look at the log

Page 102: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 102

Your own selector

Start from AliEmptySelector

Find a nameCopy AliEmptySelector.h/.cxx to <yourSelector>.h/.cxx

Replace class names, define statement

Put in your analysis code

Page 103: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 103

Reading log files

When your selector crashesYou cannot access the output via the PROOF progress windowUsually you have to restart the ROOT session

Reading output from last queryOpen ROOTGet a PROOF manager objectmgr = TProof::Mgr(“<username>@lxb6046”)Get the log files from the last sessionlogs = mgr->GetSessionLogs(0)Display themlogs->Display()Search for a special word (e.g. segmentation violation)logs->Grep(“segmentation violation”)Save them to a filelogs->Save(“*”, “logs.txt”)

Page 104: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 104

Some Goodies...

Resetting environmentTProof::Reset(“<username>@lxb6046”)

Run with debugProcess(“<selector>”, “debug”)Process(“<selector>”, “moredebug”)

Compile with debugProcess(“<selector>+g”)

Create a package from AliROOTmake ESD.par

Page 105: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 105

CAF use from LXPLUS

LXPLUS runs SLC4 on x86_64source /afs/cern.ch/alice/caf/caf-lxplus.sh

Page 106: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 106

Backup

Page 107: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 107

PROOF HandoutConnect to PROOF serverproof = TProof::Open(“<username>@lxb6046”)

Upload the ESD packageproof->UploadPackage(“ESD.par”)proof->EnablePackage(“ESD”)

Enable AliROOT.x ProofEnableAliRoot.C

Create small chain manuallychain = new TChain(“esdTree”)chain->Add(“root://lxb6046//proofpool/pdc06/100/

002/root_archive.zip#AliESDs.root”)Create long chain.L CreateESDChain.Cchain = CreateESDChain(“ESD100_110_v2.txt”)Execute a selector with PROOFchain->SetProof()chain->Process(“AliMultiplicityESDSelector.cxx++”)

Page 108: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 108

Analysis with Selectors

Create a selectorTFile *fESD = TFile::Open(“AliESDs.root”);TTree *tESD = (TTree *)fESD->Get(“esdTree”);tESD->MakeSelector();Info in <TTreePlayer::MakeClass>: Files: esdTree.h and esdTree.C generated

from TTree: esdTree

Modify the selector accordingly and run it.! emacs esdTree.{C,h}&tESD->Process(“esdTree.C”);

Use an existing example and modify it accordingly

For further information on selectors:Check the analysis user guide provided by A.PetersPresentation of M.Biskup at the Root workshop 2005

Page 109: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 109

Entries are processed in an arbitrary order

Only the needed data is

read

Skeleton can be

generated from a Tree

Basics of Selectors

Selectors contain skeleton of processing systemPreprocessing and initialization Processing each eventPost processing and clean-up

Page 110: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 110

TSelector::SlaveBegin();TSelector::SlaveTerminate();

TSelector::Init(TTree*)

TList* fInput, fOutput;

InputList OutputList

resultsinput data

InputList OutputList

PROOF

network network

Selectors

More complicated in a distributed environment

Many computers to initialize and clean-up

Many trees in a chain

Input and output results should be transparently sent over network

Page 111: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 111

PROOF and Selectors

No user’s control on the order

Many Trees are being processed

Initialize each Slave

The same code works also without

PROOF (of course!)

Client

Client

Slaves

Slaves

Slaves

Slaves

Page 112: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 112

Selectors - summary

Skeletons generated from a tree

Only methods need to be filled

Simplify program structure

Can be used for parallel processing as well as for local analysis

More about the selectors during the PROOF tutorial

Page 113: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 113

PROOF Installation

Install ROOT with PROOF enabled (default)

More information: http://root.cern.ch

Configuration (see next slides)xrootd config file: xrd.cfPROOF config file: proof.conf

Start xrootd serviceRequires unprivileged user account

Page 114: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 114

xrd.cf

## Load the XrdProofd protocol:

xrd.protocol xproofd:1093 /opt/root/lib/libXrdProofd.so

## Set ROOTSYS

xpd.rootsys /opt/root

## Working directory for sessions

xpd.workdir /pool/proofbox

Page 115: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 115

xrd.cf (2)

## xpd.resource static [<cfg_file>] [ucfg:<user_cfg_opt>] [wmx:<max_workers>] [selopt:<selection_mode>]

xpd.resource static /etc/proof/proof.conf wmx:-1 selopt:roundrobin

## Server role (master, worker) [default: any]

xpd.role worker if lxb*.cern.ch

xpd.role master if lxb6046.cern.ch

## Master(s) allowed to connect. By default all connections are allowed.

xpd.allow lxb6046.cern.ch

Page 116: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 116

proof.conf

## machine running the mastermaster lxb6046.cern.ch## machine(s) running Workers, dual

CPU machines have to be listed twice

worker lxb6047.cern.chworker lxb6047.cern.chworker lxb6048.cern.chworker lxb6048.cern.ch...

Page 117: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 117

Starting xrootd Service

xrootd -b -l xrootd.log -R proofaccount -c xrd.cf -dOptions:-b : background (skip for debugging)-l : log file-R <useraccount> : user account that

runs xrootd service-c <configfile> : configuration file-d : debug flag

Do not forget full paths to the files

Page 118: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 118

Part III: AliEn

Page 119: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 119

Installation of the AliEn software.

Authentication – Possible problems.

General description of the shell:

Basic commands.

Basic functionalities.

Working with the file catalogue:

Copying files from/to the catalogue.

File catalogue structure.

Querying the file catalogue.

ROOT API

News on production.

Outline I

Page 120: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 120

Flow of the overall analysis procedure.

New analysis framework

Local analysis:

Creation of tag files.

Local analysis using the Event Tag System.

Interactive analysis with AliEn stored files.

Batch analysis:

Flow of the procedure.

Description of the files needed.

Description of the jdl fields.

Practical examples.

Outline II

Page 121: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 121

Installation – Getting the installer

Page 122: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 122

Installation – Selecting the version

Page 123: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 123

Installation – Reuse of software

Page 124: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 124

All the installation log files are stored in this directory!In case of installation problems please send the error

message along with the install.log file

Installation – Workspace directory

Page 125: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 125

Installation – Detecting the platftom

Page 126: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 126

Installation – Supported platforms

Page 127: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 127

Installation – Installation directory

Page 128: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 128

Installation – Selecting installation directory

Page 129: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 129

Installation – Overwriting files

Page 130: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 130

Installation – Selecting packages

Page 131: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 131

Installation – Progress bar

Page 132: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 132

Installation – Final window

Page 133: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 133

ROOT application

API client

Common libraries

Globus toolkit

Gcc compiler

Installation – Directory structure

Page 134: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 134

Download the alien installer from http://alien.cern.ch.

Make the file executable.

Run the installer.

Select v2-13

Platform should be i686.

Select installation directory.

Select the following packages:

Client

gShell

ROOT

xrootd

Installation – Try it out

Page 135: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 135

Certificates should be stored under $HOME/.globus

Globus enforces privacy on your private key!(chmod 400)

Authentication – Preparing the certificates

Page 136: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 136

Authentication – Changes in env. variables

Page 137: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 137

Authentication command – Username is optional (default is the local username)

Put certificate password

Happens every 24 hours

Authentication – Getting a GRID proxy

Page 138: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 138

Authentication – Getting an AliEn token

Page 139: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 139

Globus related:Permissions on $HOME/.globus/userkey.pem are not private to the user – chmod 400 userkey.pemYour certificate authority is exotic and not known to the server.Your certificate has expired.Clock skew:

• Your local computer time is in the future with respect to the server's time.

• Your local computer time is more in the past than the certificate life time.

Authentication – Authentication problems I

Page 140: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 140

alien-token-init related:You have not gone through all 5 steps of the AliEn user registration.You have not given the AliEn user name as an argument to the token-init command and your local user name is not identical to the AliEn user name.The script wants to bootstrap the installation but you don't have write permissions on the installation path – Avoid bootstrapping by setting the GSHELL_ROOT environment variable.

Authentication – Authentication problems II

Page 141: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 141

Upload your certificates to your machines:Store them under e.g: /afs/cern.ch/user/t/trn2301/.globus/Check that the key file is read only.

Get the setenv.sh file from the agenda and place it under e.g. /home/trn2301/

Source it to set up your environment variables.

Get a valid grid proxy.

Get a valid alien token.

Check the information of your proxy/token by typing:

grid-proxy-info

alien-token-info

Authentication – Try it out

Page 142: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 142

Standard bash shell with grid comandsMain bash features are available.Not all shell helper programs are available.Some local commands (like ls, cat etc) are overwritten with the corresponding GRID commands.File/path tab completion in the virtual GRID directory.

Message of the day.

Shell (1) – Accessing the shell

Page 143: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 143

Tab completion working!!!

Shell (1) – Basic commands I

Page 144: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 144

Shell (1) – Basic commands II

Page 145: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 145

Shell (1) – Basic commands III

Page 146: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 146

Shell (1) – whereis command

Page 147: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 147

Shell (1) – Viewing the files I

Page 148: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 148

Shell (1) – Viewing the files II

Page 149: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 149

Define your preferred editor via the variable EDITOR:'emacs''emacs -nw''xemacs''xemacs -nw''pico''vi' (DEFAULT)'vim'The file is temporary in /tmp on your local disk and then is uploaded once you exit the editor!

Shell (1) – Editing files

Page 150: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 150

Shell (1) – Clear old versions

Page 151: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 151

Access the alien shell.

Check your user name by typing whoami.

List the contents of your home directory.

Check the working directory.

Create the following directory structure in your AliEn space:

$HOME/bin (if it is not there)

$HOME/Tutorial/ESD and $HOME/Tutorial/Kine

$HOME/Tutorial/ESD/output and $HOME/Tutorial/Kine/output

Get the information of the file (whereis): /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/ESD/AliAnalysisTaskPt.cxx

Shell (1) – Try it out

Page 152: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 152

GOLDEN RULEIf you want to access your local directory structure while you

are in the shell you should start by having the prefix “file:”

e.g: cp file:/home/pchrist/gshell.sh gshell.sh

Shell (2) – Copying files from/to the F.C.

Page 153: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 153

MARKUS OLDENBURG AN INTERNAL NOTE

IS ON THE WAY

Shell (2) – File catalogue structure

The path name will be:for ‘real’ data: /data/<Year>/<AcceleratorPeriod>/<RunNumber>/for simulated data: /sim/<Year>/<ProductionType>/<RunNumber>/

Subdirectories will be called:Raw/cond/ reco/<PassX>/ESD/reco/<PassX>/AOD/…

File names will look like this: <xxxx>.AliESD.root

For further information see:http://indico.cern.ch/conferenceDisplay.py?confId=3280http://cern.ch/Oldenburg/MetaData/MetaData.doc

Page 154: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 154

aliensh:[alice] [1] find -x pp

/alice/cern.ch/user/p/pchrista/production/pp/PDC06/*

AliESDs.root > pp.xml

Redirect the output

to

the xml collection.

Shell (2) – Querying the F.C. I

Page 155: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 155

aliensh:[alice] [1] find -x pp

/alice/data/2008/LHC08a/*/reco/Pass3/*

AliESDs.root

Run:collision_system=”pp” and

Run:stop<"2008-03-20 10:20:33" and

Run:start>"2008-03-19" > pp.xml

Shell (2) – Querying the F.C. II

Page 156: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 156

Create the following directory structure locally:

$HOME/AliEn/PDC06/001 and $HOME/AliEn/PDC06/002

$HOME/AliEn/Tags

$HOME/AliEn/Local/ESD and $HOME/AliEn/Local/Kine

$HOME/AliEn/Interactive/ESD and $HOME/AliEn/Interactive/Kine

$HOME/AliEn/Batch

Copy all the files under the AliEn directory /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/ESD/ to your local $HOME/AliEn/Local/ESD

ESD.par - ANALYSIS.par - AliAnalysisTaskPt.h - AliAnalysisTaskPt.cxx - runESDAnalysis.C - demoLocal.C

Shell (2) – Try it out I

Page 157: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 157

Copy all the AliEn files under /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/Kine/ to your local $HOME/AliEn/Local/Kine:

AliAnalysisTaskRLPt.h - AliAnalysisTaskRLPt.cxx - runKineAnalysis.C - demoLocal.C

Copy all the AliEn files under /alice/cern.ch/user/p/pchrist/Tutorial/TAGS/ to your local $HOME/AliEn/Tags:

ESD.par - CreateTags.C - runTagCreator.C

Copy all the root files under /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/001/ and /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/002/ your local $HOME/AliEn/PDC06/001 and $HOME/AliEn/PDC06/002

Shell (2) – Try it out II

Page 158: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 158

Shell (2) – Try it out III

Query the f.c. and get all the tag files (*.tag.root) under: /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/*

Get the output on your terminal.

Redirect the results to the tag10.xml collection: the output will not be stored in your AliEn working directory but rather in your local working directory.

Repeat the previous exercise limiting the number of output files to 5 (find -l 5 ...).

Query the f.c. for all the *Merged*.tag.root files under: /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/ and redirect the result to the tag.xml file.

Exit the shell and copy the xml to your local $HOME/AliEn/Interactive/ESD and $HOME/AliEn/Interactive/Kine.

Page 159: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 159

p+p min bias @ 14TeV --- NEvents ~ 50M:

/alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/ (5.4M)

/alice/sim/2006/pp_minbias/ (~45M)

/alice/sim/2006/pp_x_vertex_1cm/ (1.1M)

/alice/sim/2006/pp_x_vertex_05cm/ (1.1M)

/alice/sim/2006/pp_minbias_full/ (1.1M)• All RUNS have been tested and merged tag files have been

produced at the RUN level for all RunIds.

p+p min bias @ 900GeV --- NEvents = 200K:

/alice/sim/2006/pp_900GeV/• All RUNS have been tested and merged tag files have been

produced at the RUN level for all RunIds.

Muon events --- NEvents = 864K:

/alice/sim/2006/muon/ (64K)

/alice/sim/2006/muon_signle/ (800K)

Production status

Page 160: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 160

ROOT – ROOT API

Page 161: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 161

ROOT - Connecting

Page 162: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 162

ROOT – Accessing a GRID file

Page 163: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 163

AliEn software comes with a precompiled library with gcc 3.2.3 which is also shipped with AliEn.

If you are using a different version of gcc (check it with gcc –v) then do the following:

cd $ALIEN/api/src ./recompile.gapicd $ALIEN/api/libCopy all the libgapiUI.so.2* files to the libgapiUI.so.3*

Or link your gcc to the version shipped with AliEn and compile everything with this.

ROOT – Problems with gcc versions

Page 164: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 164

Get the alienroot and alienaliroot executables from indico.

Store them under your /home/trn2301/bin

Open the setenv.sh file and modify the path definition:

export PATH=$PATH:$ALIEN/api/bin:$ALIEN/globus/bin:/home/trn2301/bin

Once finished, get a token, type alienroot and then:

root [0] TGrid::Connect(“alien://”);

If it works without error messages you have installed everything successfully. If not then go back to the previous pages of this tutorial.

ROOT – Try it out

Page 165: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 165

AliAnalysisDataContainer:Class that allows the user to define the basic input/output containers.Three types of containers: input, transient and output.

AliAnalysisTask:Implementation of the actual analysis code that processes input data.

AliAnalysisManager:Definition of all data containers that will assembly the analysis.Definition of tasks.Definition of the relationships between the tasks and the containers.

Andrei Gheatahttp://indico.cern.ch/materialDisplay.py?

contribId=19&amp;sessionId=3&amp;materialId=slides&amp;confId=a056304

Framework – Main classes

Page 166: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 166

AliAnalysisManagerTObjArray *fContainers

TObjArray *fTasks

Cont2*

task1 task2 task3

Cont1*

cont3

cont4

task4

cont6

task5

Framework – Data flow structure

Page 167: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 167

Loop overchain entries

Output of mixing

AOD

Real/Simulatedmixing

Real/Simulated mixed output(root file with histos

and objects)

OUT2

Input chain

Loop overchain entries

Real/Simulatedmixing analysis

Real/Simulated output(root file with histos

and objects)

OUT1

Real/Simulatedanalysis

Comparison of OUT1 & OUT2Collection of files

Input chain

TAGS

Framework – A practical example

Page 168: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 168

Collection of files

TAGS

OutputContainer1

ROOT filefrom analysis

TASK 1

analysisInput

Container1

CHAIN

OutputContainer2

AOD

TASK 2

mixing

InputContainer2

CHAIN (from AOD)

TASK 3

Mixing analysis

OutputContainer3

ROOT filefrom mixing

analysis

OutputContainer4

Comparison

TASK 4

Comparison

Framework – Integration in the framework

Page 169: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 169

Framework – Example of a manager

Page 170: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 170

Framework – Example of a task

Page 171: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 171

Query the file catalog

PROOF

AliEn

Local

Tag xml collectio

n

Process chain with a

manager

Selection criteria

Query the Event Tag

System

User's macro

Create an esdTree

chain

Extract an esd xml

collection

Analysis – Flow of the analysis procedure

Page 172: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 172

Analysis – Event Tag System

Page 173: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 173

t->SetStorage(0);

t->ReadLocalCollection(“/home/pchrist/PDC06/pp14TeV/”);

t->MergeTags();

Setup par archiveLoad the needed libraries

AliTagCreator *t = new AliTagCreator();

Local analysis – Creation of tag files

Page 174: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 174

Setup par archiveLoad the needed libraries

AliRunTagCuts *RunCuts = new AliRunTagCuts();AliEventTagCuts *EvCuts = new AliEventTagCuts();EvCuts->SetMultiplicityRange(0,1500);

AliTagAnalysis *TagAna = new AliTagAnalysis();TagAna->ChainLocalTags(“.”);

analysischain = TagAna->QueryTags(RunCuts,EvCuts);

const char *selectorfile = "esdPt.C";analysischain->Process(selectorfile);

Local analysis – Local analysis with tags I

The query of the Event Tag System can be done by:Using the AliRunTagCuts and AliEventTagCuts objectsUsing string statements (“(fEventTag.fNumberOfTracks > 0)&&(fEventTag.fNumberOfTracks < 1500)”)

Page 175: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 175

Setup par archiveLoad the needed libraries

AliRunTagCuts *RunCuts = new AliRunTagCuts();AliEventTagCuts *EvCuts = new AliEventTagCuts();EvCuts->SetMultiplicityRange(0,1500);

AliTagAnalysis *TagAna = new AliTagAnalysis();TagAna->ChainLocalTags(“.”);TChain *analysischain = TagAna->QueryTags(RunCuts,EvCuts);AliAnalysisManager *manager = new AliAnalysisManager();AliAnalysisTaskPt *task = new AliAnalysisTaskPt(“TaskPt”);manager->AddTask(task);

manager->StartAnalysis(“local”,analysischain);

AliAnalysisDataContainer *cinput1 = manager->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);AliAnalysisDataContainer *coutput1 = manager->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");manager->ConnectInput(task,0,cinput1);manager->ConnectOutput(task,0,coutput1);cinput1->SetData(chain1);

Local analysis – Local analysis with tags II

Page 176: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 176

Open your local $HOME/AliEn/Tags/CreateTags.C file and modify it accordingly:

Change the line where you define where you have the locally stored ESDs.

Run the runTagCreator.C macro to create the tag files with alienroot.

Delete the single tag files and stay with just the merged one.

Go to your local $HOME/AliEn/Local/ESD directory and open the demoLocal.C file.

Change the line where you define the location of the tag files and run the runESDAnalysis.C macro with alienroot.

Impose some selection criteria and rerun the example.

Local analysis – Try it out I

Page 177: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 177

Go to your local $HOME/AliEn/Local/Kine directory and open the demoLocal.C file.

Change the line where you define the location of the tag files and run the runKineAnalysis.C macro with aliroot.

Impose some selection criteria and rerun the example.

Local analysis – Try it out II

Exercise 1: Access of the ESD information

Exercise 2: Access of both the ESD and the Kinematic informationThese examples can also be found in:

$ALICE_ROOT/PWG2/AnalysisMacros/Local (ESD analysis)$ALICE_ROOT/PWG2/AnalysisMacros/Kine (Kine+ESD analysis)

Page 178: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 178

Setup par archiveLoad the needed libraries

AliRauTagCuts *RunCuts = new AliRunTagCuts();AliEventTagCuts *EvCuts = new AliEventTagCuts();EvCuts->SetMultiplicityRange(0,1500);

AliTagAnalysis *TagAna = new AliTagAnalysis();TagAna->ChainGridTags(TagResult);

TChain *analysischain = TagAna->QueryTags(RunCuts,EvCuts);AliAnalysisManager *manager = new AliAnalysisManager();AliAnalysisTaskPt *task = new AliAnalysisTaskPt(“TaskPt”);manager->AddTask(task);

Manager->StartAnalysis (“local”,analysischain);

Same code as in three pages back

TGrid::Connect("alien://”);

TAlienCollection* coll = TalienCollection::Open("tag100.xml");TGridResult* TagResult = coll->GetGridResult("”,0,0);

Interactive analysis – Using the tags

Page 179: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 179

Copy the following AliEn files to your local $HOME/AliEn/Interactive/ESD:

/alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/ESD/runESDAnalysis.C

/alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/ESD/demoInteractive.C

You should also get the ESD.par, ANALYSIS.par, AliAnalysisTaskPt.h and

AliAnalysisTaskPt.cxx from the directory of the previous exercise (you

already have them locally).

Go to your local $HOME/AliEn/Interactive/ESD directory and open the demoInteractive.C file.

Change the line where you define the tag collection and put the name of the file you created by querying the f.c (it should be tag.xml).

Run the runESDAnalysis.C macro with alienroot – Impose some selection criteria and rerun the example.

Interactive analysis – Try it out I

Page 180: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 180

Copy the following AliEn files to your local $HOME/AliEn/Interactive/Kine:

/alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/Kine/runKineAnalysis.C

/alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/Kine/demoInteractive.C

You should also get the AliAnalysisTaskRLPt.h and

AliAnalysisTaskRLPt.cxx from the directory of the previous exercise

(you already have them locally).

Go to your local $HOME/AliEn/Interactive/Kine directory and open the demoInteractive.C file.

Change the line where you define the tag collection and put the name of the file you created by querying the f.c (it should be tag.xml).

Run the runKineAnalysis.C macro with alienaliroot – Impose some selection criteria and rerun the example.

Interactive analysis – Try it out II

These examples can also be found in:

$ALICE_ROOT/PWG2/AnalysisMacros/Interactive (ESD analysis)$ALICE_ROOT/PWG2/AnalysisMacros/Kine (Kine+ESD analysis)

Page 181: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 181

<collection> <event>...guid=”asdf1”...lfn=”/alice/cern.ch/.../file1.root” <event>...guid=”asdf2”...lfn=”/alice/cern.ch/.../file2.root” <event>...guid=”asdf3”...lfn=”/alice/cern.ch/.../file3.root”</collection>

F.C. query

JDL::InputDataCollectionJob Optimiser Splitting

<collection1> <event> lfn=”/alice/.../file1.root”</collection1>

<collection1> <event> lfn=”/alice/.../file2.root”</collection1>

<collection1> <event> lfn=”/alice/.../file3.root”</collection1>

JDL::InputData JDL::InputData JDL::InputData

JOB ANGENT

ROOT

XROOTD

MSS

TAlienCollection

SITE A

ROOT execution

TAlienCollection

SITE B

ROOT execution

TAlienCollection

SITE C

ROOT execution

Batch analysis – Flow of batch analysis

Page 182: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 182

GUID-LFNEventList

Global Chain

C

C2+E2C1+E1 C3+E3

OptimiserSplitting

Job agents

Job agents

LFN-GUIDEventList

LFN-GUIDEventList

LFN-GUIDEventList

Event listdoesn’t get

lostduring

splitting

InputData in new xml

Lfnevlist

lfnevlist

lfnevlist

Batch analysis – Analysis flow with tags

Page 183: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 183

Batch analysis – Creating a new xml file

Setup par archiveLoad the needed libraries

AliRauTagCuts *RunCuts = new AliRunTagCuts();AliEventTagCuts *EvCuts = new AliEventTagCuts();EvCuts->SetMultiplicityRange(0,1500);

AliTagAnalysis *TagAna = new AliTagAnalysis();TagAna->ChainGridTags(TagResult);

TagAna->CreateXMLCollection(“global”,RunCuts,EvCuts);

TGrid::Connect("alien://”);

TAlienCollection* coll = TalienCollection::Open("tag.xml");TGridResult* TagResult = coll->GetGridResult("”,0,0);

The old xml collection (tag.xml) has information about the tag files that are qoing to be queried.The new xml collection (global.xml) has information about the ESDs that are going to be analyzed.

You need to use the tags in a batch session because:

They reduce your analysis time which allows you to lower your TTL (see next slides) and thus make sure that your job starts early enough (jobs are ordered by TTL). They provide the analyzed data in the proper format (TChain + TEntryLists) in a totally transparent way.

Page 184: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 184

ExecutableIt should launch root in case you analyze ESDs.

It should launch aliroot in case you access the Kinematics.root as well.

Par fileEffective in case you read ESDs

Not needed in case you need to access the MC “truth”.

Macro

Selectors/Tasks

xml collection

jdl

Batch analysis – Files for batch analysis

Page 185: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 185

#!/bin/bash

echo

===========================

echo $PATH

echo $ROOTSYS

echo $LD_LIBRARY_PATH

echo

==========================

root -b -x Analysis.C;

IT SHOULD BE STORED UNDER

$HOME/bin IN THE FILE CATALOG!!!

Batch analysis - Executable

Page 186: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 186

Batch analysis - Macro

Setup the par file (in case you read ESDs only) – compile and load the libESD.so (or any necessary library that is needed for the analysis).

Get the xml collection.

Convert the collection to a list of files.

Process the chain with the selector or an AliAnalysisManager.

Page 187: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 187

Executable: Compulsory field where we give the lfn of the executable that should be stored in /bin or $V0/bin or $HOME/bin.

Arguments: They will be passed to the executable.

Packages: Type packages in the shell to see what kind of packages are installed.

InputFile: The files that will be transported to the node where the job will run.

InputData: It will require that the job will be executed in a site close to the files specified here.

InputDataList: The filename in which the Job Agent will write the InputData list.

InputDataListFormat: The format of the InputData list.

Batch analysis – JDL fields I

Page 188: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 188

OutputFile: The files that will be registered in the catalog once the job finishes.

OutputArchive: What files will be archived in a zip file.

Validationcommand: Specifies the script to be used as a validation script.

Email: Receive a mail when the job finishes.

TTL: The maximum run time of your job.

Split: Split the jobs in several sub jobs.

Batch analysis – JDL fields II

Page 189: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 189

Batch analysis – Job status

Page 190: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 190

If everything is ok with your jdl then your job is submittedand a <JOBID>.is assigned to it.You get a submission error message if:i)a file listed in the jdl is missingii)a package defined in the jdl is not listed in the packman

Batch analysis – Submitting jobs

Page 191: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 191

Batch analysis – Checking the job status I

Page 192: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 192

Batch analysis – Checking the job status II

Page 193: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 193

Batch analysis – Checking the priority

Page 194: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 194

Batch analysis – Checking the job output I

Page 195: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 195

Batch analysis – Checking the job output II

Page 196: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 196

The output of every splited job is listed under:

/proc/$username/$JOBID if the OutputDir is not defined in the jdl.

OutputDir if it is defined in the jdl.

In order to merge the several output files you have to run a post process:

You can find the macro that deals with this under /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/histomerge.C

[bash]$ alienroot

root [0] .L histomerge.C

root [1] histomerge($OutputDirPath,$pattern,$mergefile)

Batch analysis – Merging the output

OutputDir: is the output directory of the master job (jdl)

Pattern: the zip file that you create in your selector

Mergefile: the desired locally stored merge file

Page 197: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 197

Copy the following AliEn files to your local

$HOME/AliEn/Batch:

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/tag.xml

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runXML.C

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/CreateXML.C

Go to your local working directory and run the runXML.C

macro with alienroot to create the xml collection.

Batch analysis – Try it out I

Page 198: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 198

Copy the local file global.xml that we just created to your

AliEn $HOME/Tutorial/ESD.

Copy the following AliEn files to your AliEn

$HOME/Tutorial/ESD:

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ANALYSIS.par

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.h

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.cxx

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runESDAnalysis.C

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/demoESDBatch.C

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/analysisESD.jdl

Batch analysis – Try it out II

Page 199: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 199

Copy the following AliEn files to your AliEn $HOME/bin:

/alice/cern.ch/user/p/pchrist/bin/root.sh

While being in the AliEn shell, edit the analysisESD.jdl

and modify the InputFile, InputDataCollection,

InputDataListFormat and OutputDir fields.

Once finished, submit your batch job by typing:

“submit analysisESD.jdl”

Batch analysis – Try it out III

These examples can also be found in:

$ALICE_ROOT/PWG2/AnalysisMacros/Batch (ESD analysis)

Page 200: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 200

Copy the following AliEn files to your AliEn $HOME/Tutorial/Kine:

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskRLPt.h

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskRLPt.cxx

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runKineAnalysis.C

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/demoKineBatch.C

/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/analysisKine.jdl

Copy the following AliEn files to your AliEn $HOME/bin:

/alice/cern.ch/user/p/pchrist/bin/aliroot.sh

Edit the analysisKine.jdl and modify the InputFile,

InputDataCollection, InputDataListFormat and OutputDir fields.

Once finished, submit your batch job by typing:

“submit analysisKine.jdl”

Batch analysis – Try it out IV

These examples can also be found in:

$ALICE_ROOT/PWG2/AnalysisMacros/Kine (Kine+ESD analysis)

Page 201: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 201

Check your job priority by typing: “queue priority jobs $username”.

Display the jdl of your job by typing: “ps -jdl $jobid”.

Trace the status of your job by typing: “ps -trace $jobid”.

When the job 's status turns to RUNNING you can get the stdout and stderr of the job by typing:

“spy $jobid stdout”.“spy $jobid stderr”.

Once the job is finished, merge the output and store it locally as Pt.Merged.root

Batch analysis – Try it out V

Page 202: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 202

Registration – Certificates:

http://alien.cern.ch/twiki/bin/view/Alice/UserRegistration

https://ca.cern.ch/ca/

AliEn:

http://alien.cern.ch

Gshell:

http://alien.cern.ch/twiki/bin/view/AliEn/GAPI

User's guide:

http://project-arda-dev.web.cern.ch/project-arda-dev/alice/apiservice/AA

-UserGuide-0.0m.pdf

References I

Page 203: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 203

aliensh Grid Command Online Reference V1.0

http://project-arda-dev.web.cern.ch/project-arda-dev/alice/apiservice/guide/guide-1.0.htm

Previous tutorials:

http://aliceinfo.cern.ch/Offline/Analysis/Tutorial/

Event Tag System:

http://pcaliweb02.cern.ch/Offline/Analysis/RunEventTagSystem/

EventTags.html#Event%20tag%20system

https://edms.cern.ch/document/788315/1 (INTERNAL NOTE)

References II

Page 204: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 204

Creation of tag files:

http://pcaliweb02.cern.ch/Offline/Analysis/RunEventTagS

ystem/EventTagsCreation.html#Create%20tags%20howt

o

Analysis using the Event Tag System:

http://pcaliweb02.cern.ch/Offline/Analysis/RunEventTagS

ystem/EventTagsAnalysis.html#Analysis%20with%20tag

s

References III

Page 205: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 205

File catalog structure – Queries:

http://pcaliweb02.cern.ch/Offline/Analysis/RunEventTagSystem/

RunTags.html#Run/File%20metadata

File level metadata:

http://cern.ch/Oldenburg/MetaData/MetaData.doc

Analysis framework

http://indico.cern.ch/materialDisplay.py?contribId

=19&amp;sessionId=3&amp;materialId=slides&amp;confId

=a056304

References IV

Page 206: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 206

Analysis framework

Andrei Gheata

ALICE offline week, 5 October ‘06

Page 207: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 207

Purpose

Provide easy-to-use tools to allow data analysis in a coherent way

Suitable for analysis ranging from simple to very complex tasks in a distributed environment

Allow splitting complex analysis tasks in independent functional blocks possibly usable by other analysis

Page 208: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 208

Functionality

Basic ideas described at the last offline weekData-oriented model composed of independent tasks

Task execution triggered by data readiness

Parallel execution and event loop done via TSelector functionalityAnalysis execution performed on event-by-event basis

Page 209: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 209

Structure

Analysis may be split in functional modulesAt least oneDeriving from TTask

Modules are not manually inter-connectedConnected just to input/output data containersA data container has one provider and possibly several clientsA module becomes active when all input data is ready

TTaskTTask

TTaskTTask TTaskTTask TTaskTTask

ACTIVEACTIVE ACTIVEACTIVE INACTIVEINACTIVE

Page 210: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 210

Data-oriented model

Data type formalized by TClass usage

Any module declares a number of input data slots

Each slot must be connected to a data container of the corresponding type at run time

Modules provide data at one or more output slots

AliAnalysisTask

INPUT 0 INPUT 1

OUTPUT 0

CONT 0 CONT 1

CONT 2

Page 211: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 211

Management

Analysis modules managed by a TSelector-derived class

Provides access to initial input data (ESD’s, kinematics, whatever…) for the top-level containersInitiates the main event loop over the entries of the input trees, calling the Exec() method for the top-level tasks

Input data is generally a TChain, but the framework can manage other data types

Retreival by event tags mechanism (see talk from Panos) – to be interfaced

Parallelizing analysis executionFunctionality provided by TSelector@PROOF (see talk from Jan Fiete)

Page 212: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 212

Data flow structure

AliAnalysisManagerTObjArray *fContainers

TObjArray *fTasks

Cont2*

task1 task2 task3

cont3 cont4 cont5

Cont1*

task4

cont6

task5

Top level tasks and containers

TSelector (event loop)

Page 213: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 213

Implementation

Code in AliRootInside ANALYSIS moduleClasses: AliAnalysysManager, AliAnalysisTask, AliAnalysisDataContainer, AliAnalysisDataSlot, AliAnalysisContainerRLBesides the last class, no dependency to AliRoot

Separate library to be loadedlibANALYSIS_NEW

Demo for package usage: testAna.C inside ANALYSIS folder

Page 214: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 214

AliAnalysisManager : public TSelector

CreateContainer(const char *name, TClass *data_type, EAliAnalysisContType cont_type)

Mandatory to define all data containers that will assembly the analysisContainer types:

• kInputContainer – minimum 1 input container needed• kNormalContainer – containers used for communication

between task modules• kOutputContainer – minimum 1 output container

Page 215: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 215

AliAnalysisManager (continued)

AddTask(AliAnalysisTask *task)At least 1 task per analysis (top task)

ConnectInput(pTask, islot, pContainer)ConnectOutput(pTask, islot, pContainer)

Mandatory for all data slots defined by used analysis modules

InitAnalysis()Performs a check for data type cosistency and signal any illegal circular dependencies between modulesTo be called by TSelector::Init()

ExecAnalysis()Starts the analysis To be called by TSelector::Process()

Page 216: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 216

AliAnalysisTask : public TTask

User analysis module MUST subclass thisDefineInput/Output(Int_t islot, TClass *type)

Mandatory at least 1 input & 1 outputUsually declared in the class constructor

virtual void Exec(Option_t *option) = 0Manadatory to implement in the derived classThis actually implements how the analysis module processes input data

Page 217: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 217

Analysis module (task)

AliAnalysisTask

TTask(*) fActive

TTaskTTask

TTask

ExecuteTasks()

Exec()

Exec()

fInputs

fOutputs

MyAnalysisTask

out0 out1 out2

input0 input1 input2

Page 218: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 218

How to implement Exec()

Accesing data from input slotsWhen Exec() is called, data will be always available at all declared inputsUse: MyClass *data = (MyClass*)GetInputData(islot)

Processing input dataIn case of events, organize track loop

Publishing the result at outputMandatory to be done at the end of event processingUse: PostData(Int_t islot, TObject *result, Option_t *option)

• Will notify the container connected to output and all dependent daughter tasks that data is ready

• Subtasks activated when all inputs are ready, executed by the last provider

• Option – specifies if data should be written to a file

Page 219: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 219

AliAnalysisDataContainer

Normally a class to be used ‘as is’Enforcing a data type deriving from TObjectFor non-TObject (e.g. basic) types one can subclass and append the needed types as data members

Three types of data containersInput – containing input data provided by AliAnalysisManagerTransient – containing data transmitted between modulesOutput – containing final output data of an analysis chain, eventually written to files.

One can set a file name if the content is to be writtenAliAnalysisContainerRL – special container using AliRunLoader to access specific data

To be moved in a separate library

Page 220: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 220

Connection via data containers

MyTask1

MyTask2 MyTask3

Daughter tasks

Parent task

Automatic connection via data

containers

Page 221: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 221

AliAnalysisDataSlot

Input/Output task slots

Not a class to be handled by usersCan be declared/created in association with a task, using methods belonging to AliAnalysisTask

Page 222: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 222

Example: AOD parallel production

ESD container

D0_Filter_Task HBT_Filter_Task (…)

AOD1 AOD2 (…)

D0_Analysis_Task HBT_Analysis_Task

Page 223: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 223

Conclusions

Analysis framework in AliRootProvides all needed functionality, but there are also some basic to-do’s left

• Connection to event tag mechanism• TSelector functionality connection

Framework quite flexible and simple to use

See ANALYSIS/testAna.C macro as a simple example on how to use the framework

Additional functionality, bug fixes, optimizations certainly needed

Feedback would help

Page 224: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 224

BACKUP

AliEn Exercises

Page 225: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 225

Go to your $ROOTSYS and change the cfg.sh file – change the location where you installed the grid software (it should be e.g. /home/trn2301/alice/AliEn).

Source the script and then type make and make map.

Write the following script, name it alienroot, make it executable, place it in your $HOME/bin directory and add it

in your $PATH. #!/bin/bashexport ALIEN=/home/trn2301/alienexport ROOTSYS=/home/trn2301/rootexport PATH=$ROOTSYS/bin:$PATHexport LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH:$ALIEN/api/lib

if [ -e /tmp/gclient_env_$UID ]; thensource /tmp/gclient_env_$UID;root.exe $*

fi

ROOT – Try it out I

Page 226: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 226

AliEn Tutorial

Solutions

Panos Christakoglou

University of Athens - CERN

Page 227: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 227

1. Download the installer from the web[bash]$ wget http://alien.cern.ch/alien-installer

2. Make the file executable[bash]$ chmod a+x alien-installer

3. Run the installer[bash]$ ./alien-installer

For the solutions, we assume that the user name is trn2301 with the following attributes:● Local home directory: /home/trn2301● Alien home directory: /alice/cern.ch/user/t/trn2301

change the names accordingly to match your case!!!

Installation – Try it out

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 228: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 228

1. Upload your certificates to your machines[bash]$ scp -r <username>@lxplus.cern.ch:~/.globus .

2. Get a valid token[bash]$ alien-token-init trn2301//the username is optional and should be put if the local username

isn't the same as the alien one

3. Get your proxy info[bash]$ grid-proxy-info

4. Get your token info[bash]$ alien-token-info

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Authentication – Try it out

Page 229: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 229

1. Access the shell[bash]$ aliensh

2. Check your user name[aliensh]$ whoami

3. List the contents of your alien directory[aliensh]$ ls

4. Check the alien working direcory[aliensh]$ pwd

5. Create the following directory structure in your AliEn space: $HOME/bin (if it is not there) - $HOME/Tutorial/ESD and $HOME/Tutorial/Kine -$HOME/Tutorial/ESD/output and $HOME/Tutorial/Kine/output

[aliensh]$ mkdir -p bin Tutorial/ESD/output Tutorial/Kine/output

6. Get the information of the file: /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/ESD/AliAnalysisTaskPt.cxx

[aliensh]$ whereis /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/ESD/AliAnalysisTaskPt.cxx

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Shell (1) – Try it out

Page 230: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 230

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Shell (2) – Try it out I

1. Create the following directory structure locally: $HOME/AliEn/PDC06/001 and $HOME/AliEn/PDC06/002 - $HOME/AliEn/Tags - $HOME/AliEn/Local/ESD and $HOME/AliEn/Local/Kine - $HOME/AliEn/Interactive/ESD and $HOME/AliEn/Interactive/Kine - $HOME/AliEn/Batch

[bash]$ mkdir -p $HOME/AliEn/PDC06/001 $HOME/AliEn/PDC06/002 $HOME/AliEn/Tags $HOME/AliEn/Local/ESD $HOME/AliEn/Local/Kine $HOME/AliEn/Interactive/ESD $HOME/AliEn/Interactive/Kine $HOME/AliEn/Batch

2. Copy all the files under the AliEn directory /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/ESD/ to your local $HOME/AliEn/Local/ESD

[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/ESD/ file:/home/trn2301/AliEn/Local/

Page 231: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 231

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Shell (2) – Try it out II

3. Copy all the AliEn files under /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/Kine/ to your local $HOME/AliEn/Local/Kine[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/LOCAL/Kine/ file:/home/trn2301/AliEn/Local/

4. Copy all the AliEn files under /alice/cern.ch/user/p/pchrist/Tutorial/TAGS/ to your local $HOME/AliEn/Tags:[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/TAGS/ file:/home/trn2301/AliEn/

5. Copy all the root files under /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/001/ and /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/002/ your local $HOME/AliEn/PDC06/001 and $HOME/AliEn/PDC06/002[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/001/ file:/home/trn2301/AliEn/PDC06/[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/002/ file:/home/trn2301/AliEn/PDC06/

Page 232: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 232

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Shell (2) – Try it out III

7. Query the f.c. and get all the tag files (*.tag.root) under: /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/*[aliensh]$ find -x tag /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/* *tag.root (Get the output on your terminal)[aliensh]$ find -x tag /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/* *tag.root > tag10.xml (Redirect the results to the tag10.xml collection)

8. Repeat the previous exercise limiting the number of output files to 5 (find -l 5 ...).[aliensh]$ find -l 5 -x tag /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/* *tag.root > tag10.xml

9. Query the f.c. for all the *Merged*.tag.root files under: /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/ and redirect the result to the tag.xml file.[aliensh]$ find -x tag /alice/cern.ch/user/p/pchrist/Tutorial/PDC06/* *Merged*tag.root > tag.xml

10. Exit the shell and copy the xml to your local $HOME/AliEn/Interactive/ESD and $HOME/AliEn/Interactive/Kine.[aliensh]$ exit[bash]$ cp tag.xml $HOME/AliEn/Interactive/ESD[bash]$ cp tag.xml $HOME/AliEn/Interactive/Kine

Page 233: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 233

1. Open your local $HOME/AliEn/Tags/CreateTags.C file and modify it accordinglyt->ReadLocalCollection("/home/trn2301/AliEn/PDC06");

2. Run it to create the tag files.[bash]$ alienroot -b -q CreateTags.C

3. Delete the single tag files and stay with just the merged one.[bash]$ rm Run100.Event*

4. Go to your local $HOME/AliEn/Local/ESD directory and open the demoLocal.C file.Change the line where you define the location of the tag files and run the macro.TagAna->ChainLocalTags(“/home/trn2301/AliEn/Tags”);[bash]$ alienroot runESDAnalysis.C

5. Impose some selection criteria inside the macro and rerun the example.EvCuts->SetMultiplicityRange(10,15);

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Local analysis – Try it out I

Page 234: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 234

6. Go to your local $HOME/AliEn/LocalKine directory and open the demoLocal.C file. Change the line where you define the location of the tag files and run the macro.TagAna->ChainLocalTags(“/home/trn2301/AliEn/Tags”);[bash]$ alienaliroot runKineAnalysis.C

7. Impose some selection criteria inside the macro and rerun the example.EvCuts->SetMultiplicityRange(10,15);

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Local analysis – Try it out II

Page 235: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 235

1. Copy the following AliEn files to your local $HOME/AliEn/Interactive/ESD: /alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/ESD/runESDAnalysis.C and /alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/ESD/demoInteractive.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/ESD file:/home/trn2301/AliEn/Interactive

2. You should also get the ESD.par, ANALYSIS.par, AliAnalysisTaskPt.h and AliAnalysisTaskPt.cxx from the directory of the previous exercise (you already have them locally). [bash]$ cp $HOME/trn2301/AliEn/Local/ESD/AliAnalysisTaskPt.* $HOME/trn2301/AliEn/Interactive/ESD/[bash]$ cp $HOME/trn2301/AliEn/Local/ESD/*.par $HOME/trn2301/AliEn/Interactive/ESD/

3. Go to your local $HOME/AliEn/Interactive/ESD directory and open the demoInteractive.C file. Change the line where you define the tag collection and put the name of the file you created by querying the f.c (it should be tag.xml).TagAna->ChainGRIDTags(“tag.xml”)

4.Run the runESDAnalysis.C macro with alienroot – Impose some selection criteria and rerun the example.[bash]$ alienroot runESDAnalysis.C

Interactive analysis – Try it out I

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 236: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 236

5. Copy the following AliEn files to your local $HOME/AliEn/Interactive/Kine:/alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/Kine/runKineAnalysis.C and/alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/Kine/demoInteractive.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/INTERACTIVE/Kine file:/home/trn2301/AliEn/Interactive

6. You should also get the AliAnalysisTaskRLPt.h and AliAnalysisTaskRLPt.cxx from the directory of the previous exercise (you already have them locally). [bash]$ cp $HOME/trn2301/AliEn/Local/Kine/AliAnalysisTaskPtRL.* $HOME/trn2301/AliEn/Interactive/Kine/

7. Go to your local $HOME/AliEn/Interactive/Kine directory and open the demoInteractive.C file. Change the line where you define the tag collection and put the name of the file you created by querying the f.c (it should be tag.xml).TagAna->ChainGRIDTags(“tag.xml”)

8. Run the runKineAnalysis.C macro with alienaliroot – Impose some selection criteria and rerun the example.[bash]$ alienroot runESDAnalysis.C

Interactive analysis – Try it out II

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 237: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 237

1. Copy the following AliEn files to your local $HOME/AliEn/Batch:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/tag.xml - ESD.par - runXML.C - CreateXML.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/tag.xml file:/home/trn2301/AliEn/BATCH[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par file:/home/trn2301/AliEn/BATCH[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runXML.C file:/home/trn2301/AliEn/BATCH[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/CreateXML.C file:/home/trn2301/AliEn/BATCH

2. Go to your local working directory and run the runXML.C macro with alienroot to create the xml collection.[aliensh]$ exit[bash]$ alienroot -b -q runXML.C

Batch analysis – Try it out I

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 238: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 238

3. Copy the local file global.xml that we just created to your AliEn $HOME/Tutorial/ESD.[aliensh]$ cp file:/home/trn2301/AliEn/BATCH/global.xml Tutorial/ESD/global.xml

4. Copy the following AliEn files to your AliEn $HOME/Tutorial/ESD:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par-ANALYSIS.par-AliAnalysisTaskPt.h-AliAnalysisTaskPt.cxx-runESDAnalysis.C-demoESDBatch.C-analysisESD.jdl[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par Tutorial/ESD/ESD.par[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ANALYSIS.par Tutorial/ESD/ANALYSIS.par[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.h Tutorial/ESD/AliAnalysisTaskPt.h[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.cxx Tutorial/ESD/AliAnalysisTaskPt.cxx[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runESDAnalysis.C Tutorial/ESD/runESDAnalysis.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/demoBatch.C Tutorial/ESD/demoBatch.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/analysisESD.jdl Tutorial/ESD/analysisESD.jdl

Batch analysis – Try it out II

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 239: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 239

5. Copy the following AliEn files to your AliEn $HOME/bin: /alice/cern.ch/user/p/pchrist/bin/root.sh[aliensh]$ cp /alice/cern.ch/user/p/pchrist/bin/root.sh $HOME/bin/root.sh

6. While being in the AliEn shell, edit the analysisESD.jdl and modify the InputFile, InputDataCollection, InputDataListFormat and OutputDir fields.[aliensh]$ edit analysisESD.jdl

7. Once finished, submit your batch job.[aliensh]$ submit analysisESD.jdl

Batch analysis – Try it out III

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 240: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 240

8. Copy the following AliEn files to your AliEn $HOME/Tutorial/Kine:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskRLPt.h-AliAnalysisTaskRLPt.cxx-runKineAnalysis.C-demoKineBatch.C-analysisKine.jdl[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPtRL.h Tutorial/ESD/AliAnalysisTaskRLPt.h[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskRLPt.cxx Tutorial/ESD/AliAnalysisTaskRLPt.cxx[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runKineAnalysis.C Tutorial/ESD/runKineAnalysis.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/demoKineBatch.C Tutorial/ESD/demoKineBatch.C[aliensh]$ cp /alice/cern.ch/user/p/pchrist/Tutorial/BATCH/analysisKine.jdl Tutorial/ESD/analysisKine.jdl

9. Copy the following AliEn files to your AliEn $HOME/bin: /alice/cern.ch/user/p/pchrist/bin/aliroot.sh[aliensh]$ cp /alice/cern.ch/user/p/pchrist/bin/aliroot.sh $HOME/bin/aliroot.sh

10. Edit the analysisKine.jdl and modify the InputFile, InputDataCollection, InputDataListFormat and OutputDir fields.[aliensh]$ edit analysisKine.jdl

11. Once finished, submit your batch job.[aliensh]$ lubmit analysisKine.jdl

Batch analysis – Try it out IV

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file

Page 241: ALICE Offline Tutorial F.Carminati, P.Christakoglou, J.F.Grosse-Oetringhaus, P.Hristov, M.Meoni, A.Peters, P.Saiz June 11, 2007 – v1.4b.

June 11, 2007 241

12. Once the job is finished, merge the output and store it locally as Pt.Merged.root

[bash]$ alienroot[root] [0] .L histomerge.C[root] [1] histomerge(“/alice/cern.ch/user/t/trn2301/Tutorial/ESD/output/*”,”root_archive.zip”,”Pt.Merged.root”)

Batch analysis – Try it out V

[bash]$ --> Your local bash shell[aliensh]$ --> Your alien bash shellNo notation --> inside a file