freehep java library mark dönszelmann, slac chep, la jolla, 24-28 march 2003

28
FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Upload: annabella-bridges

Post on 27-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

FreeHEP Java Library

Mark Dönszelmann, SLACCHEP, La Jolla, 24-28 March 2003

Page 2: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 2

FreeHEPJava Library

Content

The FreeHEP Java Library Components and Tools for Java

"Will talk about a small sample of components“

General Components Application Framework VectorGraphics AID - Abstract Interface Definition compiler

HEP Component HEPIO – Java RootIO

Page 3: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 3

FreeHEPJava Library

Tools and Components for Java

Started as a convergence of WIRED Java Analysis Studio (JAS)

A common base library minimize unnecessary duplication of work maximize code reuse

Contents is a library of HEP-wide Java software Some very HEP specific (c.f. CLHEP) Some general purpose components and tools

Open source All code and documentation in CVS, web browsable All code licensed under LGPL to make it freely reusable

Minimal interdependence between packages Take what you like, leave what you don’t.

Pure Java where possible We include some C++ code for wrappers to make components available to C++

Now have contributions from Atlas, Babar, IceCube, US Linear Collider Detector (LCD) Others welcome to contribute

Page 4: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 4

FreeHEPJava Library

HEP Specific Components

Physics package 3-vector, 4-vector’s and utilities Jet Finding, Event Shape

routines Diagnostic Event Generator

HEP IO Access to a number of common

HEP formats: StdHEP MCFIO HBook Root

HEP3D Extensions to Java3D specific

for Geant4

YaPPI – Yet another Particle Property Interface

XML Particle Property Database

AIDA - Abstract Interfaces for Data Analysis

Interfaces and JAIDA - Java reference implementation

AIDAJNI – C++ wrapper around AIDA

More on this in Max Turri’s talk on Tuesday

HepRep - HEP Representables for Event Display

Interfaces and JHepRep - Java reference implementation

HepRepJNI – C++ wrapper around HepRep

see several other talks and posters

Future Plot Widget (JAS)

Page 5: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 5

FreeHEPJava Library

General Components

Application Framework General framework for Java

applications using plugin and service technology.

AID – Abstract Interface Definition

Compiler to make C++ headers and Java Interfaces from aid files.

Graphics3D Non-Java3D implementation of

3D graphics, for WIRED.FreeHEP IO

Extensions to the JavaIO system to handle specific encodings, ASCII85, …

PSViewer PostScript Viewer to embed

viewing of EPS in applications, or for previews.

Swing ExtensionsFreeHEP Tools

JNeeds – java package dependency

Ant – extensions to the build system

VectorGraphics Low level Input and Output of

binary vector graphics formats (CGM, EMF, PDF, SVG)

Vector output files, extension to Java2D

XML XMLIO – classes to store/restore

state of an applicationFuture

RecordLoop/EventLoop (IceCube)

and more…

Page 6: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 6

FreeHEPJava Library

Infrastructure

CVS for the repository

ant (from apache.org) for building the java parts and the distributions

gmake for building the C and C++ parts

JUnit for Unit testing

Java WebStart for application distribution

Page 7: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

FreeHEP Application Framework

General Application Framework for Java

Page 8: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 8

FreeHEPJava Library

Application Framework

Framework to build Java Applications, which contains: a Plugin facility

to add extra Modules a Services facility

to publish and look up information of other modules a MenuBuilder

XML for Menu and Popup Menu definitions Callbacks to user methods

a Command Dispatcher to route GUI commands, disable and enable them

a Save/Restore facility to handle saving and restoring of the application’s state via XMLIO

Can be run from WebStartUsers:

JAS, WIRED and Demo Applications (available via Webstart)

Page 9: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 9

FreeHEPJava Library

Application Framework DemosJava3D Lego Plot Demo

Vector GraphicsExport Demo Icon Browser

Page 10: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

FreeHEP Vector Graphics

Export System for Vector Graphics in Java

Page 11: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 11

FreeHEPJava Library

VectorGraphics

Adds Graphics Export functionality in the following Formats: Bitmap: GIF, JPEG, PNG and PPM Vector: CGM, EMF, PDF, PostScript/EPS, SVG, and SWF Easily extendible for new formats Different from Printing in Java which is machine dependent

Unique API, extended from java.awt.Graphics2D which adds: Double precision drawing of primitives Fast drawing of markers Handling of Colors for Screen and Printing in color, grayscale and black and

whiteCopy & Paste:

EMF (Win32) and PDF (MacOS X)Standard Export DialogUtility classes for:

Fonts inclusion or embedding (PS and PDF) “path” (line and curve) handling

Users: JAS, WIRED

and many outside usersJava IO streams

FreeHEP IO streams

FreeHEP Graphics IOlow-level formatting

(CGM, EMF, PDF and SWF)

FreeHEP VectorGraphics

FreeHEPExportDialog

Java Graphics2D

Page 12: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 12

FreeHEPJava Library

VectorGraphics Examples

0 10 20 30 40 50 60 70 80 90 1000

1,000

2,000

3,000

4,000

5,000

6,000

7,000

8,000

9,000

10,000

11,000

12,000

Data - pawdemo.hbook - MULTIPLICITY - WEIGHTED

Page 13: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 13

FreeHEPJava Library

VectorGraphics Classes

ImageGraphicsIO

Graphics2D

VectorGraphics

Graphics

VectorGraphicsConstants

AbstractVectorGraphics

PixelGraphics2D

AbstractVectorGraphicsIO

VectorGraphicsIO

GIFGraphics2DJPGGraphics2D

PPMGraphics2DPNGGraphics2D

CGMGraphics2DEMFGraphics2D

PDFGraphics2DPSGraphics2D

SVGGraphics2DSWFGraphics2D

java.awt

individual packages

org.freehep.graphicsio

org.freehep.graphics2d

MultiPageDocument

Page 14: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 14

FreeHEPJava Library

VectorGraphics Path Classes

org.freehep.graphicsio.font

org.freehep.graphicsio

individual packages

QuadToCubicPathConstructor

CubicToQuadPathConstructor

AbstractPathConstructor

PathConstructor

CGMPathConstructor

PolylinePathConstructorCharStringEncoder

EMFPathConstructorPSPathConstructor

PDFPathConstructor SWFPathConstructor

CubicToLinePathConstructor

Page 15: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 15

FreeHEPJava Library

VectorGraphics Font Classes

PSFontTable

PDFFontTable

FontTable

PSFontEmbedder

PDFFontEmbedderType1

PDFFontEmbedderType3

PDFFontEmbedder

FontEmbedderType1

FontEmbedder

PDFFontIncluder

FontIncluder

individual packages

org.freehep.graphicsio.font

Page 16: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

FreeHEP AID

Abstract Interface Definition

One source for the Interface for C++ and Java

Page 17: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 17

FreeHEPJava Library

AID-Abstract Interface Definition

Tool to translate language independent Interface definitions into Interfaces of a number target languages (C++, Java)

Unique source for Abstract Interface Definition Support for usage of Parameterized Types (templates) Preservation of Comments

User/Developer sees definition file in his own (C++, Java) languageAID language

looks like Java with C++ markup (&, *, <>) Property Configuration files define:

AID type mapping to target type AID value mapping to target value Target type to include / import statement

AID Generator (in Java) extendible for other target languages (Python?)Could write Generator to attach to Java/C++ glue systems such as JACEUsers:

AIDA, HepRep and LCIO (linear collider)

Page 18: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 18

FreeHEPJava Library

AID System

*.aidSource

Files

AID Compiler

*.hC++

HeaderFiles

*.javaJava

Interfaces

*.propertiesConfiguration

Files*.java

AbstractJava

Classes

CPPHeaderGenerator

JavaInterfaceGenerator

JavaClassGenerator

AID System

Page 19: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 19

FreeHEPJava Library

AID Compiler

AID Compiler

AIDParser.jjAID Language

Definition

JavaCC Compiler

AIDParser

1

RTTIRunTime Type Info

*.aidSource

Files

CPPHeaderGenerator

JavaInterfaceGenerator

JavaClassGenerator

*.hC++

HeaderFiles

Page 20: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 20

FreeHEPJava Library

AID RTTI – RunTime Type Info

RTTI

IClass

IConstructor

IDestructor

INamedType

n

1

n

n

nn

1

n

params

paramtype

returntype

fieldtype

template

1

next1

IField

IMethod

params

IType

org.freehep.jaco.rtti

Page 21: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

FreeHEP Java Root IO

Reader for RootIO in Java

Page 22: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 22

FreeHEPJava Library

Java RootIO: Goals and Usage

Features Pure Java package for reading Root Files

Could be extended to writing later Should work with any Root file Should not need to know about objects ahead of reading

(no need for dll’s, .so files etc.) Provide access to data, not C++ methods

Much of root functionality duplicates functionality already available in Java, so data is more useful than methods

Easy to use

Possible Usage Accessing Root data from Java Event Displays and Analysis Tools

WIRED, JAIDA, JAS3 Accessing Root data from Java Servlets, Server Pages (JSP) and

Applets. Using Root for scripting languages such as Jython, Pnuts, Beanshell

etc. More on these in Tony Johnson’s JAS talk on Tuesday.

Page 23: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 23

FreeHEPJava Library

Java RootIO: Implementation

Implementation Uses “streamer info” objects inside Root files (since Root 3.0) to

decode contents of file Dynamically generates Java proxies for each Root object read Each proxy has custom “streamer”

Build as Java bytecode using BCEL (http://jakarta.apache.org/bcel) Converted at runtime to machine code by Just-in-Time compiler &

HotSpot Includes tool to generate Java interfaces from Root file

Allows Java code to be compiled against custom user objects in file

Performance Now uses java.nio package (new since Java 1.4)

Designed to support efficient binary IO Dynamic proxies much better performance than earlier Java Root IO

release Faster than equivalent Root-CInt program, comparable to compiled

C++

Page 24: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 24

FreeHEPJava Library

Java Root IO - Benchmark

1.4GHz AMD Athlon, Windows XP, 512MByte DDR, ATA100 disk..S= Split level = 0,1,2C= Compression = 0,1Each test run 5 times in succession, lines show range in results

in later runs file is typically cached in memory == faster if task IO limited

Task: Loop over all events, loop over all tracks, sum px for all tracks. 5000 event files created with “event” test program distributed with Root.

Red = CINT Green = CINT (coded for split) Black = Java

Java Root Benchmark

0

2

4

6

8

10

12

14

16

18

c=0,

s=

0

c=0,

s=

1

c=0,

s=

2

c=1,

s=

0

c=1,

s=

1

c=1,

s=

2

mS

/eve

nt

Page 25: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 25

FreeHEPJava Library

JAS and Java RootIO

Page 26: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 26

FreeHEPJava Library

Java RootIO ExamplesGLAST

Histogram Servlet

RootIOHistogram Browser

RootIOObject Browser

Page 27: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 27

FreeHEPJava Library

Summary and Acknowledgements

FreeHEP Java Library Library with HEP and

non-HEP components Actively in use by

several projects

New (revamped) web site see next slide

Authors Gary Bower (SLAC) Julius Hrivnac (LAL) Tony Johnson (SLAC) Charles Loomis (LAL) Joseph Perl (SLAC) Victor V. Serbo (SLAC) Massimiliano Turri

(SLAC)

and others…

Page 28: FreeHEP Java Library Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003

Mark Dönszelmann, SLAC CHEP, La Jolla, 24-28 March 2003 28

FreeHEPJava Library

References

FreeHEP Java Libraries - http://java.freehep.org AID JAIDA AIDAJNI RootIO VectorGraphics …

JAS – Java Analysis Studio - http://jas.freehep.orgWIRED – http://wired.freehep.orgAIDA – http://aida.freehep.orgHepRep – http://heprep.freehep.orgFreeHEP - http://www.freehep.org

Come and see the other FreeHEP related talks.