LCIO Persistency and Data Model for LC Simulation and Reconstruction

32
LCIO Persistency and Data Model for LC Simulation and Reconstruction LCWS 2004, Paris Simulation, April 20 th 2004 Frank Gaede DESY -IT-

description

LCIO Persistency and Data Model for LC Simulation and Reconstruction. LCWS 2004, Paris Simulation, April 20 th 2004 Frank Gaede DESY -IT-. Outline. Introduction/Motivation Implementation Data model Status Examples Summary. Introduction. - PowerPoint PPT Presentation

Transcript of LCIO Persistency and Data Model for LC Simulation and Reconstruction

Page 1: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCIO Persistency and Data

Model for LC Simulation and Reconstruction

LCWS 2004, ParisSimulation, April 20th 2004

Frank Gaede DESY -IT-

Page 2: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 2

Outline

• Introduction/Motivation

• Implementation

• Data model

• Status

• Examples

• Summary

Page 3: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 3

Introduction

• at 3rd ECFA workshop in Prague decided to have Data format/persistency task force:

“Define an abstract object persistency layer and a data model for linear collider simulation studies until the Amsterdam workshop.”

• -> LCIO – Linear Collider Input/Output• DESY/SLAC/LLR joined project• design of data model and software first introduced at

the 4th ECFA workshop in Amsterdam • since Montpellier production version 1.0 (simulation

only) • now v1.1beta released (incl. reconstruction)

Page 4: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 4

Motivation for LCIO

Generator

geometry

AnalysisRecon-

structionSimulation

Java, C++, FortranGeant3, Geant4

Java, C++, FortranJava, C++, Fortran

LCIO Persistency Framework

Page 5: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 5

Requirements

• need Java, C++ and f77 (!) implementation

• extendable data model for current and future simulation studies

• user code separated from concrete data format• -> want to be flexible for future decisions on

persistency

• needed a.s.a.p. -> keep it simple (lightweight)• no dependence on other frameworks

Page 6: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 6

LCIO persistency framework

data model

LCIO

contents

data format persistency

data handlingAPI implementation

Page 7: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 7

Data Format (persistency): SIO

• SIO: Simple Input Output

• developed at SLAC for NLC simulation

• already used in hep.lcd framework

• features:• on the fly data compression • some OO capabilities, e.g. pointers • C++ and Java implementation available • no direct access -> use fast skip

Page 8: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 8

LCIO SW-Architecture

*.slcio files (SIO)

common API

LCIOC++ implementation

LCIOJava implementation

Java API C++ API f77 API

JAS/AIDA root hbook

compressed records,pointer retrieval

generated fromone sourceusing AID

Page 9: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 9

C++ and f77 example code

plus additional methods in f77 for user convenience, e.g.

HEPEvt <-> LCIOconversion

Page 10: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 10

Implementation - Design

abstract event abstract io

concrete classes

persistency implementation

Page 11: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 11

Data Model I

Page 12: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 12

Data Model II

Page 13: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 13

Data Model III

Page 14: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 14

Data Model IV

Page 15: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 15

Data Model V

Page 16: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 16

LCIO for Transient Data

• The LCEvent can be used as container for transient data in an application, e.g. reconstruction

• Application will call list of modules that read existing collections from the LCEvent and add resulting new Collections

• LCIO has (Event/Run)-Listener classes that can serve as base classes for modules

• LCIO defines a simple application framework -> see example lcioframe provided in

release

Page 17: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 17

Example LCEvent

Page 18: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 18

LCIO Status I

• production version 1.0 (09/2003)• C++, Java, f77 complete for simulation data

• and generator data ( HEPEvt<->LCIO )

• simple example code for all languages• ‘real world’ examples (JAS3, root, hbook)• documentation

• users manual• API documentation HTML (javadoc, doxygen)

• available for download via CVS• linux (gcc), windows (cygwin)

• schema evolution from now on (reading old files)

Page 19: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 19

LCIO Status II

• new beta release v1.1beta:• includes C++ implementation for reconstruction

data (Track, Cluster, ReconstructedParticle)

• Java and f77 soon to come

• added optional use of CLHEP four vectors:• Handler classes for MCParticle/ReconstructedParticles

that can be used as 4vectors and LCIO Objects

• reading of a list of files (chain)• simplified API structure (one level of inheritance less)

• not for production use yet ! -> user feedback welcome

Page 20: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 20

LCIO on the web

• LCIO homepage: http://lcio.desy.de• downloads and documentation

• LCIO forum at: http://forum.linearcollider.org• user/developer questions and comments

• discussions on new developments

• LCIO bug reports at: http://bugs.freehep.org• bug report and new feature requests

Page 21: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 21

Javadoc example

Page 22: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 22

Doxygen example

Page 23: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 23

LCIO Customers/Users

• Mokka simulation (see talk)

• Brahms reconstruction (see talk)

• JAS3• provides convenient file browser• will have LCIO-WIRED plugin -> generic event display !

• Calorimeter group ( DESY )• has MiniCal raw data converted to LCIO files• to be used also for Hcal physics prototype

• TPC groups (DESY & LBNL?)• will use LCIO for prototype

• Lelaps fast Monte Carlo• hep.lcd reconstruction • other groups looking into using LCIO

Page 24: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 24

JAS3 – LCIO file browser

http://jas.freehep.org/jas3/index.html

Page 25: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 25

LCIO Future developments

• reconstruction data model• refine some details• Java and f77 implementation soon

• add convenient methods and tools • analyzing the MCParticle tree (graph)

• iterators for MCParticles, e.g. all stable/final particles • analyzing parent/daughter relationships

• adding convenience iterators for LCIO types• simplify complex C++ syntax with dynamic_casts etc.

• add possibility to store generic user data • calibration constants etc.• discussion ongoing about implementation (not so

easy)• respond to user requests

Page 26: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 26

Summary

• LCIO, persistency and datamodel for the LC:• Java, C++ and f77 user interface

• Java and C++ implementation

• data model for simulation, (prototype) data and reconstruction

-> persistent and transient

• production version v1.0

• new beta version released (v1.1beta)

• used by several groups and tools• others invited to join !

• see LCIO homepage for more:

http://lcio.desy.de

Page 27: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 27

Appendix

• Extension slides, details, examples

Page 28: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 28

Data entities UML

Page 29: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 29

Example code: reading events

LCReader* lcReader = LCFactory::getInstance()->createLCReader() ; try{ lcReader->open( "myFile" ) ; LCEvent *myEvt ; while( 1){ try{ myEvt =cReader->readNextEvent() ) ; }catch(EndOfDataException) { break ;} cout << " Evt : " << myEvt->getEventNumber() << " - " << myEvt->getRunNumber()

<< ": " << myEvt->getDetectorName() << endl ;

} lcReader->close() ; }catch(IOException& e){ cout << e.what() << endl ; }

Page 30: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 30

Example code: reading collections

…LCEvent *evt ; while( 1){ try{ evt =lcReader->readNextEvent() ) ; }catch(EndOfDataException) { break ;} const LCCollection*col ; try{ col = evt->getCollection( “EcalHits”); int nHits = col->getNumberOfElements() ; for( int i=0 ; i< nHits ; i++ ){ const CalorimeterHit* hit =

dynamic_cast<const CalorimeterHit*> ( col->getElementAt( i ) ) ; const float* x = hit->getPosition() ; cout << “x: " << x[0] << ", " << x[1] << ", " << x[2] << " energy: " << hit->getEnergy() << endl ; }catch(DataNotAvailableException){ cout << “collection not found: EcalHits “ << endl ; } }…

Page 31: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 31

Example code : writing data (events)

LCWriter* lcWrt = LCFactory::getInstance()->createLCWriter() ;

try{ lcWriter->open( "myFile" ) ; for( int i=0; i<NEVENT; i++ ){ LCEventImpl* evt = new LCEventImpl() ; evt->setRunNumber( rn ) ; evt->setEventNumber( i ) ; // add collections ... lcWrt->writeEvent( evt ) ; delete evt ; // C++ only :) } lcWriter->close() ; }catch(IOException& e) { cout << e.what() << endl ; }

Page 32: LCIO Persistency and Data Model for LC Simulation and Reconstruction

LCWS 2004, Paris 20.04.2004 Simulation

Frank Gaede, DESY -IT- 32

Data model - Design

user extensions, e.g.calibration constants

simulationoutput

Prototype Data