lcsim/src/org/lcsim/contrib/onoprien/crux/auxdrivers
diff -u -r1.5 -r1.6
--- HitMapFilterDriver.java 6 Dec 2008 21:53:29 -0000 1.5
+++ HitMapFilterDriver.java 7 Dec 2008 23:58:45 -0000 1.6
@@ -25,13 +25,14 @@
* used by the filter to look up hits by their <tt>CellID</tt>.
*
* @author D. Onoprienko
- * @version $Id: HitMapFilterDriver.java,v 1.5 2008/12/06 21:53:29 onoprien Exp $
+ * @version $Id: HitMapFilterDriver.java,v 1.6 2008/12/07 23:58:45 onoprien Exp $
*/
public class HitMapFilterDriver extends Driver {
// -- Constructors : ----------------------------------------------------------
public HitMapFilterDriver() {
+ set("LOG_LEVEL", Level.ALL);
}
// -- Setters : ---------------------------------------------------------------
@@ -57,7 +58,7 @@
* <dt>"OUTPUT"</dt> <dd>The first value is the name under which the output collection should
* be saved into the event record.<br> The second value is the {@link CruxHitFilter} object
* to be used for filtering - only hits that pass the filter will be added to this
- * output collection. If <tt>null</tt>, no filtering will be applied.<br>
+ * output collection.<br>
* The third value is either "MAP" or "LIST", depending on whether the output
* should be a {@link CruxHitMap} or an <tt>ArrayList<CalorimeterHit></tt>.<br>
* Filter and/or output type arguments can be omitted (no filtering and "MAP" output are assumed).<br>
@@ -105,7 +106,7 @@
_isMap.add(true);
}
} else {
- _filters.add(null);
+ _filters.add(CruxHitFilter.ALL);
String type = (String)(values[1]);
if (type.equalsIgnoreCase("MAP")) {
_isMap.add(true);
@@ -116,7 +117,7 @@
}
}
} else {
- _filters.add(null);
+ _filters.add(CruxHitFilter.ALL);
_isMap.add(true);
}
_outNames.trimToSize();
@@ -151,11 +152,11 @@
// Fetch default hit map and assign it to filters
- Map<Long, CalorimeterHit> defMap = (_defMapName == null) ? null : (Map<Long, CalorimeterHit>) event.get(_defMapName);
- if (defMap != null) {
- for (int i=0; i<nOut; i++) {
- CruxHitFilter filter = _filters.get(i);
- if (filter != null) filter.setHitMap(defMap);
+ Map<Long, CalorimeterHit> defMap = null;
+ if (_defMapName != null) {
+ defMap = (Map<Long, CalorimeterHit>) event.get(_defMapName);
+ for (CruxHitFilter filter : _filters) {
+ filter.setHitMap(defMap);
}
}
@@ -248,6 +249,7 @@
}
outMap.add(outSet);
event.put(_outNames.get(out), outMap);
+ log("Saved hit map "+ _outNames.get(out) +" with "+ outMap.values().size() +" hits", Level.FINER);
} else {
if (old != null) {
try {
@@ -259,6 +261,7 @@
}
ArrayList<CalorimeterHit> outputList = new ArrayList<CalorimeterHit>(outSet);
event.put(_outNames.get(out), outputList, CalorimeterHit.class, 0);
+ log("Saved hit list "+ _outNames.get(out) +" with "+ outputList.size() +" hits", Level.FINER);
}
}
lcsim/src/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.1 -r1.2
--- CruxHitFilter.java 2 Apr 2008 22:30:10 -0000 1.1
+++ CruxHitFilter.java 7 Dec 2008 23:58:46 -0000 1.2
@@ -14,10 +14,14 @@
* with this filter through a call to <tt>setHitMap</tt>.
*
* @author D. Onoprienko
- * @version $Id: CruxHitFilter.java,v 1.1 2008/04/02 22:30:10 onoprien Exp $
+ * @version $Id: CruxHitFilter.java,v 1.2 2008/12/07 23:58:46 onoprien Exp $
*/
abstract public class CruxHitFilter {
+// -- Private parts : ---------------------------------------------------------
+
+ protected Map<Long, CalorimeterHit> _hitMap;
+
// -- Constructors : ----------------------------------------------------------
public CruxHitFilter() {
@@ -71,8 +75,12 @@
return pass(hit.getCellID());
}
-// -- Private parts : ---------------------------------------------------------
-
- protected Map<Long, CalorimeterHit> _hitMap;
+// -- Pass-all filter : -------------------------------------------------------
+
+ /** Filter that passes all hits. */
+ static final public CruxHitFilter ALL = new CruxHitFilter() {
+ public boolean pass(long cellID) {return true;}
+ public boolean pass(CalorimeterHit hit) {return true;}
+ };
}