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.

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.

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

Here is some example code that can be used.

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());
    }
}

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

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

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.

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

If you are using the code from the ExampleDriver above, the process method will be called for one event and the event number should be displayed.

Processing event: 0
  • No labels

1 Comment

  1. Unknown User (alexconway)

    How does one reload a driver once it has been loaded? If I want to test a change it seems I need to close and reopen JAS to make the change take effect.
    Thanks