Commit in hps-java/src/main/java/org/lcsim/hps/util on MAIN | |||
TwoTrackFilterDriver.java | +15 | -26 | 1.2 -> 1.3 |
clean up TwoTrackFIlterDriver, stop it from writing each event twice
diff -u -r1.2 -r1.3 --- TwoTrackFilterDriver.java 11 Mar 2013 02:08:41 -0000 1.2 +++ TwoTrackFilterDriver.java 15 Mar 2013 21:07:28 -0000 1.3 @@ -1,54 +1,43 @@
-/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */
package org.lcsim.hps.util;
-import org.lcsim.hps.util.LCIOFilterDriver; -import java.io.IOException;
import org.lcsim.event.EventHeader; import org.lcsim.event.Track;
-import org.lcsim.util.Driver;
/** * * @author phansson */ public class TwoTrackFilterDriver extends LCIOFilterDriver {
+
private String trackCollectionName = "MatchedTracks";
-
+
public TwoTrackFilterDriver() { }
-
+
public void setTrackCollectionNamePath(String trackCollection) { this.trackCollectionName = trackCollection; }
-
+
@Override boolean eventFilter(EventHeader event) { boolean pass = false;
- - if(!event.hasCollection(Track.class, trackCollectionName)) {
+ + if (!event.hasCollection(Track.class, trackCollectionName)) {
throw new RuntimeException("Error, event doesn't have the track collection"); }
- - if(this.debug) { - System.out.printf("%s: %d tracks in event %d\n",this.getClass().getSimpleName(),event.get(Track.class, trackCollectionName).size(),event.getEventNumber());
+ + if (this.debug) { + System.out.printf("%s: %d tracks in event %d\n", this.getClass().getSimpleName(), event.get(Track.class, trackCollectionName).size(), event.getEventNumber());
}
- - if (event.get(Track.class, trackCollectionName).size()>1) { - try { - if(this.debug) { - System.out.printf("%s: write event %d \n",this.getClass().getSimpleName(),event.getEventNumber()); - } - writer.write(event); - } catch (IOException x) { - throw new RuntimeException("Error writing LCIO file", x);
+ + if (event.get(Track.class, trackCollectionName).size() > 1) { + if (this.debug) { + System.out.printf("%s: write event %d \n", this.getClass().getSimpleName(), event.getEventNumber());
}
+ pass = true;
}
-
+
return pass; }
-
}
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