Commit in hps-java/src/main/java/org/lcsim/hps on MAIN | |||
recon/ecal/HPSEcalCluster.java | +1 | -2 | 1.5 -> 1.6 |
/HPSEcalClusterer.java | +2 | -2 | 1.20 -> 1.21 |
/HPSEcalCTPClusterer.java | +256 | -204 | 1.3 -> 1.4 |
monitoring/ecal/TriggerPlots.java | +292 | added 1.1 | |
+551 | -208 |
tweaks to HPSEcalCluster and clusterers; trigger monitoring plots
diff -u -r1.5 -r1.6 --- HPSEcalCluster.java 8 May 2012 15:49:32 -0000 1.5 +++ HPSEcalCluster.java 4 Jun 2012 23:03:58 -0000 1.6 @@ -11,7 +11,7 @@
* Cluster with position defined by seed hit (for 1-bit trigger) * * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalCluster.java,v 1.5 2012/05/08 15:49:32 meeg Exp $
+ * @version $Id: HPSEcalCluster.java,v 1.6 2012/06/04 23:03:58 meeg Exp $
*/ public class HPSEcalCluster extends BasicCluster {
@@ -25,7 +25,6 @@
public HPSEcalCluster(CalorimeterHit seedHit) { this.seedHit = seedHit; this.cellID = seedHit.getCellID();
- this.addHit(seedHit);
} public CalorimeterHit getSeedHit() {
diff -u -r1.20 -r1.21 --- HPSEcalClusterer.java 4 May 2012 20:29:02 -0000 1.20 +++ HPSEcalClusterer.java 4 Jun 2012 23:03:58 -0000 1.21 @@ -23,11 +23,10 @@
* @author Jeremy McCormick <[log in to unmask]> * @author Tim Nelson <[log in to unmask]> *
- * @version $Id: HPSEcalClusterer.java,v 1.20 2012/05/04 20:29:02 meeg Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.21 2012/06/04 23:03:58 meeg Exp $
*/ public class HPSEcalClusterer extends Driver {
-
HPSEcal3 ecal; String ecalCollectionName; String ecalName;
@@ -158,6 +157,7 @@
if (isSeed) { // Make a cluster from the hit list. HPSEcalCluster cluster = new HPSEcalCluster(hit);
+ cluster.addHit(hit);
for (CalorimeterHit clusHit : neighborHits) { cluster.addHit(clusHit); }
diff -u -r1.3 -r1.4 --- HPSEcalCTPClusterer.java 8 May 2012 15:49:32 -0000 1.3 +++ HPSEcalCTPClusterer.java 4 Jun 2012 23:03:58 -0000 1.4 @@ -1,19 +1,23 @@
package org.lcsim.hps.recon.ecal; import java.util.ArrayList;
+import java.util.Collection; +import java.util.Comparator;
import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map;
+import java.util.PriorityQueue;
import java.util.Set; import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.Cluster;
+//import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader; import org.lcsim.geometry.Detector; import org.lcsim.geometry.IDDecoder; import org.lcsim.geometry.subdetector.HPSEcal3.NeighborMap; import org.lcsim.geometry.subdetector.HPSEcal3;
+import org.lcsim.hps.recon.ecal.HPSEcalCTPClusterer.TimeComparator;
import org.lcsim.util.Driver; import org.lcsim.util.lcio.LCIOConstants;
@@ -25,220 +29,268 @@
* @author Jeremy McCormick <[log in to unmask]> * @author Tim Nelson <[log in to unmask]> * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalCTPClusterer.java,v 1.3 2012/05/08 15:49:32 meeg Exp $
+ * @version $Id: HPSEcalCTPClusterer.java,v 1.4 2012/06/04 23:03:58 meeg Exp $
*/ public class HPSEcalCTPClusterer extends Driver {
- HPSEcal3 ecal; - IDDecoder dec; - String ecalName; - String ecalCollectionName; - String clusterCollectionName = "EcalClusters"; - Set<Long> clusterCenters = null; - Map<Long, Double> hitSums = null; - Map<Long, CalorimeterHit> hitMap = null; - // Map of crystals to their neighbors. - NeighborMap neighborMap = null; - - public HPSEcalCTPClusterer() { - } - - public void setClusterCollectionName(String clusterCollectionName) { - this.clusterCollectionName = clusterCollectionName; - } - - public void setEcalCollectionName(String ecalCollectionName) { - this.ecalCollectionName = ecalCollectionName; - } - - 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(); - - clusterCenters = new HashSet<Long>(); - //Make set of valid cluster centers. - for (Long cellID : neighborMap.keySet()) { - boolean isValidCenter = true; - Set<Long> neighbors = neighborMap.get(cellID); - for (Long neighborID : neighbors) { - Set<Long> neighborneighbors = new HashSet<Long>(); - neighborneighbors.addAll(neighborMap.get(neighborID)); - neighborneighbors.add(neighborID); - - if (neighborneighbors.containsAll(neighbors)) { - isValidCenter = false; - break; - } - } - if (isValidCenter) { - clusterCenters.add(cellID); - } - } - - //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!"); - } - - // Get the list of raw ECal hits. - - sumHits(hits); - - // Put Cluster collection into event. - int flag = 1 << LCIOConstants.CLBIT_HITS; - event.put(clusterCollectionName, createClusters(), HPSEcalCluster.class, flag); - } - - public void sumHits(List<CalorimeterHit> hits) { - // Hit map. - hitMap = new HashMap<Long, CalorimeterHit>(); - - hitSums = new HashMap<Long, Double>(); - // Loop over ECal hits to compute energy sums - for (CalorimeterHit hit : hits) { - // 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!"); - } - - Double hitSum; - - if (clusterCenters.contains(hit.getCellID())) { - hitSum = hitSums.get(hit.getCellID()); - if (hitSum == null) { - hitSums.put(hit.getCellID(), hit.getRawEnergy()); - } else { - hitSums.put(hit.getCellID(), hitSum + hit.getRawEnergy()); - } - } - - // Loop over neighbors to make hit list for cluster. - for (Long neighborId : neighbors) { - if (!clusterCenters.contains(neighborId)) { - continue; - } - hitSum = hitSums.get(neighborId); - if (hitSum == null) { - hitSums.put(neighborId, hit.getRawEnergy()); - } else { - hitSums.put(neighborId, hitSum + hit.getRawEnergy()); - } - } - } - }
+ HPSEcal3 ecal; + IDDecoder dec; + String ecalName; + String ecalCollectionName; + String clusterCollectionName = "EcalClusters"; + Set<Long> clusterCenters = null; + Map<Long, Double> hitSums = null; + Map<Long, CalorimeterHit> hitMap = null; + // Map of crystals to their neighbors. + NeighborMap neighborMap = null; + double clusterWindow = -1; + + public HPSEcalCTPClusterer() { + } + + public void setClusterWindow(double clusterWindow) { + this.clusterWindow = clusterWindow; + } + + public void setClusterCollectionName(String clusterCollectionName) { + this.clusterCollectionName = clusterCollectionName; + } + + public void setEcalCollectionName(String ecalCollectionName) { + this.ecalCollectionName = ecalCollectionName; + } + + 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(); + + clusterCenters = new HashSet<Long>(); + //Make set of valid cluster centers. + for (Long cellID : neighborMap.keySet()) { + boolean isValidCenter = true; + Set<Long> neighbors = neighborMap.get(cellID); + for (Long neighborID : neighbors) { + Set<Long> neighborneighbors = new HashSet<Long>(); + neighborneighbors.addAll(neighborMap.get(neighborID)); + neighborneighbors.add(neighborID); + + if (neighborneighbors.containsAll(neighbors)) { + isValidCenter = false; + break; + } + } + if (isValidCenter) { + clusterCenters.add(cellID); + } + } + + //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<HPSEcalCluster> clusters; + + if (clusterWindow >= 0) { + PriorityQueue<CalorimeterHit> futureHits = new PriorityQueue<CalorimeterHit>(10, new TimeComparator()); + PriorityQueue<CalorimeterHit> pastHits = new PriorityQueue<CalorimeterHit>(10, new TimeComparator()); + clusters = new ArrayList<HPSEcalCluster>(); + + for (CalorimeterHit hit : hits) { + futureHits.add(hit); + } + + while (!futureHits.isEmpty()) { + CalorimeterHit nextHit = futureHits.poll(); + pastHits.add(nextHit); + while (!futureHits.isEmpty() && futureHits.peek().getTime() == nextHit.getTime()) { + pastHits.add(futureHits.poll()); + } + while (pastHits.peek().getTime() < nextHit.getTime() - clusterWindow) { + pastHits.poll(); + } + sumHits(pastHits); + clusters.addAll(createClusters()); + } + } else { + sumHits(hits); + clusters = createClusters(); + } + + // Put Cluster collection into event. + int flag = 1 << LCIOConstants.CLBIT_HITS; + event.put(clusterCollectionName, clusters, HPSEcalCluster.class, flag); + } + + public void sumHits(Collection<CalorimeterHit> hits) { + // Hit map. + hitMap = new HashMap<Long, CalorimeterHit>(); + + hitSums = new HashMap<Long, Double>(); + // Loop over ECal hits to compute energy sums + for (CalorimeterHit hit : hits) { + // 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!"); + } + + Double hitSum; + + if (clusterCenters.contains(hit.getCellID())) { + hitSum = hitSums.get(hit.getCellID()); + if (hitSum == null) { + hitSums.put(hit.getCellID(), hit.getRawEnergy()); + } else { + hitSums.put(hit.getCellID(), hitSum + hit.getRawEnergy()); + } + } + + // Loop over neighbors to make hit list for cluster. + for (Long neighborId : neighbors) { + if (!clusterCenters.contains(neighborId)) { + continue; + } + hitSum = hitSums.get(neighborId); + if (hitSum == null) { + hitSums.put(neighborId, hit.getRawEnergy()); + } else { + hitSums.put(neighborId, hitSum + hit.getRawEnergy()); + } + } + } + }
- public List<HPSEcalCluster> createClusters() {
+ public List<HPSEcalCluster> createClusters() {
// boolean printClusters;
- // New Cluster list to be added to event. - List<HPSEcalCluster> clusters = new ArrayList<HPSEcalCluster>(); - //System.out.println("New event"); - //for each crystal with a nonzero hit count, test for cluster - for (Long possibleCluster : hitSums.keySet()) { - Double thisSum = hitSums.get(possibleCluster); - - // 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); - int x1 = dec.getValue("ix"); - int y1 = dec.getValue("iy");
+ // New Cluster list to be added to event. + List<HPSEcalCluster> clusters = new ArrayList<HPSEcalCluster>(); + //System.out.println("New event"); + //for each crystal with a nonzero hit count, test for cluster + for (Long possibleCluster : hitSums.keySet()) { + Double thisSum = hitSums.get(possibleCluster); + + // 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); + int x1 = dec.getValue("ix"); + int y1 = dec.getValue("iy");
// System.out.printf("\nThis cluster: E= %f, ID=%d, x=%d, y=%d, neighbors=%d\n", thisSum, possibleCluster, x1, y1, neighbors.size());
- boolean isCluster = true; - for (Long neighborId : neighbors) { - // Set the ID. - dec.setID(neighborId); - int x2 = dec.getValue("ix"); - int y2 = dec.getValue("iy"); - - Double neighborSum = hitSums.get(neighborId); - if (neighborSum == null) { - continue; - }
+ boolean isCluster = true; + for (Long neighborId : neighbors) { + // Set the ID. + dec.setID(neighborId); + int x2 = dec.getValue("ix"); + int y2 = dec.getValue("iy"); + + Double neighborSum = hitSums.get(neighborId); + if (neighborSum == null) { + continue; + }
// System.out.printf("Neighbor cluster: E= %f, ID=%d, x=%d, y=%d, neighbors=%d\n", neighborSum, neighborId, x2, y2, neighborMap.get(neighborId).size());
- if (neighborSum > thisSum) {
+ if (neighborSum > thisSum) {
// System.out.println("Reject cluster: sum cut");
- isCluster = false; - break; - } // else if (false) { //ctp - // else if (neighborSum.equals(thisSum) && neighborId > possibleCluster) { //id - // else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && Math.abs(y1)>Math.abs(y2)))) { //right_in - // else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && Math.abs(y1)<Math.abs(y2)))) { //right_out - // else if (neighborSum.equals(thisSum) && (x1>x2 || (x1==x2 && Math.abs(y1)>Math.abs(y2)))) { //left_in - else if (neighborSum.equals(thisSum) && (x1 > x2 || (x1 == x2 && Math.abs(y1) < Math.abs(y2)))) { //left_out
+ isCluster = false; + break; + } // else if (false) { //ctp + // else if (neighborSum.equals(thisSum) && neighborId > possibleCluster) { //id + // else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && Math.abs(y1)>Math.abs(y2)))) { //right_in + // else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && Math.abs(y1)<Math.abs(y2)))) { //right_out + // else if (neighborSum.equals(thisSum) && (x1>x2 || (x1==x2 && Math.abs(y1)>Math.abs(y2)))) { //left_in + else if (neighborSum.equals(thisSum) && (x1 > x2 || (x1 == x2 && Math.abs(y1) < Math.abs(y2)))) { //left_out
// else if (neighborSum.equals(thisSum) && (x1<x2 || (x1==x2 && y1<y2))) { //right_up // else if (neighborSum.equals(thisSum) && (x1>x2 || (x1==x2 && y1<y2))) { //left_up // System.out.println("Reject cluster: tie-breaker cut");
- isCluster = false; - break; - } - } - - if (isCluster) { -// System.out.println("Accept this cluster"); - HPSEcalCluster cluster = new HPSEcalCluster(possibleCluster); - CalorimeterHit hit = hitMap.get(possibleCluster); - if (hit != null /*&& hit.getRawEnergy() > hitEMin && hit.getRawEnergy() < hitEMax*/) { -// System.out.printf("Adding hit, E = %f\n", hit.getRawEnergy()); - 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*/) { -// System.out.printf("Adding hit, E = %f\n", hit.getRawEnergy()); - cluster.addHit(hit); - } - } - clusters.add(cluster); - } - } - return clusters; - }
+ isCluster = false; + break; + } + } + + if (isCluster) { + List<CalorimeterHit> hits = new ArrayList<CalorimeterHit>(); + double clusterTime = Double.NEGATIVE_INFINITY; + CalorimeterHit hit = hitMap.get(possibleCluster); + if (hit != null) { + hits.add(hit); + if (hit.getTime() > clusterTime) { + clusterTime = hit.getTime(); + } + } + for (Long neighborId : neighbors) { + hit = hitMap.get(neighborId); + if (hit != null) { + hits.add(hit); + if (hit.getTime() > clusterTime) { + clusterTime = hit.getTime(); + } + } + } + CalorimeterHit seedHit = new HPSRawCalorimeterHit(0.0, null, clusterTime, possibleCluster, hits.get(0).getType()); + seedHit.setMetaData(hits.get(0).getMetaData()); + HPSEcalCluster cluster = new HPSEcalCluster(seedHit); + for (CalorimeterHit clusterHit : hits) { + cluster.addHit(clusterHit); + } + clusters.add(cluster); + } + } + return clusters; + } + + static class TimeComparator implements Comparator<CalorimeterHit> { + + public int compare(CalorimeterHit o1, CalorimeterHit o2) { + if (o1.getTime() == o2.getTime()) { + return 0; + } else { + return (o1.getTime() > o2.getTime()) ? 1 : -1; + } + } + }
}
diff -N TriggerPlots.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ TriggerPlots.java 4 Jun 2012 23:03:58 -0000 1.1 @@ -0,0 +1,292 @@
+package org.lcsim.hps.monitoring.ecal; + +import hep.aida.IHistogram1D; +import hep.aida.IHistogram2D; +import hep.aida.IPlotter; + +import java.util.List; +import org.lcsim.event.CalorimeterHit; + +import org.lcsim.event.EventHeader; +import org.lcsim.geometry.Detector; +import org.lcsim.hps.evio.TriggerData; +import org.lcsim.hps.monitoring.AIDAFrame; +import org.lcsim.hps.monitoring.Resettable; +import org.lcsim.hps.recon.ecal.HPSEcalCluster; +import org.lcsim.util.Driver; +import org.lcsim.util.aida.AIDA; + +public class TriggerPlots extends Driver implements Resettable { + + AIDAFrame plotterFrame; + String inputCollection = "EcalCalHits"; + String clusterCollection = "EcalClusters"; + double clusterEnergyCut = 130.0; + AIDA aida = AIDA.defaultInstance(); + IPlotter plotter, plotter2, plotter3; + IHistogram1D topHitTimePlot, botHitTimePlot, orHitTimePlot; + IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot; + IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D; + IHistogram2D topClusters, botClusters, pairClusters; + IHistogram1D topClusTimePlot, botClusTimePlot, orClusTimePlot; + IHistogram2D topClusTime2D, botClusTime2D, orClusTime2D; + + public void setInputCollection(String inputCollection) { + this.inputCollection = inputCollection; + } + + public void setClusterCollection(String clusterCollection) { + this.clusterCollection = clusterCollection; + } + + protected void detectorChanged(Detector detector) { + + plotterFrame = new AIDAFrame(); + plotterFrame.setTitle("HPS Trigger Plots"); + aida.tree().cd("/"); + + + plotter = aida.analysisFactory().createPlotterFactory().create("Hit Times"); + plotter.setTitle("Hit Times"); + plotterFrame.addPlotter(plotter); + plotter.style().dataStyle().errorBarStyle().setVisible(false); + plotter.createRegions(3, 3); + + topHitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Top", 100, 0, 100 * 4.0); + botHitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Bottom", 100, 0, 100 * 4.0); + orHitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Or", 100, 0, 100 * 4.0); + + topTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Top", 32, 0, 32); + botTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Bottom", 32, 0, 32); + orTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Or", 32, 0, 32); + + topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32); + botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 100, 0, 100 * 4.0, 32, 0, 32); + orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 100, 0, 100 * 4.0, 32, 0, 32); + + // Create the plotter regions. + plotter.region(0).plot(topHitTimePlot); + plotter.region(0).style().yAxisStyle().setParameter("scale", "log"); + plotter.region(1).plot(botHitTimePlot); + plotter.region(1).style().yAxisStyle().setParameter("scale", "log"); + plotter.region(2).plot(orHitTimePlot); + plotter.region(2).style().yAxisStyle().setParameter("scale", "log"); + plotter.region(3).plot(topTrigTimePlot); + plotter.region(3).style().yAxisStyle().setParameter("scale", "log"); + plotter.region(4).plot(botTrigTimePlot); + plotter.region(4).style().yAxisStyle().setParameter("scale", "log"); + plotter.region(5).plot(orTrigTimePlot); + plotter.region(5).style().yAxisStyle().setParameter("scale", "log"); + plotter.region(6).plot(topTimePlot2D); + plotter.region(6).style().setParameter("hist2DStyle", "colorMap"); + plotter.region(6).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter.region(6).style().zAxisStyle().setParameter("scale", "log"); + plotter.region(7).plot(botTimePlot2D); + plotter.region(7).style().setParameter("hist2DStyle", "colorMap"); + plotter.region(7).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter.region(7).style().zAxisStyle().setParameter("scale", "log"); + plotter.region(8).plot(orTimePlot2D); + plotter.region(8).style().setParameter("hist2DStyle", "colorMap"); + plotter.region(8).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter.region(8).style().zAxisStyle().setParameter("scale", "log"); + + plotter2 = aida.analysisFactory().createPlotterFactory().create("Clusters"); + plotter2.setTitle("Clusters"); + plotterFrame.addPlotter(plotter2); + plotter2.style().dataStyle().errorBarStyle().setVisible(false); + plotter2.style().setParameter("hist2DStyle", "colorMap"); + plotter2.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter2.style().zAxisStyle().setParameter("scale", "log"); + plotter2.createRegions(1, 3); + + topClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, Top Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5); + plotter2.region(0).plot(topClusters); + botClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, Bot Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5); + plotter2.region(1).plot(botClusters); + pairClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, Pair Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5); + plotter2.region(2).plot(pairClusters); + + topClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Cluster Time, Top", 100, 0, 100 * 4.0); + botClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Cluster Time, Bottom", 100, 0, 100 * 4.0); + orClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Cluster Time, Or", 100, 0, 100 * 4.0); + + topClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32); + botClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32); + orClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32); + + plotter3 = aida.analysisFactory().createPlotterFactory().create("Cluster Times"); + plotter3.setTitle("Cluster Times"); + plotterFrame.addPlotter(plotter3); + plotter3.style().dataStyle().errorBarStyle().setVisible(false); + plotter3.createRegions(2, 3); + + plotter3.region(0).plot(topClusTimePlot); + plotter3.region(0).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(1).plot(botClusTimePlot); + plotter3.region(1).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(2).plot(orClusTimePlot); + plotter3.region(2).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(3).plot(topClusTime2D); + plotter3.region(3).style().setParameter("hist2DStyle", "colorMap"); + plotter3.region(3).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter3.region(3).style().zAxisStyle().setParameter("scale", "log"); + plotter3.region(4).plot(botClusTime2D); + plotter3.region(4).style().setParameter("hist2DStyle", "colorMap"); + plotter3.region(4).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter3.region(4).style().zAxisStyle().setParameter("scale", "log"); + plotter3.region(5).plot(orClusTime2D); + plotter3.region(5).style().setParameter("hist2DStyle", "colorMap"); + plotter3.region(5).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter3.region(5).style().zAxisStyle().setParameter("scale", "log"); + + plotterFrame.setVisible(true); + plotterFrame.pack(); + } + + public void process(EventHeader event) { + int orTrig = 0; + int topTrig = 0; + int botTrig = 0; + int pairTrig = 0; + int orTrigTime = -1; + int topTrigTime = -1; + int botTrigTime = -1; + if (event.hasCollection(TriggerData.class, "TriggerBank")) { + List<TriggerData> triggerList = event.get(TriggerData.class, "TriggerBank"); + if (!triggerList.isEmpty()) { + TriggerData triggerData = triggerList.get(0); + + pairTrig = triggerData.getPairTrig(); + orTrig = triggerData.getOrTrig(); + if (orTrig != 0) { + for (int i = 0; i < 32; i++) { + if ((1 << (31 - i) & orTrig) != 0) { + orTrigTime = i; + orTrigTimePlot.fill(i); + break; + } + } + } + topTrig = triggerData.getTopTrig(); + if (topTrig != 0) { + for (int i = 0; i < 32; i++) { + if ((1 << (31 - i) & topTrig) != 0) { + topTrigTime = i; + topTrigTimePlot.fill(i); + break; + } + } + } + botTrig = triggerData.getBotTrig(); + if (botTrig != 0) { + for (int i = 0; i < 32; i++) { + if ((1 << (31 - i) & botTrig) != 0) { + botTrigTime = i; + botTrigTimePlot.fill(i); + break; + } + } + } + } + } + + if (event.hasCollection(CalorimeterHit.class, inputCollection)) { + List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection); +// double maxEnergy = 0; + double topTime = Double.POSITIVE_INFINITY; + double botTime = Double.POSITIVE_INFINITY; + double orTime = Double.POSITIVE_INFINITY; + for (CalorimeterHit hit : hits) { + if (hit.getTime() < orTime) { + orTime = hit.getTime(); + } + if (hit.getIdentifierFieldValue("iy") > 0 && hit.getTime() < topTime) { + topTime = hit.getTime(); + } + if (hit.getIdentifierFieldValue("iy") < 0 && hit.getTime() < botTime) { + botTime = hit.getTime(); + } +// if (hit.getRawEnergy() > maxEnergy) { +// maxEnergy = hit.getRawEnergy(); +// } + } + if (orTime != Double.POSITIVE_INFINITY) { + orHitTimePlot.fill(orTime); + orTimePlot2D.fill(orTime, orTrigTime); + } + if (topTime != Double.POSITIVE_INFINITY) { + topHitTimePlot.fill(topTime); + topTimePlot2D.fill(topTime, topTrigTime); + } + if (botTime != Double.POSITIVE_INFINITY) { + botHitTimePlot.fill(botTime); + botTimePlot2D.fill(botTime, botTrigTime); + } + } + + if (event.hasCollection(HPSEcalCluster.class, clusterCollection)) { + List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollection); +//if (clusters.size()>1) + double topTime = Double.POSITIVE_INFINITY; + double botTime = Double.POSITIVE_INFINITY; + double orTime = Double.POSITIVE_INFINITY; + clusterloop: + for (HPSEcalCluster cluster : clusters) { + if (cluster.getEnergy() < clusterEnergyCut) { + continue; + } + CalorimeterHit hit = cluster.getSeedHit(); + + if (hit.getTime() < orTime) { + orTime = hit.getTime(); + } + if (hit.getIdentifierFieldValue("iy") > 0 && hit.getTime() < topTime) { + topTime = hit.getTime(); + } + if (hit.getIdentifierFieldValue("iy") < 0 && hit.getTime() < botTime) { + botTime = hit.getTime(); + } + + if (topTrig != 0) { + topClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy")); + } + if (botTrig != 0) { + botClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy")); + } + if (pairTrig != 0) { + pairClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy")); + } + +// if ((botTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] > 0)) { +// if (botTrig != 0 && topTrig != 0 && cluster.getEnergy() > 130 && cluster.getCalorimeterHits().size() > 1) { +// for (CalorimeterHit hit : cluster.getCalorimeterHits()) { +// if (hit.getRawEnergy() > 130) { +// continue clusterloop; +// } +// } +// botClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy")); +// } + } + if (orTime != Double.POSITIVE_INFINITY) { + orClusTimePlot.fill(orTime); + orClusTime2D.fill(orTime, orTrigTime); + } + if (topTime != Double.POSITIVE_INFINITY) { + topClusTimePlot.fill(topTime); + topClusTime2D.fill(topTime, topTrigTime); + } + if (botTime != Double.POSITIVE_INFINITY) { + botClusTimePlot.fill(botTime); + botClusTime2D.fill(botTime, botTrigTime); + } + } + + } + + public void reset() { + } + + public void endOfData() { + plotterFrame.dispose(); + } +}
\ No newline at end of file
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1