lcsim/src/org/lcsim/recon/tracking/seedtracker/example
diff -N DummyTrackStateDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DummyTrackStateDriver.java 18 Mar 2010 01:56:06 -0000 1.1
@@ -0,0 +1,130 @@
+// $Id: DummyTrackStateDriver.java,v 1.1 2010/03/18 01:56:06 jeremy Exp $
+package org.lcsim.recon.tracking.seedtracker.example;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.GenericObject;
+import org.lcsim.event.Track;
+import org.lcsim.util.Driver;
+
+/**
+ * Adds dummy TrackState information to the event for testing slicPandora.
+ * @author jeremym
+ */
+class DummyTrackStateDriver extends Driver
+{
+ /**
+ * Dummy implmementation of TrackState for Pandora PFA New input.
+ * @author jeremym
+ */
+ class MyTrackState implements GenericObject
+ {
+ List<Float> vals = new ArrayList<Float>();
+
+ MyTrackState(float x, float y, float z, float px, float py, float pz)
+ {
+ vals.add(x);
+ vals.add(y);
+ vals.add(z);
+ vals.add(px);
+ vals.add(py);
+ vals.add(pz);
+ }
+
+ public double getDoubleVal(int index)
+ {
+ return 0;
+ }
+
+ public float getFloatVal(int index)
+ {
+ return vals.get(index);
+ }
+
+ public int getIntVal(int index)
+ {
+ return 0;
+ }
+
+ public int getNDouble()
+ {
+ return 0;
+ }
+
+ public int getNFloat()
+ {
+ return 6;
+ }
+
+ public int getNInt()
+ {
+ return 0;
+ }
+
+ public boolean isFixedSize()
+ {
+ return true;
+ }
+ }
+
+ /**
+ * Make collections of GenericObjects containing dummy TrackStates for testing slicPandora.
+ */
+ public void process(EventHeader event)
+ {
+ List<Track> tracks = event.get(Track.class, "Tracks");
+
+ // Setup start lists.
+ // List<LCRelation> startRelations = new ArrayList<LCRelation>();
+ List<GenericObject> startObjs = new ArrayList<GenericObject>();
+
+ // Setup end lists.
+ // List<LCRelation> endRelations = new ArrayList<LCRelation>();
+ List<GenericObject> endObjs = new ArrayList<GenericObject>();
+
+ // Setup ECal lists.
+ // List<LCRelation> ecalRelations = new ArrayList<LCRelation>();
+ List<GenericObject> ecalObjs = new ArrayList<GenericObject>();
+
+ for (Track track : tracks)
+ {
+ // Make start state.
+ MyTrackState startState = new MyTrackState(1.0f, 2.0f, 3.0f, 4.0f,
+ 5.0f, 6.0f);
+ startObjs.add(startState);
+ // LCRelation startRel = new MyLCRelation(track,startState);
+ // startRelations.add(startRel);
+
+ // Make ECal state.
+ MyTrackState ecalState = new MyTrackState(1.1f, 2.1f, 3.1f, 4.1f,
+ 5.1f, 6.1f);
+ ecalObjs.add(ecalState);
+ // LCRelation ecalRel = new MyLCRelation(track,ecalState);
+ // ecalRelations.add(ecalRel);
+
+ // Make end state.
+ MyTrackState endState = new MyTrackState(1.2f, 2.2f, 3.2f, 4.2f,
+ 5.2f, 6.2f);
+ endObjs.add(endState);
+ // LCRelation endRel = new MyLCRelation(track,endState);
+ // endRelations.add(endRel);
+ }
+
+ // int flag = 1 << LCIOConstants.GOBIT_FIXED;
+
+ // Write out start states.
+ event.put("StateAtStart", startObjs, GenericObject.class, 0);
+ // event.put("Tracks_StateAtStart", startRelations, LCRelation.class,
+ // 0);
+
+ // Write out ecal states.
+ event.put("StateAtECal", ecalObjs, GenericObject.class, 0);
+ // event.put("Tracks_StateAtECal", ecalRelations, LCRelation.class, 0);
+
+ // Write out end states.
+ event.put("StateAtEnd", endObjs, GenericObject.class, 0);
+ // event.put("Tracks_StateAtEnd", endRelations, LCRelation.class, 0);
+ }
+}
\ No newline at end of file