Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Preliminaries

You should complete the Setting Up Netbeans 6.5 with Maven 2 tutorial and JAS3 should be installed.

Driver Creation

We will create an LCSim Driver in the lcsim-contrib project. A Driver is the entry point for your physics analysis code.

In the lcsim-contrib project in Netbeans, right click on Source Packages and select New > Java Package. Add a package for your code.

Image Added

If your name is Bob Smith, then you might call it org.lcsim.contrib.bsmith. I will use org.lcsim.contrib.example, but you should add a unique package name for yourself. You should only need to add this new base package the first time you add code to this project.

Create a new class in your package by right-clicking on the package in Source Packages and selecting New > Java Class.

Image Added

In the class name box, put a name that accurately describes what your class does.

Image Added

Here is some example code that can be used.

No Format
package org.lcsim.contrib.example;

import org.lcsim.event.EventHeader;
import org.lcsim.util.Driver;

/**
 * This is an example Driver class that prints the event number.
 *
 * @author My Name Here
 */
public class ExampleDriver extends Driver
{
    public void process(EventHeader event)
    {
        System.out.println("Processing event: " + event.getEventNumber());
    }
}

Image Added

Right-click on lcsim-contrib in Netbeans and click Build.

Image Added

If the build completes successfully, i.e. there were no compile errors, then you should see a message like this.

Image Added

That's it. Now the lcsim-contrib jar should be installed and available for use in JAS3.

Loading the Driver in JAS3

Open JAS3 and then open an LCIO file using File > Open. (Any LCIO file will do.)

Now load the Driver by select File > Load and typing the fully qualified class name into the box. The fully qualified name is the package name followed by the class name.

Image Added

An error message will display if the Driver did not load.

If you are using the code from the ExampleDriver above, this message should display in the JAS3 log windowthe process method will be called for one event and the event number should be displayed.

No Format
Processing event: 0