Subsections
Below we will compare jHepWork with two popular object-oriented packages currently
used in high-energy physics:
1) JAS package [5], based on Java and FreeHEP libraries [4] and 2) C++ ROOT package [6,7].
Compare to JAS, the jHepWork:
- has a full-featured integrated development environment (IDE) with
syntax highlighting,
syntax checker, code completion, code analyser, an Jython shell and a file manager. The
jHepWork IDE is based on the jeHEP editor which was specifically designed
for the jHepWork project;
- contains a powerful plotting program to display data (including 3D plots) with a large
choice for interactive labels and text attributes (subscripts, superscripts, overlines,
arrows, Greek symbols etc.).
jHepWork plots are more interactive than those written using FreeHEP JAIDA libraries linked with JAS.
The plotting library is based on the jHPlot
library developed for the jHepWork project;
- is designed to write short programs due to several enhancements
and simpler class names. The classes written for jHepWork were
written keeping in mind simplicity of
numerous high-level constructs enabling the user
to write programs that are significantly shorter than programs written using JAS;
- is a pure JAVA program, therefore, it is easier to maintain than
JAS (JAS contains shared libraries which depend on specific platform);
It includes a larger collection of GNU-licensed
scientific and mathematical packages than currently included to JAS.
- includes high-level constructions for data manipulations, data presentations
in form of tables, data input and output, calculations
of systematical errors and visualization (plots, tables, spreadsheet)
which have no analogy in JAS;
- includes advanced help system with the code completion.
For the core jHplot package, the code completion feature is complimented with a detailed
API information on each method associated with certain class.
Compare to ROOT, jHepWork:
- is a Java-based program, thus it is fully multi-platform and does
not require installation.
Java is very robust.
For example, Java source codes developed 6-7 years ago can easily be compiled without any
changes even today.
Even jar libraries compiled many years from now can run without problems on
modern Java Virtual Machines. Java has automatic garbage collection, which is
significant advantage over C++/C;
- being Java-based, does not require compilation and installation.
This is especially useful for plugins distributed via the Internet in
form of bitecode jar libraries;
- has a full-featured IDE with
syntax highlighting,
syntax checker, code completion and analyser;
- can be integrated with the Web in form of applets, thus
it is better suited for distributed analysis
environment via the Internet. This is essential
feature for modern large collaborations in high-energy physics and in other
scientific fields;
- calculations based on Jython/Python scripts are typically 4-5
times shorter than equivalent ROOT/C++ programs;
- calculations based on Jython scripts can be compiled to Java
bytecode files and packed to jar libraries without
modifications of Jython scripts. In contrast, ROOT/CINT scripts
have to be written using a proper C++ syntax if they will be compiled and put
to libraries.
This makes the ROOT/CINT scripts to be almost identical to the standard C++ code,
which takes more time for writing;
- can access high-level Python and Java data structures;
- includes an advanced help system with a code completion based
on the Java reflection technology. With increasingly large number of
classes and methods in ROOT,
it is difficult to understand which method belongs to a particular class,
and what is description of this method.
Using the jHepWork IDE, it is possible to access the full
description of the main jHPlot
methods during editing Jython scripts.
Jython scripts are about 4-10 times slower than equivalent Java programs and
about a factor 5 slower than the equivalent ROOT/CINT codes for operations
on primitive data types (remember, all Jython data types are objects).
This means that CPU extensive tasks should be moved to Java jar libraries.
jHepWork was designed for the front-end data analysis in which program
speed is not essential, as it is assumed the a JHepWork program is used for
operations with data and objects (like histograms) which have been already
created by C++, Fortran or Java code.
For such front-end data analysis, the bottleneck is mainly
user input speed, interaction with a graphical object using mouse or network latency.
In practice, final results obtained with Jython programs can be obtained
much faster than those designed in C++/Java,
because development is so much easier in jHepWork that you often wind up with a
much better algorithm based on Jython syntax and jHepWork high-level
objects than he/she would in C++ or Java.
In case of CPU extensive tasks, like large loops over primitive data types,
reading files etc. one should use high-level structures of Jython and jHepWork.
For example,
one should use the method randomUniform()
of the P0D class to create an array of random numbers,
rather than
writing a loop over random numbers and using add() method to fill an array in Jython.
To write a file with many numbers, one should use a single line with the
statement toFile() or methods of the P1D class, instead
of writing a Jython loop over all numbers with the Jython write() method.
In case if such methods are used, jHepWork programs are typically 5-10 times faster than
those in which loops are directly implemented in Jython scripts,
and about 2-3 times faster than those macros written in CINT/C++ language.
We will consider examples
of the jHepWork scripts optimized for speed in Section :autorefsection2.25.