You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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.

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.)

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

  • No labels