Yet another Particle Property Interface
Member of FreeHEP Printable Page


To use the YaPPI Java API means to write a Java program that uses class definitions from the YaPPI class package. The program will make use of methods to read (or write) particle data from (or to) XML files that you specify. The basic steps in using the YaPPI Java API are:

  1. Get the YaPPI class library (jar files) that you will need to compile your program with.
  2. Use YaPPI classes, methods and variables, as explained in the javadocs YaPPI classes.
  3. Load the XML data.
  4. Manipulate the data.

We expand on each of these steps below.

Get YaPPI Jar Files

In your program you will use classes defined in these jar files, thus you will need to have them in your Java classpath. Thus:

  1. Download the jar files from the FreeHEP download area.
  2. Modify the classpath of your JDK to include the location of the FreeHEP Jar files.

Use the YaPPI API javadocs

For the details on what you can do with each YaPPI API class, such as constructor to use, which methods to call, and so on, you will need to browse the javadoc (automatically generated documentation) for the Java classes of the YaPPI API. The YaPPI javadoc is contained in the FreeHEP Java Library javadoc.

Please the the YaPPI Class Diagram for an overview of the available classes.

Load the XML data

XML data is loaded by reading XML files, as many as needed. This you do creating an instance of the XMLYappi class, and using one of its read methods to load one or more XML files. Please see small test class below as a sample.

Please visit the YaPPI XML Schema for a visual representation of how Particle Property data is structured in XML by YaPPI.

Manipulate the Data

Data that is read in from XML files is made accessible to your program via a set of get methods, for each supported data element. Please see the methods available to XMLYappi for a complete list. The sample below shows a get of a family and a get of a particle.

Sample Code

package hep.physics.yappi.test;

import hep.physics.yappi.*;

public class TestYappi {

    public static void main(String[] args) throws Exception {

        XMLYappi yappi = new XMLYappi();

        Family family = yappi.getFamily("ccbar MESONS");
        System.out.println("Family: " + family);

        ParticleType particleType = yappi.getParticle("eta(c)(1S)");
        System.out.println("Particle: " + particleType);