lcsim/src/org/lcsim/fit/helicaltrack
diff -u -r1.38 -r1.39
--- HelicalTrackHitDriver.java 14 Dec 2010 21:45:55 -0000 1.38
+++ HelicalTrackHitDriver.java 17 Mar 2011 19:54:36 -0000 1.39
@@ -22,6 +22,7 @@
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.ITransform3D;
+import org.lcsim.detector.solids.LineSegment3D;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.detector.tracker.silicon.SiTrackerModule;
import org.lcsim.digisim.MyLCRelation;
@@ -180,7 +181,7 @@
// Loop over the collections of hits with virtual segmentation
for (String colname : _vscol) {
-
+
// Get the segmentation manager if we haven't already done so
if (_segman == null) _segman = (SegmentationManager) event.get("SegmentationManager");
@@ -536,43 +537,48 @@
private HelicalTrackStrip makeDigiStrip(SiTrackerHitStrip1D h){
-
- SiTrackerHitStrip1D local = h.getTransformedHit(CoordinateSystem.SENSOR);
- SiTrackerHitStrip1D global = h.getTransformedHit(CoordinateSystem.GLOBAL);
-
- ITransform3D trans = local.getLocalToGlobal();
- Hep3Vector org = trans.transformed(_orgloc);
- Hep3Vector u = global.getMeasuredCoordinate();
- Hep3Vector v = global.getUnmeasuredCoordinate();
-// System.out.println("Strip hit origin x: "+org.x()+" y: "+org.y()+" z: "+org.z());
-// System.out.println("Strip hit measured x: "+u.x()+" y: "+u.y()+" z: "+u.z());
-// System.out.println("Strip hit unmeasured x: "+v.x()+" y: "+v.y()+" z: "+v.z());
-
- double umeas = local.getPosition()[0];
- double vmin = VecOp.dot(local.getUnmeasuredCoordinate(),local.getHitSegment().getStartPoint());
- double vmax = VecOp.dot(local.getUnmeasuredCoordinate(),local.getHitSegment().getEndPoint());
- double du = Math.sqrt(local.getCovarianceAsMatrix().diagonal(0));
-// System.out.println("umeas: "+umeas+" vmin: "+vmin+" vmax: "+vmax+" du: "+du);
+ // Get the tranform from global coordinates to electrode coordinates
+ // We will use this to get the local hit coordinates and measurement error
+ ITransform3D trans = h.getReadoutElectrodes().getGlobalToLocal();
+
+ // Get the global coordinates of the electrode origin
+ Hep3Vector org = h.getReadoutElectrodes().getLocalToGlobal().transformed(_orgloc);
+
+ // Get the unit vectors for the measured and unmeasured directions
+ Hep3Vector u = h.getMeasuredCoordinate();
+ Hep3Vector v = h.getUnmeasuredCoordinate();
+
+ // Get the measured coordinate (i.e., the distance from the origin along the u direction)
+ double umeas = trans.transformed(h.getPositionAsVector()).x();
+
+ // Get the limits on the unmeasured coordinate
+ LineSegment3D vseg = h.getHitSegment();
+ double vmin = trans.transformed(vseg.getStartPoint()).y();
+ double vmax = trans.transformed(vseg.getEndPoint()).y();
+
+ // Get the error on the measured coordinate
+ double du = Math.sqrt(trans.rotated(h.getCovarianceAsMatrix()).diagonal(0));
+
+ // Get the identifier information
IDetectorElement de = h.getSensor();
String det = _ID.getName(de);
int lyr = _ID.getLayer(de);
BarrelEndcapFlag be = _ID.getBarrelEndcapFlag(de);
-// System.out.println("Identifier: "+det+lyr+be);
+ // Get the energy deposit, time, and raw hits from the SiTrackerHitStrip1D
double dEdx = h.getdEdx();
double time = h.getTime();
List<RawTrackerHit> rawhits = h.getRawHits();
-// for (RawTrackerHit raw : rawhits) {
-// for (SimTrackerHit shit : raw.getSimTrackerHits()) {
-// System.out.println("Sim Hit x: "+shit.getPoint()[0]+
-// " y: "+shit.getPoint()[1]+" z: "+shit.getPoint()[2]);
-// }
-// }
+
+ // Create a new HelicalTrackStrip
HelicalTrackStrip strip = new HelicalTrackStrip(org, u, v, umeas, du,
vmin, vmax, dEdx, time, rawhits, det, lyr, be);
-
+
+ // Save the MCParticles associated with this hit
for (MCParticle p : h.getMCParticles()) strip.addMCParticle(p);
+
+ // Done!
return strip;
}