lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.4 -r1.5
--- ClusterFirstLayerDecision.java 6 Nov 2006 21:34:14 -0000 1.4
+++ ClusterFirstLayerDecision.java 15 May 2007 01:52:03 -0000 1.5
@@ -1,19 +1,35 @@
package org.lcsim.recon.cluster.util;
+import hep.physics.vec.*;
+
import org.lcsim.event.Cluster;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.util.decision.*;
+import org.lcsim.geometry.subdetector.CylindricalCalorimeter;
+import org.lcsim.geometry.Detector;
+import org.lcsim.event.EventHeader;
/**
* Accept clusters if their innermost hit is in the first n layers
- * (i.e. innermost hit has layer index < n)
+ * (i.e. innermost hit has layer index < n).
+ *
+ * There is a special case which is a little tricky.
+ * In the barrel/endcap scheme, there can be corner regions
+ * which are in an early layer of one subdetector but which
+ * aren't really on the front surface of the calorimeter.
+ * Optionally, we can
+ * check for these and reject corner hits if a particle
+ * would have to pass through > n layers to reach them.
*
- * @version $Id: ClusterFirstLayerDecision.java,v 1.4 2006/11/06 21:34:14 mcharles Exp $
+ * @version $Id: ClusterFirstLayerDecision.java,v 1.5 2007/05/15 01:52:03 mcharles Exp $
*/
public class ClusterFirstLayerDecision implements DecisionMakerSingle<Cluster>
{
int m_layerCut;
+ boolean m_ignoreCorners = false;
+ /** Optionally, we can veto corner hits. */
+ public void setIgnoreCorners(boolean ignoreCorners) { m_ignoreCorners = ignoreCorners; }
/**
* Simple constructor
@@ -49,6 +65,23 @@
continue;
}
}
+ if (m_ignoreCorners) {
+ if (!m_initGeom) { throw new AssertionError("Geometry information not passed to "+this.getClass().getName()); }
+ org.lcsim.geometry.Subdetector subdet = hit.getSubdetector();
+ Hep3Vector hitPosition = new BasicHep3Vector(hit.getPosition());
+ double r = Math.sqrt(hitPosition.x()*hitPosition.x() + hitPosition.y()*hitPosition.y());
+ if (subdet.getName().compareTo("EMBarrel") == 0) {
+ if ( Math.abs(hitPosition.z()) > Math.abs(m_ECAL_endcap_layerN_z) ) { continue; }
+ } else if (subdet.getName().compareTo("EMEndcap") == 0) {
+ if ( r > Math.abs(m_ECAL_barrel_layerN_r) ) { continue; }
+ } else if (subdet.getName().compareTo("HADBarrel") == 0) {
+ if ( Math.abs(hitPosition.z()) > Math.abs(m_HCAL_endcap_layerN_z) ) { continue; }
+ } else if (subdet.getName().compareTo("HADEndcap") == 0) {
+ if ( r > Math.abs(m_HCAL_barrel_layerN_r) ) { continue; }
+ } else {
+ throw new AssertionError("Unrecognised event component: '"+subdet.getName()+"'");
+ }
+ }
org.lcsim.geometry.IDDecoder id = hit.getIDDecoder();
id.setID(hit.getCellID());
int layer = id.getLayer();
@@ -64,4 +97,22 @@
return (firstLayer < m_layerCut);
}
}
+
+ protected boolean m_initGeom = false;
+ protected double m_ECAL_barrel_layerN_r;
+ protected double m_ECAL_endcap_layerN_z;
+ protected double m_HCAL_barrel_layerN_r;
+ protected double m_HCAL_endcap_layerN_z;
+ public void initGeometry(EventHeader event) {
+ m_initGeom = true;
+ Detector det = event.getDetector();
+ CylindricalCalorimeter ecal_barrel = ((CylindricalCalorimeter) det.getSubdetectors().get("EMBarrel"));
+ CylindricalCalorimeter ecal_endcap = ((CylindricalCalorimeter) det.getSubdetectors().get("EMEndcap"));
+ CylindricalCalorimeter hcal_barrel = ((CylindricalCalorimeter) det.getSubdetectors().get("HADBarrel"));
+ CylindricalCalorimeter hcal_endcap = ((CylindricalCalorimeter) det.getSubdetectors().get("HADEndcap"));
+ m_ECAL_barrel_layerN_r = ecal_barrel.getLayering().getDistanceToLayerSensorMid(m_layerCut);
+ m_ECAL_endcap_layerN_z = ecal_endcap.getLayering().getDistanceToLayerSensorMid(m_layerCut);
+ m_HCAL_barrel_layerN_r = hcal_barrel.getLayering().getDistanceToLayerSensorMid(m_layerCut);
+ m_HCAL_endcap_layerN_z = hcal_endcap.getLayering().getDistanceToLayerSensorMid(m_layerCut);
+ }
}