1 added + 5 modified, total 6 files
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -N HPSECalUtils.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSECalUtils.java 23 Aug 2012 18:48:18 -0000 1.1
@@ -0,0 +1,43 @@
+package org.lcsim.hps.recon.ecal;
+
+import org.lcsim.event.CalorimeterHit;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: HPSECalUtils.java,v 1.1 2012/08/23 18:48:18 meeg Exp $
+ */
+public class HPSECalUtils {
+
+ /**
+ * Returns the quadrant which contains the ECal cluster
+ *
+ * @param ecalCluster : ECal cluster
+ * @return Quadrant number
+ */
+ public static int getQuadrant(HPSEcalCluster ecalCluster) {
+ return getQuadrant(ecalCluster.getSeedHit());
+ }
+
+ public static int getQuadrant(CalorimeterHit hit) {
+ int ix = hit.getIdentifierFieldValue("ix");
+ int iy = hit.getIdentifierFieldValue("iy");
+ return getQuadrant(ix, iy);
+ }
+
+ public static int getQuadrant(int x, int y) {
+ if (x > 0) {
+ if (y > 0) {
+ return 1;
+ } else {
+ return 4;
+ }
+ } else {
+ if (y > 0) {
+ return 2;
+ } else {
+ return 3;
+ }
+ }
+ }
+}
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.7 -r1.8
--- HPSFADCTriggerDriver.java 2 Aug 2012 20:32:15 -0000 1.7
+++ HPSFADCTriggerDriver.java 23 Aug 2012 18:48:18 -0000 1.8
@@ -1,13 +1,9 @@
package org.lcsim.hps.recon.ecal;
-import java.io.IOException;
-import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.List;
-import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
-import org.lcsim.event.EventHeader;
import org.lcsim.hps.util.ClockSingleton;
/**
@@ -16,7 +12,7 @@
*
* @author Omar Moreno <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSFADCTriggerDriver.java,v 1.7 2012/08/02 20:32:15 meeg Exp $
+ * @version $Id: HPSFADCTriggerDriver.java,v 1.8 2012/08/23 18:48:18 meeg Exp $
*/
public class HPSFADCTriggerDriver extends HPSTriggerDriver {
@@ -57,6 +53,7 @@
deadtimelessTriggerCount = 0;
}
+ @Override
public boolean testTrigger(List<HPSEcalCluster> clusters) {
boolean trigger = false;
@@ -72,8 +69,8 @@
if (outputStream != null) {
outputStream.printf("Event %d: cluster pair (energy %f in quadrant %d, energy %f in quadrant %d)\n",
ClockSingleton.getClock(),
- clusterPair[0].getEnergy(), getECalQuadrant(clusterPair[0]),
- clusterPair[1].getEnergy(), getECalQuadrant(clusterPair[1]));
+ clusterPair[0].getEnergy(), HPSECalUtils.getQuadrant(clusterPair[0]),
+ clusterPair[1].getEnergy(), HPSECalUtils.getQuadrant(clusterPair[1]));
}
// Require that the event have at least two clusters in opposite
@@ -216,44 +213,19 @@
* @return true if opposite quadrants, false otherwise
*/
public boolean oppositeQuadrantsCut(HPSEcalCluster[] clusterPair) {
- int quad1 = getECalQuadrant(clusterPair[0]);
- int quad2 = getECalQuadrant(clusterPair[1]);
+ int quad1 = HPSECalUtils.getQuadrant(clusterPair[0]);
+ int quad2 = HPSECalUtils.getQuadrant(clusterPair[1]);
//if clusters are in the same quadrant, they're not opposite quadrants
if (quad1 == quad2) {
return false;
- } //opposite pairs of quadrants are either both even (2 and 4) or both off (1 and 3)
+ } //opposite pairs of quadrants are either both even (2 and 4) or both odd (1 and 3)
else {
return ((quad1 & 1) == (quad2 & 1));
}
}
/**
- * Returns the quadrant which contains the ECal cluster
- *
- * @param ecalCluster : ECal cluster
- * @return Quadrant number
- */
- public int getECalQuadrant(HPSEcalCluster ecalCluster) {
- dec.setID(ecalCluster.getSeedHit().getCellID());
- int ix = dec.getValue("ix");
- int iy = dec.getValue("iy");
- if (ix > 0) {
- if (iy > 0) {
- return 1;
- } else {
- return 4;
- }
- } else {
- if (iy > 0) {
- return 2;
- } else {
- return 3;
- }
- }
- }
-
- /**
* Checks if the ECal clusters making up a cluster pair lie above the low
* energy threshold and below the high energy threshold
*
@@ -298,10 +270,6 @@
* Require that the distance from the beam of the lowest energy cluster in a
* cluster pair satisfies the following E_low + d_b*.0032 GeV/mm < .8 GeV
*
- *
- *
-
- *
* @param clusterPair : pair of clusters
* @return true if pair is found, false otherwise
*/
@@ -315,7 +283,7 @@
lowEnergyCluster = clusterPair[1];
}
- double lowEClusterPosition[] = hitPosition(lowEnergyCluster.getSeedHit());
+ double lowEClusterPosition[] = lowEnergyCluster.getSeedHit().getPosition();
// Calculate its position
double lowEClusterDistance = Math.sqrt(Math.pow(lowEClusterPosition[0], 2)
+ Math.pow(lowEClusterPosition[1], 2));
@@ -338,8 +306,8 @@
* @return true if pair is found, false otherwise
*/
public boolean coplanarityCut(HPSEcalCluster[] clusterPair) {
- double cluster1Position[] = hitPosition(clusterPair[0].getSeedHit());
- double cluster2Position[] = hitPosition(clusterPair[1].getSeedHit());
+ double cluster1Position[] = clusterPair[0].getSeedHit().getPosition();
+ double cluster2Position[] = clusterPair[1].getSeedHit().getPosition();
// Find the distance of both clusters from the origin
double cluster1Dist = Math.sqrt(Math.pow(cluster1Position[0], 2)
+ Math.pow(cluster1Position[1], 2));
@@ -357,21 +325,4 @@
return ((180 - phi) < maxCoplanarityAngle);
}
-
- /**
- * Finds position of an ECal hit using the crystal ID
- *
- * @param hit : ECal hit
- * @return [x,y] of crystal center in units of mm
- */
- public double[] hitPosition(CalorimeterHit hit) {
- dec.setID(hit.getCellID());
- int ix = dec.getValue("ix");
- int iy = dec.getValue("iy");
- double position[] = new double[2];
- position[0] = crystalX * ix;
- position[1] = crystalY * iy + beamGap * Math.signum(iy);
-
- return position;
- }
}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.7 -r1.8
--- HPSEcalCluster.java 22 Jun 2012 18:50:24 -0000 1.7
+++ HPSEcalCluster.java 23 Aug 2012 18:48:18 -0000 1.8
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.lcsim.hps.recon.ecal;
import hep.physics.vec.BasicHep3Vector;
@@ -17,15 +13,15 @@
* Cluster with position defined by seed hit (for 1-bit trigger)
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalCluster.java,v 1.7 2012/06/22 18:50:24 phansson Exp $
+ * @version $Id: HPSEcalCluster.java,v 1.8 2012/08/23 18:48:18 meeg Exp $
*/
public class HPSEcalCluster extends BasicCluster {
- CalorimeterHit seedHit = null;
- long cellID;
+ private CalorimeterHit seedHit = null;
+ private long cellID;
- static double eCriticalW = 800/(74+1); //MeV
- static double radLenW = 8.8; //mm
+ static final double eCriticalW = 800/(74+1); //MeV
+ static final double radLenW = 8.8; //mm
double[] electronPosAtDepth = new double[3];
private boolean needsElectronPosCalculation = true;
double[] photonPosAtDepth = new double[3];
@@ -56,6 +52,7 @@
// return getSeedHit().getPosition();
// }
//
+ @Override
public double[] getPosition() {
//Electron by default!?
return this.getPositionAtShowerMax(true);
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.23 -r1.24
--- HPSEcalClusterer.java 2 Aug 2012 20:32:15 -0000 1.23
+++ HPSEcalClusterer.java 23 Aug 2012 18:48:18 -0000 1.24
@@ -23,13 +23,13 @@
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim Nelson <[log in to unmask]>
*
- * @version $Id: HPSEcalClusterer.java,v 1.23 2012/08/02 20:32:15 meeg Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.24 2012/08/23 18:48:18 meeg Exp $
*/
public class HPSEcalClusterer extends Driver {
HPSEcal3 ecal;
String ecalCollectionName;
- String ecalName;
+ String ecalName = "Ecal";
String clusterCollectionName = "EcalClusters";
// Minimum E for cluster seed.
double seedEMin = .05;
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.14 -r1.15
--- HPSTriggerDriver.java 3 Aug 2012 00:05:26 -0000 1.14
+++ HPSTriggerDriver.java 23 Aug 2012 18:48:18 -0000 1.15
@@ -8,9 +8,6 @@
import org.lcsim.event.EventHeader;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.Subdetector;
import org.lcsim.hps.recon.tracking.apv25.HPSAPV25;
import org.lcsim.hps.util.ClockSingleton;
import org.lcsim.util.Driver;
@@ -21,14 +18,11 @@
* Applies SVT trigger latency and sends trigger signal to SVT
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSTriggerDriver.java,v 1.14 2012/08/03 00:05:26 meeg Exp $
+ * @version $Id: HPSTriggerDriver.java,v 1.15 2012/08/23 18:48:18 meeg Exp $
*/
public abstract class HPSTriggerDriver extends Driver {
- protected Subdetector ecal;
- private String ecalName = "Ecal";
protected String clusterCollectionName = "EcalClusters";
- protected IDDecoder dec = null;
private String outputFileName;
protected PrintWriter outputStream = null;
protected int numTriggers;
@@ -63,10 +57,6 @@
this.clusterCollectionName = clusterCollectionName;
}
- public void setEcalName(String ecalName) {
- this.ecalName = ecalName;
- }
-
public void setOutputFileName(String outputFileName) {
this.outputFileName = outputFileName;
}
@@ -77,10 +67,6 @@
throw new RuntimeException("The parameter clusterCollectionName was not set!");
}
- if (ecalName == null) {
- throw new RuntimeException("The parameter ecalName was not set!");
- }
-
if (outputFileName != null) {
try {
outputStream = new PrintWriter(outputFileName);
@@ -96,15 +82,6 @@
}
@Override
- public void detectorChanged(Detector detector) {
- // Get the Subdetector.
- ecal = detector.getSubdetector(ecalName);
-
- // Cache ref to decoder.
- dec = ecal.getIDDecoder();
- }
-
- @Override
public void process(EventHeader event) {
triggerBit = false; //reset trigger
//System.out.println(this.getClass().getCanonicalName() + " - process");
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.2 -r1.3
--- HPS1BitTriggerDriver.java 2 Aug 2012 20:32:15 -0000 1.2
+++ HPS1BitTriggerDriver.java 23 Aug 2012 18:48:18 -0000 1.3
@@ -1,43 +1,30 @@
package org.lcsim.hps.recon.ecal;
import java.util.List;
-import org.lcsim.event.EventHeader;
/**
* Reads clusters and makes trigger decision using opposite quadrant criterion.
* Prints triggers to file if file path specified.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPS1BitTriggerDriver.java,v 1.2 2012/08/02 20:32:15 meeg Exp $
+ * @version $Id: HPS1BitTriggerDriver.java,v 1.3 2012/08/23 18:48:18 meeg Exp $
*/
public class HPS1BitTriggerDriver extends HPSTriggerDriver {
- public HPS1BitTriggerDriver() {
- }
- public boolean testTrigger(List<HPSEcalCluster> clusters) {
+ public HPS1BitTriggerDriver() {
+ }
- boolean quadrants[] = new boolean[4];
+ @Override
+ public boolean testTrigger(List<HPSEcalCluster> clusters) {
- for (HPSEcalCluster clus : clusters) {
- dec.setID(clus.getSeedHit().getCellID());
- int ix = dec.getValue("ix");
- int iy = dec.getValue("iy");
- //System.out.printf("ix = %d, iy = %d\n", ix, iy);
+ boolean quadrants[] = new boolean[4];
- if (ix > 0) {
- if (iy > 0) {
- quadrants[0] = true;
- } else {
- quadrants[3] = true;
- }
- } else {
- if (iy > 0) {
- quadrants[1] = true;
- } else {
- quadrants[2] = true;
- }
- }
- }
- return (quadrants[0] && quadrants[2]) || (quadrants[1] && quadrants[3]);
- }
+ for (HPSEcalCluster clus : clusters) {
+// int ix = clus.getSeedHit().getIdentifierFieldValue("ix");
+// int iy = clus.getSeedHit().getIdentifierFieldValue("iy");
+ //System.out.printf("ix = %d, iy = %d\n", ix, iy);
+ quadrants[HPSECalUtils.getQuadrant(clus)] = true;
+ }
+ return (quadrants[0] && quadrants[2]) || (quadrants[1] && quadrants[3]);
+ }
}
CVSspam 0.2.12