Commit in lcsim/src/org/lcsim/contrib/onoprien/crux on MAIN
auxdrivers/HitMapFilterDriver.java+27-71.4 -> 1.5
infrastructure/CruxHitMap.java+10-61.5 -> 1.6
+37-13
2 modified files


lcsim/src/org/lcsim/contrib/onoprien/crux/auxdrivers
HitMapFilterDriver.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- HitMapFilterDriver.java	5 Dec 2008 00:05:30 -0000	1.4
+++ HitMapFilterDriver.java	6 Dec 2008 21:53:29 -0000	1.5
@@ -25,7 +25,7 @@
  * used by the filter to look up hits by their <tt>CellID</tt>.
  *
  * @author D. Onoprienko
- * @version $Id: HitMapFilterDriver.java,v 1.4 2008/12/05 00:05:30 onoprien Exp $
+ * @version $Id: HitMapFilterDriver.java,v 1.5 2008/12/06 21:53:29 onoprien Exp $
  */
 public class HitMapFilterDriver extends Driver {
   
@@ -60,7 +60,7 @@
    *         output collection. If <tt>null</tt>, no filtering will be applied.<br>
    *         The third value is either "MAP" or "LIST", depending on whether the output 
    *         should be a {@link CruxHitMap} or an <tt>ArrayList&lt;CalorimeterHit&gt;</tt>.<br>
-   *         Filter and output type arguments can be omitted (no filtering and "MAP" output are assumed).<br>
+   *         Filter and/or output type arguments can be omitted (no filtering and "MAP" output are assumed).<br>
    *         Several output collections can be created, each with its own filter, by calling
    *         this method repeatedly.</dd>
    * <dt>"ID_TO_HIT_MAP"</dt> <dd>Name of the map (of type <tt>Map&lt;Long,CalorimeterHit&gt;</tt>)
@@ -90,13 +90,33 @@
         if (values.length > 3 || values.length < 1) throw new IllegalArgumentException(ERR_INV + name);
         _outNames.add((String)(values[0]));
         if (values.length > 1) {
-          _filters.add((CruxHitFilter)(values[1]));
+          if (values[1] instanceof CruxHitFilter) {
+            _filters.add((CruxHitFilter)(values[1]));
+            if (values.length > 2) {
+              String type = (String)(values[2]);
+              if (type.equalsIgnoreCase("MAP")) {
+                _isMap.add(true);
+              } else if (type.equalsIgnoreCase("LIST")) {
+                _isMap.add(false);
+              } else {
+                throw new IllegalArgumentException(ERR_IV + name);
+              }
+            } else {
+              _isMap.add(true);
+            }
+          } else {
+            _filters.add(null);
+            String type = (String)(values[1]);
+            if (type.equalsIgnoreCase("MAP")) {
+              _isMap.add(true);
+            } else if (type.equalsIgnoreCase("LIST")) {
+              _isMap.add(false);
+            } else {
+              throw new IllegalArgumentException(ERR_IV + name);
+            }
+          }
         } else {
           _filters.add(null);
-        }
-        if (values.length > 2) {
-          _isMap.add((Boolean)(values[2]));
-        } else {
           _isMap.add(true);
         }
         _outNames.trimToSize();

lcsim/src/org/lcsim/contrib/onoprien/crux/infrastructure
CruxHitMap.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- CruxHitMap.java	2 Dec 2008 23:56:08 -0000	1.5
+++ CruxHitMap.java	6 Dec 2008 21:53:29 -0000	1.6
@@ -13,7 +13,7 @@
  * // FIXME: need to structure by module to speed up access
  *
  * @author D. Onoprienko
- * @version $Id: CruxHitMap.java,v 1.5 2008/12/02 23:56:08 onoprien Exp $
+ * @version $Id: CruxHitMap.java,v 1.6 2008/12/06 21:53:29 onoprien Exp $
  */
 public class CruxHitMap extends org.lcsim.util.hitmap.HitMap {
   
@@ -58,14 +58,18 @@
   
   public ArrayList<CalorimeterHit> getList(CruxHitFilter filter) {
     ArrayList<CalorimeterHit> out = new ArrayList<CalorimeterHit>(size());
-    filter.setHitMap(this);
-    for (CalorimeterHit hit : values()) {
-      if (filter.pass(hit)) out.add(hit);
+    if (filter == null) {
+      out.addAll(values());
+    } else {
+      filter.setHitMap(this);
+      for (CalorimeterHit hit : values()) {
+        if (filter.pass(hit)) out.add(hit);
+      }
+      filter.setHitMap(null);
     }
-    filter.setHitMap(null);
     return out;
   }
-  
+ 
   public CruxHitMap getMap(CruxHitFilter filter) {
     ArrayList<CalorimeterHit> hits = getList(filter);
     CruxHitMap out = new CruxHitMap((int)(hits.size()*1.5));
CVSspam 0.2.8