Commit in lcsim/src/org/lcsim/util/heprep on MAIN
TrackConverter.java+44-371.6 -> 1.7
use TrackStates instead of old Track API

lcsim/src/org/lcsim/util/heprep
TrackConverter.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- TrackConverter.java	24 Aug 2007 20:10:28 -0000	1.6
+++ TrackConverter.java	18 Oct 2012 19:32:49 -0000	1.7
@@ -2,15 +2,18 @@
 
 import hep.graphics.heprep.HepRepFactory;
 import hep.graphics.heprep.HepRepInstance;
+import hep.graphics.heprep.HepRepInstanceTree;
 import hep.graphics.heprep.HepRepType;
 import hep.graphics.heprep.HepRepTypeTree;
-import hep.graphics.heprep.HepRepInstanceTree;
 import hep.physics.vec.Hep3Vector;
+
 import java.util.List;
+
 import org.lcsim.constants.Constants;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.EventHeader.LCMetaData;
 import org.lcsim.event.Track;
+import org.lcsim.event.TrackState;
 import org.lcsim.geometry.Detector;
 import org.lcsim.util.swim.HelixSwimmer;
 
@@ -18,7 +21,7 @@
 /**
  *
  * @author tonyj
- * @version $Id: TrackConverter.java,v 1.6 2007/08/24 20:10:28 jeremy Exp $
+ * @version $Id: TrackConverter.java,v 1.7 2012/10/18 19:32:49 jeremy Exp $
  */
 class TrackConverter implements HepRepCollectionConverter
 {
@@ -72,40 +75,44 @@
 		typeX.addAttDef("s","s","physics","");
 
 		for (Track t : (List<Track>) collection)
-		{         
-			helix.setTrack(t);
-			double distanceToCylinder = helix.getDistanceToCylinder(trackingRMax,trackingZMax);
-
-			HepRepInstance instanceX = factory.createHepRepInstance(instanceTree, typeX);
-			double pt = field[2]*Constants.fieldConversion/Math.abs(t.getTrackParameter(2));
-
-			instanceX.addAttValue("pT",pt);
-			instanceX.addAttValue("dedX",t.getdEdx());
-			instanceX.addAttValue("dedX error",t.getdEdxError());
-			instanceX.addAttValue("Charge",t.getCharge());
-			instanceX.addAttValue("Chi2",t.getChi2());
-			instanceX.addAttValue("pX",t.getPX());
-			instanceX.addAttValue("pY",t.getPY());
-			instanceX.addAttValue("pZ",t.getPZ());
-			instanceX.addAttValue("NDF",t.getNDF());
-			instanceX.addAttValue("Reference Point X",t.getReferencePointX());
-			instanceX.addAttValue("Reference Point Y",t.getReferencePointY());
-			instanceX.addAttValue("Reference Point Z",t.getReferencePointZ());
-			instanceX.addAttValue("d0",t.getTrackParameter(0));
-			instanceX.addAttValue("phi0",t.getTrackParameter(1));
-			instanceX.addAttValue("omega",t.getTrackParameter(2));
-			instanceX.addAttValue("z0",t.getTrackParameter(3));
-			instanceX.addAttValue("s",t.getTrackParameter(4));
-
-			double dAlpha = 10; // 1cm
-
-			for (int k=0;k<200;k++)
-			{
-				double d = k*dAlpha;
-				if (d>distanceToCylinder) break;
-				Hep3Vector point = helix.getPointAtDistance(d);
-				factory.createHepRepPoint(instanceX,point.x(),point.y(),point.z());
-			}
-		}
+        {         		    
+            helix.setTrack(t);
+            double distanceToCylinder = helix.getDistanceToCylinder(trackingRMax,trackingZMax);
+
+            TrackState ts = t.getTrackStates().get(0);
+            double[] rp = ts.getReferencePoint();
+            double[] p = ts.getMomentum();
+                                                
+            HepRepInstance instanceX = factory.createHepRepInstance(instanceTree, typeX);
+            double pt = field[2]*Constants.fieldConversion/Math.abs(ts.getParameter(2));
+            
+            instanceX.addAttValue("pT",pt);
+            instanceX.addAttValue("dedX",t.getdEdx());
+            instanceX.addAttValue("dedX error",t.getdEdxError());
+            instanceX.addAttValue("Charge",t.getCharge());
+            instanceX.addAttValue("Chi2",t.getChi2());
+            instanceX.addAttValue("pX",p[0]);
+            instanceX.addAttValue("pY",p[1]);
+            instanceX.addAttValue("pZ",p[2]);
+            instanceX.addAttValue("NDF",t.getNDF());
+            instanceX.addAttValue("Reference Point X",rp[0]);
+            instanceX.addAttValue("Reference Point Y",rp[1]);
+            instanceX.addAttValue("Reference Point Z",rp[2]);
+            instanceX.addAttValue("d0",ts.getParameter(0));
+            instanceX.addAttValue("phi0",ts.getParameter(1));
+            instanceX.addAttValue("omega",ts.getParameter(2));
+            instanceX.addAttValue("z0",ts.getParameter(3));
+            instanceX.addAttValue("s",ts.getParameter(4));
+
+            double dAlpha = 10; // 1cm
+
+            for (int k=0;k<200;k++)
+            {
+                double d = k*dAlpha;
+                if (d>distanceToCylinder) break;
+                Hep3Vector point = helix.getPointAtDistance(d);
+                factory.createHepRepPoint(instanceX,point.x(),point.y(),point.z());
+            }            
+        }		
 	}
 }
\ No newline at end of file
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1