java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCTriggerDriver.java 2014-04-08 01:02:43 UTC (rev 465)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/FADCTriggerDriver.java 2014-04-08 01:05:06 UTC (rev 466)
@@ -42,6 +42,7 @@
private double energyDistanceThreshold = 0.5;
// maximum time difference between two clusters, in units of readout cycles (4 ns).
private int pairCoincidence = 2;
+ private double originX = 1393.0 * Math.tan(0.03052); //ECal midplane, defined by photon beam position (30.52 mrad) at ECal face (z=1393 mm)
int allPairs;
int oppositeQuadrantCount;
int clusterEnergyCount;
@@ -126,6 +127,16 @@
this.pairCoincidence = pairCoincidence;
}
+ /**
+ * Set X coordinate used as the origin for cluster coplanarity and distance
+ * calculations. Defaults to the ECal midplane.
+ *
+ * @param originX
+ */
+ public void setOriginX(double originX) {
+ this.originX = originX;
+ }
+
@Override
public void detectorChanged(Detector detector) {
setBeamEnergy(this.getBeamEnergyFromDetector(detector));
@@ -512,10 +523,10 @@
protected double getClusterAngle(HPSEcalCluster cluster) { //returns angle in range of -180 to 180
double position[] = cluster.getSeedHit().getPosition();
- return Math.toDegrees(Math.atan2(position[1], position[0]));
+ return Math.toDegrees(Math.atan2(position[1], position[0] - originX));
}
protected double getClusterDistance(HPSEcalCluster cluster) {
- return Math.hypot(cluster.getSeedHit().getPosition()[0], cluster.getSeedHit().getPosition()[1]);
+ return Math.hypot(cluster.getSeedHit().getPosition()[0] - originX, cluster.getSeedHit().getPosition()[1]);
}
}
\ No newline at end of file