Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/SteveMagill on MAIN | |||
CombineRPLists.java | +48 | added 1.1 |
diff -N CombineRPLists.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ CombineRPLists.java 14 Feb 2012 19:15:49 -0000 1.1 @@ -0,0 +1,48 @@
+package org.lcsim.contrib.SteveMagill; + +/* + * CombineRPLists.java + * + * Revised CombineClLists + * + * Utility to combine a set of RPLists into 1 RPList + */ + +import java.util.*; +import org.lcsim.event.EventHeader; +import org.lcsim.util.Driver; +import org.lcsim.event.ReconstructedParticle; + +/** + * + * @author cassell + */ +public class CombineRPLists extends Driver +{ + + /** Creates a new instance of CombineRPLists */ + String[] inName; + String outName; + public CombineRPLists(String[] in, String out) + { + inName = in; + outName = out; + } + + protected void process(EventHeader event) + { + List<ReconstructedParticle> outRPList = new ArrayList<ReconstructedParticle>(); + List<List<ReconstructedParticle>> all = event.get(ReconstructedParticle.class); + for(List<ReconstructedParticle> cl:all) + { + for(int i=0;i<inName.length;i++) + { + if(event.getMetaData(cl).getName().compareTo(inName[i]) == 0) + { + outRPList.addAll(cl); + } + } + } + event.put(outName,outRPList, ReconstructedParticle.class,0); + } +}
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