21 modified files
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.9 -r1.10
--- HPSEcalCluster.java 27 Aug 2012 21:53:47 -0000 1.9
+++ HPSEcalCluster.java 8 Dec 2012 01:12:16 -0000 1.10
@@ -13,14 +13,14 @@
* Cluster with position defined by seed hit (for 1-bit trigger)
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalCluster.java,v 1.9 2012/08/27 21:53:47 meeg Exp $
+ * @version $Id: HPSEcalCluster.java,v 1.10 2012/12/08 01:12:16 meeg Exp $
*/
public class HPSEcalCluster extends BasicCluster {
private CalorimeterHit seedHit = null;
private long cellID;
- static final double eCriticalW = 800/(74+1); //MeV
+ static final double eCriticalW = 800.0*HPSECalUtils.MeV/(74+1);
static final double radLenW = 8.8; //mm
double[] electronPosAtDepth = new double[3];
private boolean needsElectronPosCalculation = true;
@@ -96,7 +96,7 @@
public double[] calculatePositionAtDepth(List<CalorimeterHit> hits, double dmax)
{
- //copy form package org.lcsim.recon.cluster.util;
+ //copy from package org.lcsim.recon.cluster.util.TensorClusterPropertyCalculator;
double positionErrorLocal[] = new double[6];
double directionErrorLocal[] = new double[6];
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.3 -r1.4
--- HPSEcal1BitClusterVetoClusterer.java 21 Oct 2011 20:32:15 -0000 1.3
+++ HPSEcal1BitClusterVetoClusterer.java 8 Dec 2012 01:12:16 -0000 1.4
@@ -14,65 +14,68 @@
* The clustering algorithm is from JLab Hall B 6 GeV DVCS Trigger Design doc.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcal1BitClusterVetoClusterer.java,v 1.3 2011/10/21 20:32:15 meeg Exp $
+ * @version $Id: HPSEcal1BitClusterVetoClusterer.java,v 1.4 2012/12/08 01:12:16 meeg Exp $
*/
public class HPSEcal1BitClusterVetoClusterer extends HPSEcal1BitClusterer {
- public HPSEcal1BitClusterVetoClusterer() {
- }
+ public HPSEcal1BitClusterVetoClusterer() {
+ }
- public void countHits(List<CalorimeterHit> hits, List<CalorimeterHit> vetoHits) {
- // Hit map.
- hitMap = new HashMap<Long, CalorimeterHit>();
-
- hitCounts = new HashMap<Long, Integer>();
- // Loop over ECal hits to count hit towers
- for (CalorimeterHit hit : hits) {
- dec.setID(hit.getCellID());
- int ix = dec.getValue("ix");
- if (ix >= xMin && ix <= xMax)
- continue;
-
- // Make a hit map for quick lookup by ID.
- hitMap.put(hit.getCellID(), hit);
-
- // Get neighbor crystal IDs.
- Set<Long> neighbors = neighborMap.get(hit.getCellID());
-
- if (neighbors == null) {
- throw new RuntimeException("Oops! Set of neighbors is null!");
- }
-
- Integer hitCount = hitCounts.get(hit.getCellID());
- if (hitCount == null)
- hitCounts.put(hit.getCellID(), 1);
- else
- hitCounts.put(hit.getCellID(), hitCount + 1);
-
- // Loop over neighbors to make hit list for cluster.
- for (Long neighborId : neighbors) {
- hitCount = hitCounts.get(neighborId);
- if (hitCount == null)
- hitCounts.put(neighborId, 1);
- else
- hitCounts.put(neighborId, hitCount + 1);
- }
- }
- if (vetoHits != null) {
- for (CalorimeterHit hit : vetoHits) {
- //Get neighbor crystal IDs.
- Set<Long> neighbors = neighborMap.get(hit.getCellID());
-
- if (neighbors == null) {
- throw new RuntimeException("Oops! Set of neighbors is null!");
- }
-
- // Veto the hit towers for the vetoed crystal and all neighbors.
- hitCounts.remove(hit.getCellID());
- for (Long neighborId : neighbors) {
- hitCounts.remove(neighborId);
- }
- }
- }
- }
+ @Override
+ public void countHits(List<CalorimeterHit> hits, List<CalorimeterHit> vetoHits) {
+ // Hit map.
+ hitMap = new HashMap<Long, CalorimeterHit>();
+
+ hitCounts = new HashMap<Long, Integer>();
+ // Loop over ECal hits to count hit towers
+ for (CalorimeterHit hit : hits) {
+ int ix = hit.getIdentifierFieldValue("ix");
+ if (ix >= xMin && ix <= xMax) {
+ continue;
+ }
+
+ // Make a hit map for quick lookup by ID.
+ hitMap.put(hit.getCellID(), hit);
+
+ // Get neighbor crystal IDs.
+ Set<Long> neighbors = neighborMap.get(hit.getCellID());
+
+ if (neighbors == null) {
+ throw new RuntimeException("Oops! Set of neighbors is null!");
+ }
+
+ Integer hitCount = hitCounts.get(hit.getCellID());
+ if (hitCount == null) {
+ hitCounts.put(hit.getCellID(), 1);
+ } else {
+ hitCounts.put(hit.getCellID(), hitCount + 1);
+ }
+
+ // Loop over neighbors to make hit list for cluster.
+ for (Long neighborId : neighbors) {
+ hitCount = hitCounts.get(neighborId);
+ if (hitCount == null) {
+ hitCounts.put(neighborId, 1);
+ } else {
+ hitCounts.put(neighborId, hitCount + 1);
+ }
+ }
+ }
+ if (vetoHits != null) {
+ for (CalorimeterHit hit : vetoHits) {
+ //Get neighbor crystal IDs.
+ Set<Long> neighbors = neighborMap.get(hit.getCellID());
+
+ if (neighbors == null) {
+ throw new RuntimeException("Oops! Set of neighbors is null!");
+ }
+
+ // Veto the hit towers for the vetoed crystal and all neighbors.
+ hitCounts.remove(hit.getCellID());
+ for (Long neighborId : neighbors) {
+ hitCounts.remove(neighborId);
+ }
+ }
+ }
+ }
}
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.13 -r1.14
--- HPSEcalRawConverter.java 27 Sep 2012 01:08:12 -0000 1.13
+++ HPSEcalRawConverter.java 8 Dec 2012 01:12:17 -0000 1.14
@@ -47,9 +47,9 @@
long id = hit.getCellID();
double rawEnergy;
if (constantGain) {
- rawEnergy = gain * sumADC(hit);
+ rawEnergy = gain * sumADC(hit) * HPSECalUtils.MeV;
} else {
- rawEnergy = HPSEcalConditions.physicalToGain(id) * sumADC(hit);
+ rawEnergy = HPSEcalConditions.physicalToGain(id) * sumADC(hit) * HPSECalUtils.MeV;
}
// double[] pos = hit.getDetectorElement().getGeometry().getPosition().v();
CalorimeterHit h = new HPSRawCalorimeterHit(rawEnergy + 0.0000001, time, id, 0);
@@ -65,9 +65,9 @@
long id = hit.getCellID();
double rawEnergy;
if (constantGain) {
- rawEnergy = gain * (hit.getAmplitude() - window * HPSEcalConditions.physicalToPedestal(id));
+ rawEnergy = gain * (hit.getAmplitude() - window * HPSEcalConditions.physicalToPedestal(id)) * HPSECalUtils.MeV;
} else {
- rawEnergy = HPSEcalConditions.physicalToGain(id) * (hit.getAmplitude() - window * HPSEcalConditions.physicalToPedestal(id));
+ rawEnergy = HPSEcalConditions.physicalToGain(id) * (hit.getAmplitude() - window * HPSEcalConditions.physicalToPedestal(id)) * HPSECalUtils.MeV;
}
CalorimeterHit h = new HPSRawCalorimeterHit(rawEnergy + 0.0000001, time, id, 0);
//+0.0000001 is a horrible hack to ensure rawEnergy!=BaseCalorimeterHit.UNSET_CORRECTED_ENERGY
@@ -79,9 +79,9 @@
long id = hit.getCellID();
int amplitude;
if (constantGain) {
- amplitude = (int) Math.round(hit.getRawEnergy() / gain + window * HPSEcalConditions.physicalToPedestal(id));
+ amplitude = (int) Math.round((hit.getRawEnergy() / HPSECalUtils.MeV) / gain + window * HPSEcalConditions.physicalToPedestal(id));
} else {
- amplitude = (int) Math.round(hit.getRawEnergy() / HPSEcalConditions.physicalToGain(id) + window * HPSEcalConditions.physicalToPedestal(id));
+ amplitude = (int) Math.round((hit.getRawEnergy() / HPSECalUtils.MeV) / HPSEcalConditions.physicalToGain(id) + window * HPSEcalConditions.physicalToPedestal(id));
}
RawCalorimeterHit h = new BaseRawCalorimeterHit(id, amplitude, time);
return h;
@@ -93,7 +93,7 @@
}
double time = hit.getTimeStamp() / 16.0;
long id = hit.getCellID();
- double rawEnergy = g * (hit.getAmplitude() - window * HPSEcalConditions.physicalToPedestal(id));
+ double rawEnergy = g * (hit.getAmplitude() - window * HPSEcalConditions.physicalToPedestal(id)) * HPSECalUtils.MeV;
CalorimeterHit h = new HPSRawCalorimeterHit(rawEnergy + 0.0000001, time, id, 0);
//+0.0000001 is a horrible hack to ensure rawEnergy!=BaseCalorimeterHit.UNSET_CORRECTED_ENERGY
return h;
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.3 -r1.4
--- HPSEcalWindowDiscriminatorReadoutDriver.java 27 Aug 2012 21:53:47 -0000 1.3
+++ HPSEcalWindowDiscriminatorReadoutDriver.java 8 Dec 2012 01:12:17 -0000 1.4
@@ -15,7 +15,7 @@
*
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalWindowDiscriminatorReadoutDriver.java,v 1.3 2012/08/27 21:53:47 meeg Exp $
+ * @version $Id: HPSEcalWindowDiscriminatorReadoutDriver.java,v 1.4 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcalWindowDiscriminatorReadoutDriver extends HPSEcalDiscriminatorReadoutDriver {
//last time we saw a rising edge
@@ -23,7 +23,7 @@
Map<Long, Double> lowTimeMap = null;
//last time we saw a rising edge
Map<Long, Double> highTimeMap = null;
- double highThreshold = 10.0;
+ double highThreshold = 10.0 * HPSECalUtils.GeV;
public HPSEcalWindowDiscriminatorReadoutDriver() {
}
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.19 -r1.20
--- HPSEcal1BitClusterer.java 21 Oct 2011 20:32:16 -0000 1.19
+++ HPSEcal1BitClusterer.java 8 Dec 2012 01:12:17 -0000 1.20
@@ -24,322 +24,357 @@
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim Nelson <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcal1BitClusterer.java,v 1.19 2011/10/21 20:32:16 meeg Exp $
+ * @version $Id: HPSEcal1BitClusterer.java,v 1.20 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcal1BitClusterer extends Driver {
- HPSEcal3 ecal;
- IDDecoder dec;
- String ecalName;
- String ecalCollectionName;
- String vetoCollectionName;
- String clusterCollectionName = "EcalClusters";
- //set bounds for a range of crystals to turn off in the clusterer
- int xMin = 0;
- int xMax = 0;
- Map<Long, Integer> hitCounts = null;
- Map<Long, CalorimeterHit> hitMap = null;
- // Threshold hit count for cluster. Cluster must have more than this many hits.
- int clusterThreshold = 5;
- // Map of crystals to their neighbors.
- NeighborMap neighborMap = null;
-
- public HPSEcal1BitClusterer() {
- }
-
- public void setClusterCollectionName(String clusterCollectionName) {
- this.clusterCollectionName = clusterCollectionName;
- }
-
- public void setEcalCollectionName(String ecalCollectionName) {
- this.ecalCollectionName = ecalCollectionName;
- }
-
- public void setVetoCollectionName(String vetoCollectionName) {
- this.vetoCollectionName = vetoCollectionName;
- }
-
- public void setxMax(int xMax) {
- this.xMax = xMax;
- }
-
- public void setxMin(int xMin) {
- this.xMin = xMin;
- }
-
- public void setClusterThreshold(int clusterThreshold) {
- this.clusterThreshold = clusterThreshold;
- }
-
- public void setEcalName(String ecalName) {
- this.ecalName = ecalName;
- }
-
- public void startOfData() {
- if (ecalCollectionName == null) {
- throw new RuntimeException("The parameter ecalCollectionName was not set!");
- }
-
- if (ecalName == null) {
- throw new RuntimeException("The parameter ecalName was not set!");
- }
- }
-
- public void detectorChanged(Detector detector) {
- // Get the Subdetector.
- ecal = (HPSEcal3) detector.getSubdetector(ecalName);
-
- // Get the decoder for the ECal IDs.
- dec = ecal.getIDDecoder();
-
- // Cache ref to neighbor map.
- neighborMap = ecal.getNeighborMap();
-
- //System.out.println(ecal.getName());
- //System.out.println(" nx="+ecal.nx());
- //System.out.println(" ny="+ecal.ny());
- //System.out.println(" beamgap="+ecal.beamGap());
- //System.out.println(" dface="+ecal.distanceToFace());
-
- //System.out.println(neighborMap.toString());
- }
-
- public void process(EventHeader event) {
- //System.out.println(this.getClass().getCanonicalName() + " - process");
-
- // Get the list of raw ECal hits.
- List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
- if (hits == null)
- throw new RuntimeException("Event is missing ECal raw hits collection!");
- List<CalorimeterHit> vetoHits = null;
-
- // Get the list of raw ECal hits.
- if (vetoCollectionName != null) {
- vetoHits = event.get(CalorimeterHit.class, vetoCollectionName);
- if (vetoHits == null)
- throw new RuntimeException("Event is missing ECal veto hits collection!");
- }
-
- countHits(hits, vetoHits);
-
- // Put Cluster collection into event.
- int flag = 1 << LCIOConstants.CLBIT_HITS;
- event.put(clusterCollectionName, createClusters(), Cluster.class, flag);
- }
-
- public void countHits(List<CalorimeterHit> hits, List<CalorimeterHit> vetoHits) {
- // Hit map.
- hitMap = new HashMap<Long, CalorimeterHit>();
- HashMap<Long, CalorimeterHit> vetoMap = new HashMap<Long, CalorimeterHit>();
-
- if (vetoHits != null) {
- for (CalorimeterHit hit : vetoHits) {
- vetoMap.put(hit.getCellID(), hit);
- }
- }
-
- hitCounts = new HashMap<Long, Integer>();
- // Loop over ECal hits to count hit towers
- for (CalorimeterHit hit : hits) {
- if (vetoMap.get(hit.getCellID()) != null)
- continue;
-
- dec.setID(hit.getCellID());
- int ix = dec.getValue("ix");
- if (ix >= xMin && ix <= xMax)
- continue;
-
- // Make a hit map for quick lookup by ID.
- hitMap.put(hit.getCellID(), hit);
-
- // Get neighbor crystal IDs.
- Set<Long> neighbors = neighborMap.get(hit.getCellID());
-
- if (neighbors == null) {
- throw new RuntimeException("Oops! Set of neighbors is null!");
- }
-
- Integer hitCount = hitCounts.get(hit.getCellID());
- if (hitCount == null)
- hitCounts.put(hit.getCellID(), 1);
- else
- hitCounts.put(hit.getCellID(), hitCount + 1);
-
- // Loop over neighbors to make hit list for cluster.
- for (Long neighborId : neighbors) {
- hitCount = hitCounts.get(neighborId);
- if (hitCount == null)
- hitCounts.put(neighborId, 1);
- else
- hitCounts.put(neighborId, hitCount + 1);
- }
- }
- }
-
- public List<Cluster> createClusters() {
- // New Cluster list to be added to event.
- List<Cluster> clusters = new ArrayList<Cluster>();
-
- //for each crystal with a nonzero hit count, test for cluster
- for (Long possibleCluster : hitCounts.keySet()) {
- //System.out.printf("%d, %d hits\n",possibleCluster,hitCounts.get(possibleCluster));
- if (hitCounts.get(possibleCluster) <= clusterThreshold) {
- continue;
- }
-
- // Get neighbor crystal IDs.
- Set<Long> neighbors = neighborMap.get(possibleCluster);
-
- if (neighbors == null) {
- throw new RuntimeException("Oops! Set of neighbors is null!");
- }
-
- //Apply peak detector scheme.
- // Set the ID.
- dec.setID(possibleCluster);
- // Get ID field values.
- int x1 = dec.getValue("ix");
- int y1 = dec.getValue("iy");
- Integer hitCount = hitCounts.get(possibleCluster);
-
- //System.out.printf("Possible cluster: x: %d, y: %d, hits: %d\n",x1,y1,hitCount);
- boolean isCluster = true;
- for (Long neighborId : neighbors) {
- // Set the ID.
- dec.setID(neighborId);
- Integer neighborHitCount = hitCounts.get(neighborId);
- if (neighborHitCount == null)
- continue;
- // Get ID field values.
- int x2 = dec.getValue("ix");
- int y2 = dec.getValue("iy");
- if (y1 > 0) {
- if (x1 > 0) {
- //quadrant 1
- if (x1 == 1) {
- //special case: left edge of quadrant
- if (x1 > x2 && y1 < y2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (x1 > x2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else if (x1 < x2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (y1 < y2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else {
- if (hitCount > neighborHitCount)
- continue;
- }
- } else {
- if (x1 > x2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else if (x1 < x2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (y1 < y2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else {
- if (hitCount > neighborHitCount)
- continue;
- }
- }
- } else {
- //quadrant 2
- if (y1 > y2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else if (y1 < y2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (x1 > x2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else {
- if (hitCount > neighborHitCount)
- continue;
- }
- }
- } else {
- if (x1 < 0) {
- //quadrant 3
- if (x1 == 1) {
- //special case: left edge of quadrant
- if (x1 < x2 && y1 > y2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (x1 < x2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else if (x1 > x2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (y1 > y2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else {
- if (hitCount > neighborHitCount)
- continue;
- }
- } else {
- if (x1 < x2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else if (x1 > x2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (y1 > y2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else {
- if (hitCount > neighborHitCount)
- continue;
- }
- }
- } else {
- //quadrant 4
- if (y1 < y2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else if (y1 > y2) {
- if (hitCount > neighborHitCount)
- continue;
- } else if (x1 < x2) {
- if (hitCount >= neighborHitCount)
- continue;
- } else {
- if (hitCount > neighborHitCount)
- continue;
- }
- }
- }
- isCluster = false;
- break;
- }
-
- if (isCluster) {
- //System.out.printf("Cluster: x: %d, y: %d, side:%d, hits: %d\n",x1,y1,side1,hitCount);
- HPSEcalCluster cluster = new HPSEcalCluster(possibleCluster);
- CalorimeterHit hit = hitMap.get(possibleCluster);
- if (hit != null /*&& hit.getRawEnergy() > hitEMin && hit.getRawEnergy() < hitEMax*/) {
- cluster.addHit(hit);
- }
-
- for (Long neighborId : neighbors) {
- // Find the neighbor hit in the event if it exists.
- hit = hitMap.get(neighborId);
- if (hit != null /*&& hit.getRawEnergy() > hitEMin && hit.getRawEnergy() < hitEMax*/) {
- cluster.addHit(hit);
- }
- }
- clusters.add(cluster);
- }
- }
- return clusters;
- }
+ HPSEcal3 ecal;
+ IDDecoder dec;
+ String ecalName;
+ String ecalCollectionName;
+ String vetoCollectionName;
+ String clusterCollectionName = "EcalClusters";
+ //set bounds for a range of crystals to turn off in the clusterer
+ int xMin = 0;
+ int xMax = 0;
+ Map<Long, Integer> hitCounts = null;
+ Map<Long, CalorimeterHit> hitMap = null;
+ // Threshold hit count for cluster. Cluster must have more than this many hits.
+ int clusterThreshold = 5;
+ // Map of crystals to their neighbors.
+ NeighborMap neighborMap = null;
+
+ public HPSEcal1BitClusterer() {
+ }
+
+ public void setClusterCollectionName(String clusterCollectionName) {
+ this.clusterCollectionName = clusterCollectionName;
+ }
+
+ public void setEcalCollectionName(String ecalCollectionName) {
+ this.ecalCollectionName = ecalCollectionName;
+ }
+
+ public void setVetoCollectionName(String vetoCollectionName) {
+ this.vetoCollectionName = vetoCollectionName;
+ }
+
+ public void setxMax(int xMax) {
+ this.xMax = xMax;
+ }
+
+ public void setxMin(int xMin) {
+ this.xMin = xMin;
+ }
+
+ public void setClusterThreshold(int clusterThreshold) {
+ this.clusterThreshold = clusterThreshold;
+ }
+
+ public void setEcalName(String ecalName) {
+ this.ecalName = ecalName;
+ }
+
+ @Override
+ public void startOfData() {
+ if (ecalCollectionName == null) {
+ throw new RuntimeException("The parameter ecalCollectionName was not set!");
+ }
+
+ if (ecalName == null) {
+ throw new RuntimeException("The parameter ecalName was not set!");
+ }
+ }
+
+ @Override
+ public void detectorChanged(Detector detector) {
+ // Get the Subdetector.
+ ecal = (HPSEcal3) detector.getSubdetector(ecalName);
+
+ // Get the decoder for the ECal IDs.
+ dec = ecal.getIDDecoder();
+
+ // Cache ref to neighbor map.
+ neighborMap = ecal.getNeighborMap();
+
+ //System.out.println(ecal.getName());
+ //System.out.println(" nx="+ecal.nx());
+ //System.out.println(" ny="+ecal.ny());
+ //System.out.println(" beamgap="+ecal.beamGap());
+ //System.out.println(" dface="+ecal.distanceToFace());
+
+ //System.out.println(neighborMap.toString());
+ }
+
+ @Override
+ public void process(EventHeader event) {
+ //System.out.println(this.getClass().getCanonicalName() + " - process");
+
+ // Get the list of raw ECal hits.
+ List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
+ if (hits == null) {
+ throw new RuntimeException("Event is missing ECal raw hits collection!");
+ }
+ List<CalorimeterHit> vetoHits = null;
+
+ // Get the list of raw ECal hits.
+ if (vetoCollectionName != null) {
+ vetoHits = event.get(CalorimeterHit.class, vetoCollectionName);
+ if (vetoHits == null) {
+ throw new RuntimeException("Event is missing ECal veto hits collection!");
+ }
+ }
+
+ countHits(hits, vetoHits);
+
+ // Put Cluster collection into event.
+ int flag = 1 << LCIOConstants.CLBIT_HITS;
+ event.put(clusterCollectionName, createClusters(), Cluster.class, flag);
+ }
+
+ public void countHits(List<CalorimeterHit> hits, List<CalorimeterHit> vetoHits) {
+ // Hit map.
+ hitMap = new HashMap<Long, CalorimeterHit>();
+ HashMap<Long, CalorimeterHit> vetoMap = new HashMap<Long, CalorimeterHit>();
+
+ if (vetoHits != null) {
+ for (CalorimeterHit hit : vetoHits) {
+ vetoMap.put(hit.getCellID(), hit);
+ }
+ }
+
+ hitCounts = new HashMap<Long, Integer>();
+ // Loop over ECal hits to count hit towers
+ for (CalorimeterHit hit : hits) {
+ if (vetoMap.get(hit.getCellID()) != null) {
+ continue;
+ }
+
+ int ix = hit.getIdentifierFieldValue("ix");
+ if (ix >= xMin && ix <= xMax) {
+ continue;
+ }
+
+ // Make a hit map for quick lookup by ID.
+ hitMap.put(hit.getCellID(), hit);
+
+ // Get neighbor crystal IDs.
+ Set<Long> neighbors = neighborMap.get(hit.getCellID());
+
+ if (neighbors == null) {
+ throw new RuntimeException("Oops! Set of neighbors is null!");
+ }
+
+ Integer hitCount = hitCounts.get(hit.getCellID());
+ if (hitCount == null) {
+ hitCounts.put(hit.getCellID(), 1);
+ } else {
+ hitCounts.put(hit.getCellID(), hitCount + 1);
+ }
+
+ // Loop over neighbors to make hit list for cluster.
+ for (Long neighborId : neighbors) {
+ hitCount = hitCounts.get(neighborId);
+ if (hitCount == null) {
+ hitCounts.put(neighborId, 1);
+ } else {
+ hitCounts.put(neighborId, hitCount + 1);
+ }
+ }
+ }
+ }
+
+ public List<Cluster> createClusters() {
+ // New Cluster list to be added to event.
+ List<Cluster> clusters = new ArrayList<Cluster>();
+
+ //for each crystal with a nonzero hit count, test for cluster
+ for (Long possibleCluster : hitCounts.keySet()) {
+ //System.out.printf("%d, %d hits\n",possibleCluster,hitCounts.get(possibleCluster));
+ if (hitCounts.get(possibleCluster) <= clusterThreshold) {
+ continue;
+ }
+
+ // Get neighbor crystal IDs.
+ Set<Long> neighbors = neighborMap.get(possibleCluster);
+
+ if (neighbors == null) {
+ throw new RuntimeException("Oops! Set of neighbors is null!");
+ }
+
+ //Apply peak detector scheme.
+ // Set the ID.
+ dec.setID(possibleCluster);
+ // Get ID field values.
+ int x1 = dec.getValue("ix");
+ int y1 = dec.getValue("iy");
+ Integer hitCount = hitCounts.get(possibleCluster);
+
+ //System.out.printf("Possible cluster: x: %d, y: %d, hits: %d\n",x1,y1,hitCount);
+ boolean isCluster = true;
+ for (Long neighborId : neighbors) {
+ // Set the ID.
+ dec.setID(neighborId);
+ Integer neighborHitCount = hitCounts.get(neighborId);
+ if (neighborHitCount == null) {
+ continue;
+ }
+ // Get ID field values.
+ int x2 = dec.getValue("ix");
+ int y2 = dec.getValue("iy");
+ if (y1 > 0) {
+ if (x1 > 0) {
+ //quadrant 1
+ if (x1 == 1) {
+ //special case: left edge of quadrant
+ if (x1 > x2 && y1 < y2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (x1 > x2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else if (x1 < x2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (y1 < y2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ }
+ } else {
+ if (x1 > x2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else if (x1 < x2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (y1 < y2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ }
+ }
+ } else {
+ //quadrant 2
+ if (y1 > y2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else if (y1 < y2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (x1 > x2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ }
+ }
+ } else {
+ if (x1 < 0) {
+ //quadrant 3
+ if (x1 == 1) {
+ //special case: left edge of quadrant
+ if (x1 < x2 && y1 > y2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (x1 < x2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else if (x1 > x2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (y1 > y2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ }
+ } else {
+ if (x1 < x2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else if (x1 > x2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (y1 > y2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ }
+ }
+ } else {
+ //quadrant 4
+ if (y1 < y2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else if (y1 > y2) {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ } else if (x1 < x2) {
+ if (hitCount >= neighborHitCount) {
+ continue;
+ }
+ } else {
+ if (hitCount > neighborHitCount) {
+ continue;
+ }
+ }
+ }
+ }
+ isCluster = false;
+ break;
+ }
+
+ if (isCluster) {
+ //System.out.printf("Cluster: x: %d, y: %d, side:%d, hits: %d\n",x1,y1,side1,hitCount);
+ HPSEcalCluster cluster = new HPSEcalCluster(possibleCluster);
+ CalorimeterHit hit = hitMap.get(possibleCluster);
+ if (hit != null /*&& hit.getRawEnergy() > hitEMin && hit.getRawEnergy() < hitEMax*/) {
+ cluster.addHit(hit);
+ }
+
+ for (Long neighborId : neighbors) {
+ // Find the neighbor hit in the event if it exists.
+ hit = hitMap.get(neighborId);
+ if (hit != null /*&& hit.getRawEnergy() > hitEMin && hit.getRawEnergy() < hitEMax*/) {
+ cluster.addHit(hit);
+ }
+ }
+ clusters.add(cluster);
+ }
+ }
+ return clusters;
+ }
}
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.5 -r1.6
--- EcalCrystalFilter.java 22 Jun 2012 22:41:32 -0000 1.5
+++ EcalCrystalFilter.java 8 Dec 2012 01:12:17 -0000 1.6
@@ -1,6 +1,5 @@
package org.lcsim.hps.recon.ecal;
-import org.lcsim.hps.monitoring.ecal.*;
import hep.aida.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -23,7 +22,6 @@
import org.lcsim.hps.monitoring.AIDAFrame;
import org.lcsim.hps.monitoring.Redrawable;
import org.lcsim.hps.monitoring.Resettable;
-import org.lcsim.hps.recon.ecal.HPSEcalConditions;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
@@ -47,8 +45,6 @@
private AIDAFrame plotterFrame;
private AIDAFrame plotterFrameTop;
private AIDAFrame plotterFrameBot;
-
-
private IHistogram1D aMeanPlot;
private IHistogram1D aSigmaPlot;
private IHistogram1D tMeanPlot;
@@ -65,17 +61,14 @@
private IHistogram2D aTOutSigmaPlot;
private IHistogram2D tTOutMeanPlot;
private IHistogram2D tTOutSigmaPlot;
-
private IHistogram2D aTTOutMeanPlot;
private IHistogram2D aTTOutSigmaPlot;
private IHistogram2D tTTOutMeanPlot;
private IHistogram2D tTTOutSigmaPlot;
-
private IHistogram2D aBTOutMeanPlot;
private IHistogram2D aBTOutSigmaPlot;
private IHistogram2D tBTOutMeanPlot;
private IHistogram2D tBTOutSigmaPlot;
-
private IHistogram1D[][] aPlots = new IHistogram1D[47][11];
private IHistogram1D[][] tPlots = new IHistogram1D[47][11];
private IHistogram1D[][] aTPlots = new IHistogram1D[47][11];
@@ -118,7 +111,7 @@
xList[count] = i;
xListTop[count] = i;
xListBot[count] = i;
-
+
count++;
}
}
@@ -137,17 +130,17 @@
} catch (IOException ex) {
Logger.getLogger(EcalCrystalFilter.class.getName()).log(Level.SEVERE, null, ex);
}
-
-
+
+
outputPlotFileName = "";
-
+
}
public void closeFile() throws IOException {
pWriter.close();
fWriter.close();
}
-
+
public void setMaxE(double maxE) {
this.maxE = maxE;
}
@@ -164,6 +157,7 @@
this.inputCollection = inputCollection;
}
+ @Override
public void detectorChanged(Detector detector) {
if (inputCollection == null) {
throw new RuntimeException("The inputCollection parameter was not set.");
@@ -171,23 +165,23 @@
aida = AIDA.defaultInstance();
aida.tree().cd("/");
-
- aSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Filter", 50, 0,200);
- aMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Filter", 50, 0,1000);
- tSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Filter", 50,0,50);
+
+ aSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Filter", 50, 0, 200);
+ aMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Filter", 50, 0, 1000);
+ tSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Filter", 50, 0, 50);
tMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time) Filter", 50, 0, 100);
-
- aTSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Top Trig Filter", 50, 0,200);
- aTMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Top Trig Filter", 50, 0,1000);
- tTSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Top Trig Filter", 50,0,50);
+
+ aTSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Top Trig Filter", 50, 0, 200);
+ aTMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Top Trig Filter", 50, 0, 1000);
+ tTSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Top Trig Filter", 50, 0, 50);
tTMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time) Top Trig Filter", 50, 0, 100);
-
- aBSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Bottom Trig Filter", 50, 0,200);
- aBMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Bottom Trig Filter", 50, 0,1000);
- tBSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Bottom Trig Filter", 50,0,50);
+
+ aBSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Bottom Trig Filter", 50, 0, 200);
+ aBMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Bottom Trig Filter", 50, 0, 1000);
+ tBSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Bottom Trig Filter", 50, 0, 50);
tBMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time) Bottom Trig Filter", 50, 0, 100);
-
-
+
+
aTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Amplitude) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
aTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Amplitude) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
tTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Time) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
@@ -203,17 +197,17 @@
tBTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Time) Time Top Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
tBTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Time) Time Top Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
-
+
for (int x = -23; x <= 23; x++) { // slot
for (int y = -5; y <= 5; y++) { // crate
//System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
// IHistogram1D hist = aida.histogram1D("ECAL: x=" + i + "; y=" + j, 1000, 0, 16);
// plots[x + 23][y + 5] = aida.cloud1D("ECAL: x=" + x + "; y=" + y);
if (calWindow == 0) {
- aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
- aTPlots[x + 23][y + 5] = aida.histogram1D("Top ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
- aBPlots[x + 23][y + 5] = aida.histogram1D("Bottom ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
-
+ aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 500, -0.1, maxE);
+ aTPlots[x + 23][y + 5] = aida.histogram1D("Top ECAL Amplitudes: x=" + x + "; y=" + y, 500, -0.1, maxE);
+ aBPlots[x + 23][y + 5] = aida.histogram1D("Bottom ECAL Amplitudes: x=" + x + "; y=" + y, 500, -0.1, maxE);
+
} else {
aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
aTPlots[x + 23][y + 5] = aida.histogram1D("Top Trig CAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
@@ -262,7 +256,7 @@
plotter.region(0).plot(aSigmaPlot);
plotter.region(1).plot(aMeanPlot);
plotter.style().dataStyle().fillStyle().setColor("yellow");
-
+
// Setup the plotter.
plotter2 = aida.analysisFactory().createPlotterFactory().create();
plotter2.setTitle("HPS ECal Hit Time ");
@@ -281,8 +275,8 @@
plotter2.region(0).plot(tSigmaPlot);
plotter2.region(1).plot(tMeanPlot);
plotter2.style().dataStyle().fillStyle().setColor("green");
-
-
+
+
// Setup the plotter.
plotter3 = aida.analysisFactory().createPlotterFactory().create();
plotter3.setTitle("HPS ECal for Time Outliers ");
@@ -301,8 +295,8 @@
plotter3.region(0).plot(tTOutSigmaPlot);
plotter3.region(1).plot(tTOutMeanPlot);
plotter3.style().dataStyle().fillStyle().setColor("green");
-
- // Setup the plotter.
+
+ // Setup the plotter.
plotter4 = aida.analysisFactory().createPlotterFactory().create();
plotter4.setTitle("HPS ECal Amplitude for Time Outliers ");
plotterFrame.addPlotter(plotter4);
@@ -320,19 +314,19 @@
plotter4.region(0).plot(aTOutSigmaPlot);
plotter4.region(1).plot(aTOutMeanPlot);
plotter4.style().dataStyle().fillStyle().setColor("green");
-
+
plotter.region(2).plot(aPlots[-5 + 23][2 + 5 - 1]);
plotter2.region(2).plot(tPlots[-5 + 23][2 + 5 - 1]);
plotter3.region(2).plot(tPlots[-5 + 23][2 + 5 - 1]);
plotter4.region(2).plot(aPlots[-5 + 23][2 + 5 - 1]);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
plotterFrameTop = new AIDAFrame();
plotterFrameTop.setTitle("HPS Top Trig ECal Crystal Filter Plots");
@@ -346,15 +340,15 @@
yComboTop.addActionListener(this);
yLabelTop = new JLabel("yT");
yLabelTop.setLabelFor(yComboTop);
-
-
+
+
plotterFrameTop.getControlsPanel().add(yLabelTop);
plotterFrameTop.getControlsPanel().add(yComboTop);
blankButtonTop = new JButton("Hide histogram (Top)");
plotterFrameTop.getControlsPanel().add(blankButtonTop);
blankButtonTop.addActionListener(this);
-
-
+
+
// Setup the plotterTop.
plotterTop = aida.analysisFactory().createPlotterFactory().create();
plotterTop.setTitle("HPS ECal Amplitude");
@@ -370,7 +364,7 @@
plotterTop.region(0).plot(aTSigmaPlot);
plotterTop.region(1).plot(aTMeanPlot);
plotterTop.style().dataStyle().fillStyle().setColor("yellow");
-
+
// Setup the plotterTop.
plotterTop2 = aida.analysisFactory().createPlotterFactory().create();
plotterTop2.setTitle("HPS ECal Hit Time ");
@@ -386,14 +380,14 @@
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotterTop2.region(0).plot(tTSigmaPlot);
plotterTop2.region(1).plot(tTMeanPlot);
-
-
+
+
// Setup the plotter.
plotterTop3 = aida.analysisFactory().createPlotterFactory().create();
plotterTop3.setTitle("HPS ECal for Time Outliers ");
plotterFrameTop.addPlotter(plotterTop3);
plotterTop3.createRegions(1, 3);
-
+
plotterTop3.setStyle(plotter3.style());
style = plotterTop3.region(0).style();
style.setParameter("hist2DStyle", "colorMap");
@@ -403,8 +397,8 @@
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotterTop3.region(0).plot(tTTOutSigmaPlot);
plotterTop3.region(1).plot(tTTOutMeanPlot);
-
- // Setup the plotter.
+
+ // Setup the plotter.
plotterTop4 = aida.analysisFactory().createPlotterFactory().create();
plotterTop4.setTitle("HPS ECal Amplitude for Time Outliers ");
plotterFrameTop.addPlotter(plotterTop4);
@@ -419,19 +413,19 @@
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotterTop4.region(0).plot(aTTOutSigmaPlot);
plotterTop4.region(1).plot(aTTOutMeanPlot);
-
+
plotterTop.region(2).plot(aTPlots[-5 + 23][2 + 5 - 1]);
plotterTop2.region(2).plot(tTPlots[-5 + 23][2 + 5 - 1]);
plotterTop3.region(2).plot(tTPlots[-5 + 23][2 + 5 - 1]);
plotterTop4.region(2).plot(aTPlots[-5 + 23][2 + 5 - 1]);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
plotterFrameBot = new AIDAFrame();
plotterFrameBot.setTitle("HPS Bottom Trig ECal Crystal Filter Plots");
@@ -466,7 +460,7 @@
plotterBot.region(0).plot(aBSigmaPlot);
plotterBot.region(1).plot(aBMeanPlot);
plotterBot.style().dataStyle().fillStyle().setColor("yellow");
-
+
// Setup the plotterBot.
plotterBot2 = aida.analysisFactory().createPlotterFactory().create();
plotterBot2.setTitle("HPS ECal Hit Time ");
@@ -482,14 +476,14 @@
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotterBot2.region(0).plot(tBSigmaPlot);
plotterBot2.region(1).plot(tBMeanPlot);
-
-
+
+
// Setup the plotter.
plotterBot3 = aida.analysisFactory().createPlotterFactory().create();
plotterBot3.setTitle("HPS ECal for Time Outliers ");
plotterFrameBot.addPlotter(plotterBot3);
plotterBot3.createRegions(1, 3);
-
+
plotterBot3.setStyle(plotter3.style());
style = plotterBot3.region(0).style();
style.setParameter("hist2DStyle", "colorMap");
@@ -499,8 +493,8 @@
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotterBot3.region(0).plot(tBTOutSigmaPlot);
plotterBot3.region(1).plot(tBTOutMeanPlot);
-
- // Setup the plotter.
+
+ // Setup the plotter.
plotterBot4 = aida.analysisFactory().createPlotterFactory().create();
plotterBot4.setTitle("HPS ECal Amplitude for Time Outliers ");
plotterFrameBot.addPlotter(plotterBot4);
@@ -515,81 +509,86 @@
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotterBot4.region(0).plot(aBTOutSigmaPlot);
plotterBot4.region(1).plot(aBTOutMeanPlot);
-
+
plotterBot.region(2).plot(aBPlots[-5 + 23][2 + 5 - 1]);
plotterBot2.region(2).plot(tBPlots[-5 + 23][2 + 5 - 1]);
plotterBot3.region(2).plot(tBPlots[-5 + 23][2 + 5 - 1]);
plotterBot4.region(2).plot(aBPlots[-5 + 23][2 + 5 - 1]);
//xCombo.setSelectedIndex(-5 + 23);
//yCombo.setSelectedIndex(2 + 5 - 1);
-
-
-
-
-
+
+
+
+
+
plotterFrame.pack();
if (!hide) {
plotterFrame.setVisible(true);
}
-
-
-
+
+
+
plotterFrameTop.pack();
if (!hide) {
plotterFrameTop.setVisible(true);
}
-
-
-
-
+
+
+
+
plotterFrameBot.pack();
if (!hide) {
plotterFrameBot.setVisible(true);
}
-
-
-
+
+
+
xComboBot.setSelectedIndex(-5 + 23);
yComboBot.setSelectedIndex(2 + 5 - 1);
-
-
+
+
xComboTop.setSelectedIndex(-5 + 23);
yComboTop.setSelectedIndex(2 + 5 - 1);
-
-
-
+
+
+
xCombo.setSelectedIndex(-5 + 23);
yCombo.setSelectedIndex(2 + 5 - 1);
-
-
-
+
+
+
}
-
public void printOutliers() {
-
+
//Outliers in time -- threshold is nr of sigma/rms from the mean
- System.out.printf("Crystals with time RMS more than %.1f times the RMS(<RMS>)=%.1f from <RMS>=%.1f for all crystals\n",tTOutNSigmaThr,tSigmaPlot.rms(),tSigmaPlot.mean());
-
- for(int iside=0;iside<3;++iside) {
- System.out.println("-- Side " + iside );
- pWriter.printf("# Side %d\n",iside);
+ System.out.printf("Crystals with time RMS more than %.1f times the RMS(<RMS>)=%.1f from <RMS>=%.1f for all crystals\n", tTOutNSigmaThr, tSigmaPlot.rms(), tSigmaPlot.mean());
+
+ for (int iside = 0; iside < 3; ++iside) {
+ System.out.println("-- Side " + iside);
+ pWriter.printf("# Side %d\n", iside);
for (int x = -23; x <= 23; x++) { // slot
for (int y = -5; y <= 5; y++) { // crate
boolean ok = false;
- if(iside==0) {
- if(tTOutSigmaPlot.binEntries(tTOutSigmaPlot.coordToIndexX(x), tTOutSigmaPlot.coordToIndexY(y))>0) ok =true;
- } else if(iside==1) {
- if(tTTOutSigmaPlot.binEntries(tTTOutSigmaPlot.coordToIndexX(x), tTTOutSigmaPlot.coordToIndexY(y))>0) ok =true;
+ if (iside == 0) {
+ if (tTOutSigmaPlot.binEntries(tTOutSigmaPlot.coordToIndexX(x), tTOutSigmaPlot.coordToIndexY(y)) > 0) {
+ ok = true;
+ }
+ } else if (iside == 1) {
+ if (tTTOutSigmaPlot.binEntries(tTTOutSigmaPlot.coordToIndexX(x), tTTOutSigmaPlot.coordToIndexY(y)) > 0) {
+ ok = true;
+ }
- } else if(iside==2) {
- if(tBTOutSigmaPlot.binEntries(tBTOutSigmaPlot.coordToIndexX(x), tBTOutSigmaPlot.coordToIndexY(y))>0) ok =true;
+ } else if (iside == 2) {
+ if (tBTOutSigmaPlot.binEntries(tBTOutSigmaPlot.coordToIndexX(x), tBTOutSigmaPlot.coordToIndexY(y)) > 0) {
+ ok = true;
+ }
}
- if(ok) {
+ if (ok) {
IIdentifierHelper helper = HPSEcalConditions.getHelper();
IExpandedIdentifier expId = new ExpandedIdentifier(helper.getIdentifierDictionary().getNumberOfFields());
//expId.setValue(helper.getFieldIndex("system"), ecal.getSystemID());
@@ -598,20 +597,19 @@
Long id = helper.pack(expId).getValue();
- System.out.printf("[%d,%d]\t%d\t%d\t%d\tTime:%f +- %f\tAmp:%f +- %f\n",x,y,HPSEcalConditions.getCrate(id),HPSEcalConditions.getSlot(id) ,HPSEcalConditions.getChannel(id), tPlots[x + 23][y + 5].mean(), tPlots[x + 23][y + 5].rms(), aPlots[x + 23][y + 5].mean(), aPlots[x + 23][y + 5].rms());
+ System.out.printf("[%d,%d]\t%d\t%d\t%d\tTime:%f +- %f\tAmp:%f +- %f\n", x, y, HPSEcalConditions.getCrate(id), HPSEcalConditions.getSlot(id), HPSEcalConditions.getChannel(id), tPlots[x + 23][y + 5].mean(), tPlots[x + 23][y + 5].rms(), aPlots[x + 23][y + 5].mean(), aPlots[x + 23][y + 5].rms());
- pWriter.printf("%d %d\n",x,y);
+ pWriter.printf("%d %d\n", x, y);
}
}
}
}
}
-
-
-
+
+ @Override
public void endOfData() {
-
+
//Redraw one final time and use those values to print out the outlying crystals
redraw();
printOutliers();
@@ -638,18 +636,20 @@
} catch (IOException ex) {
Logger.getLogger(EcalCrystalFilter.class.getName()).log(Level.SEVERE, null, ex);
}
-
-
- if (outputPlotFileName != "")
- try {
- aida.saveAs(outputPlotFileName);
- } catch (IOException ex) {
- Logger.getLogger(EcalCrystalFilter.class.getName()).log(Level.SEVERE, "Couldn't save aida plots to file " + outputPlotFileName, ex);
+
+
+ if (!"".equals(outputPlotFileName)) {
+ try {
+ aida.saveAs(outputPlotFileName);
+ } catch (IOException ex) {
+ Logger.getLogger(EcalCrystalFilter.class.getName()).log(Level.SEVERE, "Couldn't save aida plots to file " + outputPlotFileName, ex);
+ }
}
//displayFastTrackingPlots();
-
+
}
+ @Override
public void reset() {
// if (plotter != null) {
// plotter.hide();
@@ -664,75 +664,95 @@
@Override
public void process(EventHeader event) {
-
+
getTrigger(event);
-
-
- boolean isTop,isBot,isAll;
- for(int iside=0; iside<3;++iside) {
-
+
+
+ boolean isTop, isBot, isAll;
+ for (int iside = 0; iside < 3; ++iside) {
+
isAll = false;
isTop = false;
isBot = false;
//System.out.println("Side " + iside + " Trigger " + _trigger[0] + "," + _trigger[1]);
-
- if(iside==0) {
- isAll =true;
- }else if (iside==1) {
- if(_trigger[0]>0) isTop = true;
- else continue;
- }
- else if(iside==2) {
- if(_trigger[1]>0) isBot = true;
- else continue;
+
+ if (iside == 0) {
+ isAll = true;
+ } else if (iside == 1) {
+ if (_trigger[0] > 0) {
+ isTop = true;
+ } else {
+ continue;
+ }
+ } else if (iside == 2) {
+ if (_trigger[1] > 0) {
+ isBot = true;
+ } else {
+ continue;
+ }
}
-
+
//System.out.println("isTop " + isTop + " isBot " + isBot);
-
-
+
+
if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
for (RawTrackerHit hit : hits) {
-
-
+
+
int y = hit.getIdentifierFieldValue("iy");
int x = hit.getIdentifierFieldValue("ix");
-
+
//System.out.println("RawTrackerHit: iside " + iside + " trigger " + _trigger[0] + ", " + _trigger[1] + " isBot " + isBot + " isTop " + isTop + " iy " + y);
-
+
//Only look at the opposite half of what triggered
- if(isAll) {
-
+ if (isAll) {
}
- if(isTop) {
- if(y>0) continue;
- }
- if(isBot) {
- if(y<0) continue;
+ if (isTop) {
+ if (y > 0) {
+ continue;
+ }
}
-
-
+ if (isBot) {
+ if (y < 0) {
+ continue;
+ }
+ }
+
+
//System.out.println("RawTrackerHit: ===> fill");
-
-
+
+
if (calWindow > 0) {
for (int i = 0; i < calWindow; i++) {
-
- if(isAll) aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
- if(isTop) aTPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
- if(isBot) aBPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
-
+
+ if (isAll) {
+ aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+ }
+ if (isTop) {
+ aTPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+ }
+ if (isBot) {
+ aBPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+ }
+
}
} else {
for (int i = 0; i < hit.getADCValues().length; i++) {
- if(isAll) aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
- if(isTop) aTPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
- if(isBot) aBPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
-
+ if (isAll) {
+ aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+ }
+ if (isTop) {
+ aTPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+ }
+ if (isBot) {
+ aBPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+ }
+
}
}
}
@@ -747,34 +767,39 @@
int x = hit.getIdentifierFieldValue("ix");
int y = hit.getIdentifierFieldValue("iy");
-
+
//System.out.println("BaseRawCalorimeterHit: iside " + iside + " trigger " + _trigger[0] + ", " + _trigger[1] + " isBot " + isBot + " isTop " + isTop + " iy " + y );
//Only look at the opposite half of what triggered
- if(isAll) {}
- if(isTop) {
- if(y>0) continue;
- }
- if(isBot) {
- if(y<0) continue;
+ if (isAll) {
}
-
+ if (isTop) {
+ if (y > 0) {
+ continue;
+ }
+ }
+ if (isBot) {
+ if (y < 0) {
+ continue;
+ }
+ }
+
//System.out.println("BaseRawCalorimeterHit: ===> fill");
-
-
- if(isAll) {
+
+
+ if (isAll) {
aPlots[x + 23][y + 5].fill(hit.getAmplitude());
tPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
}
- if(isTop) {
+ if (isTop) {
aTPlots[x + 23][y + 5].fill(hit.getAmplitude());
tTPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
}
- if(isBot) {
+ if (isBot) {
aBPlots[x + 23][y + 5].fill(hit.getAmplitude());
tBPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
}
-
+
}
if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
redraw();
@@ -789,27 +814,32 @@
//System.out.println("CalorimeterHit: iside " + iside + " trigger " + _trigger[0] + ", " + _trigger[1] + " isBot " + isBot + " isTop " + isTop + " iy " + y );
-
-
+
+
//Only look at the opposite half of what triggered
- if(isAll) {}
- if(isTop) {
- if(y>0) continue;
- }
- if(isBot) {
- if(y<0) continue;
+ if (isAll) {
}
-
+ if (isTop) {
+ if (y > 0) {
+ continue;
+ }
+ }
+ if (isBot) {
+ if (y < 0) {
+ continue;
+ }
+ }
+
//System.out.println("CalorimeterHit: ===> fill");
- if(isAll) {
+ if (isAll) {
aPlots[x + 23][y + 5].fill(hit.getRawEnergy());
tPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
}
- if(isTop) {
+ if (isTop) {
aTPlots[x + 23][y + 5].fill(hit.getRawEnergy());
tTPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
}
- if(isBot) {
+ if (isBot) {
aBPlots[x + 23][y + 5].fill(hit.getRawEnergy());
tBPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
}
@@ -820,36 +850,34 @@
}
}
}
-
+
private void clearTrigger() {
- _trigger[0] = 0;
+ _trigger[0] = 0;
_trigger[1] = 0;
}
-
- private void getTrigger(EventHeader event) {
-
+
+ private void getTrigger(EventHeader event) {
+
clearTrigger();
- if(event.hasCollection(TriggerData.class, "TriggerBank")) {
+ if (event.hasCollection(TriggerData.class, "TriggerBank")) {
List<TriggerData> triggerDataList = event.get(TriggerData.class, "TriggerBank");
- if(triggerDataList.isEmpty() == false) {
+ if (triggerDataList.isEmpty() == false) {
TriggerData triggerData = triggerDataList.get(0);
int topTrig = triggerData.getTopTrig();
int botTrig = triggerData.getBotTrig();
- _trigger[0] = topTrig>0 ? 1 : 0;
- _trigger[1] = botTrig>0 ? 1 : 0;
+ _trigger[0] = topTrig > 0 ? 1 : 0;
+ _trigger[1] = botTrig > 0 ? 1 : 0;
} else {
- System.out.println( "Event has EMPTY trigger list!!");
- _trigger[0] = 0;
+ System.out.println("Event has EMPTY trigger list!!");
+ _trigger[0] = 0;
_trigger[1] = 0;
}
- }
- else {
- System.out.println( "Event has NO trigger bank!!");
- _trigger[0] = 0;
+ } else {
+ System.out.println("Event has NO trigger bank!!");
+ _trigger[0] = 0;
_trigger[1] = 0;
}
}
-
@Override
public void actionPerformed(ActionEvent ae) {
@@ -861,15 +889,15 @@
plotter4.region(2).clear();
- */
- } else if(ae.getSource() == blankButtonTop) {
+ */
+ } else if (ae.getSource() == blankButtonTop) {
plotterTop.region(2).clear();
plotterTop2.region(2).clear();
-
- } else if(ae.getSource() == blankButtonBot) {
+
+ } else if (ae.getSource() == blankButtonBot) {
plotterBot.region(2).clear();
plotterBot2.region(2).clear();
-
+
} else {
Integer x, y;
x = (Integer) xCombo.getSelectedItem();
@@ -884,12 +912,12 @@
plotter3.region(2).plot(tPlots[x + 23][y + 5]);
plotter4.region(2).clear();
plotter4.region(2).plot(aPlots[x + 23][y + 5]);
-
-
+
+
//Integer x, y;
x = (Integer) xComboTop.getSelectedItem();
y = (Integer) yComboTop.getSelectedItem();
-
+
plotterTop.region(2).clear();
plotterTop.region(2).plot(aTPlots[x + 23][y + 5]);
plotterTop2.region(2).clear();
@@ -900,11 +928,11 @@
plotterTop3.region(2).plot(tTPlots[x + 23][y + 5]);
plotterTop4.region(2).clear();
plotterTop4.region(2).plot(aTPlots[x + 23][y + 5]);
-
+
//Integer x, y;
x = (Integer) xComboBot.getSelectedItem();
y = (Integer) yComboBot.getSelectedItem();
-
+
plotterBot.region(2).clear();
plotterBot.region(2).plot(aBPlots[x + 23][y + 5]);
plotterBot2.region(2).clear();
@@ -943,64 +971,64 @@
if (aPlots[x + 23][y + 5].entries() > 10) {
aSigmaPlot.fill(aPlots[x + 23][y + 5].rms());
aMeanPlot.fill(aPlots[x + 23][y + 5].mean());
-
+
}
if (aTPlots[x + 23][y + 5].entries() > 10) {
-
+
aTSigmaPlot.fill(aTPlots[x + 23][y + 5].rms());
aTMeanPlot.fill(aTPlots[x + 23][y + 5].mean());
-
+
}
if (aBPlots[x + 23][y + 5].entries() > 10) {
-
-
+
+
aBSigmaPlot.fill(aBPlots[x + 23][y + 5].rms());
aBMeanPlot.fill(aBPlots[x + 23][y + 5].mean());
}
-
+
if (tPlots[x + 23][y + 5].entries() > 10) {
tSigmaPlot.fill(tPlots[x + 23][y + 5].rms());
tMeanPlot.fill(tPlots[x + 23][y + 5].mean());
}
-
+
if (tTPlots[x + 23][y + 5].entries() > 10) {
-
+
tTSigmaPlot.fill(tTPlots[x + 23][y + 5].rms());
tTMeanPlot.fill(tTPlots[x + 23][y + 5].mean());
-
+
}
if (tBPlots[x + 23][y + 5].entries() > 10) {
-
-
+
+
tBSigmaPlot.fill(tBPlots[x + 23][y + 5].rms());
tBMeanPlot.fill(tBPlots[x + 23][y + 5].mean());
}
-
+
//Outliers in time -- threshold is nr of sigma/rms from the mean
-
- if (tPlots[x + 23][y + 5].rms() > (tSigmaPlot.mean()+tSigmaPlot.rms()*tTOutNSigmaThr) && tPlots[x + 23][y + 5].entries() > 10) {
- tTOutSigmaPlot.fill(x,y,tPlots[x + 23][y + 5].rms());
- tTOutMeanPlot.fill(x,y,tPlots[x + 23][y + 5].mean());
- aTOutSigmaPlot.fill(x,y,aPlots[x + 23][y + 5].rms());
- aTOutMeanPlot.fill(x,y,aPlots[x + 23][y + 5].mean());
- }
- if (tTPlots[x + 23][y + 5].rms() > (tTSigmaPlot.mean()+tTSigmaPlot.rms()*tTOutNSigmaThr) && tTPlots[x + 23][y + 5].entries() > 10) {
-
- tTTOutSigmaPlot.fill(x,y,tTPlots[x + 23][y + 5].rms());
- tTTOutMeanPlot.fill(x,y,tTPlots[x + 23][y + 5].mean());
- aTTOutSigmaPlot.fill(x,y,aTPlots[x + 23][y + 5].rms());
- aTTOutMeanPlot.fill(x,y,aTPlots[x + 23][y + 5].mean());
- }
- if (tBPlots[x + 23][y + 5].rms() > (tBSigmaPlot.mean()+tBSigmaPlot.rms()*tTOutNSigmaThr) && tBPlots[x + 23][y + 5].entries() > 10) {
-
- tBTOutSigmaPlot.fill(x,y,tBPlots[x + 23][y + 5].rms());
- tBTOutMeanPlot.fill(x,y,tBPlots[x + 23][y + 5].mean());
-
- aBTOutSigmaPlot.fill(x,y,aBPlots[x + 23][y + 5].rms());
- aBTOutMeanPlot.fill(x,y,aBPlots[x + 23][y + 5].mean());
-
+
+ if (tPlots[x + 23][y + 5].rms() > (tSigmaPlot.mean() + tSigmaPlot.rms() * tTOutNSigmaThr) && tPlots[x + 23][y + 5].entries() > 10) {
+ tTOutSigmaPlot.fill(x, y, tPlots[x + 23][y + 5].rms());
+ tTOutMeanPlot.fill(x, y, tPlots[x + 23][y + 5].mean());
+ aTOutSigmaPlot.fill(x, y, aPlots[x + 23][y + 5].rms());
+ aTOutMeanPlot.fill(x, y, aPlots[x + 23][y + 5].mean());
}
-
+ if (tTPlots[x + 23][y + 5].rms() > (tTSigmaPlot.mean() + tTSigmaPlot.rms() * tTOutNSigmaThr) && tTPlots[x + 23][y + 5].entries() > 10) {
+
+ tTTOutSigmaPlot.fill(x, y, tTPlots[x + 23][y + 5].rms());
+ tTTOutMeanPlot.fill(x, y, tTPlots[x + 23][y + 5].mean());
+ aTTOutSigmaPlot.fill(x, y, aTPlots[x + 23][y + 5].rms());
+ aTTOutMeanPlot.fill(x, y, aTPlots[x + 23][y + 5].mean());
+ }
+ if (tBPlots[x + 23][y + 5].rms() > (tBSigmaPlot.mean() + tBSigmaPlot.rms() * tTOutNSigmaThr) && tBPlots[x + 23][y + 5].entries() > 10) {
+
+ tBTOutSigmaPlot.fill(x, y, tBPlots[x + 23][y + 5].rms());
+ tBTOutMeanPlot.fill(x, y, tBPlots[x + 23][y + 5].mean());
+
+ aBTOutSigmaPlot.fill(x, y, aBPlots[x + 23][y + 5].rms());
+ aBTOutMeanPlot.fill(x, y, aBPlots[x + 23][y + 5].mean());
+
+ }
+
}
}
//printOutliers();
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.9 -r1.10
--- HPSEcalSimpleReadoutDriver.java 27 Aug 2012 21:53:47 -0000 1.9
+++ HPSEcalSimpleReadoutDriver.java 8 Dec 2012 01:12:17 -0000 1.10
@@ -11,7 +11,7 @@
* No time evolution - this just integrates all hits in a cycle.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalSimpleReadoutDriver.java,v 1.9 2012/08/27 21:53:47 meeg Exp $
+ * @version $Id: HPSEcalSimpleReadoutDriver.java,v 1.10 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcalSimpleReadoutDriver extends HPSEcalReadoutDriver<HPSRawCalorimeterHit> {
//buffer for deposited energy
@@ -21,6 +21,7 @@
hitClass = HPSRawCalorimeterHit.class;
}
+ @Override
protected void readHits(List<HPSRawCalorimeterHit> hits) {
for (Long cellID : eDepMap.keySet()) {
// int ix = dec.getValue("ix");
@@ -36,6 +37,7 @@
eDepMap = new HashMap<Long, Double>();
}
+ @Override
protected void putHits(List<CalorimeterHit> hits) {
//fill the readout buffers
for (CalorimeterHit hit : hits) {
@@ -48,6 +50,7 @@
}
}
+ @Override
protected void initReadout() {
//initialize buffers
eDepMap = new HashMap<Long, Double>();
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.12 -r1.13
--- HPSFADCTriggerDriver.java 2 Oct 2012 01:56:08 -0000 1.12
+++ HPSFADCTriggerDriver.java 8 Dec 2012 01:12:17 -0000 1.13
@@ -15,19 +15,18 @@
*
* @author Omar Moreno <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSFADCTriggerDriver.java,v 1.12 2012/10/02 01:56:08 phansson Exp $
+ * @version $Id: HPSFADCTriggerDriver.java,v 1.13 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSFADCTriggerDriver extends HPSTriggerDriver {
- private static final double GeV = 1000;
// A list to contain all cluster pairs in an event
List<HPSEcalCluster[]> clusterPairs;
int nTriggers;
int totalEvents;
- private double clusterEnergyHigh = 1.85 * GeV; // GeV
- private double clusterEnergyLow = .1 * GeV; // GeV
- private double energySumThreshold = 2.2 * GeV; // GeV
- private double energyDifferenceThreshold = 1.5 * GeV; // GeV
+ private double clusterEnergyHigh = 1.85 * HPSECalUtils.GeV; // GeV
+ private double clusterEnergyLow = .1 * HPSECalUtils.GeV; // GeV
+ private double energySumThreshold = 2.2 * HPSECalUtils.GeV; // GeV
+ private double energyDifferenceThreshold = 1.5 * HPSECalUtils.GeV; // GeV
private double maxCoplanarityAngle = 35; // degrees
int allPairs;
int oppositeQuadrantCount;
@@ -68,17 +67,17 @@
// one of the cluster pairs satisfies all of the trigger conditions,
// a trigger signal is sent to all other detectors.
for (HPSEcalCluster[] clusterPair : clusterPairs) {
-
-
+
+
if (outputStream != null) {
outputStream.printf("Event %d: cluster pair (energy %f in quadrant %d (%s), energy %f in quadrant %d (%s))\n",
ClockSingleton.getClock(),
- clusterPair[0].getEnergy(), HPSECalUtils.getQuadrant(clusterPair[0]),clusterPair[0].getSeedHit().getPositionVec().toString(),
- clusterPair[1].getEnergy(), HPSECalUtils.getQuadrant(clusterPair[1]),clusterPair[1].getSeedHit().getPositionVec().toString());
+ clusterPair[0].getEnergy(), HPSECalUtils.getQuadrant(clusterPair[0]), clusterPair[0].getSeedHit().getPositionVec().toString(),
+ clusterPair[1].getEnergy(), HPSECalUtils.getQuadrant(clusterPair[1]), clusterPair[1].getSeedHit().getPositionVec().toString());
}
-
+
allPairs++;
-
+
// Require that the event have at least two clusters in opposite
// quadrants
if (!oppositeQuadrantsCut(clusterPair)) {
@@ -157,7 +156,7 @@
@Override
public void endOfData() {
if (outputStream != null) {
- outputStream.printf("Number of pairs: %d\n",allPairs);
+ outputStream.printf("Number of pairs: %d\n", allPairs);
outputStream.printf("Number of cluster pairs after successive trigger conditions:\n");
outputStream.printf("Opposite quadrants: %d\n", oppositeQuadrantCount);
outputStream.printf("Cluster energy: %d\n", clusterEnergyCount);
@@ -169,7 +168,7 @@
outputStream.printf("Trigger count: %d\n", numTriggers);
outputStream.close();
}
- System.out.printf("Number of pairs: %d\n",allPairs);
+ System.out.printf("Number of pairs: %d\n", allPairs);
System.out.printf("Number of cluster pairs after successive trigger conditions:\n");
System.out.printf("Opposite quadrants: %d\n", oppositeQuadrantCount);
System.out.printf("Cluster energy: %d\n", clusterEnergyCount);
@@ -296,9 +295,9 @@
double lowEClusterDistance = Math.sqrt(Math.pow(lowEClusterPosition[0], 2)
+ Math.pow(lowEClusterPosition[1], 2));
- double clusterDistvsE = lowEnergyCluster.getEnergy() + lowEClusterDistance * (0.0032 * GeV);
+ double clusterDistvsE = lowEnergyCluster.getEnergy() + lowEClusterDistance * (0.0032 * HPSECalUtils.GeV);
- if (clusterDistvsE > .8 * GeV /*
+ if (clusterDistvsE > .8 * HPSECalUtils.GeV /*
* GeV
*/) {
return true;
@@ -321,7 +320,7 @@
+ Math.pow(cluster1Position[1], 2));
double cluster2Dist = Math.sqrt(Math.pow(cluster2Position[0], 2)
+ Math.pow(cluster2Position[1], 2));
-
+
// Calculate the dot product between the distance vectors of
// each cluster in the cluster pair
double clusterDot = cluster1Position[0] * cluster2Position[0]
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.3 -r1.4
--- HPSEcal1BitEventVetoClusterer.java 21 Oct 2011 20:32:16 -0000 1.3
+++ HPSEcal1BitEventVetoClusterer.java 8 Dec 2012 01:12:17 -0000 1.4
@@ -14,52 +14,56 @@
* The clustering algorithm is from JLab Hall B 6 GeV DVCS Trigger Design doc.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcal1BitEventVetoClusterer.java,v 1.3 2011/10/21 20:32:16 meeg Exp $
+ * @version $Id: HPSEcal1BitEventVetoClusterer.java,v 1.4 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcal1BitEventVetoClusterer extends HPSEcal1BitClusterer {
- public HPSEcal1BitEventVetoClusterer() {
- }
+ public HPSEcal1BitEventVetoClusterer() {
+ }
- public void countHits(List<CalorimeterHit> hits, List<CalorimeterHit> vetoHits) {
- // Hit map.
- hitMap = new HashMap<Long, CalorimeterHit>();
-
- hitCounts = new HashMap<Long, Integer>();
- if (vetoHits != null && !vetoHits.isEmpty())
- return;
-
- // Loop over ECal hits to count hit towers
- for (CalorimeterHit hit : hits) {
- dec.setID(hit.getCellID());
- int ix = dec.getValue("ix");
- if (ix >= xMin && ix <= xMax)
- continue;
-
- // Make a hit map for quick lookup by ID.
- hitMap.put(hit.getCellID(), hit);
-
- // Get neighbor crystal IDs.
- Set<Long> neighbors = neighborMap.get(hit.getCellID());
-
- if (neighbors == null) {
- throw new RuntimeException("Oops! Set of neighbors is null!");
- }
-
- Integer hitCount = hitCounts.get(hit.getCellID());
- if (hitCount == null)
- hitCounts.put(hit.getCellID(), 1);
- else
- hitCounts.put(hit.getCellID(), hitCount + 1);
-
- // Loop over neighbors to make hit list for cluster.
- for (Long neighborId : neighbors) {
- hitCount = hitCounts.get(neighborId);
- if (hitCount == null)
- hitCounts.put(neighborId, 1);
- else
- hitCounts.put(neighborId, hitCount + 1);
- }
- }
- }
+ @Override
+ public void countHits(List<CalorimeterHit> hits, List<CalorimeterHit> vetoHits) {
+ // Hit map.
+ hitMap = new HashMap<Long, CalorimeterHit>();
+
+ hitCounts = new HashMap<Long, Integer>();
+ if (vetoHits != null && !vetoHits.isEmpty()) {
+ return;
+ }
+
+ // Loop over ECal hits to count hit towers
+ for (CalorimeterHit hit : hits) {
+ int ix = hit.getIdentifierFieldValue("ix");
+ if (ix >= xMin && ix <= xMax) {
+ continue;
+ }
+
+ // Make a hit map for quick lookup by ID.
+ hitMap.put(hit.getCellID(), hit);
+
+ // Get neighbor crystal IDs.
+ Set<Long> neighbors = neighborMap.get(hit.getCellID());
+
+ if (neighbors == null) {
+ throw new RuntimeException("Oops! Set of neighbors is null!");
+ }
+
+ Integer hitCount = hitCounts.get(hit.getCellID());
+ if (hitCount == null) {
+ hitCounts.put(hit.getCellID(), 1);
+ } else {
+ hitCounts.put(hit.getCellID(), hitCount + 1);
+ }
+
+ // Loop over neighbors to make hit list for cluster.
+ for (Long neighborId : neighbors) {
+ hitCount = hitCounts.get(neighborId);
+ if (hitCount == null) {
+ hitCounts.put(neighborId, 1);
+ } else {
+ hitCounts.put(neighborId, hitCount + 1);
+ }
+ }
+ }
+ }
}
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.2 -r1.3
--- HPSECalUtils.java 23 Aug 2012 20:38:48 -0000 1.2
+++ HPSECalUtils.java 8 Dec 2012 01:12:17 -0000 1.3
@@ -5,10 +5,13 @@
/**
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSECalUtils.java,v 1.2 2012/08/23 20:38:48 meeg Exp $
+ * @version $Id: HPSECalUtils.java,v 1.3 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSECalUtils {
+ public static final double GeV = 1.0;
+ public static final double MeV = 0.001;
+
/**
* Returns the quadrant which contains the ECal cluster
*
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.1 -r1.2
--- HPSFADCSingleTriggerDriver.java 2 Oct 2012 22:48:17 -0000 1.1
+++ HPSFADCSingleTriggerDriver.java 8 Dec 2012 01:12:17 -0000 1.2
@@ -4,7 +4,6 @@
import java.util.LinkedList;
import java.util.List;
-import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.hps.evio.TriggerData;
import org.lcsim.hps.util.ClockSingleton;
@@ -12,24 +11,20 @@
/**
* Reads clusters and makes trigger decision using opposite quadrant criterion.
* Prints triggers to file if file path specified.
+ * TODO: Redundant with TestRunTriggerDriver.
*
* @author Omar Moreno <[log in to unmask]>
* @author Sho Uemura <[log in to unmask]>
* @author Per Hansson Adrian <[log in to unmask]>
- * @version $Id: HPSFADCSingleTriggerDriver.java,v 1.1 2012/10/02 22:48:17 phansson Exp $
+ * @version $Id: HPSFADCSingleTriggerDriver.java,v 1.2 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSFADCSingleTriggerDriver extends HPSTriggerDriver {
-
- private static final double GeV = 1000;
// A list to contain all cluster pairs in an event
List<HPSEcalCluster[]> clusterPairs;
int nTriggers;
int totalEvents;
- private double clusterEnergyHigh = 1.85 * GeV; // GeV
- private double clusterEnergyLow = .1 * GeV; // GeV
- private double energySumThreshold = 2.2 * GeV; // GeV
- private double energyDifferenceThreshold = 1.5 * GeV; // GeV
- private double maxCoplanarityAngle = 35; // degrees
+ private double clusterEnergyHigh = 1.85 * HPSECalUtils.GeV; // GeV
+ private double clusterEnergyLow = .1 * HPSECalUtils.GeV; // GeV
int allClusters;
int clusterEnergyCount;
int deadtimelessTriggerCount;
@@ -109,28 +104,6 @@
super.endOfData();
}
-
-
- /**
- * Checks if the ECal clusters making up a cluster pair lie in opposite
- * quadrants
- *
- * @param clusterPair : pair of clusters
- * @return true if opposite quadrants, false otherwise
- */
- public boolean oppositeQuadrantsCut(HPSEcalCluster[] clusterPair) {
- 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 odd (1 and 3)
- else {
- return ((quad1 & 1) == (quad2 & 1));
- }
- }
-
/**
* Checks if the ECal clusters making up a cluster pair lie above the low
* energy threshold and below the high energy threshold
@@ -138,98 +111,11 @@
* @param clusterPair : pair of clusters
* @return true if a pair is found, false otherwise
*/
- public boolean clusterECut(HPSEcalCluster cluster) {
+ private boolean clusterECut(HPSEcalCluster cluster) {
return (cluster.getEnergy() < clusterEnergyHigh && cluster.getEnergy() > clusterEnergyLow);
}
/**
- * Checks if the sum of the energies of ECal clusters making up a cluster
- * pair is below an energy sum threshold
- *
- * @param clusterPair : pair of clusters
- * @return true if a pair is found, false otherwise
- */
- public boolean energySum(Cluster[] clusterPair) {
- double clusterESum = clusterPair[0].getEnergy()
- + clusterPair[1].getEnergy();
- return (clusterESum < energySumThreshold);
- }
-
- /**
- * Checks if the energy difference between the ECal clusters making up a
- * cluster pair is below an energy difference threshold
- *
- * @param clusterPair : pair of clusters
- * @return true if pair is found, false otherwise
- */
- public boolean energyDifference(HPSEcalCluster[] clusterPair) {
- double clusterEDifference = Math.abs(clusterPair[0].getEnergy()
- - clusterPair[1].getEnergy());
-
- return (clusterEDifference < energyDifferenceThreshold);
- }
-
- /**
- * 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
- */
- public boolean energyDistanceCut(HPSEcalCluster[] clusterPair) {
- HPSEcalCluster lowEnergyCluster;
-
- // Obtain the lowest energy cluster
- if (clusterPair[0].getEnergy() < clusterPair[1].getEnergy()) {
- lowEnergyCluster = clusterPair[0];
- } else {
- lowEnergyCluster = clusterPair[1];
- }
-
- double lowEClusterPosition[] = lowEnergyCluster.getSeedHit().getPosition();
- // Calculate its position
- double lowEClusterDistance = Math.sqrt(Math.pow(lowEClusterPosition[0], 2)
- + Math.pow(lowEClusterPosition[1], 2));
-
- double clusterDistvsE = lowEnergyCluster.getEnergy() + lowEClusterDistance * (0.0032 * GeV);
-
- if (clusterDistvsE > .8 * GeV /*
- * GeV
- */) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if a cluster pair is coplanar to the beam within a given angle
- *
- * @param clusterPair : pair of clusters
- * @return true if pair is found, false otherwise
- */
- public boolean coplanarityCut(HPSEcalCluster[] clusterPair) {
- 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));
- double cluster2Dist = Math.sqrt(Math.pow(cluster2Position[0], 2)
- + Math.pow(cluster2Position[1], 2));
-
- // Calculate the dot product between the distance vectors of
- // each cluster in the cluster pair
- double clusterDot = cluster1Position[0] * cluster2Position[0]
- + cluster1Position[1] * cluster2Position[1];
-
- // Find the angle between clusters in the pair
- double cosphi = clusterDot / (cluster1Dist * cluster2Dist);
- double phi = Math.toDegrees(Math.acos(cosphi));
-
- return ((180 - phi) < maxCoplanarityAngle);
- }
-
- /**
* Make a dummy TriggerData
*/
@Override
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.6 -r1.7
--- HPSEcalEdepToTriggerConverterDriver.java 16 Oct 2012 20:00:27 -0000 1.6
+++ HPSEcalEdepToTriggerConverterDriver.java 8 Dec 2012 01:12:17 -0000 1.7
@@ -25,9 +25,7 @@
private int triggerThreshold = 80;
private int truncateScale = 128;
private double pulseIntegral = tp * Math.E / readoutPeriod;
- //normalization constant from cal gain (MeV/integral bit) to amplitude gain (amplitude bit/GeV)
- private double gainNorm = 1000.0 / pulseIntegral;
- private double gainScale = 1.0;
+ private double gainScale = 1.0; //gain miscalibration factor
private double _gain = -1.0; //constant gain, activated if >0
public HPSEcalEdepToTriggerConverterDriver() {
@@ -56,7 +54,7 @@
public void setTruncateScale(int truncateScale) {
this.truncateScale = truncateScale;
}
-
+
public void setConstantGain(double gain) {
this._gain = gain;
}
@@ -92,7 +90,7 @@
if (triggerHit != null) {
triggerHits.add(triggerHit);
}
- CalorimeterHit readoutHit = makeReadoutHit(hit,_gain);
+ CalorimeterHit readoutHit = makeReadoutHit(hit);
if (readoutHit != null) {
readoutHits.add(readoutHit);
}
@@ -104,8 +102,7 @@
}
public CalorimeterHit makeTriggerHit(CalorimeterHit hit) {
- long id = hit.getCellID();
- double amplitude = hit.getRawEnergy() * gainNorm / HPSEcalConditions.physicalToGain(id) * gainScale;
+ double amplitude = hitAmplitude(hit);
// double time = readoutPeriod * (Math.random() - 1);
double time = 0 - hit.getTime();
@@ -131,26 +128,19 @@
// System.out.format("%f %f %f\n", readoutIntegral, amplitude, triggerIntegral);
- int truncatedIntegral = (int) Math.floor(triggerIntegral / truncateScale) /** truncateScale*/;
+ int truncatedIntegral = (int) Math.floor(triggerIntegral / truncateScale);
if (truncatedIntegral > 0) {
- return new HPSRawCalorimeterHit(truncatedIntegral, hit.getTime(), id, 0);
+ return new HPSRawCalorimeterHit(truncatedIntegral, hit.getTime(), hit.getCellID(), 0);
}
return null;
}
public CalorimeterHit makeReadoutHit(CalorimeterHit hit) {
- double gain = -1.0;
- return makeReadoutHit(hit,gain);
- }
-
- public CalorimeterHit makeReadoutHit(CalorimeterHit hit, double gain) {
- long id = hit.getCellID();
- gain = gain > 0 ? gain : HPSEcalConditions.physicalToGain(id);
- double amplitude = hit.getRawEnergy() * gainNorm / gain * gainScale;
+ double amplitude = hitAmplitude(hit);
if (amplitude < readoutThreshold) {
return null;
}
- double integral = hit.getRawEnergy() * 1000.0 * gainScale;
+ double integral = hit.getRawEnergy()/HPSECalUtils.GeV * gainScale;
// double thresholdCrossingTime = 0 - hit.getTime();
// while (true) {
@@ -172,10 +162,15 @@
//// double integral = readoutIntegral * HPSEcalConditions.physicalToGain(id);
// System.out.format("dumb: %f, full: %f\n",hit.getRawEnergy() * 1000.0,readoutIntegral * HPSEcalConditions.physicalToGain(id));
- CalorimeterHit h = new HPSRawCalorimeterHit(integral, hit.getTime(), id, 0);
+ CalorimeterHit h = new HPSRawCalorimeterHit(integral, hit.getTime(), hit.getCellID(), 0);
return h;
}
+ private double hitAmplitude(CalorimeterHit hit) {
+ double gain = _gain > 0 ? _gain : HPSEcalConditions.physicalToGain(hit.getCellID());
+ return (hit.getRawEnergy() /HPSECalUtils.MeV) / (gain * pulseIntegral);
+ }
+
private double pulseAmplitude(double time) {
if (time <= 0.0) {
return 0.0;
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.5 -r1.6
--- HPSEcalDiscriminatorReadoutDriver.java 27 Aug 2012 21:53:47 -0000 1.5
+++ HPSEcalDiscriminatorReadoutDriver.java 8 Dec 2012 01:12:17 -0000 1.6
@@ -13,7 +13,7 @@
* Simulates time evolution of preamp output pulse and leading-edge discriminator.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalDiscriminatorReadoutDriver.java,v 1.5 2012/08/27 21:53:47 meeg Exp $
+ * @version $Id: HPSEcalDiscriminatorReadoutDriver.java,v 1.6 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcalDiscriminatorReadoutDriver extends HPSEcalReadoutDriver<HPSRawCalorimeterHit> {
@@ -28,7 +28,7 @@
//discriminator output pulse width in ns
double outputWidth = 32.0;
//output hit "energy" in GeV
- double outputEnergy = 10.0;
+ double outputEnergy = 10.0*HPSECalUtils.GeV;
public HPSEcalDiscriminatorReadoutDriver() {
hitClass = HPSRawCalorimeterHit.class;
@@ -52,6 +52,7 @@
this.t0 = t0;
}
+ @Override
protected void readHits(List<HPSRawCalorimeterHit> hits) {
for (Long cellID : edgeTimeMap.keySet()) {
//if there's an output pulse, make a hit
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.21 -r1.22
--- HPSEcalFADCReadoutDriver.java 20 Nov 2012 23:25:09 -0000 1.21
+++ HPSEcalFADCReadoutDriver.java 8 Dec 2012 01:12:17 -0000 1.22
@@ -27,7 +27,7 @@
* Simulates time evolution of preamp output pulse.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.21 2012/11/20 23:25:09 meeg Exp $
+ * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.22 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcalFADCReadoutDriver extends HPSEcalReadoutDriver<RawCalorimeterHit> {
@@ -170,12 +170,11 @@
pipeline.step();
double pedestal = HPSEcalConditions.physicalToPedestal(cellID);
//normalization constant from cal gain (MeV/integral bit) to amplitude gain (amplitude bit/GeV)
- double gainNorm = 1000.0 / pulseIntegral;
double gain;
if (fixedGain > 0) {
- gain = gainNorm / fixedGain;
+ gain = 1.0 / (fixedGain * HPSECalUtils.MeV * pulseIntegral);
} else {
- gain = gainNorm / HPSEcalConditions.physicalToGain(cellID);
+ gain = 1.0 / (HPSEcalConditions.physicalToGain(cellID) * HPSECalUtils.MeV * pulseIntegral);
}
double currentValue = gain * eDepBuffer.currentValue();
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.24 -r1.25
--- HPSEcalClusterer.java 23 Aug 2012 18:48:18 -0000 1.24
+++ HPSEcalClusterer.java 8 Dec 2012 01:12:17 -0000 1.25
@@ -23,7 +23,7 @@
* @author Jeremy McCormick <[log in to unmask]>
* @author Tim Nelson <[log in to unmask]>
*
- * @version $Id: HPSEcalClusterer.java,v 1.24 2012/08/23 18:48:18 meeg Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.25 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSEcalClusterer extends Driver {
@@ -32,9 +32,9 @@
String ecalName = "Ecal";
String clusterCollectionName = "EcalClusters";
// Minimum E for cluster seed.
- double seedEMin = .05;
+ double seedEMin = .05 * HPSECalUtils.GeV;
// Minimum E to add hit to cluster.
- double addEMin = .03;
+ double addEMin = .03 * HPSECalUtils.GeV;
// Odd or even number of crystals in X.
boolean oddX;
// Map of crystals to their neighbors.
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.3 -r1.4
--- TestRunRateAnalysis.java 14 Aug 2012 00:58:04 -0000 1.3
+++ TestRunRateAnalysis.java 8 Dec 2012 01:12:17 -0000 1.4
@@ -15,7 +15,7 @@
* Prints triggers to file if file path specified.
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: TestRunRateAnalysis.java,v 1.3 2012/08/14 00:58:04 meeg Exp $
+ * @version $Id: TestRunRateAnalysis.java,v 1.4 2012/12/08 01:12:17 meeg Exp $
*/
public class TestRunRateAnalysis extends Driver {
@@ -67,6 +67,7 @@
this.clusterCollectionName = clusterCollectionName;
}
+ @Override
public void process(EventHeader event) {
//System.out.println(this.getClass().getCanonicalName() + " - process");
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.2 -r1.3
--- HPSDummyTriggerDriver.java 31 Jul 2012 00:08:40 -0000 1.2
+++ HPSDummyTriggerDriver.java 8 Dec 2012 01:12:17 -0000 1.3
@@ -8,7 +8,7 @@
* Free-running trigger - triggers on every Nth event
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSDummyTriggerDriver.java,v 1.2 2012/07/31 00:08:40 meeg Exp $
+ * @version $Id: HPSDummyTriggerDriver.java,v 1.3 2012/12/08 01:12:17 meeg Exp $
*/
public class HPSDummyTriggerDriver extends HPSTriggerDriver {
@@ -23,6 +23,7 @@
return (ClockSingleton.getClock() % period == 0);
}
+ @Override
public boolean testTrigger(List<HPSEcalCluster> clusters) {
return false;
}
hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.9 -r1.10
--- EcalEvsX.java 8 Sep 2012 00:17:54 -0000 1.9
+++ EcalEvsX.java 8 Dec 2012 01:12:18 -0000 1.10
@@ -52,9 +52,9 @@
// Setup plots.
aida.tree().cd("/");
// EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 400.0, 100, -2000, 2000);
- EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 400.0, 100, 0, 2000);
- invMassPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Photon Pair Mass", 100, 0.0, 250.0);
- clusterPairEnergyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Energies", 1000, -100, 2000, 1000, -100, 2000);
+ EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 400.0, 100, 0, 2.0);
+ invMassPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Photon Pair Mass", 100, 0.0, 0.250);
+ clusterPairEnergyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Energies", 1000, -0.1, 2.0, 1000, -0.1, 2.0);
clusterPairPositionPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Positions", 50, -350, 350, 50, -350, 350);
// Create the plotter regions.
hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.10 -r1.11
--- EcalPedestalPlots.java 27 Aug 2012 21:53:47 -0000 1.10
+++ EcalPedestalPlots.java 8 Dec 2012 01:12:18 -0000 1.11
@@ -18,6 +18,7 @@
import org.lcsim.hps.monitoring.AIDAFrame;
import org.lcsim.hps.monitoring.Redrawable;
import org.lcsim.hps.monitoring.Resettable;
+import org.lcsim.hps.recon.ecal.HPSECalUtils;
import org.lcsim.hps.recon.ecal.HPSEcalConditions;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
@@ -45,7 +46,7 @@
int eventn = 0;
boolean hide = false;
int calWindow = 0;
- double maxE = 1000;
+ double maxE = 1000 * HPSECalUtils.MeV;
public EcalPedestalPlots() {
int count = 0;
@@ -80,6 +81,7 @@
this.inputCollection = inputCollection;
}
+ @Override
public void detectorChanged(Detector detector) {
if (inputCollection == null) {
throw new RuntimeException("The inputCollection parameter was not set.");
@@ -98,7 +100,7 @@
// IHistogram1D hist = aida.histogram1D("ECAL: x=" + i + "; y=" + j, 1000, 0, 16);
// plots[x + 23][y + 5] = aida.cloud1D("ECAL: x=" + x + "; y=" + y);
if (calWindow == 0) {
- aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
+ aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 500, -0.1, maxE);
} else {
aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
}
@@ -172,6 +174,7 @@
}
}
+ @Override
public void endOfData() {
plotterFrame.dispose();
if (calWindow > 0) {
@@ -193,6 +196,7 @@
}
}
+ @Override
public void reset() {
if (plotter != null) {
plotter.hide();
@@ -205,6 +209,7 @@
}
}
+ @Override
public void process(EventHeader event) {
if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.7 -r1.8
--- EcalHitPlots.java 7 Jun 2012 00:49:48 -0000 1.7
+++ EcalHitPlots.java 8 Dec 2012 01:12:18 -0000 1.8
@@ -12,6 +12,7 @@
import org.lcsim.hps.evio.TriggerData;
import org.lcsim.hps.monitoring.AIDAFrame;
import org.lcsim.hps.monitoring.Resettable;
+import org.lcsim.hps.recon.ecal.HPSECalUtils;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
@@ -31,7 +32,7 @@
// IHistogram2D topX, botX, topY, botY;
IHistogram2D edgePlot;
int eventn = 0;
- double maxE = 5000;
+ double maxE = 5000 * HPSECalUtils.MeV;
boolean logScale = false;
public void setInputCollection(String inputCollection) {
@@ -46,6 +47,7 @@
this.logScale = logScale;
}
+ @Override
protected void detectorChanged(Detector detector) {
plotterFrame = new AIDAFrame();
@@ -74,8 +76,8 @@
plotterFrame.addPlotter(plotter2);
plotter2.style().dataStyle().errorBarStyle().setVisible(false);
- hitEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy", 1000, -100, maxE);
- hitMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Hit Energy In Event", 1000, -100, maxE);
+ hitEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy", 1000, -0.1, maxE);
+ hitMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Hit Energy In Event", 1000, -0.1, maxE);
if (logScale) {
plotter2.style().yAxisStyle().setParameter("scale", "log");
@@ -145,6 +147,7 @@
plotterFrame.pack();
}
+ @Override
public void process(EventHeader event) {
int orTrigTime = -1;
int topTrigTime = -1;
@@ -250,6 +253,7 @@
}
}
+ @Override
public void reset() {
hitCountPlot.reset();
hitTimePlot.reset();
@@ -257,6 +261,7 @@
hitMaxEnergyPlot.reset();
}
+ @Override
public void endOfData() {
plotterFrame.dispose();
}
hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.7 -r1.8
--- EcalClusterPlots.java 7 Jun 2012 00:49:48 -0000 1.7
+++ EcalClusterPlots.java 8 Dec 2012 01:12:18 -0000 1.8
@@ -14,6 +14,7 @@
import org.lcsim.hps.evio.TriggerData;
import org.lcsim.hps.monitoring.AIDAFrame;
import org.lcsim.hps.monitoring.Resettable;
+import org.lcsim.hps.recon.ecal.HPSECalUtils;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
@@ -31,7 +32,7 @@
IHistogram1D clusterTimeSigma;
IHistogram2D edgePlot;
int eventn = 0;
- double maxE = 5000;
+ double maxE = 5000 * HPSECalUtils.MeV;
boolean logScale = false;
public void setInputCollection(String inputCollection) {
@@ -46,6 +47,7 @@
this.logScale = logScale;
}
+ @Override
protected void detectorChanged(Detector detector) {
plotterFrame = new AIDAFrame();
@@ -78,8 +80,8 @@
plotter2.style().yAxisStyle().setParameter("scale", "log");
}
- clusterEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Energy", 1000, -100, maxE);
- clusterMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Cluster Energy In Event", 1000, -100, maxE);
+ clusterEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Energy", 1000, -0.1, maxE);
+ clusterMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Cluster Energy In Event", 1000, -0.1, maxE);
// Create the plotter regions.
@@ -114,6 +116,7 @@
plotterFrame.pack();
}
+ @Override
public void process(EventHeader event) {
int orTrig = 0;
int topTrig = 0;
@@ -136,45 +139,45 @@
// if ((botTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] > 0)) {
// if ((botTrig == 0 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getPosition()[1] > 0)) {
clusterEnergyPlot.fill(cluster.getEnergy());
- if (cluster.getEnergy() > maxEnergy) {
- maxEnergy = cluster.getEnergy();
- }
- int size = 0;
- double[] times = new double[cluster.getCalorimeterHits().size()];
+ if (cluster.getEnergy() > maxEnergy) {
+ maxEnergy = cluster.getEnergy();
+ }
+ int size = 0;
+ double[] times = new double[cluster.getCalorimeterHits().size()];
// System.out.format("cluster:\n");
- for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
- if (hit.getRawEnergy() != 0) {
- times[size] = hit.getTime();
- clusterTimes.fill(hit.getTime());
- size++;
+ for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
+ if (hit.getRawEnergy() != 0) {
+ times[size] = hit.getTime();
+ clusterTimes.fill(hit.getTime());
+ size++;
// System.out.format("x=%d, y=%d, time=%f, energy=%f\n", hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getTime(), hit.getRawEnergy());
- }
}
- clusterSizePlot.fill(size);
- clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(times, 0, size)));
-
- List<CalorimeterHit> hits = cluster.getCalorimeterHits();
- for (int i = 0; i < hits.size(); i++) {
- CalorimeterHit hit1 = hits.get(i);
- if (hit1.getRawEnergy() == 0) {
+ }
+ clusterSizePlot.fill(size);
+ clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(times, 0, size)));
+
+ List<CalorimeterHit> hits = cluster.getCalorimeterHits();
+ for (int i = 0; i < hits.size(); i++) {
+ CalorimeterHit hit1 = hits.get(i);
+ if (hit1.getRawEnergy() == 0) {
+ continue;
+ }
+ int x1 = hit1.getIdentifierFieldValue("ix");
+ int y1 = hit1.getIdentifierFieldValue("iy");
+ for (int j = i + 1; j < hits.size(); j++) {
+ CalorimeterHit hit2 = hits.get(j);
+ if (hit2.getRawEnergy() == 0) {
continue;
}
- int x1 = hit1.getIdentifierFieldValue("ix");
- int y1 = hit1.getIdentifierFieldValue("iy");
- for (int j = i + 1; j < hits.size(); j++) {
- CalorimeterHit hit2 = hits.get(j);
- if (hit2.getRawEnergy() == 0) {
- continue;
- }
- int x2 = hit2.getIdentifierFieldValue("ix");
- int y2 = hit2.getIdentifierFieldValue("iy");
- if ((Math.abs(x1 - x2) <= 1 || x1 * x2 == -1) && (Math.abs(y1 - y2) <= 1)) {
- if (x1 != x2 || y1 != y2) {
- edgePlot.fill((x1 + x2) / 2.0, (y1 + y2) / 2.0);
- }
+ int x2 = hit2.getIdentifierFieldValue("ix");
+ int y2 = hit2.getIdentifierFieldValue("iy");
+ if ((Math.abs(x1 - x2) <= 1 || x1 * x2 == -1) && (Math.abs(y1 - y2) <= 1)) {
+ if (x1 != x2 || y1 != y2) {
+ edgePlot.fill((x1 + x2) / 2.0, (y1 + y2) / 2.0);
}
}
}
+ }
// }
}
clusterMaxEnergyPlot.fill(maxEnergy);
@@ -183,6 +186,7 @@
}
}
+ @Override
public void reset() {
clusterCountPlot.reset();
clusterSizePlot.reset();
@@ -190,6 +194,7 @@
clusterMaxEnergyPlot.reset();
}
+ @Override
public void endOfData() {
plotterFrame.dispose();
}
CVSspam 0.2.12