|
||||||
ManualTo 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:
We expand on each of these steps below. Get YaPPI Jar FilesIn your program you will use classes defined in these jar files, thus you will need to have them in your Java classpath. Thus:
Use the YaPPI API javadocsFor 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 dataXML 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 DataData 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(); yappi.read("hep/physics/yappi/xml/2000/PDG-Family.xml"); yappi.read("hep/physics/yappi/xml/2000/PDG-Properties.xml"); Family family = yappi.getFamily("ccbar MESONS"); System.out.println("Family: " + family); ParticleType particleType = yappi.getParticle("eta(c)(1S)"); System.out.println("Particle: " + particleType); } }                                                                                                                                                                                                                 |