hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.16 -r1.17
--- TrackerReconDriver.java 28 Apr 2012 19:35:09 -0000 1.16
+++ TrackerReconDriver.java 28 Apr 2012 21:03:47 -0000 1.17
@@ -21,64 +21,49 @@
* This class runs the Track Reconstruction for the HPS Test Proposal detector.
* The tracker digitization must be run in front of it. It is intended to work
* with the {@link TrackerDigiDriver} digitization Driver.
- *
+ *
* @author jeremym
- * @version $Id: TrackerReconDriver.java,v 1.16 2012/04/28 19:35:09 meeg Exp $
+ * @version $Id: TrackerReconDriver.java,v 1.17 2012/04/28 21:03:47 meeg Exp $
*/
public final class TrackerReconDriver extends Driver {
-
+
// Debug flag.
//private final static boolean DEBUG = false;
private boolean debug = false;
-
// Tracks found across all events.
int ntracks = 0;
-
// Number of events processed.
int nevents = 0;
-
// Cache detector object.
Detector detector = null;
-
// Default B-field value.
private double bfield = 0.5;
-
// Name of the SVT subdetector.
private String subdetectorName = "Tracker";
-
// SimTrackerHit input collection for readout cleanup.
private String simTrackerHitCollectionName = "TrackerHits";
-
// Tracking strategies resource path.
private String strategyResource = "HPS-Test-1pt3.xml";
-
// Output track collection.
private String trackCollectionName = "MatchedTracks";
-
// HelicalTrackHit input collection.
private String stInputCollectionName = "RotatedHelicalTrackHits";
-
// Output hit collection for HelicalTrackHits.
private String hthOutputCollectionName = "HelicalTrackHits";
-
// Input strip hits collection from digi.
private String stripHitsCollectionName = "StripClusterer_SiTrackerHitStrip1D";
-
// Hit relations output collection.
private String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
-
// Track to MC relations output collection.
private String helicalTrackMCRelationsCollectionName = "HelicalTrackMCRelations";
-
// Max strip separation when making HelicalTrackHits.
private double stripMaxSeparation = 10.01;
-
// Tolerance factor when making HelicalTrackHits.
private double stripTolerance = 0.01;
public TrackerReconDriver() {
}
-
+
public void setDebug(boolean debug) {
this.debug = debug;
}
@@ -89,10 +74,9 @@
/**
* Set the tracking strategy resource.
- *
- * @param strategyResource
- * The absolute path to the strategy resource in the hps-java
- * jar.
+ *
+ * @param strategyResource The absolute path to the strategy resource in the
+ * hps-java jar.
*/
public void setStrategyResource(String strategyResource) {
this.strategyResource = strategyResource;
@@ -132,9 +116,9 @@
/**
* Set the SimTrackerHit collection to be used for tracking.
- *
- * @param simTrackerHitCollectionName
- * The name of the SimTrackerHit collection in the event.
+ *
+ * @param simTrackerHitCollectionName The name of the SimTrackerHit
+ * collection in the event.
*/
public void setSimTrackerHitCollectionName(String simTrackerHitCollectionName) {
this.simTrackerHitCollectionName = simTrackerHitCollectionName;
@@ -150,8 +134,9 @@
// Get B-field Y with no sign. Seed Tracker doesn't like signed B-field components.
// FIXME Is this always right?
this.bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0, 0, 0)).y()));
- if (debug)
+ if (debug) {
System.out.println("Set B-field to " + this.bfield);
+ }
initialize();
@@ -170,16 +155,19 @@
// Setup default stereo pairings, which should work for even number of
// modules.
List<SiTrackerModule> modules = detector.getSubdetector(subdetectorName).getDetectorElement().findDescendants(SiTrackerModule.class);
- if (modules.size() == 0)
+ if (modules.size() == 0) {
throw new RuntimeException("No SiTrackerModules found in detector.");
+ }
int nmodules = modules.size();
- if (nmodules % 2 != 0)
+ if (nmodules % 2 != 0) {
throw new RuntimeException("Don't know how to do stereo pairing for odd number of modules.");
+ }
List<int[]> pairs = new ArrayList<int[]>();
for (int i = 1; i <= (nmodules / 2) - 1; i += 2) {
- int[] pair = { i, i + 1 };
- if (debug)
+ int[] pair = {i, i + 1};
+ if (debug) {
System.out.println("Adding stereo pair: " + pair[0] + ", " + pair[1]);
+ }
pairs.add(pair);
}
@@ -202,8 +190,9 @@
// 2) Driver to run Seed Tracker.
//
- if (!strategyResource.startsWith("/"))
+ if (!strategyResource.startsWith("/")) {
strategyResource = "/" + strategyResource;
+ }
List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(this.getClass().getResourceAsStream(strategyResource));
SeedTracker stFinal = new SeedTracker(sFinallist);
HPSTransformations hpstrans = new HPSTransformations();
@@ -211,7 +200,8 @@
stFinal.setInputCollectionName(stInputCollectionName);
stFinal.setTrkCollectionName(trackCollectionName);
stFinal.setBField(bfield);
- stFinal.setSectorParams(false);
+ stFinal.setSectorParams(false); //this doesn't actually seem to do anything
+// stFinal.setSectorParams(1, 10000);
add(stFinal);
//
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.7 -r1.8
--- HPSRawTrackerHitFitterDriver.java 28 Apr 2012 19:35:09 -0000 1.7
+++ HPSRawTrackerHitFitterDriver.java 28 Apr 2012 21:03:47 -0000 1.8
@@ -15,6 +15,7 @@
*/
public class HPSRawTrackerHitFitterDriver extends Driver {
+ private boolean debug = false;
private HPSShaperFitAlgorithm _shaper = new DumbShaperFit();
private String rawHitCollectionName = "SVTRawTrackerHits";
private String fitCollectionName = "SVTShapeFitParameters";
@@ -22,6 +23,10 @@
private int genericObjectFlags = 1 << LCIOConstants.GOBIT_FIXED;
private int relationFlags = 0;
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
public void setFitAlgorithm(String fitAlgorithm) {
if (fitAlgorithm.equals("Analytic")) {
_shaper = new HPSShaperAnalyticFitAlgorithm();
@@ -64,6 +69,12 @@
for (RawTrackerHit hit : rawHits) {
ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) hit.getDetectorElement(), hit.getIdentifierFieldValue("strip"));
HPSShapeFitParameters fit = _shaper.fitShape(hit, constants);
+ if (debug) {
+ System.out.println(fit);
+ }
+ if (fit.getT0() < 0.0) {
+ continue;
+ }
fits.add(fit);
HPSFittedRawTrackerHit hth = new HPSFittedRawTrackerHit(hit, fit);
hits.add(hth);