hps-java/src/main/java/org/lcsim/hps/readout/ecal
diff -u -r1.3 -r1.4
--- FADCTriggerDriver.java 2 Apr 2013 01:11:11 -0000 1.3
+++ FADCTriggerDriver.java 2 Sep 2013 21:56:56 -0000 1.4
@@ -23,7 +23,7 @@
*
* @author Omar Moreno <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: FADCTriggerDriver.java,v 1.3 2013/04/02 01:11:11 meeg Exp $
+ * @version $Id: FADCTriggerDriver.java,v 1.4 2013/09/02 21:56:56 phansson Exp $
*/
public class FADCTriggerDriver extends TriggerDriver {
@@ -31,7 +31,7 @@
List<HPSEcalCluster[]> clusterPairs;
int nTriggers;
int totalEvents;
- private double beamEnergy = 2.2 * ECalUtils.GeV;
+ protected double beamEnergy = 2.2 * ECalUtils.GeV;
private double clusterEnergyHigh = 1.85 / 2.2;
private double clusterEnergyLow = .1 / 2.2;
private double energySumThreshold = 1.0;
@@ -104,15 +104,16 @@
this.beamEnergy = beamEnergy * ECalUtils.GeV;
}
+ protected double getBeamEnergyFromDetector(Detector detector) {
+ if (detector.getName().contains("1pt1")) return 1.1;
+ else if (detector.getName().contains("2pt2")) return 2.2;
+ else if (detector.getName().contains("6pt6")) return 6.6;
+ else return -1.0;
+ }
+
@Override
public void detectorChanged(Detector detector) {
- if (detector.getName().contains("1pt1")) {
- setBeamEnergy(1.1);
- } else if (detector.getName().contains("2pt2")) {
- setBeamEnergy(2.2);
- } else if (detector.getName().contains("6pt6")) {
- setBeamEnergy(6.6);
- }
+ setBeamEnergy(this.getBeamEnergyFromDetector(detector));
clusterSumDiff2DAll = aida.histogram2D("All cluster pairs: energy difference vs. sum", 100, 0.0, 2 * beamEnergy, 100, 0.0, beamEnergy);
clusterEnergy2DAll = aida.histogram2D("All cluster pairs: energy (less energetic vs. more energetic)", 100, 0.0, 2 * beamEnergy, 100, 0.0, beamEnergy);
@@ -318,7 +319,7 @@
* @param ecalClusters : List of ECal clusters
* @return true if there are any cluster pairs
*/
- private boolean getClusterPairs(List<HPSEcalCluster> ecalClusters) {
+ protected boolean getClusterPairs(List<HPSEcalCluster> ecalClusters) {
// Create a list which will hold all neighboring cluster to the cluster
// of interest
List< HPSEcalCluster> ecalClusterNeighbors = new LinkedList< HPSEcalCluster>();
@@ -348,7 +349,7 @@
return !clusterPairs.isEmpty();
}
- private boolean getClusterPairsTopBot(List<HPSEcalCluster> ecalClusters) {
+ protected boolean getClusterPairsTopBot(List<HPSEcalCluster> ecalClusters) {
// Create a list which will hold all neighboring cluster to the cluster
// of interest
List< HPSEcalCluster> topClusters = new ArrayList< HPSEcalCluster>();
@@ -385,7 +386,7 @@
* @param clusterPair : pair of clusters
* @return true if opposite quadrants, false otherwise
*/
- private boolean oppositeQuadrantsCut(HPSEcalCluster[] clusterPair) {
+ protected boolean oppositeQuadrantsCut(HPSEcalCluster[] clusterPair) {
int quad1 = ECalUtils.getQuadrant(clusterPair[0]);
int quad2 = ECalUtils.getQuadrant(clusterPair[1]);
@@ -405,7 +406,7 @@
* @param clusterPair : pair of clusters
* @return true if a pair is found, false otherwise
*/
- private boolean clusterECut(HPSEcalCluster[] clusterPair) {
+ protected boolean clusterECut(HPSEcalCluster[] clusterPair) {
return (clusterPair[0].getEnergy() < beamEnergy * clusterEnergyHigh
&& clusterPair[1].getEnergy() < beamEnergy * clusterEnergyHigh
&& clusterPair[0].getEnergy() > beamEnergy * clusterEnergyLow
@@ -419,7 +420,7 @@
* @param clusterPair : pair of clusters
* @return true if a pair is found, false otherwise
*/
- private boolean energySum(Cluster[] clusterPair) {
+ protected boolean energySum(Cluster[] clusterPair) {
double clusterESum = clusterPair[0].getEnergy() + clusterPair[1].getEnergy();
return (clusterESum < beamEnergy * energySumThreshold);
}
@@ -431,7 +432,7 @@
* @param clusterPair : pair of clusters
* @return true if pair is found, false otherwise
*/
- private boolean energyDifference(HPSEcalCluster[] clusterPair) {
+ protected boolean energyDifference(HPSEcalCluster[] clusterPair) {
double clusterEDifference = clusterPair[0].getEnergy() - clusterPair[1].getEnergy();
return (clusterEDifference < beamEnergy * energyDifferenceThreshold);
@@ -444,7 +445,7 @@
* @param clusterPair : pair of clusters
* @return true if pair is found, false otherwise
*/
- private boolean energyDistanceCut(HPSEcalCluster[] clusterPair) {
+ protected boolean energyDistanceCut(HPSEcalCluster[] clusterPair) {
HPSEcalCluster lowEnergyCluster = clusterPair[1];
// Calculate its position
@@ -461,23 +462,23 @@
* @param clusterPair : pair of clusters
* @return true if pair is found, false otherwise
*/
- private boolean coplanarityCut(HPSEcalCluster[] clusterPair) {
+ protected boolean coplanarityCut(HPSEcalCluster[] clusterPair) {
return (Math.abs(pairUncoplanarity(clusterPair)) < maxCoplanarityAngle);
}
- private double pairUncoplanarity(HPSEcalCluster[] clusterPair) { // Find the angle between clusters in the pair
+ protected double pairUncoplanarity(HPSEcalCluster[] clusterPair) { // Find the angle between clusters in the pair
double cluster1Angle = (getClusterAngle(clusterPair[0]) + 180.0) % 180.0;
double cluster2Angle = (getClusterAngle(clusterPair[1]) + 180.0) % 180.0;
return cluster2Angle - cluster1Angle;
}
- private double getClusterAngle(HPSEcalCluster cluster) { //returns angle in range of -180 to 180
+ 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]));
}
- private double getClusterDistance(HPSEcalCluster cluster) {
+ protected double getClusterDistance(HPSEcalCluster cluster) {
return Math.hypot(cluster.getSeedHit().getPosition()[0], cluster.getSeedHit().getPosition()[1]);
}
}
\ No newline at end of file