hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
diff -u -r1.4 -r1.5
--- TriggerPlots.java 22 Jun 2012 00:23:26 -0000 1.4
+++ TriggerPlots.java 1 Aug 2012 23:32:46 -0000 1.5
@@ -11,19 +11,22 @@
import org.lcsim.geometry.Detector;
import org.lcsim.hps.evio.TriggerData;
import org.lcsim.hps.monitoring.AIDAFrame;
+import org.lcsim.hps.monitoring.Redrawable;
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 {
+public class TriggerPlots extends Driver implements Resettable, Redrawable {
+ int eventRefreshRate = 1;
+ int eventn = 0;
AIDAFrame plotterFrame;
String inputCollection = "EcalCalHits";
String clusterCollection = "EcalClusters";
double clusterEnergyCut = 130.0;
AIDA aida = AIDA.defaultInstance();
- IPlotter plotter, plotter2, plotter3, plotter4;
+ IPlotter plotter, plotter2, plotter3, plotter4, plotter5;
IHistogram1D topHitTimePlot, botHitTimePlot, orHitTimePlot;
IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
@@ -34,6 +37,7 @@
IHistogram1D topClusTimeDiff, botClusTimeDiff, orClusTimeDiff;
IHistogram2D trigType;
IHistogram1D simTrigTop, simTrigBot, simTrigAnd;
+ IHistogram1D toptrig_cl_ecal_e_top, toptrig_cl_ecal_emax_top, toptrig_cl_ecal_n_top, toptrig_cl_ecal_n_bottom, toptrig_cl_ecal_e_bottom, toptrig_cl_ecal_e_bottom_trig, toptrigtag_cl_ecal_e_bottom, toptrigtag_cl_ecal_e_bottom_trig;
public void setInputCollection(String inputCollection) {
this.inputCollection = inputCollection;
@@ -171,6 +175,31 @@
plotter4.region(1).plot(simTrigBot);
plotter4.region(2).plot(simTrigAnd);
+ plotter5 = aida.analysisFactory().createPlotterFactory().create("Trigger Types");
+ plotter5.setTitle("Trigger Types");
+ plotterFrame.addPlotter(plotter5);
+ plotter5.style().dataStyle().errorBarStyle().setVisible(false);
+ plotter5.createRegions(3, 3);
+
+ toptrig_cl_ecal_n_top = aida.histogram1D("toptrig_cl_ecal_n_top", 7, 0, 7);
+ toptrig_cl_ecal_e_bottom = aida.histogram1D("toptrig_cl_ecal_e_bottom", 200, 0, 10000);
+ toptrigtag_cl_ecal_e_bottom = aida.histogram1D("toptrigtag_cl_ecal_e_bottom", 200, 0, 10000);
+ toptrig_cl_ecal_e_top = aida.histogram1D("toptrig_cl_ecal_e_top", 200, 0, 10000);
+ toptrig_cl_ecal_e_bottom_trig = aida.histogram1D("toptrig_cl_ecal_e_bottom_trig", 200, 0, 10000);
+ toptrigtag_cl_ecal_e_bottom_trig = aida.histogram1D("toptrigtag_cl_ecal_e_bottom_trig", 200, 0, 10000);
+ toptrig_cl_ecal_emax_top = aida.histogram1D("toptrig_cl_ecal_emax_top", 200, 0, 10000);
+ toptrig_cl_ecal_n_bottom = aida.histogram1D("toptrig_cl_ecal_n_bottom", 7, 0, 7);
+// toptrig_cl_ecal_n_top = aida.histogram1D("toptrig_cl_ecal_n_top",7,0,7);
+ plotter5.region(0).plot(toptrig_cl_ecal_n_top);
+ plotter5.region(1).plot(toptrig_cl_ecal_e_bottom);
+ plotter5.region(2).plot(toptrigtag_cl_ecal_e_bottom);
+ plotter5.region(3).plot(toptrig_cl_ecal_e_top);
+ plotter5.region(4).plot(toptrig_cl_ecal_e_bottom_trig);
+ plotter5.region(5).plot(toptrigtag_cl_ecal_e_bottom_trig);
+ plotter5.region(6).plot(toptrig_cl_ecal_emax_top);
+// plotter5.region(3).plot(toptrig_cl_ecal_n_bottom);
+// plotter5.region(0).plot();
+
plotterFrame.setVisible(true);
plotterFrame.pack();
}
@@ -359,88 +388,85 @@
-// 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 (topTrig != 0) {
+ //Find the tag
+ double Emax = -999999.9;
+ HPSEcalCluster cl_tag = null; //highest-E cluster in top half
+ int n = 0; //num. clusters in top half
+ for (HPSEcalCluster cl : clusters) {
+ if (cl.getPosition()[1] > 0) { //top half
+ ++n;
+ toptrig_cl_ecal_e_top.fill(cl.getEnergy());
+ if (cl.getEnergy() > Emax) {
+ Emax = cl.getEnergy();
+ cl_tag = cl;
+ }
+ }
+ }
+
+ //Find a probe
+ double Emaxb = -999999.9;
+ HPSEcalCluster cl_probe = null; //highest-E cluster in bottom half
+ int nb = 0; //num. clusters in bottom half
+ for (HPSEcalCluster cl : clusters) {
+ if (cl.getPosition()[1] <= 0) { //bottom half
+ ++nb;
+ if (cl.getEnergy() > Emaxb) {
+ Emaxb = cl.getEnergy();
+ cl_probe = cl;
+ }
+ }
+ }
+
+ if (Emax > -9999) {
+ toptrig_cl_ecal_emax_top.fill(Emax);
+ }
+ toptrig_cl_ecal_n_top.fill(n);
+
+ if (cl_tag != null) {
+
+ //use only cases where the is a single probe candidate
+ if (nb == 0) {
+ toptrig_cl_ecal_n_bottom.fill(0);
+
+ } else if (nb > 1) {
+ toptrig_cl_ecal_n_bottom.fill(1);
+ } else if (nb == 1) {
+
+
+ toptrig_cl_ecal_n_bottom.fill(2);
+
+ toptrig_cl_ecal_e_bottom.fill(cl_probe.getEnergy());
+
+ if (botTrig != 0) {
+ toptrig_cl_ecal_n_bottom.fill(3);
+ toptrig_cl_ecal_e_bottom_trig.fill(cl_probe.getEnergy());
+ }
+
+ if (cl_tag.getEnergy() > 2000) {
+ toptrig_cl_ecal_n_bottom.fill(4);
+ toptrigtag_cl_ecal_e_bottom.fill(cl_probe.getEnergy());
+
+ if (botTrig != 0) {
+ toptrig_cl_ecal_n_bottom.fill(5);
+ 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"));
}
+ if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+ redraw();
+ }
}
public void reset() {
@@ -471,4 +497,19 @@
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();
}
+
+ @Override
+ public void redraw() {
+ IHistogram1D heff = aida.histogramFactory().divide("turn-on", toptrig_cl_ecal_e_bottom_trig, toptrig_cl_ecal_e_bottom);
+ plotter5.region(7).clear();
+ plotter5.region(7).plot(heff);
+ IHistogram1D heff2 = aida.histogramFactory().divide("turn-on: tag > 2000 ADC", toptrigtag_cl_ecal_e_bottom_trig, toptrig_cl_ecal_e_bottom);
+ plotter5.region(8).clear();
+ plotter5.region(8).plot(heff2);
+ }
+
+ @Override
+ public void setEventRefreshRate(int eventRefreshRate) {
+ this.eventRefreshRate = eventRefreshRate;
+ }
}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -u -r1.1 -r1.2
--- HPSEcalReadoutToTriggerConverterDriver.java 22 Jun 2012 00:23:26 -0000 1.1
+++ HPSEcalReadoutToTriggerConverterDriver.java 1 Aug 2012 23:32:46 -0000 1.2
@@ -28,6 +28,7 @@
private int readoutThreshold = 50;
private int triggerThreshold = 80;
private double timeShift = 0;
+ private int truncateScale = 128;
public HPSEcalReadoutToTriggerConverterDriver() {
}
@@ -60,6 +61,10 @@
this.applyBadCrystalMap = apply;
}
+ public void setTruncateScale(int truncateScale) {
+ this.truncateScale = truncateScale;
+ }
+
@Override
public void startOfData() {
if (ecalCollectionName == null) {
@@ -146,7 +151,7 @@
if (hit.getTimeStamp() % 64 != 0) {
System.out.println("unexpected timestamp " + hit.getTimeStamp());
}
- int truncatedIntegral = (int) Math.floor(triggerIntegral / 128) * 128;
+ int truncatedIntegral = (int) Math.floor(triggerIntegral / truncateScale) * truncateScale;
double hitTime = hit.getTimeStamp() / 16.0;
// if (readoutTime >= 0 && triggerTime >= 0) {
// hitTime += triggerTime - readoutTime;