hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.5 -r1.6
--- TrackerReconDriver.java 19 Jan 2012 23:56:54 -0000 1.5
+++ TrackerReconDriver.java 23 Jan 2012 23:11:26 -0000 1.6
@@ -1,5 +1,7 @@
package org.lcsim.hps.recon.tracking;
+import hep.physics.vec.BasicHep3Vector;
+
import java.util.ArrayList;
import java.util.List;
@@ -21,13 +23,13 @@
* It is intended to work with the {@link TrackerDigiDriver} digitization Driver.
*
* @author jeremym
- * @version $Id: TrackerReconDriver.java,v 1.5 2012/01/19 23:56:54 jeremy Exp $
+ * @version $Id: TrackerReconDriver.java,v 1.6 2012/01/23 23:11:26 jeremy Exp $
*/
public final class TrackerReconDriver extends Driver
{
// Debug flag
private final static boolean DEBUG = true;
-
+
// Tracks found across all events.
int ntracks = 0;
@@ -37,7 +39,7 @@
// Cache detector object.
Detector detector = null;
- // FIXME Hard-coded B-field value. Get this from the Detector?
+ // Default B-field value.
private double bfield = 0.5;
// Name of the SVT subdetector.
@@ -101,10 +103,10 @@
}
// FIXME This set method should go away eventually. Field should be read from Detector in detectorChanged method.
- public void setBField(double bfield)
- {
- this.bfield = bfield;
- }
+ //public void setBField(double bfield)
+ //{
+ // this.bfield = bfield;
+ //}
public void setInputHitCollectionName(String inputHitCollectionName)
{
@@ -149,10 +151,17 @@
* This is used to setup the Drivers after XML config.
*/
public void detectorChanged(Detector detector)
- {
+ {
+ // Cache Detector object.
this.detector = detector;
- //System.out.println("detector bfield @ 0,0,0 = " + detector.getFieldMap().getField(new BasicHep3Vector(0,0,0)));
+
+ // Get B-field Y component with flipped sign.
+ // FIXME Is this always right?
+ this.bfield = -(detector.getFieldMap().getField(new BasicHep3Vector(0,0,0))).y();
+ System.out.println("Set B-field to " + this.bfield);
+
initialize();
+
super.detectorChanged(detector);
}