Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/util on MAIN
HPSTwoTrackFilterDriver.java+46added 1.1
Two track event filtering implementation

hps-java/src/main/java/org/lcsim/hps/util
HPSTwoTrackFilterDriver.java added at 1.1
diff -N HPSTwoTrackFilterDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HPSTwoTrackFilterDriver.java	10 Jan 2013 18:11:46 -0000	1.1
@@ -0,0 +1,46 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.util;
+
+import org.lcsim.hps.util.HPSLCIOFilterDriver;
+import java.io.IOException;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author phansson
+ */
+public class HPSTwoTrackFilterDriver extends HPSLCIOFilterDriver {
+    private String trackCollectionName = "MatchedTracks";
+    
+    public HPSTwoTrackFilterDriver() {
+    }
+    
+    public void setTrackCollectionNamePath(String trackCollection) {
+        this.trackCollectionName = trackCollection;
+    }
+    
+    @Override
+    boolean eventFilter(EventHeader event) {
+        boolean pass = false;
+        
+        if(!event.hasCollection(Track.class, trackCollectionName)) {
+            throw new RuntimeException("Error, event doesn't have the track collection");
+        }
+        if (event.get(Track.class, trackCollectionName).size()>1) {
+            try {
+                writer.write(event);
+            } catch (IOException x) {
+                throw new RuntimeException("Error writing LCIO file", x);
+            }
+        }
+
+        
+        return pass;
+    }
+    
+}
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