hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.1 -r1.2
--- TriggerPlots.java 4 Jun 2012 23:03:58 -0000 1.1
+++ TriggerPlots.java 7 Jun 2012 00:49:48 -0000 1.2
@@ -23,13 +23,16 @@
String clusterCollection = "EcalClusters";
double clusterEnergyCut = 130.0;
AIDA aida = AIDA.defaultInstance();
- IPlotter plotter, plotter2, plotter3;
+ IPlotter plotter, plotter2, plotter3, plotter4;
IHistogram1D topHitTimePlot, botHitTimePlot, orHitTimePlot;
IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
IHistogram2D topClusters, botClusters, pairClusters;
+ IHistogram2D noTopClusters, noBotClusters;
IHistogram1D topClusTimePlot, botClusTimePlot, orClusTimePlot;
IHistogram2D topClusTime2D, botClusTime2D, orClusTime2D;
+ IHistogram2D trigType;
+ IHistogram1D simTrigTop, simTrigBot, simTrigAnd;
public void setInputCollection(String inputCollection) {
this.inputCollection = inputCollection;
@@ -39,6 +42,10 @@
this.clusterCollection = clusterCollection;
}
+ public void setClusterEnergyCut(double clusterEnergyCut) {
+ this.clusterEnergyCut = clusterEnergyCut;
+ }
+
protected void detectorChanged(Detector detector) {
plotterFrame = new AIDAFrame();
@@ -97,7 +104,7 @@
plotter2.style().setParameter("hist2DStyle", "colorMap");
plotter2.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotter2.style().zAxisStyle().setParameter("scale", "log");
- plotter2.createRegions(1, 3);
+ plotter2.createRegions(2, 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);
@@ -105,14 +112,18 @@
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);
+ noTopClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, No Top Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ plotter2.region(3).plot(noTopClusters);
+ noBotClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, No Bot Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ plotter2.region(4).plot(noBotClusters);
+
+ topClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : First Cluster Time, Top", 100, 0, 100 * 4.0);
+ botClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : First Cluster Time, Bottom", 100, 0, 100 * 4.0);
+ orClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : First Cluster Time, Or", 100, 0, 100 * 4.0);
+
+ topClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32);
+ botClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Bottom", 100, 0, 100 * 4.0, 32, 0, 32);
+ orClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Or", 100, 0, 100 * 4.0, 32, 0, 32);
plotter3 = aida.analysisFactory().createPlotterFactory().create("Cluster Times");
plotter3.setTitle("Cluster Times");
@@ -139,6 +150,27 @@
plotter3.region(5).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotter3.region(5).style().zAxisStyle().setParameter("scale", "log");
+ trigType = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Actual Trigger vs. Simulated Trigger", 4, 0, 4, 4, 0, 4);
+ simTrigTop = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Simulated Trigger - Top-Trigger Events", 4, 0, 4);
+ simTrigBot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Simulated Trigger - Bottom-Trigger Events", 4, 0, 4);
+ simTrigAnd = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Simulated Trigger - And-Trigger Events", 4, 0, 4);
+
+ plotter4 = aida.analysisFactory().createPlotterFactory().create("Cluster Times");
+ plotter4.setTitle("Trigger Types");
+ plotterFrame.addPlotter(plotter4);
+ plotter4.style().dataStyle().errorBarStyle().setVisible(false);
+ plotter4.style().yAxisStyle().setParameter("scale", "log");
+// plotter4.style().setParameter("hist2DStyle", "colorMap");
+// plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+// plotter4.style().zAxisStyle().setParameter("scale", "log");
+// plotter4.createRegion();
+// plotter4.region(0).plot(trigType);
+ plotter4.createRegions(1, 3);
+
+ plotter4.region(0).plot(simTrigTop);
+ plotter4.region(1).plot(simTrigBot);
+ plotter4.region(2).plot(simTrigAnd);
+
plotterFrame.setVisible(true);
plotterFrame.pack();
}
@@ -224,6 +256,8 @@
}
}
+// if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+// List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
if (event.hasCollection(HPSEcalCluster.class, clusterCollection)) {
List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollection);
//if (clusters.size()>1)
@@ -232,7 +266,9 @@
double orTime = Double.POSITIVE_INFINITY;
clusterloop:
for (HPSEcalCluster cluster : clusters) {
+// for (CalorimeterHit hit : hits) {
if (cluster.getEnergy() < clusterEnergyCut) {
+// if (hit.getRawEnergy() < clusterEnergyCut) {
continue;
}
CalorimeterHit hit = cluster.getSeedHit();
@@ -248,13 +284,17 @@
}
if (topTrig != 0) {
- topClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
+ topClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+ } else {
+ noTopClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
}
if (botTrig != 0) {
- botClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
+ botClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+ } else {
+ noBotClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
}
if (pairTrig != 0) {
- pairClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
+ pairClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
}
// if ((botTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] > 0)) {
@@ -279,6 +319,33 @@
botClusTimePlot.fill(botTime);
botClusTime2D.fill(botTime, botTrigTime);
}
+
+ int trigTypeActual, trigTypeSim;
+
+ if (topTime == Double.POSITIVE_INFINITY && botTime == Double.POSITIVE_INFINITY) {
+ trigTypeSim = 0;
+ } else if (topTime != Double.POSITIVE_INFINITY && botTime == Double.POSITIVE_INFINITY) {
+ trigTypeSim = 1;
+ } else if (topTime == Double.POSITIVE_INFINITY && botTime != Double.POSITIVE_INFINITY) {
+ trigTypeSim = 2;
+ } else {
+ trigTypeSim = 3;
+ }
+
+ if (topTrig == 0 && botTrig == 0) {
+ trigTypeActual = 0;
+ } else if (topTrig != 0 && botTrig == 0) {
+ trigTypeActual = 1;
+ simTrigTop.fill(trigTypeSim);
+ } else if (topTrig == 0 && botTrig != 0) {
+ trigTypeActual = 2;
+ simTrigBot.fill(trigTypeSim);
+ } else {
+ trigTypeActual = 3;
+ simTrigAnd.fill(trigTypeSim);
+ }
+
+ trigType.fill(trigTypeSim, trigTypeActual);
}
}
hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.6 -r1.7
--- EcalHitPlots.java 29 May 2012 22:25:10 -0000 1.6
+++ EcalHitPlots.java 7 Jun 2012 00:49:48 -0000 1.7
@@ -20,7 +20,7 @@
AIDAFrame plotterFrame;
String inputCollection = "EcalCalHits";
AIDA aida = AIDA.defaultInstance();
- IPlotter plotter, plotter2, plotter3;
+ IPlotter plotter, plotter2, plotter3, plotter4;
IHistogram1D hitCountPlot;
IHistogram1D hitTimePlot;
IHistogram1D hitEnergyPlot;
@@ -28,6 +28,8 @@
IHistogram1D topTimePlot, botTimePlot, orTimePlot;
IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
+// IHistogram2D topX, botX, topY, botY;
+ IHistogram2D edgePlot;
int eventn = 0;
double maxE = 5000;
boolean logScale = false;
@@ -128,6 +130,17 @@
plotter3.region(8).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotter3.region(8).style().zAxisStyle().setParameter("scale", "log");
+ plotter4 = aida.analysisFactory().createPlotterFactory().create("Edges");
+ plotter4.setTitle("Edges");
+ plotterFrame.addPlotter(plotter4);
+ plotter4.style().setParameter("hist2DStyle", "colorMap");
+ plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ plotter4.style().zAxisStyle().setParameter("scale", "log");
+ plotter4.createRegion();
+
+ edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Pairs Across Crystal Edges", 93, -23.25, 23.25, 21, -5.25, 5.25);
+ plotter4.region(0).plot(edgePlot);
+
plotterFrame.setVisible(true);
plotterFrame.pack();
}
@@ -182,6 +195,13 @@
double botTime = Double.POSITIVE_INFINITY;
double orTime = Double.POSITIVE_INFINITY;
for (CalorimeterHit hit : hits) {
+// if (hit.getIdentifierFieldValue("iy") > 0) {
+// topX.fill(hit.getIdentifierFieldValue("ix"),hit.getPosition()[0]);
+// topY.fill(hit.getIdentifierFieldValue("iy"),hit.getPosition()[1]);
+// } else {
+// botX.fill(hit.getIdentifierFieldValue("ix"),hit.getPosition()[0]);
+// botY.fill(hit.getIdentifierFieldValue("iy"),hit.getPosition()[1]);
+// }
hitEnergyPlot.fill(hit.getRawEnergy());
hitTimePlot.fill(hit.getTime());
if (hit.getTime() < orTime) {
@@ -210,22 +230,26 @@
botTimePlot2D.fill(botTime, botTrigTime);
}
hitMaxEnergyPlot.fill(maxEnergy);
+ for (int i = 0; i < hits.size(); i++) {
+ CalorimeterHit hit1 = hits.get(i);
+ int x1 = hit1.getIdentifierFieldValue("ix");
+ int y1 = hit1.getIdentifierFieldValue("iy");
+ for (int j = i + 1; j < hits.size(); j++) {
+ CalorimeterHit hit2 = hits.get(j);
+ 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);
+ }
+ }
+ }
+ }
} else {
hitCountPlot.fill(0);
}
-
-
}
-// public void endOfData() {
-// if (plotter != null) {
-// plotter.hide();
-// plotter.destroyRegions();
-// }
-// if (hitCountPlot != null) {
-// hitCountPlot.reset();
-// }
-// }
public void reset() {
hitCountPlot.reset();
hitTimePlot.reset();
hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.6 -r1.7
--- EcalClusterPlots.java 18 May 2012 08:26:35 -0000 1.6
+++ EcalClusterPlots.java 7 Jun 2012 00:49:48 -0000 1.7
@@ -1,14 +1,17 @@
package org.lcsim.hps.monitoring.ecal;
import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
import hep.aida.IPlotter;
import java.util.List;
+import org.apache.commons.math.stat.StatUtils;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
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.util.Driver;
@@ -19,12 +22,14 @@
AIDAFrame plotterFrame;
String inputCollection = "EcalClusters";
AIDA aida = AIDA.defaultInstance();
- IPlotter plotter;
- IPlotter plotter2;
+ IPlotter plotter, plotter2, plotter3, plotter4;
IHistogram1D clusterCountPlot;
IHistogram1D clusterSizePlot;
IHistogram1D clusterEnergyPlot;
IHistogram1D clusterMaxEnergyPlot;
+ IHistogram1D clusterTimes;
+ IHistogram1D clusterTimeSigma;
+ IHistogram2D edgePlot;
int eventn = 0;
double maxE = 5000;
boolean logScale = false;
@@ -82,27 +87,95 @@
plotter2.region(0).plot(clusterEnergyPlot);
plotter2.region(1).plot(clusterMaxEnergyPlot);
+ plotter3 = aida.analysisFactory().createPlotterFactory().create("Cluster Times");
+ plotter3.setTitle("Cluster Times");
+ plotterFrame.addPlotter(plotter3);
+ plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+ plotter3.createRegions(1, 2);
+ plotter3.style().yAxisStyle().setParameter("scale", "log");
+
+ clusterTimes = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Times", 100, 0, 4.0 * 100);
+ clusterTimeSigma = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time Sigma", 100, 0, 50);
+ plotter3.region(0).plot(clusterTimes);
+ plotter3.region(1).plot(clusterTimeSigma);
+
+ plotter4 = aida.analysisFactory().createPlotterFactory().create("Edges");
+ plotter4.setTitle("Edges");
+ plotterFrame.addPlotter(plotter4);
+ plotter4.style().setParameter("hist2DStyle", "colorMap");
+ plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ plotter4.style().zAxisStyle().setParameter("scale", "log");
+ plotter4.createRegion();
+
+ edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Pairs Across Crystal Edges", 93, -23.25, 23.25, 21, -5.25, 5.25);
+ plotter4.region(0).plot(edgePlot);
+
plotterFrame.setVisible(true);
plotterFrame.pack();
}
public void process(EventHeader event) {
+ int orTrig = 0;
+ int topTrig = 0;
+ int botTrig = 0;
+ if (event.hasCollection(TriggerData.class, "TriggerBank")) {
+ List<TriggerData> triggerList = event.get(TriggerData.class, "TriggerBank");
+ if (!triggerList.isEmpty()) {
+ TriggerData triggerData = triggerList.get(0);
+
+ orTrig = triggerData.getOrTrig();
+ topTrig = triggerData.getTopTrig();
+ botTrig = triggerData.getBotTrig();
+ }
+ }
if (event.hasCollection(Cluster.class, inputCollection)) {
List<Cluster> clusters = event.get(Cluster.class, inputCollection);
clusterCountPlot.fill(clusters.size());
double maxEnergy = 0;
for (Cluster cluster : clusters) {
- clusterEnergyPlot.fill(cluster.getEnergy());
- if (cluster.getEnergy() > maxEnergy) {
- maxEnergy = cluster.getEnergy();
- }
- int size = 0;
- for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
- if (hit.getRawEnergy() != 0) {
- size++;
+// 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()];
+// System.out.format("cluster:\n");
+ 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) {
+ 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);
+ }
+ }
+ }
}
- }
- clusterSizePlot.fill(size);
+// }
}
clusterMaxEnergyPlot.fill(maxEnergy);
} else {