Commit in lcsim/src/org/lcsim/util/heprep on MAIN
ClusterConverter.java+20-101.5 -> 1.6
CalorimeterHitConverter.java+17-81.7 -> 1.8
+37-18
2 modified files
JM: Guard against null position exceptions in event display.

lcsim/src/org/lcsim/util/heprep
ClusterConverter.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ClusterConverter.java	7 Apr 2006 02:50:18 -0000	1.5
+++ ClusterConverter.java	24 Aug 2007 20:07:40 -0000	1.6
@@ -19,7 +19,7 @@
 /**
  *
  * @author tonyj
- * @version $Id: ClusterConverter.java,v 1.5 2006/04/07 02:50:18 ngraf Exp $
+ * @version $Id: ClusterConverter.java,v 1.6 2007/08/24 20:07:40 jeremy Exp $
  */
 class ClusterConverter implements HepRepCollectionConverter
 {
@@ -75,15 +75,25 @@
                 for (CalorimeterHit hit : hits)
                 {
                     // FixMe: What if hit doesn't have position?
-                    pos = hit.getPosition();
-                    HepRepInstance instanceX = factory.createHepRepInstance(instanceC, typeX);
-                    instanceX.addAttValue("energy",hit.getRawEnergy());
-                    instanceX.addAttValue("MarkSize",5);
-                    //instanceX.addAttValue("cluster",cluster.getEnergy());
-                    instanceX.addAttValue("color",clusterColor);
-                    instanceX.addAttValue("showparentattributes", true);
-                    instanceX.addAttValue("pickparent", true);
-                    HepRepPoint pp = factory.createHepRepPoint(instanceX,pos[0],pos[1],pos[2]);
+                	double hitpos[] = null;
+                	try {
+                		hitpos = hit.getPosition();
+                	}
+                	catch (Exception x)
+                	{}
+                	
+                	if (hitpos != null)
+                	{
+                		pos = hit.getPosition();
+                		HepRepInstance instanceX = factory.createHepRepInstance(instanceC, typeX);
+                		instanceX.addAttValue("energy",hit.getRawEnergy());
+                		instanceX.addAttValue("MarkSize",5);
+                		//instanceX.addAttValue("cluster",cluster.getEnergy());
+                		instanceX.addAttValue("color",clusterColor);
+                		instanceX.addAttValue("showparentattributes", true);
+                		instanceX.addAttValue("pickparent", true);
+                		HepRepPoint pp = factory.createHepRepPoint(instanceX,pos[0],pos[1],pos[2]);
+                	}
                 }
             }
         }

lcsim/src/org/lcsim/util/heprep
CalorimeterHitConverter.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- CalorimeterHitConverter.java	1 Feb 2006 21:22:37 -0000	1.7
+++ CalorimeterHitConverter.java	24 Aug 2007 20:07:40 -0000	1.8
@@ -18,7 +18,7 @@
 /**
  *
  * @author tonyj
- * @version $Id: CalorimeterHitConverter.java,v 1.7 2006/02/01 21:22:37 jeremy Exp $
+ * @version $Id: CalorimeterHitConverter.java,v 1.8 2007/08/24 20:07:40 jeremy Exp $
  */
 class CalorimeterHitConverter implements HepRepCollectionConverter
 {
@@ -65,15 +65,24 @@
          if (Double.isNaN(e) || Double.isInfinite(e) || e <= 0) continue;
          //if (!hasPos) decoder.setID(hit.getCellID());
          //double[] pos = hasPos ?  hit.getPosition() : decoder.getPosition();
-         double[] pos = hit.getPosition();
-         HepRepInstance instanceX = factory.createHepRepInstance(instanceTree, typeX);
-         instanceX.addAttValue("energy",hit.getRawEnergy());
-         if (hitColorMap != null)
+         double pos[] = null;
+         try {
+        	 pos = hit.getPosition();
+         }
+         catch (Exception x)
+         {}
+         
+         if (pos != null)
          {
-            double v = (Math.log(hit.getRawEnergy())-Math.log(minEnergy))/(Math.log(maxEnergy)-Math.log(minEnergy));
-            instanceX.addAttValue("color",hitColorMap.getColor(v,1.0f));
+        	 HepRepInstance instanceX = factory.createHepRepInstance(instanceTree, typeX);
+        	 instanceX.addAttValue("energy",hit.getRawEnergy());
+        	 if (hitColorMap != null)
+        	 {
+        		 double v = (Math.log(hit.getRawEnergy())-Math.log(minEnergy))/(Math.log(maxEnergy)-Math.log(minEnergy));
+        		 instanceX.addAttValue("color",hitColorMap.getColor(v,1.0f));
+        	 }
+        	 HepRepPoint pp = factory.createHepRepPoint(instanceX,pos[0],pos[1],pos[2]);
          }
-         HepRepPoint pp = factory.createHepRepPoint(instanceX,pos[0],pos[1],pos[2]);
       }
    }
 }
CVSspam 0.2.8