9 removed files
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalClusterPlots.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalClusterPlots.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,208 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-
-
-import hep.aida.IHistogram1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterFactory;
-
-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.deprecated.Resettable;
-import org.lcsim.hps.recon.ecal.ECalUtils;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalClusterPlots extends Driver implements Resettable {
-
- //AIDAFrame plotterFrame;
- String inputCollection = "EcalClusters";
- AIDA aida = AIDA.defaultInstance();
-
-
- IPlotter plotter1, plotter2, plotter3, plotter4;
- IHistogram1D clusterCountPlot;
- IHistogram1D clusterSizePlot;
- IHistogram1D clusterEnergyPlot;
- IHistogram1D clusterMaxEnergyPlot;
- IHistogram1D clusterTimes;
- IHistogram1D clusterTimeSigma;
- IHistogram2D edgePlot;
- int eventn = 0;
- double maxE = 5000 * ECalUtils.MeV;
- boolean logScale = false;
- boolean hide = false;
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- public void setMaxE(double maxE) {
- this.maxE = maxE;
- }
-
- public void setLogScale(boolean logScale) {
- this.logScale = logScale;
- }
-
- @Override
- protected void detectorChanged(Detector detector) {
-
- //plotterFrame = new AIDAFrame();
- //plotterFrame.setTitle("HPS ECal Cluster Plots");
-
- // Setup the plotter factory.
- IPlotterFactory plotterFactory = aida.analysisFactory().createPlotterFactory("Ecal Cluster Plots");
- plotter1 = plotterFactory.create("Cluster Counts");
- plotter1.setTitle("Cluster Counts");
- //plotterFrame.addPlotter(plotter);
- plotter1.style().dataStyle().errorBarStyle().setVisible(false);
-
- // Setup plots.
- aida.tree().cd("/");
- clusterCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Count per Event", 10, -0.5, 9.5);
- clusterSizePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Size", 10, -0.5, 9.5);
- 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);
- edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster center from hits", 93, -23.25, 23.25, 21, -5.25, 5.25);
- clusterTimes = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time Mean", 400, 0, 4.0 * 100);
- clusterTimeSigma = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time Sigma", 100, 0, 40);
-
-
- // Create the plotter regions.
- plotter1.createRegions(2, 2);
- plotter1.region(0).plot(clusterCountPlot);
- plotter1.region(1).plot(clusterSizePlot);
- plotter1.region(2).plot(edgePlot);
- plotter1.region(3).plot(clusterMaxEnergyPlot);
-
- // Setup the plotter.
- plotter2 = plotterFactory.create("Cluster Energies");
- plotter2.setTitle("Cluster Energies");
- //plotterFrame.addPlotter(plotter2);
- plotter2.style().dataStyle().errorBarStyle().setVisible(false);
-
- if (logScale) {
- plotter2.style().yAxisStyle().setParameter("scale", "log");
- }
-
-
-
- // Create the plotter regions.
- plotter2.createRegions(1, 2);
- plotter2.region(0).plot(clusterEnergyPlot);
- plotter2.region(1).plot(clusterMaxEnergyPlot);
-
- plotter3 = plotterFactory.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");
-
-
- plotter3.region(0).plot(clusterTimes);
- plotter3.region(1).plot(clusterTimeSigma);
-
- plotter4 = plotterFactory.create("Cluster Center");
- 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();
-
-
-
-
- //plotterFrame.setVisible(true);
- //plotterFrame.pack();
-
- if (!hide){
- plotter1.show();
- plotter2.show();
- plotter3.show();
- plotter4.show();
- }
- }
-
- @Override
- 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) {
-// 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()];
- double[] energies = new double[cluster.getCalorimeterHits().size()];
-
- double X = 0;
- double Y = 0;
-// System.out.format("cluster:\n");
- for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
- if (hit.getRawEnergy() != 0) {
- energies[size] = hit.getRawEnergy();
- times[size] = hit.getTime();
- X += energies[size] * hit.getIdentifierFieldValue("ix");
- Y += energies[size] * hit.getIdentifierFieldValue("iy");
- //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());
- }
- }
- X/=size;
- Y/=size;
- clusterTimes.fill(StatUtils.mean(times, 0, size));
- clusterSizePlot.fill(size); //The number of "hits" in a "cluster"
- clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(times, 0, size)));
- edgePlot.fill(X,Y);
-
-
-// }
- }
- clusterMaxEnergyPlot.fill(maxEnergy);
- } else {
- clusterCountPlot.fill(0);
- }
- }
-
- @Override
- public void reset() {
- clusterCountPlot.reset();
- clusterSizePlot.reset();
- clusterEnergyPlot.reset();
- clusterMaxEnergyPlot.reset();
- }
-
- @Override
- public void endOfData() {
- //plotterFrame.dispose();
- }
-}
\ No newline at end of file
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalDaqPlots.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalDaqPlots.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,163 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterFactory;
-import hep.aida.IPlotterStyle;
-import hep.aida.ref.plotter.PlotterRegion;
-import jas.hist.JASHist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawCalorimeterHit;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.recon.ecal.EcalConditions;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalDaqPlots extends Driver implements Resettable {
-
- private String subdetectorName = "Ecal";
- private String inputCollection = "EcalReadoutHits";
- private IPlotter plotter;
- private AIDA aida;
- private Detector detector;
- private List<IHistogram1D> plots;
- private static final short[] slots = {10, 13, 9, 14, 8, 15, 7, 16, 6, 17, 5, 18, 4, 19};
-
- public EcalDaqPlots() {
- }
-
- public void setSubdetectorName(String subdetectorName) {
- this.subdetectorName = subdetectorName;
- }
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- public void detectorChanged(Detector detector) {
-
- this.detector = detector;
-
- if (subdetectorName == null) {
- throw new RuntimeException("The subdetectorName parameter was not set.");
- }
-
- if (inputCollection == null) {
- throw new RuntimeException("The inputCollection parameter was not set.");
- }
-
- Subdetector subdetector = detector.getSubdetector(subdetectorName);
-
- aida = AIDA.defaultInstance();
- aida.tree().cd("/");
- plots = new ArrayList<IHistogram1D>();
-
-
- for (int i = 1; i < 3; i++) { // crate
- for (int j = 0; j < 14; j++) { // slot
- plots.add(aida.histogram1D("ECAL: Crate " + i + "; Slot " + slots[j], 16, 0, 16));
- }
- }
-
- IPlotterFactory factory= aida.analysisFactory().createPlotterFactory("ECAL DAQ Plots");
- plotter =factory.create("DAQ Plots");
- IPlotterStyle pstyle = plotter.style();
- pstyle.dataStyle().fillStyle().setColor("orange");
- pstyle.dataStyle().markerStyle().setColor("orange");
- pstyle.dataStyle().errorBarStyle().setVisible(false);
- plotter.createRegions(7, 4);
-
- int id,plot_id;
- for (int i = 1; i < 3; i++) { // crate
- for (int j = 0; j < 14; j++) { // slot
- //System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
- id = (i-1)*14+(j);
- plot_id = 0;
- if (i==1){
- if (j%2==0) plot_id=j*2;
- else plot_id=(j-1)*2+1;
- }
- else if (i==2){
- if (j%2==0) plot_id=j*2+2;
- else plot_id=(j-1)*2+3;
- }
-
- plotter.region(plot_id).plot(plots.get(id));
- /*JASHist jhist = ((PlotterRegion) plotter.region(region)).getPlot();
- jhist.setAllowUserInteraction(false);
- jhist.setAllowPopupMenus(false);
- */
- }
- }
- plotter.show();
- }
-
-// public void endOfData() {
-// if (plotter != null) {
-// plotter.hide();
-// }
-// }
-
- public void reset() {
- if (plotter != null) {
- // plotter.hide();
- // plotter.destroyRegions();
- for (IHistogram1D plot : plots) {
- plot.reset();
- }
- //detectorChanged(detector);
- }
- }
-
- public void process(EventHeader event) {
- if (event.hasCollection(RawCalorimeterHit.class, inputCollection)) {
- List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, inputCollection);
- for (RawCalorimeterHit hit : hits) {
- Long daqId = EcalConditions.physicalToDaqID(hit.getCellID());
- int crate = EcalConditions.getCrate(daqId);
- int slot = EcalConditions.getSlot(daqId);
- int channel = EcalConditions.getChannel(daqId);
- int id = getSlotIndex(slot)+(crate-1)*14;
-
- //System.out.println("crate="+crate+"; slot="+slot+"; channel="+channel);
- //System.out.println("filling plot: " + "ECAL: Crate " + crate + "; Slot " + slot+ "(" + getSlotIndex(slot)+ ")"+" id: "+id );
- plots.get(id).fill(channel);
- }
- }
- if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
- List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
- for (RawTrackerHit hit : hits) {
- Long daqId = EcalConditions.physicalToDaqID(hit.getCellID());
- int crate = EcalConditions.getCrate(daqId);
- int slot = EcalConditions.getSlot(daqId);
- int channel = EcalConditions.getChannel(daqId);
- //System.out.println("crate="+crate+"; slot="+slot+"; channel="+channel);
- //System.out.println("filling plot: " + "ECAL: Crate " + crate + "; Slot " + slot);
- int id = getSlotIndex(slot)+(crate-1)*14;
- plots.get(id).fill(channel);
- }
- }
- }
-
-
-
- public int getSlotIndex(int slot){
- int ret=-1;
- for (int ii=0;ii<14;ii++){
- if (slots[ii]==slot) ret=ii;
- }
- return ret;
- }
-
-
-
-
-
-}
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalEventMonitor.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalEventMonitor.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,128 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.aida.ref.plotter.PlotterRegion;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.List;
-
-import javax.swing.JCheckBox;
-
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.EventHeader;
-import org.lcsim.geometry.Detector;
-import org.lcsim.hps.recon.ecal.HPSEcalCluster;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalEventMonitor extends Driver implements ItemListener {
-
- String inputCollectionName = "EcalCalHits";
- String clusterCollectionName = "EcalClusters";
- AIDA aida = AIDA.defaultInstance();
- IPlotter plotter;
- IHistogram2D hitPlot;
- IHistogram2D clusterPlot;
- int eventRefreshRate = 1;
- int eventn = 0;
- //private AIDAFrame plotterFrame;
- private JCheckBox logScaleBox;
-
- public EcalEventMonitor() {
- }
-
- public void setEventRefreshRate(int eventRefreshRate) {
- this.eventRefreshRate = eventRefreshRate;
- }
-
- public void setInputCollectionName(String inputCollectionName) {
- this.inputCollectionName = inputCollectionName;
- }
-
- protected void detectorChanged(Detector detector) {
- // Setup plots.
- System.out.println("ECAL Event Monitor: detector changed");
- aida.tree().cd("/");
- hitPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollectionName + " : Pedestal-Subtracted ADC Value", 47, -23.5, 23.5, 11, -5.5, 5.5);
-
- clusterPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollectionName + " : Energy", 47, -23.5, 23.5, 11, -5.5, 5.5);
-
- String title = "HPS ECal Event Monitor";
- // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory().create();
- plotter.setTitle(title);
- //plotterFrame = new AIDAFrame();
- //plotterFrame.addPlotter(plotter);
- //plotterFrame.setVisible(true);
- //plotterFrame.setTitle(title);
-
- // Create the plotter regions.
- plotter.createRegions(1, 2);
- plotter.style().statisticsBoxStyle().setVisible(false);
-
- for (int i = 0; i < plotter.numberOfRegions(); i++) {
- IPlotterStyle style = plotter.region(i).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- style.zAxisStyle().setParameter("scale", "lin");
- }
-
- plotter.region(0).plot(hitPlot);
- ((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false);
- ((PlotterRegion) plotter.region(0)).getPlot().setAllowPopupMenus(false);
-
- plotter.region(1).plot(clusterPlot);
- ((PlotterRegion) plotter.region(1)).getPlot().setAllowUserInteraction(false);
- ((PlotterRegion) plotter.region(1)).getPlot().setAllowPopupMenus(false);
-
- logScaleBox = new JCheckBox("log scale");
- logScaleBox.addItemListener(this);
- //plotterFrame.getControlsPanel().add(logScaleBox);
-
- //plotterFrame.pack();
- }
-
- public void process(EventHeader event) {
- if (++eventn % eventRefreshRate != 0) {
- return;
- }
- hitPlot.reset();
- clusterPlot.reset();
- if (event.hasCollection(CalorimeterHit.class, inputCollectionName)) {
- List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollectionName);
- for (CalorimeterHit hit : hits) {
- hitPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getRawEnergy());
- }
- }
- if (event.hasCollection(HPSEcalCluster.class, clusterCollectionName)) {
- List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollectionName);
- for (HPSEcalCluster cluster : clusters) {
- CalorimeterHit seedHit = cluster.getSeedHit();
- clusterPlot.fill(seedHit.getIdentifierFieldValue("ix"), seedHit.getIdentifierFieldValue("iy"), cluster.getEnergy());
- }
- }
- }
-
- public void endOfData() {
- //if (plotterFrame != null) {
- // plotterFrame.dispose();
- //}
- }
-
- @Override
- public void itemStateChanged(ItemEvent ie) {
- if (ie.getSource() == logScaleBox) {
- for (int i = 0; i < plotter.numberOfRegions(); i++) {
- IPlotterStyle style = plotter.region(i).style();
- if (ie.getStateChange() == ItemEvent.DESELECTED) {
- style.zAxisStyle().setParameter("scale", "lin");
- } else {
- style.zAxisStyle().setParameter("scale", "log");
- }
- }
- }
- }
-}
\ No newline at end of file
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalHitPlots.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalHitPlots.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,364 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.aida.IPlotterFactory;
-import hep.aida.ref.plotter.PlotterUtilities;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.GenericObject;
-import org.lcsim.geometry.Detector;
-import org.lcsim.hps.evio.TriggerData;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.monitoring.deprecated.Redrawable;
-import org.lcsim.hps.users.celentan.EcalMonitoringUtils;
-import org.lcsim.hps.recon.ecal.ECalUtils;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-import org.freehep.swing.popup.GlobalMouseListener;
-import org.freehep.swing.popup.GlobalPopupListener;
-
-
-import javax.swing.JPanel;
-//import org.jfree.chart.ChartPanel;
-
-public class EcalHitPlots extends Driver implements Resettable{
-
- //AIDAFrame plotterFrame;
- String inputCollection = "EcalCalHits";
- AIDA aida = AIDA.defaultInstance();
- IPlotter plotter, plotter2, plotter3, plotter4;
-
- IHistogram1D hitCountPlot;
- IHistogram1D hitTimePlot;
- IHistogram1D hitEnergyPlot;
- IHistogram1D hitMaxEnergyPlot;
- IHistogram1D topTimePlot, botTimePlot, orTimePlot;
- IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
- IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
- // IHistogram2D topX, botX, topY, botY;
- IHistogram2D hitNumberPlot;
- IHistogram2D occupancyPlot;
-
-
- //Plotter5
- ArrayList<IHistogram1D> channelEnergyPlot;
- ArrayList<IHistogram1D> channelTimePlot;
-
-
- int eventn = 0;
- int eventRefreshRate = 1;
- int dummy = 0;
- double maxE = 5000 * ECalUtils.MeV;
- double maxEch = 2500 * ECalUtils.MeV;
- boolean logScale = false;
- boolean hide = false;
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- public void setMaxE(double maxE) {
- this.maxE = maxE;
- }
-
- public void setMaxEch(double maxEch) {
- this.maxEch = maxEch;
- }
-
- public void setLogScale(boolean logScale) {
- this.logScale = logScale;
- }
-
- @Override
- protected void detectorChanged(Detector detector) {
-
- //plotterFrame = new AIDAFrame();
- // plotterFrame.setTitle("HPS ECal Hit Plots");
- System.out.println("Detector changed called: "+ detector.getClass().getName());
- aida.tree().cd("/");
- IPlotterFactory plotterFactory = aida.analysisFactory().createPlotterFactory("Ecal Hit Plots");
-
- // Setup the plotter.
- plotter = plotterFactory.create("Hit Counts");
- plotter.setTitle("Hit Counts");
- // plotterFrame.addPlotter(plotter);
- plotter.style().dataStyle().errorBarStyle().setVisible(false);
-
- // Setup plots.
- hitCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count In Event", 10, -0.5, 9.5);
- hitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time", 100, 0 * 4.0, 100 * 4.0);
- hitNumberPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count");
- occupancyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy");
- topTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Top", 100, 0, 100 * 4.0);
- botTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Bottom", 100, 0, 100 * 4.0);
- orTimePlot = 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);
-
- 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);
-
-
- channelEnergyPlot=new ArrayList<IHistogram1D>();
- channelTimePlot=new ArrayList<IHistogram1D>();
- for(int id = 0; id < (47*11); id = id +1){
- int row=EcalMonitoringUtils.getRowFromHistoID(id);
- int column=EcalMonitoringUtils.getColumnFromHistoID(id);
- //create the histograms
- channelEnergyPlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy : " + (row) + " "+ (column)+ ": "+id, 1000, -0.1, maxEch));
- channelTimePlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time : " + (row) + " "+ (column)+ ": "+id, 100, 0, 400));
- }
-
-
- // Create the plotter regions.
- plotter.createRegions(2, 2);
- plotter.region(3).plot(hitCountPlot);
- plotter.region(1).plot(hitTimePlot);
- plotter.region(0).plot(hitNumberPlot);
- IPlotterStyle style = plotter.region(2).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- style.zAxisStyle().setParameter("scale", "log");
- plotter.region(2).plot(occupancyPlot);
-
- // Setup the plotter.
- plotter2 = plotterFactory.create("Hit Energies");
- plotter2.setTitle("Hit Energies");
- // plotter2.addMouseListener(this);
- // plotterFrame.addPlotter(plotter2);
- plotter2.style().dataStyle().errorBarStyle().setVisible(false);
-
-
-// hitEnergyPlot.addMouseListener(this);
-
- if (logScale) {
- plotter2.style().yAxisStyle().setParameter("scale", "log");
- }
-
- // Create the plotter regions.
- plotter2.createRegions(1, 2);
- plotter2.region(0).plot(hitEnergyPlot);
- plotter2.region(1).plot(hitMaxEnergyPlot);
-
-
-
-
-
-
-
-
-
- plotter3 = plotterFactory.create("Hit Times");
- plotter3.setTitle("Hit Times");
- // plotterFrame.addPlotter(plotter3);
- plotter3.style().dataStyle().errorBarStyle().setVisible(false);
- plotter3.createRegions(3, 3);
-
-
- // Create the plotter regions.
- plotter3.region(0).plot(topTimePlot);
- plotter3.region(1).plot(botTimePlot);
- plotter3.region(2).plot(orTimePlot);
- plotter3.region(3).plot(topTrigTimePlot);
- plotter3.region(4).plot(botTrigTimePlot);
- plotter3.region(5).plot(orTrigTimePlot);
- for (int i = 0; i < 6; i++) {
- if (plotter3.region(i).style() != null) {
- plotter3.region(i).style().yAxisStyle().setParameter("scale", "log");
- }
- }
- plotter3.region(6).plot(topTimePlot2D);
- plotter3.region(7).plot(botTimePlot2D);
- plotter3.region(8).plot(orTimePlot2D);
- for (int i = 6; i < 9; i++) {
- if (plotter3.region(i).style() != null) {
- plotter3.region(i).style().setParameter("hist2DStyle", "colorMap");
- plotter3.region(i).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- plotter3.region(i).style().zAxisStyle().setParameter("scale", "log");
- }
- }
-
- // plotter4 = plotterFactory.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();
-
- //
- // plotter4.region(0).plot(edgePlot);
-
-
- if (!hide) {
- plotter.show();
- plotter2.show();
- plotter3.show();
- // plotter4.show();
- // plotter5.show(); Andrea: not yet.
- }
- //plotterFrame.setVisible(true);
- //plotterFrame.pack();
- }
-
- @Override
- public void process(EventHeader event) {
-
-
- int orTrigTime = -1;
- int topTrigTime = -1;
- int botTrigTime = -1;
- if (event.hasCollection(GenericObject.class, "TriggerBank")) {
- List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank");
- if (!triggerList.isEmpty()) {
- GenericObject triggerData = triggerList.get(0);
-
- int orTrig = TriggerData.getOrTrig(triggerData);
- if (orTrig != 0) {
- for (int i = 0; i < 32; i++) {
- if ((1 << (31 - i) & orTrig) != 0) {
- orTrigTime = i;
- orTrigTimePlot.fill(i);
- break;
- }
- }
- }
- int topTrig = TriggerData.getTopTrig(triggerData);
- if (topTrig != 0) {
- for (int i = 0; i < 32; i++) {
- if ((1 << (31 - i) & topTrig) != 0) {
- topTrigTime = i;
- topTrigTimePlot.fill(i);
- break;
- }
- }
- }
- int botTrig = TriggerData.getBotTrig(triggerData);
- 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);
- hitCountPlot.fill(hits.size());
- int id = 0;
- int row = 0;
- int column = 0;
- double maxEnergy = 0;
- double topTime = Double.POSITIVE_INFINITY;
- 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());
-
-
- column=hit.getIdentifierFieldValue("ix");
- row=hit.getIdentifierFieldValue("iy");
- if ((hit.getIdentifierFieldValue("ix")!=0)&&(hit.getIdentifierFieldValue("iy")!=0)){
- id = EcalMonitoringUtils.getHistoIDFromRowColumn(row,column);
- channelEnergyPlot.get(id).fill(hit.getCorrectedEnergy());
- channelTimePlot.get(id).fill(hit.getTime());
- }
-
- 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) {
- orTimePlot.fill(orTime);
- orTimePlot2D.fill(orTime, orTrigTime);
- }
- if (topTime != Double.POSITIVE_INFINITY) {
- topTimePlot.fill(topTime);
- topTimePlot2D.fill(topTime, topTrigTime);
- }
- if (botTime != Double.POSITIVE_INFINITY) {
- botTimePlot.fill(botTime);
- 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);
- }
-
-
-
- }
-
- @Override
- public void reset() {
- hitCountPlot.reset();
- hitTimePlot.reset();
- hitEnergyPlot.reset();
- hitMaxEnergyPlot.reset();
- for(int id = 0; id < (47*11); id = id +1){
- channelEnergyPlot.get(id).reset();
- channelTimePlot.get(id).reset();
- }
- }
-
- @Override
- public void endOfData() {
- //plotterFrame.dispose();
- }
-
-
-}
-
-
\ No newline at end of file
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalMonitoringPlots.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalMonitoringPlots.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,198 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram2D;
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-
-import java.util.List;
-import java.util.ArrayList;
-
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.base.BaseRawCalorimeterHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.hps.monitoring.deprecated.Redrawable;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.recon.ecal.HPSEcalCluster;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalMonitoringPlots extends Driver implements Resettable, Redrawable {
-
- String inputCollection = "EcalReadoutHits";
- String clusterCollection = "EcalClusters";
- AIDA aida = AIDA.defaultInstance();
- IPlotter plotter;
- IHistogram2D hitCountFillPlot;
- IHistogram2D hitCountDrawPlot;
-
- IHistogram2D occupancyDrawPlot;
- ArrayList<IHistogram1D> occupancyPlots;
-
- IHistogram2D clusterCountFillPlot;
- IHistogram2D clusterCountDrawPlot;
- int eventRefreshRate = 1;
- int eventn = 0;
- boolean hide = false;
-
- public EcalMonitoringPlots() {
- }
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- public void setClusterCollection(String clusterCollection) {
- this.clusterCollection = clusterCollection;
- }
-
- public void setHide(boolean hide) {
- this.hide = hide;
- }
-
- protected void detectorChanged(Detector detector) {
- // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory("Ecal Monitoring Plots").create("HPS ECal Monitoring Plots");
- // Setup plots.
- aida.tree().cd("/");
- hitCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
- hitCountFillPlot = makeCopy(hitCountDrawPlot);
- occupancyDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy", 47, -23.5, 23.5, 11, -5.5, 5.5);
- clusterCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Center Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
- clusterCountFillPlot = makeCopy(clusterCountDrawPlot);
-
- occupancyPlots=new ArrayList<IHistogram1D>();
- for (int ii=0;ii<(11*47);ii++){
- int row=EcalMonitoringUtils.getRowFromHistoID(ii);
- int column=EcalMonitoringUtils.getColumnFromHistoID(ii);
- occupancyPlots.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy : " + (row) + " "+ (column)+ ": "+ii, 101,0,1));
- }
-
-
- // Create the plotter regions.
- plotter.createRegions(2, 2);
- plotter.style().statisticsBoxStyle().setVisible(false);
- IPlotterStyle style = plotter.region(0).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- plotter.region(0).plot(hitCountDrawPlot);
- style = plotter.region(1).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- plotter.region(1).plot(clusterCountDrawPlot);
- style = plotter.region(2).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- style.zAxisStyle().setParameter("scale", "log");
- plotter.region(2).plot(occupancyDrawPlot);
-
-
- if (!hide) {
- plotter.show();
- }
- }
-
- public void process(EventHeader event) {
- int nhits=0;
- int chits[]=new int[11*47];
- if (event.hasCollection(BaseRawCalorimeterHit.class, inputCollection)) {
- List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollection);
- for (BaseRawCalorimeterHit hit : hits) {
- int column=hit.getIdentifierFieldValue("ix");
- int row=hit.getIdentifierFieldValue("iy");
- int id=EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
- hitCountFillPlot.fill(column,row);
- chits[id]++;
- nhits++;
- }
- }
- if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
- List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
- for (RawTrackerHit hit : hits) {
- int column=hit.getIdentifierFieldValue("ix");
- int row=hit.getIdentifierFieldValue("iy");
- int id=EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
- hitCountFillPlot.fill(column,row);
- chits[id]++;
- nhits++;
- }
- }
- if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
- List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
- for (CalorimeterHit hit : hits) {
- int column=hit.getIdentifierFieldValue("ix");
- int row=hit.getIdentifierFieldValue("iy");
- int id=EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
- hitCountFillPlot.fill(column,row);
- chits[id]++;
- nhits++;
- }
- }
-
-
-
-
- if (nhits>0) {
- for (int ii=0;ii<(11*47);ii++){
- occupancyPlots.get(ii).fill(chits[ii]*1./(nhits ));
- }
- }
-
-
- if (event.hasCollection(HPSEcalCluster.class, clusterCollection)) {
- List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollection);
-//if (clusters.size()>1)
- for (HPSEcalCluster cluster : clusters) {
- clusterCountFillPlot.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
- }
- }
- if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
- redraw();
- }
- }
-
- public void endOfData() {
- plotter.hide();
- plotter.destroyRegions();
- }
-
- @Override
- public void reset() {
- hitCountFillPlot.reset();
- hitCountDrawPlot.reset();
- clusterCountFillPlot.reset();
- clusterCountDrawPlot.reset();
-
- occupancyDrawPlot.reset();
- for (int id=0;id<(47*11);id++){
- occupancyPlots.get(id).reset();
- }
- }
-
- @Override
- public void redraw() {
- hitCountDrawPlot.reset();
- hitCountDrawPlot.add(hitCountFillPlot);
- clusterCountDrawPlot.reset();
- clusterCountDrawPlot.add(clusterCountFillPlot);
- occupancyDrawPlot.reset();
- for (int id=0;id<(47*11);id++){
- int row=EcalMonitoringUtils.getRowFromHistoID(id);
- int column=EcalMonitoringUtils.getColumnFromHistoID(id);
- double mean=occupancyPlots.get(id).mean();
- if ((row!=0)&&(column!=0)&&(!EcalMonitoringUtils.isInHole(row, column))) occupancyDrawPlot.fill(column,row,mean);
- }
- }
-
- @Override
- public void setEventRefreshRate(int eventRefreshRate) {
- this.eventRefreshRate = eventRefreshRate;
- }
-
- private IHistogram2D makeCopy(IHistogram2D hist) {
- return aida.histogram2D(hist.title() + "_copy", hist.xAxis().bins(), hist.xAxis().lowerEdge(), hist.xAxis().upperEdge(), hist.yAxis().bins(), hist.yAxis().lowerEdge(), hist.yAxis().upperEdge());
- }
-}
-
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalMonitoringUtils.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalMonitoringUtils.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,28 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-public class EcalMonitoringUtils {
-
-
- public static int getRowFromHistoID(int id){
- return (5-(id%11));
- }
-
- public static int getColumnFromHistoID(int id){
- return ((id/11)-23);
- }
-
- public static int getHistoIDFromRowColumn(int row,int column){
- return (-row+5)+11*(column+23);
- }
-
- public static Boolean isInHole(int row,int column){
- Boolean ret;
- ret=false;
- if ((row==1)||(row==-1)){
- if ((column<=-2)&&(column>=-8)) ret=true;
- }
- return ret;
- }
-
-
-}
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalWindowEventPlots.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalWindowEventPlots.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,148 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalWindowEventPlots extends Driver implements ActionListener {
-
- private String inputCollection;
- private IPlotter plotter;
- private AIDA aida = AIDA.defaultInstance();
- //private AIDAFrame plotterFrame;
- private IHistogram1D[][] plots = new IHistogram1D[47][11];
- private JLabel xLabel, yLabel;
- private JComboBox xCombo;
- private JComboBox yCombo;
- private JButton blankButton;
- private static final Integer[] xList = new Integer[46];
- private static final Integer[] yList = new Integer[10];
- boolean hide = false;
- int window = 100;
-
- public void setWindow(int window) {
- this.window = window;
- }
-
- public EcalWindowEventPlots() {
- int count = 0;
- for (int i = -23; i <= 23; i++) {
- if (i != 0) {
- xList[count] = i;
- count++;
- }
- }
- count = 0;
- for (int i = -5; i <= 5; i++) {
- if (i != 0) {
- yList[count] = i;
- count++;
- }
- }
- }
-
- public void setHide(boolean hide) {
- this.hide = hide;
- }
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- @Override
- public void detectorChanged(Detector detector) {
- if (inputCollection == null) {
- throw new RuntimeException("The inputCollection parameter was not set.");
- }
-
- // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory().create();
- plotter.setTitle("HPS ECal Window Event Plots");
- //plotterFrame = new AIDAFrame();
- //plotterFrame.addPlotter(plotter);
-
- aida = AIDA.defaultInstance();
- aida.tree().cd("/");
-
- for (int x = -23; x <= 23; x++) { // slot
- for (int y = -5; y <= 5; y++) { // crate
- plots[x + 23][y + 5] = aida.histogram1D("ECAL window: x=" + x + "; y=" + y, window, -0.5, window - 0.5);
- }
- }
-
- // Create the plotter regions.
- plotter.createRegion();
-
- xCombo = new JComboBox(xList);
- xCombo.addActionListener(this);
- xLabel = new JLabel("x");
- xLabel.setLabelFor(xCombo);
- //plotterFrame.getControlsPanel().add(xLabel);
- //plotterFrame.getControlsPanel().add(xCombo);
- yCombo = new JComboBox(yList);
- yCombo.addActionListener(this);
- yLabel = new JLabel("y");
- yLabel.setLabelFor(yCombo);
- //plotterFrame.getControlsPanel().add(yLabel);
- //plotterFrame.getControlsPanel().add(yCombo);
- blankButton = new JButton("Hide histogram");
- //plotterFrame.getControlsPanel().add(blankButton);
- blankButton.addActionListener(this);
-
- //plotterFrame.pack();
-
- plotter.style().statisticsBoxStyle().setVisible(false);
- plotter.style().zAxisStyle().setParameter("allowZeroSuppression", "true");
- plotter.style().dataStyle().errorBarStyle().setVisible(false);
-
- plotter.region(0).plot(plots[-5 + 23][2 + 5]);
- xCombo.setSelectedIndex((-5 + 23));
- yCombo.setSelectedIndex((2 + 5 - 1));
-
- //if (!hide) {
- // plotterFrame.setVisible(true);
- //}
- }
-
- @Override
- public void process(EventHeader event) {
- for (int x = -23; x <= 23; x++) { // slot
- for (int y = -5; y <= 5; y++) { // crate
- plots[x + 23][y + 5].reset();
- }
- }
-
- if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
- List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
- for (RawTrackerHit hit : hits) {
- int x = hit.getIdentifierFieldValue("ix");
- int y = hit.getIdentifierFieldValue("iy");
- for (int i = 0; i < window; i++) {
- plots[x + 23][y + 5].fill(i, hit.getADCValues()[i]);
- }
- }
- }
- }
-
- @Override
- public void actionPerformed(ActionEvent ae) {
- Integer x, y;
- x = (Integer) xCombo.getSelectedItem();
- y = (Integer) yCombo.getSelectedItem();
- plotter.region(0).clear();
- plotter.region(0).plot(plots[x + 23][y + 5]);
- }
-}
\ No newline at end of file
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalWindowPlots.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalWindowPlots.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,188 +0,0 @@
-package org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.hps.monitoring.deprecated.AIDAFrame;
-import org.lcsim.hps.recon.ecal.EcalConditions;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalWindowPlots extends Driver implements ActionListener {
-
- private String inputCollection = "EcalReadoutHits";
- private IPlotter plotter;
- private AIDAFrame plotterFrame;
- private AIDA aida;
- private Detector detector;
- private IHistogram1D windowPlot;
- private int window = 100;
- private JLabel crateLabel, slotLabel, channelLabel;
- private JComboBox crateCombo;
- private JComboBox slotCombo;
- private JComboBox channelCombo;
- private static final String[] crateList = new String[3];
- private static final String[] slotList = new String[17];
- private static final String[] channelList = new String[17];
- private boolean testCrate = false;
- private boolean testSlot = false;
- private boolean testChannel = false;
- private int plotCrate, plotSlot, plotChannel;
-
- public EcalWindowPlots() {
- int count = 0;
- crateList[0] = "all";
- for (int i = 1; i <= 2; i++) {
- count++;
- crateList[count] = Integer.toString(i);
- }
- count = 0;
- slotList[0] = "all";
- for (int i = 0; i <= 15; i++) {
- count++;
- slotList[count] = Integer.toString(i);
- }
- count = 0;
- channelList[0] = "all";
- for (int i = 0; i <= 15; i++) {
- count++;
- channelList[count] = Integer.toString(i);
- }
- }
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- public void setWindow(int window) {
- this.window = window;
- }
-
- @Override
- public void detectorChanged(Detector detector) {
-
- this.detector = detector;
-
- if (inputCollection == null) {
- throw new RuntimeException("The inputCollection parameter was not set.");
- }
-
- setupPlots();
- }
-
- private void setupPlots() {
- if (plotterFrame != null) {
- plotterFrame.dispose(); //this clears the plotterFrame
- }
-
- aida = AIDA.defaultInstance();
- aida.tree().cd("/");
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
-
- plotterFrame = new AIDAFrame();
- plotterFrame.addPlotter(plotter);
- plotterFrame.setVisible(true);
- IPlotterStyle pstyle = plotter.style();
- pstyle.dataStyle().errorBarStyle().setVisible(false);
- windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
- plotter.region(0).plot(windowPlot);
-
- crateCombo = new JComboBox(crateList);
- crateCombo.addActionListener(this);
- crateLabel = new JLabel("crate");
- crateLabel.setLabelFor(crateCombo);
- plotterFrame.getControlsPanel().add(crateLabel);
- plotterFrame.getControlsPanel().add(crateCombo);
- slotCombo = new JComboBox(slotList);
- slotCombo.addActionListener(this);
- slotLabel = new JLabel("slot");
- slotLabel.setLabelFor(slotCombo);
- plotterFrame.getControlsPanel().add(slotLabel);
- plotterFrame.getControlsPanel().add(slotCombo);
- channelCombo = new JComboBox(channelList);
- channelCombo.addActionListener(this);
- channelLabel = new JLabel("channel");
- channelLabel.setLabelFor(channelCombo);
- plotterFrame.getControlsPanel().add(channelLabel);
- plotterFrame.getControlsPanel().add(channelCombo);
- plotterFrame.pack();
- }
-
- @Override
- public void endOfData() {
- if (plotterFrame != null) {
- plotterFrame.dispose();
- }
- }
-
- @Override
- public void process(EventHeader event) {
- if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
- List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
- for (RawTrackerHit hit : hits) {
- Long daqId = EcalConditions.physicalToDaqID(hit.getCellID());
- int crate = EcalConditions.getCrate(daqId);
- int slot = EcalConditions.getSlot(daqId);
- int channel = EcalConditions.getChannel(daqId);
-// System.out.println("got hit: crate " + crate + ", slot " + slot + ", channel " + channel);
- if (hit.getADCValues().length != window) {
- throw new RuntimeException("Hit has unexpected window length " + hit.getADCValues().length + ", not " + window);
- }
- if (testCrate && crate != plotCrate) {
- continue;
- }
- if (testSlot && slot != plotSlot) {
- continue;
- }
- if (testChannel && channel != plotChannel) {
- continue;
- }
- windowPlot.reset();
- for (int i = 0; i < window; i++) {
- windowPlot.fill(i, hit.getADCValues()[i]);
-
- }
- }
- }
- }
-
- @Override
- public void actionPerformed(ActionEvent ae) {
- String selItem;
- selItem = (String) crateCombo.getSelectedItem();
- if (selItem.equals("all")) {
- testCrate = false;
- } else {
- testCrate = true;
- plotCrate = Integer.decode(selItem);
- }
-
- selItem = (String) slotCombo.getSelectedItem();
- if (selItem.equals("all")) {
- testSlot = false;
- } else {
- testSlot = true;
- plotSlot = Integer.decode(selItem);
- }
-
- selItem = (String) channelCombo.getSelectedItem();
- if (selItem.equals("all")) {
- testChannel = false;
- } else {
- testChannel = true;
- plotChannel = Integer.decode(selItem);
- }
- }
-}
-
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalWindowPlotsXY.java 2014-03-24 16:31:25 UTC (rev 337)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalWindowPlotsXY.java 2014-03-24 17:48:02 UTC (rev 338)
@@ -1,178 +0,0 @@
-package main.java.org.lcsim.hps.users.celentan;
-
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.hps.monitoring.deprecated.AIDAFrame;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalWindowPlotsXY extends Driver implements ActionListener {
-
- private String subdetectorName= "Ecal";
- private String inputCollection;
- private IPlotter plotter;
- private AIDAFrame plotterFrame;
- private AIDA aida;
- private Detector detector;
- private IDDecoder dec;
- private IHistogram1D windowPlot;
- private int window = 10;
- private JLabel xLabel, yLabel;
- private JComboBox xCombo;
- private JComboBox yCombo;
- private static final String[] xList = new String[47];
- private static final String[] yList = new String[11];
- private boolean testX = false;
- private boolean testY = false;
- private int plotX, plotY;
-
- public EcalWindowPlotsXY() {
- int count = 0;
- xList[0] = "all";
- for (int i = -23; i <= 23; i++) {
- if (i != 0) {
- count++;
- xList[count] = Integer.toString(i);
- }
- }
- count = 0;
- yList[0] = "all";
- for (int i = -5; i <= 5; i++) {
- if (i != 0) {
- count++;
- yList[count] = Integer.toString(i);
- }
- }
- }
-
- public void setSubdetectorName(String subdetectorName) {
- this.subdetectorName = subdetectorName;
- }
-
- public void setInputCollection(String inputCollection) {
- this.inputCollection = inputCollection;
- }
-
- public void setWindow(int window) {
- this.window = window;
- }
-
- public void detectorChanged(Detector detector) {
-
- this.detector = detector;
-
- if (subdetectorName == null) {
- throw new RuntimeException("The subdetectorName parameter was not set.");
- }
-
- if (inputCollection == null) {
- throw new RuntimeException("The inputCollection parameter was not set.");
- }
-
- Subdetector subdetector = detector.getSubdetector(subdetectorName);
- dec = subdetector.getReadout().getIDDecoder();
-
- setupPlots();
- }
-
- private void setupPlots() {
- System.out.println("ECAL WINDOW PLOTS START");
- if (plotterFrame != null) {
- plotterFrame.dispose();
- }
-
- aida = AIDA.defaultInstance();
- aida.tree().cd("/");
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
-
- plotterFrame = new AIDAFrame();
- plotterFrame.addPlotter(plotter);
- plotterFrame.setVisible(true);
- IPlotterStyle pstyle = plotter.style();
- pstyle.dataStyle().errorBarStyle().setVisible(false);
- windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
- plotter.region(0).plot(windowPlot);
-
- xCombo = new JComboBox(xList);
- xCombo.addActionListener(this);
- xLabel = new JLabel("x");
- xLabel.setLabelFor(xCombo);
- plotterFrame.getControlsPanel().add(xLabel);
- plotterFrame.getControlsPanel().add(xCombo);
- yCombo = new JComboBox(yList);
- yCombo.addActionListener(this);
- yLabel = new JLabel("y");
- yLabel.setLabelFor(yCombo);
- plotterFrame.getControlsPanel().add(yLabel);
- plotterFrame.getControlsPanel().add(yCombo);
- plotterFrame.pack();
-
- plotterFrame.show();
- }
-
- public void endOfData() {
- if (plotterFrame != null) {
- plotterFrame.dispose();
- }
- }
-
- public void process(EventHeader event) {
- if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
- List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
- for (RawTrackerHit hit : hits) {
- dec.setID(hit.getCellID());
- int x = dec.getValue("ix");
- int y = dec.getValue("iy");
-// System.out.println("got hit: x= " + x + ", y= " + y);
- if (hit.getADCValues().length != window) {
- throw new RuntimeException("Hit has unexpected window length " + hit.getADCValues().length + ", not " + window);
- }
- if (testX && x != plotX) {
- continue;
- }
- if (testY && y != plotY) {
- continue;
- }
- windowPlot.reset();
- for (int i = 0; i < window; i++) {
- windowPlot.fill(i, hit.getADCValues()[i]);
-
- }
- }
- }
- }
-
- @Override
- public void actionPerformed(ActionEvent ae) {
- String selItem;
- selItem = (String) xCombo.getSelectedItem();
- if (selItem.equals("all")) {
- testX = false;
- } else {
- testX = true;
- plotX = Integer.decode(selItem);
- }
-
- selItem = (String) yCombo.getSelectedItem();
- if (selItem.equals("all")) {
- testY = false;
- } else {
- testY = true;
- plotY = Integer.decode(selItem);
- }
- }
-}
SVNspam 0.1