lcsim/src/org/lcsim/contrib/uiowa/MuonFinder
diff -N SimpleMipQualityDecision.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SimpleMipQualityDecision.java 28 Sep 2008 06:32:55 -0000 1.1
@@ -0,0 +1,62 @@
+package org.lcsim.contrib.uiowa.MuonFinder;
+
+import java.util.*;
+
+import org.lcsim.util.*;
+import org.lcsim.util.decision.*;
+import org.lcsim.geometry.subdetector.CylindricalCalorimeter;
+import org.lcsim.geometry.*;
+import org.lcsim.event.*;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.contrib.uiowa.ReclusterDriver;
+/**
+ * A class to look at whether a calorimeter cluster is
+ * consistent with being a track/MIP. Criteria are based on
+ *
+ * modified from the code written by Mat.
+ */
+
+
+public class SimpleMipQualityDecision
+{
+ private int count;
+
+ public SimpleMipQualityDecision() {
+ // No user-settable options for now
+ }
+
+ public boolean valid(Cluster mip) {
+ // How many layers in this MIP?
+ // And how many instances of >1 hit in a layer?
+ Set<Integer> layersSeen = new HashSet<Integer>();
+ Set<Integer> isolayer = new HashSet<Integer>();
+ CalorimeterHit outhit = null;
+ int max = 0;
+ for (CalorimeterHit hit : mip.getCalorimeterHits()) {
+ int layer = getLayer(hit);
+ Integer layerInt = new Integer(layer);
+ if (!layersSeen.contains(layerInt)) {
+ layersSeen.add(layerInt);
+ isolayer.add(layerInt);
+ } else {
+ isolayer.remove(layerInt);
+ }
+ if(layer > max){
+ max = layer;
+ }
+ }
+
+ if( max < 5) { count = 3;}
+ else count = 0;
+
+ boolean pass = (isolayer.size() >= count);
+ return pass;
+ }
+
+ protected int getLayer(CalorimeterHit hit) {
+ org.lcsim.geometry.IDDecoder id = hit.getIDDecoder();
+ id.setID(hit.getCellID());
+ int layer = id.getLayer();
+ return layer;
+ }
+}