lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.2 -r1.3
--- ClusterFirstLayerDecision.java 2 Nov 2006 23:02:43 -0000 1.2
+++ ClusterFirstLayerDecision.java 3 Nov 2006 21:54:14 -0000 1.3
@@ -8,7 +8,7 @@
* Accept clusters if their innermost hit is in the first n layers
* (i.e. innermost hit has layer index < n)
*
- * @version $Id: ClusterFirstLayerDecision.java,v 1.2 2006/11/02 23:02:43 mcharles Exp $
+ * @version $Id: ClusterFirstLayerDecision.java,v 1.3 2006/11/03 21:54:14 mcharles Exp $
*/
public class ClusterFirstLayerDecision implements DecisionMakerSingle<Cluster>
@@ -21,11 +21,34 @@
public ClusterFirstLayerDecision(int layerCut) {
m_layerCut = layerCut;
}
+ /** Specify layer cut and hit preselection requirement in constructor. */
+ public ClusterFirstLayerDecision(int layerCut, DecisionMakerSingle<CalorimeterHit> hitDecision) {
+ m_layerCut = layerCut;
+ applyHitRequirement(hitDecision);
+ }
+
+ /**
+ * Apply a cut to hits before checking their layer.
+ * For example, you can require that the hit is in the
+ * ECAL -- that way the valid() method looks at whether
+ * there's a hit in the first n ECAL layers, rather than
+ * the first n ECAL layers or the first n HCAL layers.
+ */
+ public void applyHitRequirement(DecisionMakerSingle<CalorimeterHit> hitDecision) {
+ m_hitCut = hitDecision;
+ }
+ protected DecisionMakerSingle<CalorimeterHit> m_hitCut = null;
public boolean valid(Cluster clus) {
int firstLayer = -1;
CalorimeterHit innermostHit = null;
for (CalorimeterHit hit : clus.getCalorimeterHits()) {
+ if (m_hitCut != null) {
+ if ( ! m_hitCut.valid(hit) ) {
+ // Ignore this hit (fails preselection cut)
+ continue;
+ }
+ }
org.lcsim.geometry.IDDecoder id = hit.getIDDecoder();
id.setID(hit.getCellID());
int layer = id.getLayer();