[Feedback][Tutorial Contents][hep.lcd Home]
The hep.lcd.util.driver 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, which reconstruction components such as Track Fitters, or Cluster Finders must implement. An AbstractProcessor class is provided which implements Processor and which most components will extend. A second class Driver 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.
To call the Track Finder it is simply necessary to create a class that extends Driver, and which adds TrackReco 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); } } }
Once a track reconstruction algorithm has been run the tracks will automatically appear on the event display.