lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.1 -r1.2
--- FlushReconstructedParticlesDriver.java 27 Aug 2007 20:16:51 -0000 1.1
+++ FlushReconstructedParticlesDriver.java 16 Jan 2008 19:30:01 -0000 1.2
@@ -41,17 +41,27 @@
Vector<ReconstructedParticle> outputList = new Vector<ReconstructedParticle>();
Vector<Cluster> outputClusterList = new Vector<Cluster>();
for (ReconstructedParticle inputPart : inputList) {
+ // Find all hits in the cluster, being careful to pick
+ // them *all* up even if the various subclusters behave
+ // inconsistently.
Set<CalorimeterHit> hits = new HashSet<CalorimeterHit>();
+ Set<Cluster> allSubClusters = new HashSet<Cluster>();
for (Cluster clus : inputPart.getClusters()) {
- hits.addAll(clus.getCalorimeterHits());
+ allSubClusters.addAll(recursivelyFindSubClusters(clus));
}
+ for (Cluster subClus : allSubClusters) {
+ hits.addAll(subClus.getCalorimeterHits());
+ }
+ // Create the output cluster and particle
BasicCluster outputCluster = new BasicCluster();
for (CalorimeterHit hit : hits) {
outputCluster.addHit(hit);
}
BaseReconstructedParticle outputPart = new BaseReconstructedParticle();
- outputPart.addCluster(outputCluster);
- outputClusterList.add(outputCluster);
+ if (outputCluster.getCalorimeterHits().size() > 0) {
+ outputPart.addCluster(outputCluster);
+ outputClusterList.add(outputCluster);
+ }
for (Track tr : inputPart.getTracks()) {
outputPart.addTrack(tr);
}
@@ -70,6 +80,16 @@
event.put(m_outputParticleListName, outputList, ReconstructedParticle.class, 0);
}
+ protected Set<Cluster> recursivelyFindSubClusters(Cluster clus) {
+ Set<Cluster> output = new HashSet<Cluster>();
+ output.add(clus);
+ for (Cluster subClus : clus.getClusters()) {
+ Set<Cluster> subClusterDaughters = recursivelyFindSubClusters(subClus);
+ output.addAll(subClusterDaughters);
+ }
+ return output;
+ }
+
String m_inputParticleListName;
String m_outputParticleListName;
String m_outputClusterListName;