# Presentation: 177034

## Java Analysis Studio and the Java Framework for Future Linear Colliders.

- CERN  - January 13th 1998
- Tony Johnson - SLAC
- tony_johnson@slac.stanford.edu

## Contents

- Introduction to Java
- Pro’s and Con’s of Java for HEP
- Java Framework for LC Detector studies
- Java Analysis Studio
- Features
- Beta Release Information
- Demo
- Future
- Opportunities for Collaboration
- Conclusion

## What is Java?

- History
- Originally designed (1991) as a small language for consumer electronics (cable boxes, toasters *etc.*)
- Eventually (1994) HotJava Browser appeared, which allowed Java Applets to appear in web pages.
- Adopted by Netscape, Microsoft, Sun etc. as Web Programming Language.
- More than just a Web Tool
- Java is a fully functional, platform independent, object oriented programming language + powerful set of machine independent libraries, including GUI libraries.

- Compiler

- Mac

- Unix

- PC

- Bytecode
- Interpreter

- JIT
- Compiler

- Machine Code

## Totally Buzzword Compliant

- Simple
- well, simpler than C++
- Object Orientated
- more so than C++
- Distributed
- Built in support for Internet protocols, URL’s, HTTP, Remote Method Invocation, DB access *etc.*
- Robust
- “Impossible” to create memory leaks, go beyond the end of an array, corrupt stack or code
- Secure
- Bytecode “verifier”, padded cell

- Architecture Neural, Portable
- Runs on PC, MAC, Unix, VMS
- Interpreted
- “Compiler” converts code into machine independent “bytecodes”
- High Performance
- With JIT compiler still 2-3 times slower than native C++, but...
- Multithreaded
- Language has direct support for writing multithreaded applications
- Dynamic
- Libraries can change without recompiling programs that use them

## Why Java for HEP Computing?

- Highly Portable
- Java works today on NT, Win95/8, Unix, Mac,  VMS etc.
- Programs written in Java are very portable
- care needed for browsers, AWT
- Fast
- Within factor of 3 of compiled C++ code today, getting faster.
- Bottlenecks may be elsewhere anyway (IO, GUI, Geant, Physicist).
- Very fast turnaround time (compilation, dynamic loading)

- Simple to Learn
- More object oriented than C++
- Without all the tricky bits
- Memory management
- No pointers
- No backwards compatibility
- Spend time designing program + solving physics problems, not working around language problems
- Programs written in Java much more likely to work as intended.
- Much easier to debug if they don’t

## Why Java for HEP Computing?

- Previous generation of experiments used Fortran + Data Management System (== Jazelle, Zebra, BOS)
- Solves Three Problems
- Ability to Represent Complex Data Structures
- Persistence (i.e. read in and write out complex structures)
- Run time access to named data in structures (for analysis)

- Now time has marched on and modern experiments use C++
- Represent Complex Data
- Persistence
- Run time access to data
- Still need to build (or buy and deploy) data management system (e.g. Root, Objectivity)
- Java
- Represent Complex Data
- Persistence (serialization)
- Run time access to data (reflection)
- support built-in to language

## Why Java for HEP computing?

- Java is more than a language
- very large set of standard libraries (API’s)
- Distributed computing, networking, CORBA, RMI
- Graphics, 2D and 3D, GUI’s
- Collections, Hash tables, Maps, Vectors
- IO, Compression, Encryption
- Security, sand-box
- Wide industry support
- Databases, oracle, objectivity
- Tools, IDE’s, Debugger’s, Optimizer’s, UML tools

## Why Java for HEP Computing?

- Built-in support for distributed computing and Networking
- take code to data
- Download JAVA analysis “agents” into remote server
- flexible built-in padded cell protects server  from analysis modules
- Rather than move all the data to Remote institute, transparently move code to data
- possible to have distributed farm of processors analyzing data
- Give user impression code is running locally

## Why not Java for HEP computing?

- No operator overloading
- Annoying for complex numbers, matrices, 4-vectors
- Perhaps more often abused than sensibly used
- Floating point performance
- Requirement for identical results can be a problem
- Being addressed by Java Grande Forum + Sun
- http://www.javagrande.org/
- Bugs sometimes slow to be fixed
- Printing, Imaging existed for >1 year
- Perhaps “Community Source License”  will help
- Little control over Memory Allocation
- Integration with C++ could be better

## Where would HEP use Java?

- GUI systems
- online + control
- offline (event display)
- Data Analysis tasks
- Offline
- Online
- Reconstruction packages?
- Generators

## Java for Linear Collider Detector Studies

- Dual Goals:
- Contribute to Linear Collider Detector/Physics Studies in US
- Experiment with using Java for full offline reconstruction and analysis package

## LC Detector studies in US 

- Goals:
- Detailed Study  of physics signals in a variety of possible LC Detectors.
- Reference Small and Large detectors
- 3 year study
- Start with simulation studies
- Preliminary results by Barcelona meeting in May
- Move on to detector R&D
- Full simulation with GISMO
- Switch to Geant4, now released
- Analysis using Paw, Root, JAS

## Java package hep.lcd ?

- hep.lcd a Java framework for rapid development of
- Fast simulation tools
- Reconstruction (Clustering and Track Finding)
- Analysis algorithms
- Built-in event display, histograming and diagnostic tools.
- Flexible architecture for adding new detector geometries and architectures.
- Can be run inside JAS or standalone

## hep.lcd current status

- Reconstruction
- Track finder written, track fitter in progress
- Several clustering algorithms
- Parameterized MC
- Can read generator input or Gismo output
- Track and Cluster smearing
- Analysis Utilities
- Thrust calculator  (Lund)
- Jet finder [Durham]

- Framework
- Processor + Driver system
- interactively control
- which processors called
-  debugging/histogramming
- Parameter  (Constant] access
- driven by detector geometry
- IO system based on Java IO
- random access  files
- Histograming - built in to JAS
- Event Display

## hep.lcd framework

## Event Display

## Event Display

## Event Display

## Event Display

## Is Java fast Enough for HEP offline?

- Current (266Mhz PII, JDK 1.1.7)
- Clustering .6 secs/event
- 13.5 Million Calorimeter Cells
- Fast MC 5-50ms/event
- Track Finding <2secs/event
- Getting better!!!
- JDK 1.2
-  HotSpot - Run-time optimization
- In real life may be faster than C++ (c.f. Babar)
- Better, cheaper analysis tools
- Manageable complexity

## Java Analysis Studio

- Experiment independent analysis tool for High Energy Physics data

## What is Java Analysis Studio?

- HEP Data Analysis Application
- Easy to use + powerful GUI
- Support Analysis Modules written in Java
- Experiment and Data Format Independent
- Supports n-tuple or Structured (object) Data
- Data Location Independent (Local or Remote)
- Extensible (via Plug-ins and Data Interface Modules (DIMS))
- Web + Internet compatible
- Combination of custom and Commercial components (but no runtime license fees)
- Based on Industry Standards

## Java Analysis Studio Features

- Rich, easy to use GUI

## Java Analysis Studio Features

- Data Format Independent
- Currently Support
- PAW n-tuples, Hippo n-tuples, any SQL database, flat-file n-tuples, StdHep MC events
- Any data format via user supplied Data Interface Module (DIM)
- Experimenting with
- Object databases (Objectstore, Objectivity)
- Random access Java based IO  (similar to root IO]
- Future
- XML, Root, CDF/HDF

## Java Analysis Studio Features

- Supports **both** n-tuples and Structured Data
- n-tuples are fast and allow for simplifications in GUI
-  Simple Interactive cuts
-  Simple plot generation
- but n-tuples ultimately limiting
- Arbitrarily Structured Data provides ultimate flexibility
- Requires slightly more work from end-user
- Complete Object Oriented Analysis Environment
- Flexible enough to write (or prototype) reconstruction code

## Java Analysis Studio Features

- Histogram/ScatterPlot Display
- Commercial plot package used in earlier versions replaced with custom plot package
- Supports strings, dates, multiple axes, direct user interaction, overlays, fitting, scatter plots

## Java Analysis Studio Features

- User analysis modules written in Java
- Java Excellent Language for Physics Analysis
- Easy to learn yet very powerful, fully OO language
- Fast (and getting faster]
- Very fast code, load, test, fix cycle
- JAS provides built-in editor, compiler, plus:
- hep.analysis package
- for creating/filling/manipulating histograms
- hep.physics package
- simple particle, track manipulation package

## Slide 28

## hep.analysis package

- Histogram delegates binning to:
- “partition classes” [idea stolen from LHC++]
- Map from X, Y to bin number
- supports real, integer, string, date’s etc.
- Calculation of contents, errors in bin
- allows efficiency plots, mean/rms plots etc
- Data storage method
- immediate binning (c.f. Hbook)
- delayed binning, allows rebinning, axis changes via GUI
- Many standard partitions provided.
- User can provide own partition functions

## Java Analysis Studio Features

- User Extensible, via
- Analysis Modules
- Data Interface Modules
- Access to experiment specific data, native language modules
- Plug In’s (c.f. Web Applets]
- Event Displays, etc.
- Fitter, Functions, Partitions

## Java Analysis Studio Features

- Analyze local or remote data

- User interface independent of Data Location
- Does not assume fast network (works well at 28.8 bps]
- Analysis code moves (transparently) to data

- Local Data

## JAS Implementation

- “100% Java” Application
- Uses Sun’s Java Foundation Classes (Swing) for GUI
- [optional] interfaces to legacy data (PAW, hippo, StdHep) uses Java Native Interface [JNI]
- Leverage Commercial Components
- Java itself
- compiler, GUI, debugger,  networking, Remote Method Invocation
- Help system  from Oracle
- Plot component (not currently used]
- Object databases, SQL databases
- No runtime license fees

## JAS Implementation 

- Modular Design
- Can use individual parts
- hep.analysis package
- Histogram display package
- (e.g. for online display)
- Plot package
- Analysis tools
- Can add or replace parts

## Java Experience

- Very Productive
- No memory leaks
- No subtle c++ problems
- fun to write
- Cross Platform Easy
- Develop under NT,
- It just works elsewhere!
- Getting faster all the time:
- Swing 1.1
- Faster Java Virtual Machines + Hot-Spot

## 1.0 Beta Release now available

- Windows (NT, 95, 98] self extracting executable
- Unix (Solaris+Linux) binary distribution available
- Should be easy to port to other Unix, Mac etc.
- Limitations
- Detailed documentation still under development
- May still be some changes to user API
- Download from:
- http://www-sldnt.slac.stanford.edu/jas

## Demo

## Future

- Next Release (1.0 final)
- More types of plots
- 2d plots, lego plots etc.
- More flexible control of histograms
- More n-tuple handling tools (c.f. HippoDraw]
- More Data Interface Modules
- Objectivity, Root
- Built in debugger, code profiler, scripting
- You tell us!!

## Collaboration

- Integrate Wired event display as “Plug In” (M.Donszelmann, CERN)
- Working with Babar, CMS, LCD
- Looking for more collaborators and/or experiments interested in trying Java Analysis Studio out and giving us feedback.

## How to try it out

- Please try it:
- http://www-sldnt.slac.stanford.edu/jas
- Please give us feedback
- jas-feedback@sld-mail.slac.stanford.edu
- Mailing List:
- http://www.slac.stanford.edu/cgi-bin/lwgate/JAS-L/
- Also general mailing list for Java in HEP:
- http://www.slac.stanford.edu/cgi-bin/lwgate/HEP-JAVA/

## Conclusions

- Java is a very useful language+environment that could be very beneficial to HEP in many areas.
- Could Java be used for entire offline for major experiment (e.g. linear collider detector?)
- Technically - Yes
- Politically - ?