Print

Print


Commit in lcsim/src/org/lcsim/recon/pfa/identifier on MAIN
LocalHelixExtrapolator.java+661.13 -> 1.14
MJC: Support extrapolation of helix into MCAL

lcsim/src/org/lcsim/recon/pfa/identifier
LocalHelixExtrapolator.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- LocalHelixExtrapolator.java	15 Aug 2008 17:12:54 -0000	1.13
+++ LocalHelixExtrapolator.java	21 Aug 2008 18:36:07 -0000	1.14
@@ -38,24 +38,32 @@
     protected boolean m_init = false;
     protected double m_ECAL_barrel_zmin;
     protected double m_HCAL_barrel_zmin;
+    protected double m_MCAL_barrel_zmin;
     protected double m_ECAL_barrel_zmax;
     protected double m_HCAL_barrel_zmax;
+    protected double m_MCAL_barrel_zmax;
     protected double m_ECAL_barrel_r;
     protected double m_HCAL_barrel_r;
+    protected double m_MCAL_barrel_r;
     protected double m_ECAL_endcap_z;
     protected double m_FCAL_endcap_z;
     protected double m_HCAL_endcap_z;
+    protected double m_MCAL_endcap_z;
     protected Vector<Double> m_ECAL_barrel_layering_r;
     protected Vector<Double> m_HCAL_barrel_layering_r;
+    protected Vector<Double> m_MCAL_barrel_layering_r;
     protected Vector<Double> m_ECAL_endcap_layering_z;
     protected Vector<Double> m_FCAL_endcap_layering_z;
     protected Vector<Double> m_HCAL_endcap_layering_z;
+    protected Vector<Double> m_MCAL_endcap_layering_z;
     protected double m_ECAL_endcap_rmin;
     protected double m_FCAL_endcap_rmin;
     protected double m_HCAL_endcap_rmin;
+    protected double m_MCAL_endcap_rmin;
     protected double m_ECAL_endcap_rmax;
     protected double m_FCAL_endcap_rmax;
     protected double m_HCAL_endcap_rmax;
+    protected double m_MCAL_endcap_rmax;
     protected double[] m_fieldStrength;
     boolean m_barrelValid = false;
     boolean m_endcapValid = false;
@@ -97,21 +105,29 @@
 	CylindricalCalorimeter hdb = ((CylindricalCalorimeter) det.getSubdetectors().get("HADBarrel"));
 	CylindricalCalorimeter hde = ((CylindricalCalorimeter) det.getSubdetectors().get("HADEndcap"));
 	CylindricalCalorimeter fwe = ((CylindricalCalorimeter) det.getSubdetectors().get("ForwardEMEndcap"));
+	CylindricalCalorimeter mub = ((CylindricalCalorimeter) det.getSubdetectors().get("MuonBarrel"));
+	CylindricalCalorimeter mue = ((CylindricalCalorimeter) det.getSubdetectors().get("MuonEndcap"));
 	m_ECAL_barrel_zmin = emb.getZMin();
 	m_HCAL_barrel_zmin = hdb.getZMin();
+	m_MCAL_barrel_zmin = mub.getZMin();
 	m_ECAL_barrel_zmax = emb.getZMax();
 	m_HCAL_barrel_zmax = hdb.getZMax();
+	m_MCAL_barrel_zmax = mub.getZMax();
 	m_ECAL_barrel_r = emb.getLayering().getDistanceToLayerSensorMid(0);
 	m_HCAL_barrel_r = hdb.getLayering().getDistanceToLayerSensorMid(0);
+	m_MCAL_barrel_r = mub.getLayering().getDistanceToLayerSensorMid(0);
 	m_ECAL_endcap_z = eme.getLayering().getDistanceToLayerSensorMid(0);
 	m_FCAL_endcap_z = fwe.getLayering().getDistanceToLayerSensorMid(0);
 	m_HCAL_endcap_z = hde.getLayering().getDistanceToLayerSensorMid(0);
+	m_MCAL_endcap_z = mue.getLayering().getDistanceToLayerSensorMid(0);
 	m_ECAL_endcap_rmin = eme.getInnerRadius();
 	m_FCAL_endcap_rmin = fwe.getInnerRadius();
 	m_HCAL_endcap_rmin = hde.getInnerRadius();
+	m_MCAL_endcap_rmin = mue.getInnerRadius();
 	m_ECAL_endcap_rmax = eme.getOuterRadius();
 	m_FCAL_endcap_rmax = fwe.getOuterRadius();
 	m_HCAL_endcap_rmax = hde.getOuterRadius();
+	m_MCAL_endcap_rmax = mue.getOuterRadius();
 	double[] zero = {0, 0, 0};
 	m_fieldStrength = det.getFieldMap().getField(zero);
 	m_ECAL_barrel_layering_r = new Vector<Double>();
@@ -139,6 +155,16 @@
 	    double z = hde.getLayering().getDistanceToLayerSensorMid(iLayer);
 	    m_HCAL_endcap_layering_z.add(new Double(z));
 	}
+	m_MCAL_barrel_layering_r = new Vector<Double>();
+	for (int iLayer=0; iLayer<hdb.getLayering().getLayerCount(); iLayer++) {
+	    double r = hdb.getLayering().getDistanceToLayerSensorMid(iLayer);
+	    m_MCAL_barrel_layering_r.add(new Double(r));
+	}
+	m_MCAL_endcap_layering_z = new Vector<Double>();
+	for (int iLayer=0; iLayer<hde.getLayering().getLayerCount(); iLayer++) {
+	    double z = hde.getLayering().getDistanceToLayerSensorMid(iLayer);
+	    m_MCAL_endcap_layering_z.add(new Double(z));
+	}
 	m_init = true;
     }
 
@@ -408,6 +434,26 @@
 	}
     }
 
+    public Long extendToMCALLayerAndFindCell(int layer) {
+	Hep3Vector point = extendToMCALLayer(layer);
+	IDDecoder id = null;
+	if (m_barrelValid) {
+	    id = m_event.getDetector().getDecoder("MuonBarrHits");
+	    if (id == null) { throw new AssertionError("Failed to find barrel ID"); }
+	} else if (m_endcapValid) {
+	    id = m_event.getDetector().getDecoder("MuonEndcapHits");
+	    if (id == null) { throw new AssertionError("Failed to find endcap ID"); }
+	}
+	if (id != null) {
+	    long cell = id.findCellContainingXYZ(point);
+	    id.setID(cell);
+	    Hep3Vector cellCenter = id.getPositionVector();
+	    return new Long(cell);
+	} else {
+	    return null;
+	}
+    }
+
     /** Assumes extrapolation has already been done. */
     public Hep3Vector getTangent() {
 	double dphi = 0.01;
@@ -584,6 +630,18 @@
     }
 
     /** Assumes extrapolation has already been done. */
+    public Hep3Vector extendToMCALLayer(int layer) {
+	if (m_barrelValid) {
+	    return extendToMCALBarrelLayer(layer);
+	} else if (m_endcapValid) {
+	    return extendToMCALEndcapLayer(layer);
+	} else {
+	    // No solution
+	    return null;
+	}
+    }
+
+    /** Assumes extrapolation has already been done. */
     public Hep3Vector extendToECALBarrelLayer(int layer) {
 	return extendToBarrelLayer(layer, m_ECAL_barrel_layering_r, m_ECAL_barrel_zmin, m_ECAL_barrel_zmax);
     }
@@ -605,4 +663,12 @@
     public Hep3Vector extendToHCALEndcapLayer(int layer) {
 	return extendToEndcapLayer(layer, m_HCAL_endcap_layering_z, m_HCAL_endcap_rmin, m_HCAL_endcap_rmax);
     }
+    /** Assumes extrapolation has already been done. */
+    public Hep3Vector extendToMCALBarrelLayer(int layer) {
+	return extendToBarrelLayer(layer, m_MCAL_barrel_layering_r, m_MCAL_barrel_zmin, m_MCAL_barrel_zmax);
+    }
+    /** Assumes extrapolation has already been done. */
+    public Hep3Vector extendToMCALEndcapLayer(int layer) {
+	return extendToEndcapLayer(layer, m_MCAL_endcap_layering_z, m_MCAL_endcap_rmin, m_MCAL_endcap_rmax);
+    }
 }
CVSspam 0.2.8