# Presentation: 091673

## The FreeHEP Java Libraryhttp://java.freehep.org

- ACAT 2000
- Fermilab – October 2000

**Mark Donszelmann, Julius Hrivnac** – CERN
**Gary Bower, Tony Johnson, Joseph Perl** - SLAC
**Charles Loomis** – UC Santa Cruz

## What is Freehep library

- Started as a convergence of
- WIRED
- Java Analysis Studio (JAS)
- A common base library
- minimize unnecessary duplication of work
- maximize code reuse
- Soon realized many others working on Java
- Now have contributions from
- Atlas, Babar and US Linear Collider Detector (LCD)
- Others welcome to contribute
- Today - a library of HEP-wide Java software
- Some very HEP specific (c.f. CLHEP)
- Some general purpose utilities

## Goals

- Open source
- All code and documentation in CVS, web browsable
- All code licensed under LGPL to make it freely reusable
- Preview area for partly-baked ideas
- Minimal interdependence between packages
- Take what you like, leave what you don’t.
- Pure Java where possible
- We include some C++ code
- In particular tools for helping Java and C++ to co-exist

## Why Java?

- We enjoy writing Java code
- OO, highly portable
- Maximizes programmer effectiveness
- No need to deal with memory leaks, core dumps, corrupted pointers
- Frees developer to concentrate on clean OO design
- Java makes code reuse easy
- Use interfaces to separate interfaces and implementation
- Can support >1 implementation of same functionality
- No problem with incompatible base libraries

## Isn’t Java too slow?

- No!
- Huge advances have been made in last 4 years
- Dynamic code optimization
- Optimizes code **while it is running**
- Java now gives average of 60% of C++ performance
- Java performance continues to improve
- Static optimization (C++) is mature – no improvement expected

## What does it contain?

- Non-HEP specific
**2D Vector Graphics** – generates .eps, .svg, ...
**Studio – Hep Studio**
**JACO **– Java access to C++ Objects
- Jneeds – java package dependency
- HEP specific
**hep.physics** package
- 3-vector, 4-vector’s and utilities
- Jet Finding, Event Shape routines
- Diagnostic Event Generator
**Yappi** – XML Particle Property Database
**hep.io** – STDHEP, Root
**AIDA interface**
**HepRep**
**HEP3D**

## 2D Graphics Package

- Java contains machine independent graphics
- Advanced 2D graphics
- Built-in support for printing
- Freehep 2D graphics adds support for
- Saving graphics in vector graphics format
- Encapsulated Postscript (eps)
- Clean output – can be hand edited if necessary
- Scalable vector graphics (svg)
- Easily extensible for other vector graphics formats
- General graphics export
- Supports vector and pixel graphics (GIF, JPG, PNG)
- Easily extensible for other formats (e.g. XML)

## (HEP) Studio

- Studio
- Common Base GUI for JAS + Wired + ...
- XML Menus
- Command Dispatch mechanism
- Plugin Architecture
- Flexible MDI type GUI
- Save/Restore state via XML
- HEP Studio
- Adds event access
- Random or Sequential
- Remote or Local

## JACO (Java Access to C++ Objects)

- Interoperability of Java and C++ is certainly possible
- But tedious
- Code must be written for each method
- Need to deal with starting JavaVM
- Need to deal with object lifetimes
- JACO – Aims to solve this
- Automatic generation of glue code
- Small library to deal with details
- Aimed at Event Display and Event Analysis

- .hh files

- RTTI

- Parser

- Code Generator

- .java

- .hh

- .cc

- Runtime Library

## hep.physics

- 3-vectors, 4-vectors, utilities
- Interface and basic implementation
- Event Shape utilities
- Jet finder framework
- Supports many different algorithms
- User extensible
- Diagnostic Event Generator
- Framework for event generation
- Can support Java or Fortran/C++ generators

## YaPPi

**Java API for accessing particle properties**
- Full API for access to all data
- Particle Property Provider
- Simpler interface suitable for analysis and MC programs
**XML format for storing**
- Particle Properties, Decay Modes and Branching Ratios
- Supports all data from PDG book
- Numeric and non-numeric data
- Allows one of more XML files to be merged
- Supports user-supplied XML files
**Utilities**
- Perl(!) script for parsing PDG postscript files
- Generates XML files for entire book (in progress)
- Servlet to publish data via Web

## HEP IO

- Uses:
- Event Display, Analysis tools, Event Generators
- StdHep
- Complete implementation of basic StdHEP IO
- Interoperable with Fortran/C implementation
- Supports reading and writing
- Root IO
- Initial implementation read-only
- Supports (de)compression, random access, StreamerInfo
- Support for reading TTree’s not yet complete
- Goal is complete read/write access to Root IO
- Including Trees, Automatic splits, pointer following etc.

## AIDA

- AIDA = Abstract Interface for Data Analysis
- Isolates analysis/reconstruction program from histogram package
- Can change from one package to another without changing code.
- FreeHEP contains
- Java AIDA interface specification
- Java reference implementation
- C++  Java mapping

- Java
- Program

- A
- I
- D
- A

- Java AIDA
- Implementation

- C++
- Program

- A
- I
- D
- A

- C++ AIDA
- Implementation

- Java AIDA
- Implementation

- C++
- Program

- A
- I
- D
- A

- A
- I
- D
- A

- C++ -> Java

## HepRep

- Experiment independent graphics representables
- Can be moved from server to client
- File access, Direct or Client-Server mode:
- XML, JHepRep, RMI, or CORBA.
- Easy to add new representations for Event Display
- Allows experiment independent Event Display client
- Can be mapped to different displays
- EG Wired, Java 3D
- JHepRep/C++ interface allows HepRep’s to be created from C++
- Geant 4 interface

## HEP3D

- Java 3D Primitives for Geant4 volumes
- G4Box
- G4Cons
- G4Para
- G4Polycone
- G4Polyhedra
- G4Sphere
- G4Trap
- G4Trd
- G4Tubs
- Support for switching between wireframe and solid shapes

## Future Possibilities?

- ZVTOP – Topological vertex finding
- Being worked on by Wolfgang Walkowiak
- TRF++ - general purpose tracking package
- Being worked on by Norm Graf
- Other reusable reconstruction algorithms
- Clustering
- Kalman Filter
- General purpose fitting framework
- General purpose plotter

## More Info?

- How do I get it?
- _[http://java.freehep.org](http://java.freehep.org/)_
- All source code is in CVS
- Browse it on the web, or download with your favorite CVS client
- All software distributed under Lesser GNU Public License  (LGPL)
- Manuals
- Automatically generated documentation (javadoc)
- Updated every 15 minutes
- Pre-built libraries (jar files)
- How can I contribute
- Contact any of the authors or e-mail
- _[developers@](mailto:developers@freehep.org)__[freehep](mailto:developers@freehep.org)__[.org](mailto:developers@freehep.org)_

## Conclusion

- Warning!
- Different sections of library are in different stages of completion
- Some packages have been in use for some time
- Some are still under development
- Try it, give us feedback
- Don’t waste time with
- Core dumps
- Memory leaks
- Subtle debugging problems
- Join the HENP Java revolution!