hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.3 -r1.4
--- TriggerPlots.java 11 Jun 2012 22:57:02 -0000 1.3
+++ TriggerPlots.java 22 Jun 2012 00:23:26 -0000 1.4
@@ -31,6 +31,7 @@
IHistogram2D noTopClusters, noBotClusters;
IHistogram1D topClusTimePlot, botClusTimePlot, orClusTimePlot;
IHistogram2D topClusTime2D, botClusTime2D, orClusTime2D;
+ IHistogram1D topClusTimeDiff, botClusTimeDiff, orClusTimeDiff;
IHistogram2D trigType;
IHistogram1D simTrigTop, simTrigBot, simTrigAnd;
@@ -67,35 +68,28 @@
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);
+ topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 101, -4.0, 100 * 4.0, 33, -1, 32);
+ botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 101, -4.0, 100 * 4.0, 33, -1, 32);
+ orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 101, -4.0, 100 * 4.0, 33, -1, 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");
+ for (int i = 0; i < 6; i++) {
+ plotter.region(i).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");
+ for (int i = 6; i < 9; i++) {
+ plotter.region(i).style().setParameter("hist2DStyle", "colorMap");
+ plotter.region(i).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ plotter.region(i).style().zAxisStyle().setParameter("scale", "log");
+ }
plotter2 = aida.analysisFactory().createPlotterFactory().create("Clusters");
plotter2.setTitle("Clusters");
@@ -121,34 +115,40 @@
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);
+ topClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Top", 101, -4.0, 100 * 4.0, 33, -1, 32);
+ botClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Bottom", 101, -4.0, 100 * 4.0, 33, -1, 32);
+ orClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Or", 101, -4.0, 100 * 4.0, 33, -1, 32);
+
+ topClusTimeDiff = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time - Trig Time, Top", 200, -100 * 4.0, 100 * 4.0);
+ botClusTimeDiff = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time - Trig Time, Bottom", 200, -100 * 4.0, 100 * 4.0);
+ orClusTimeDiff = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time - Trig Time, Or", 200, -100 * 4.0, 100 * 4.0);
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.createRegions(3, 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");
+ for (int i = 0; i < 3; i++) {
+ plotter3.region(i).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");
+ for (int i = 3; i < 6; i++) {
+ plotter3.region(i).style().setParameter("hist2DStyle", "colorMap");
+ plotter3.region(i).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ plotter3.region(i).style().zAxisStyle().setParameter("scale", "log");
+ }
+ plotter3.region(6).plot(topClusTimeDiff);
+ plotter3.region(7).plot(botClusTimeDiff);
+ plotter3.region(8).plot(orClusTimeDiff);
+// for (int i = 6; i < 9; i++) {
+// plotter3.region(i).style().yAxisStyle().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);
@@ -261,9 +261,9 @@
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;
+ double topTime = -4.0;
+ double botTime = -4.0;
+ double orTime = -4.0;
clusterloop:
for (HPSEcalCluster cluster : clusters) {
// for (CalorimeterHit hit : hits) {
@@ -273,13 +273,13 @@
}
CalorimeterHit hit = cluster.getSeedHit();
- if (hit.getTime() < orTime) {
+ if (orTime < 0 || hit.getTime() < orTime) {
orTime = hit.getTime();
}
- if (hit.getIdentifierFieldValue("iy") > 0 && hit.getTime() < topTime) {
+ if (hit.getIdentifierFieldValue("iy") > 0 && (topTime < 0 || hit.getTime() < topTime)) {
topTime = hit.getTime();
}
- if (hit.getIdentifierFieldValue("iy") < 0 && hit.getTime() < botTime) {
+ if (hit.getIdentifierFieldValue("iy") < 0 && (botTime < 0 || hit.getTime() < botTime)) {
botTime = hit.getTime();
}
@@ -307,26 +307,35 @@
// botClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
// }
}
- if (orTime != Double.POSITIVE_INFINITY) {
+ if (orTime >= 0 || orTrigTime >= 0) {
orClusTimePlot.fill(orTime);
orClusTime2D.fill(orTime, orTrigTime);
+ if (orTime >= 0 || orTrigTime >= 0) {
+ orClusTimeDiff.fill(orTime - orTrigTime * 4.0);
+ }
}
- if (topTime != Double.POSITIVE_INFINITY) {
+ if (topTime >= 0 || topTrigTime >= 0) {
topClusTimePlot.fill(topTime);
topClusTime2D.fill(topTime, topTrigTime);
+ if (topTime >= 0 || topTrigTime >= 0) {
+ topClusTimeDiff.fill(topTime - topTrigTime * 4.0);
+ }
}
- if (botTime != Double.POSITIVE_INFINITY) {
+ if (botTime >= 0 || botTrigTime >= 0) {
botClusTimePlot.fill(botTime);
botClusTime2D.fill(botTime, botTrigTime);
+ if (botTime >= 0 || botTrigTime >= 0) {
+ botClusTimeDiff.fill(botTime - botTrigTime * 4.0);
+ }
}
int trigTypeActual, trigTypeSim;
- if (topTime == Double.POSITIVE_INFINITY && botTime == Double.POSITIVE_INFINITY) {
+ if (topTime < 0 && botTime < 0) {
trigTypeSim = 0;
- } else if (topTime != Double.POSITIVE_INFINITY && botTime == Double.POSITIVE_INFINITY) {
+ } else if (topTime >= 0 && botTime < 0) {
trigTypeSim = 1;
- } else if (topTime == Double.POSITIVE_INFINITY && botTime != Double.POSITIVE_INFINITY) {
+ } else if (topTime < 0 && botTime >= 0) {
trigTypeSim = 2;
} else {
trigTypeSim = 3;
@@ -346,6 +355,90 @@
}
trigType.fill(trigTypeSim, trigTypeActual);
+
+
+
+
+// if(topTrig!=0) {
+//
+// //Find the tag
+// double Emax=-999999.9;
+// HPSEcalCluster cl_tag = null;
+// int n = 0;
+// for(HPSEcalCluster cl: clusters) {
+// if(cl.getPosition()[1]>0) {
+// ++n;
+// aida.histogram1D("toptrig_cl_ecal_e_top").fill(cl.getEnergy());
+// if(cl.getEnergy()>Emax) {
+// Emax = cl.getEnergy();
+// cl_tag = cl;
+// }
+// }
+// }
+// if(Emax>-9999) aida.histogram1D("toptrig_cl_ecal_emax_top").fill(Emax);
+// aida.histogram1D("toptrig_cl_ecal_n_top").fill(n);
+//
+// if(cl_tag!=null) {
+// //Find a probe
+// int nb = 0;
+// HPSEcalCluster cl_probe = null;
+// double Emaxb=-999999.9;
+// for(HPSEcalCluster cl: clusters) {
+// if(cl.getPosition()[1]<=0) {
+// ++nb;
+// if(cl.getEnergy()>Emaxb) {
+// Emaxb=cl.getEnergy();
+// cl_probe = cl;
+// }
+// }
+// }
+//
+// //use only cases where the is a single probe candidate
+// if(nb==0) {
+// aida.histogram1D("toptrig_cl_ecal_n_bottom").fill(0);
+//
+// } else if(nb>1) {
+// aida.histogram1D("toptrig_cl_ecal_n_bottom").fill(1);
+// }else if(nb==1) {
+//
+//
+// aida.histogram1D("toptrig_cl_ecal_n_bottom").fill(2);
+//
+// aida.histogram1D("toptrig_cl_ecal_e_bottom").fill(cl_probe.getEnergy());
+//
+// if(botTrig!=0) {
+// aida.histogram1D("toptrig_cl_ecal_n_bottom").fill(3);
+// aida.histogram1D("toptrig_cl_ecal_e_bottom_trig").fill(cl_probe.getEnergy());
+// }
+//
+// if(cl_tag.getEnergy()>500) {
+// aida.histogram1D("toptrig_cl_ecal_n_bottom").fill(4);
+// aida.histogram1D("toptrigtag_cl_ecal_e_bottom").fill(cl_probe.getEnergy());
+//
+// if(botTrig!=0) {
+// aida.histogram1D("toptrig_cl_ecal_n_bottom").fill(5);
+// aida.histogram1D("toptrigtag_cl_ecal_e_bottom_trig").fill(cl_probe.getEnergy());
+// }
+//
+// }
+//
+// }
+// } //tag found
+// }//topTrigger
+
+
+// if((nevents % refreshRate) == 0) {
+// IHistogram1D heff = hf.divide(aida.histogram1D("toptrig_cl_ecal_e_bottom_trig").title(), aida.histogram1D("toptrig_cl_ecal_e_bottom_trig"), aida.histogram1D("toptrig_cl_ecal_e_bottom"));
+// plotter_trig_tag.region(7).clear();
+// plotter_trig_tag.region(7).plot(heff);
+// IHistogram heff2 = hf.divide(aida.histogram1D("toptrigtag_cl_ecal_e_bottom_trig").title(), aida.histogram1D("toptrigtag_cl_ecal_e_bottom_trig"), aida.histogram1D("toptrig_cl_ecal_e_bottom"));
+// plotter_trig_tag.region(8).clear();
+// plotter_trig_tag.region(8).plot(heff2);
+//
+// }
+
+ //fillResetEff(aida.histogram1D("toptrig_cl_ecal_e_bottom_trig"),aida.histogram1D("toptrig_cl_ecal_e_bottom"),aida.histogram1D("toptrig_cl_ecal_e_bottom_trigeff"));
+ //fillResetEff(aida.histogram1D("toptrigtag_cl_ecal_e_bottom_trig"),aida.histogram1D("toptrigtag_cl_ecal_e_bottom"),aida.histogram1D("toptrigtag_cl_ecal_e_bottom_trigeff"));
}
}
@@ -354,6 +447,28 @@
}
public void endOfData() {
+ System.out.format("Top trigger bit: \t");
+ for (int i = 0; i < 4; i++) {
+ System.out.format("%d\t", simTrigTop.binEntries(i));
+ }
+ System.out.println();
+ System.out.format("Bottom trigger bit: \t");
+ for (int i = 0; i < 4; i++) {
+ System.out.format("%d\t", simTrigBot.binEntries(i));
+ }
+ System.out.println();
+ System.out.format("Both trigger bits: \t");
+ for (int i = 0; i < 4; i++) {
+ System.out.format("%d\t", simTrigAnd.binEntries(i));
+ }
+ System.out.println();
+
+ System.out.println("Events where top fired:");
+ System.out.format("Bottom fired:\t\t%d\t%d\n", simTrigAnd.binEntries(2) + simTrigAnd.binEntries(3), simTrigAnd.binEntries(0) + simTrigAnd.binEntries(1));
+ System.out.format("Bottom didn't fire:\t%d\t%d\n", simTrigTop.binEntries(2) + simTrigTop.binEntries(3), simTrigTop.binEntries(0) + simTrigTop.binEntries(1));
+ System.out.println("Events where bottom fired:");
+ System.out.format("Top fired:\t\t%d\t%d\n", simTrigAnd.binEntries(1) + simTrigAnd.binEntries(3), simTrigAnd.binEntries(0) + simTrigAnd.binEntries(2));
+ System.out.format("Top didn't fire:\t%d\t%d\n", simTrigBot.binEntries(1) + simTrigBot.binEntries(3), simTrigBot.binEntries(0) + simTrigBot.binEntries(2));
plotterFrame.dispose();
}
}
\ No newline at end of file