[Feedback][Tutorial Contents][hep.lcd Home]

shoeline2[1].gif (1488 bytes)

The Track Reconstruction Package

Drivers and Processors

The hep.lcd.util.driver(in the API reference documentation) package contains a set of classes which make it easy to write reconstruction packages which involve several different processing stages called in succession. The package contains an interface Processor(in the API reference documentation), which reconstruction components such as Track Fitters, or Cluster Finders must implement. An AbstractProcessor(in the API reference documentation) class is provided which implements Processor and which most components will extend. A second class Driver(in the API reference documentation) maintains a list of Processors to call, and calls them in order when its processEvent method is called. Driver extends EventAnalyzer, so any class which extends Driver can be used anywhere an EventAnalyzer has been used in the previous tutorials. In general it is not necessary to provide a processEvent method for a Driver, since the driver provides its own implementation of processEvent, which calls all the Processors in the drivers list.

A Driver also provides functionality which can control the level of debug output and histograms generated by the Processors called by the Driver.

The Track Reconstructor

To call the Track Finder it is simply necessary to create a class that extends Driver, and which adds TrackReco(in the API reference documentation) as one of the processors to be called by the Driver. TrackReco is the main TrackReconstruction driver. The code below shows an example of how to do this.

import hep.analysis.*;

import hep.lcd.recon.tracking.*;
import hep.lcd.util.driver.*;
import hep.lcd.event.*;
import java.util.*;
import hep.physics.*;

final public class LCDTrackDriver extends Driver
{
   public LCDTrackDriver()
   {
      add(new TrackReco()); 
      add(new TrackAnalyzer());
   }
}
class TrackAnalyzer extends AbstractProcessor
{
   public void process(LCDEvent event)
   {
      for (Enumeration e = event.getTrackList().getTracks();
           e.hasMoreElements();)
      {
         Track t = (Track) e.nextElement();
         double ptot = Math.sqrt(t.getMomentumX()*t.getMomentumX() +
                                 t.getMomentumY()*t.getMomentumY() +
                                 t.getMomentumZ()*t.getMomentumZ());
         histogram("ptot").fill(ptot);
      }
   }
}

Viewing Tracks on the LCD Event Display

Once a track reconstruction algorithm has been run the tracks will automatically appear on the event display.

ed.gif (9659 bytes)