The hep.io.root Package

Viewing Root Histograms with the JAS Plot Widget

The following example shows how to display root histograms using the JAS plot widget. You will need both root.jar and jas.jar (part of the JAS distribution) in your CLASSPATH to compile and run this, plus the Example.root data file. The essential class is the RootHistogramAdapter which takes a Root histogram (TH1) and converts it to a JAS DataSource, which can be displayed by the JAS Plot widget. The RootHistogramAdapter is quite crude at the moment, it only works for simple 1D and 2D plots, and ignores attributes such as line color, markers, date axis etc. (It should be easy to improve it, volunteers are welcome).

Running the program will produce something like this:

A Root Histogram Browser

This code can easily be extended to create a Root Histogram Browser.