hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.6 -r1.7
--- HPSStripMaker.java 29 Sep 2012 00:19:41 -0000 1.6
+++ HPSStripMaker.java 7 Nov 2012 20:54:27 -0000 1.7
@@ -44,6 +44,8 @@
double _fourClusterErr = 1 / 2;
double _fiveClusterErr = 1;
+ boolean _debug = false;
+
public HPSStripMaker(HPSClusteringAlgorithm algo) {
_clustering = algo;
}
@@ -174,6 +176,7 @@
}
private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " makeTrackerHit ");
Hep3Vector position = getPosition(cluster, electrodes);
SymmetricMatrix covariance = getCovariance(cluster, electrodes);
double time = getTime(cluster);
@@ -184,17 +187,21 @@
rth_cluster.add(bth.getRawTrackerHit());
}
SiTrackerHitStrip1D hit = new SiTrackerHitStrip1D(position, covariance, energy, time, rth_cluster, type);
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " SiTrackerHitStrip1D created at " + position + "(" + hit.getPositionAsVector().toString()+")" + " E " + energy + " time " + time);
return hit;
}
private Hep3Vector getPosition(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
- boolean debug = false;
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " getPosition for cluster size " + cluster.size());
List<Double> signals = new ArrayList<Double>();
List<Hep3Vector> positions = new ArrayList<Hep3Vector>();
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " Loop of " + cluster.size() + " and add signals and positions to vectors");
+
for (HPSFittedRawTrackerHit hit : cluster) {
signals.add(hit.getAmp());
positions.add(((SiStrips) electrodes).getStripCenter(_strip_map.get(hit)));
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " Added hit with signal " + hit.getAmp() + " at strip center posiiton " + (((SiStrips) electrodes).getStripCenter(_strip_map.get(hit))));
}
// Average charge on central strips of longer clusters
@@ -214,6 +221,8 @@
}
}
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " Calculate charge weighted mean for " + signals.size() + " signals");
+
double total_charge = 0;
Hep3Vector position = new BasicHep3Vector(0, 0, 0);
@@ -222,22 +231,24 @@
total_charge += signal;
position = VecOp.add(position, VecOp.mult(signal, positions.get(istrip)));
+ if(_debug) System.out.println(this.getClass().getSimpleName() + "strip " + istrip+": signal " + signal + " position " + positions.get(istrip) + " -> total_position " + position.toString() + " ( total charge " + total_charge + ")");
+
}
position = VecOp.mult(1 / total_charge, position);
- if(debug) System.out.println(this.getClass().getSimpleName() + " charge weighted position "+position.toString() + " (before trans)");
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " charge weighted position "+position.toString() + " (before trans)");
electrodes.getParentToLocal().inverse().transform(position);
- if(debug) System.out.println(this.getClass().getSimpleName() + " charge weighted position "+position.toString() + " (after trans)");
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " charge weighted position "+position.toString() + " (after trans)");
// Swim position back through lorentz drift direction to midpoint between bias surfaces
if(_simulation!=null) {
_simulation.setSensor((SiSensor) electrodes.getDetectorElement());
_simulation.lorentzCorrect(position, electrodes.getChargeCarrier());
- if(debug) System.out.println(this.getClass().getSimpleName() + ": Position " + position.toString() + " ( after Lorentz)");
+ if(_debug) System.out.println(this.getClass().getSimpleName() + ": Position " + position.toString() + " ( after Lorentz)");
}
// return position in global coordinates
Hep3Vector newpos = ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal().transformed(position);
- if(debug) System.out.println(this.getClass().getSimpleName() + " newpos "+newpos.toString());
+ if(_debug) System.out.println(this.getClass().getSimpleName() + " final cluster position "+newpos.toString());
return ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal().transformed(position);
// return electrodes.getLocalToGlobal().transformed(position);