Print

Print


Author: [log in to unmask]
Date: Fri May 29 12:17:03 2015
New Revision: 3058

Log:
Change test so checking hit times is optional (fixes error for GTPClusterer).

Modified:
    java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java

Modified: java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java
 =============================================================================
--- java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java	(original)
+++ java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java	Fri May 29 12:17:03 2015
@@ -58,7 +58,8 @@
         boolean checkPropCalc;
         boolean checkClusterPosition;
         boolean checkNullHits;
-        boolean checkHitPositions;        
+        boolean checkHitPositions;    
+        boolean checkHitTime;
         double[] cuts = null;
         ClusterType clusterType;
         String clustererName;
@@ -87,6 +88,11 @@
 
         ClustererTestConfig checkHitEnergy() {
             checkHitEnergy = true;
+            return this;
+        }
+        
+        ClustererTestConfig checkHitTime() {
+            checkHitTime = true;
             return this;
         }
 
@@ -148,7 +154,8 @@
             .checkHitEnergy()
             .checkClusterPosition()
             .checkNullHits()
-            .checkHitPositions());
+            .checkHitPositions()
+            .checkHitTime());
     }
 
     /**
@@ -162,7 +169,8 @@
             .checkHitEnergy()
             .checkClusterPosition()
             .checkNullHits()
-            .checkHitPositions());
+            .checkHitPositions()
+            .checkHitTime());
     }
 
     /**
@@ -175,7 +183,8 @@
             .checkHitEnergy()
             .checkClusterPosition()
             .checkHitPositions()
-            .checkNullHits());
+            .checkNullHits()
+            .checkHitTime());
     }
 
     /**
@@ -188,7 +197,8 @@
             .checkHitEnergy()
             .checkClusterPosition()
             .checkHitPositions()
-            .checkNullHits());
+            .checkNullHits()
+            .checkHitTime());
     }
 
     /**
@@ -352,8 +362,10 @@
                     if (config.checkHitEnergy) {    
                         assertTrue("Hit energy " + hit.getCorrectedEnergy() + " is <= 0.", hit.getCorrectedEnergy() > 0.);
                     }
-                    double time = hit.getTime();
-                    assertTrue("Hit time is invalid.", time != 0.);
+                    if (config.checkHitTime) {
+                        double time = hit.getTime();
+                        assertTrue("Hit time is invalid.", time != 0.);
+                    }                    
                 }
             }
         }