Commit in java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots on MAIN
EcalEventDisplay.java+32-25942 -> 943
EcalMonitoringPlots.java+7-6942 -> 943
EcalMonitoringUtils.java-26942 removed
EcalWindowPlotsXY.java+19-22942 -> 943
+58-79
1 removed + 3 modified, total 4 files
Deleted EcalMonitorinUtils and moved functions in recon.ecal.ECalUtils

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalEventDisplay.java 942 -> 943
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplay.java	2014-09-02 22:47:31 UTC (rev 942)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplay.java	2014-09-03 12:43:58 UTC (rev 943)
@@ -113,22 +113,22 @@
        //create the histograms for single channel energy and time distribution.
        //these are NOT shown in this plotter, but are used in the event display.
        for(int ii = 0; ii < (47*11); ii = ii +1){
-             int row=EcalMonitoringUtils.getRowFromHistoID(ii);
-             int column=EcalMonitoringUtils.getColumnFromHistoID(ii);      
-             channelEnergyPlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy : " + (row) + " "+ (column)+ ": "+ii, 100, 0, maxEch));  
-             channelTimePlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time : " + (row) + " "+ (column)+ ": "+ii, 100, 0, 400));     
-             channelTimeVsEnergyPlot.add(aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time Vs Energy : " + (row) + " "+ (column)+ ": "+ii, 100, 0, 400,100, 0, maxEch));              
-             channelRawWaveform.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy : " + (row) + " "+ (column)+ ": "+ii));
+             int row=ECalUtils.getRowFromHistoID(ii);
+             int column=ECalUtils.getColumnFromHistoID(ii);      
+             channelEnergyPlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy : " + (column) + " "+ (row)+ ": "+ii, 100, 0, maxEch));  
+             channelTimePlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time : " + (column) + " "+ (row)+ ": "+ii, 100, 0, 400));     
+             channelTimeVsEnergyPlot.add(aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time Vs Energy : " + (column) + " "+ (row)+ ": "+ii, 100, 0, 400,100, 0, maxEch));              
+             channelRawWaveform.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy : " + (column) + " "+ (row)+ ": "+ii));
              //the above instruction is a terrible hack, just to fill the arrayList with all the elements. They'll be initialized properly during the event readout,
              //since we want to account for possibly different raw waveform dimensions!
-             //channelRawWaveform.add(aida.cloud1D(detector.getDetectorName() + " : " + inputCollection + " : Raw Waveform : " + (row) + " "+ (column)+ ": "+ii,1000000000));
+             //channelRawWaveform.add(aida.cloud1D(detector.getDetectorName() + " : " + inputCollection + " : Raw Waveform : " + (column) + " "+ (row)+ ": "+ii,1000000000));
              
              isFirstRaw[ii]=true;
              windowRaw[ii]=1;
        }
        id=0;
-       iy=EcalMonitoringUtils.getRowFromHistoID(id);
-   	   ix=EcalMonitoringUtils.getColumnFromHistoID(id);  
+       iy=ECalUtils.getRowFromHistoID(id);
+   	   ix=ECalUtils.getColumnFromHistoID(id);  
    	   
    	   
     	
@@ -199,7 +199,7 @@
                 row=hit.getIdentifierFieldValue("iy");
                 column=hit.getIdentifierFieldValue("ix");           	
                 if ((row!=0)&&(column!=0)){
-                    ii = EcalMonitoringUtils.getHistoIDFromRowColumn(row,column);
+                    ii = ECalUtils.getHistoIDFromRowColumn(row,column);
                     if (hit.getCorrectedEnergy() > 0) { //A.C. > 0 for the 2D plot drawing                 	
                     	channelEnergyPlot.get(ii).fill(hit.getCorrectedEnergy());
                         channelTimePlot.get(ii).fill(hit.getTime());
@@ -233,11 +233,11 @@
         		 row=hit.getIdentifierFieldValue("iy");
                  column=hit.getIdentifierFieldValue("ix");
                  if ((row!=0)&&(column!=0)){
-                     ii = EcalMonitoringUtils.getHistoIDFromRowColumn(row,column);
+                     ii = ECalUtils.getHistoIDFromRowColumn(row,column);
                      if (isFirstRaw[ii]){ //at the very first hit we read for this channel, we need to read the window length and save it
                     	 isFirstRaw[ii]=false;
                     	 windowRaw[ii]=hit.getADCValues().length;                   	 
-                    	 channelRawWaveform.set(ii,aida.histogram1D(detector.getDetectorName() + " : " + inputCollectionRaw + " : Raw Waveform : " + (row) + " "+ (column)+ ": "+ii,windowRaw[ii],-0.5*ECalUtils.ecalReadoutPeriod,(-0.5+windowRaw[ii])*ECalUtils.ecalReadoutPeriod));
+                    	 channelRawWaveform.set(ii,aida.histogram1D(detector.getDetectorName() + " : " + inputCollectionRaw + " : Raw Waveform : " + (column) + " "+ (row)+ ": "+ii,windowRaw[ii],-0.5*ECalUtils.ecalReadoutPeriod,(-0.5+windowRaw[ii])*ECalUtils.ecalReadoutPeriod));
                      }
                      if (do_update){
                          channelRawWaveform.get(ii).reset();                     
@@ -296,27 +296,34 @@
     @Override
 	public void crystalClicked(CrystalEvent e){
     
+    	int itmpx,itmpy;
     	Point displayPoint,ecalPoint;
     	displayPoint=e.getCrystalID();
     	ecalPoint=viewer.toEcalPoint(displayPoint);
-    	ix=(int) ecalPoint.getX(); //column
-    	iy=(int) ecalPoint.getY(); //raw
-    	id=EcalMonitoringUtils.getHistoIDFromRowColumn(iy,ix);
-    	System.out.println("Crystal event: "+ix+" "+iy+" "+id);
-            	
+    	itmpx=(int) ecalPoint.getX(); //column
+    	itmpy=(int) ecalPoint.getY(); //row
+    	
+    	if (!ECalUtils.isInHole(itmpy,itmpx)){
+    		ix=itmpx;
+    		iy=itmpy;
+    	    id=ECalUtils.getHistoIDFromRowColumn(iy,ix);
+    	    System.out.println("Crystal event: "+ix+" "+iy+" "+id);
+        
+    	
        	
-       	plotter.region(0).clear();
-        plotter.region(0).plot(channelEnergyPlot.get(id));
+           	plotter.region(0).clear();
+            plotter.region(0).plot(channelEnergyPlot.get(id));
     
-        plotter.region(1).clear();
-        plotter.region(1).plot(channelTimePlot.get(id));           	    
+            plotter.region(1).clear();
+            plotter.region(1).plot(channelTimePlot.get(id));           	    
    
 
-    	plotter.region(2).clear();
-    	plotter.region(2).plot(channelTimeVsEnergyPlot.get(id));
+    	    plotter.region(2).clear();
+        	plotter.region(2).plot(channelTimeVsEnergyPlot.get(id));
     	
-    	plotter.region(3).clear();
-    	plotter.region(3).plot(channelRawWaveform.get(id));
+    	    plotter.region(3).clear();
+    	    plotter.region(3).plot(channelRawWaveform.get(id));
+    	}
     }    
 }
 

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalMonitoringPlots.java 942 -> 943
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java	2014-09-02 22:47:31 UTC (rev 942)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java	2014-09-03 12:43:58 UTC (rev 943)
@@ -9,6 +9,7 @@
 import java.util.List;
 
 import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.recon.ecal.ECalUtils;
 import org.hps.util.Redrawable;
 import org.hps.util.Resettable;
 import org.lcsim.event.CalorimeterHit;
@@ -87,8 +88,8 @@
 
         occupancyPlots = new ArrayList<IHistogram1D>();
         for (int ii = 0; ii < (11 * 47); ii++) {
-            int row = EcalMonitoringUtils.getRowFromHistoID(ii);
-            int column = EcalMonitoringUtils.getColumnFromHistoID(ii);
+            int row = ECalUtils.getRowFromHistoID(ii);
+            int column = ECalUtils.getColumnFromHistoID(ii);
             occupancyPlots.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy : " + (row) + " " + (column) + ": " + ii, 101, 0, 1));
         }
 
@@ -138,7 +139,7 @@
             for (CalorimeterHit hit : hits) {
                 int column = hit.getIdentifierFieldValue("ix");
                 int row = hit.getIdentifierFieldValue("iy");
-                int id = EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
+                int id = ECalUtils.getHistoIDFromRowColumn(row, column);
                 hitCountFillPlot.fill(column, row);
                 chits[id]++;
                 nhits++;
@@ -188,10 +189,10 @@
         clusterCountDrawPlot.add(clusterCountFillPlot);
         occupancyDrawPlot.reset();
         for (int id = 0; id < (47 * 11); id++) {
-            int row = EcalMonitoringUtils.getRowFromHistoID(id);
-            int column = EcalMonitoringUtils.getColumnFromHistoID(id);
+            int row = ECalUtils.getRowFromHistoID(id);
+            int column = ECalUtils.getColumnFromHistoID(id);
             double mean = occupancyPlots.get(id).mean();
-            if ((row != 0) && (column != 0) && (!EcalMonitoringUtils.isInHole(row, column)))
+            if ((row != 0) && (column != 0) && (!ECalUtils.isInHole(row, column)))
                 occupancyDrawPlot.fill(column, row, mean);
         }
     }

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalMonitoringUtils.java removed after 942
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringUtils.java	2014-09-02 22:47:31 UTC (rev 942)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringUtils.java	2014-09-03 12:43:58 UTC (rev 943)
@@ -1,26 +0,0 @@
-package org.hps.monitoring.ecal.plots;
-
-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/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalWindowPlotsXY.java 942 -> 943
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java	2014-09-02 22:47:31 UTC (rev 942)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java	2014-09-03 12:43:58 UTC (rev 943)
@@ -19,6 +19,8 @@
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 
+import org.hps.recon.ecal.ECalUtils;
+
 public class EcalWindowPlotsXY extends Driver implements ActionListener {
 
     private String subdetectorName= "Ecal";
@@ -29,6 +31,7 @@
     private Detector detector;
     private IDDecoder dec;
     private IHistogram1D windowPlot;
+    private IHistogram1D windowPlot1;
     private int window = 10;
     private JLabel xLabel, yLabel;
     private JComboBox xCombo;
@@ -38,6 +41,7 @@
     private boolean testX = false;
     private boolean testY = false;
     private int plotX, plotY;
+    private boolean isFirst = true;
 
     public EcalWindowPlotsXY() {
         int count = 0;
@@ -96,31 +100,17 @@
 
         aida = AIDA.defaultInstance();
         aida.tree().cd("/");
-        plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
+        plotter = aida.analysisFactory().createPlotterFactory("ECAL Window plots").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();
+        plotter.createRegions(1,1);     
+    	windowPlot1 = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : dummy", 1, -0.5, 1 - 0.5);
+    	plotter.region(0).plot(windowPlot1);
+        plotter.show();
     }
 
     public void endOfData() {
@@ -137,8 +127,15 @@
                 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 (isFirst) {
+                	System.out.println("FIRST!!!");
+                    isFirst=false;
+                	window=hit.getADCValues().length;
+                	windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
+                	plotter.region(0).clear();
+                	plotter.region(0).plot(windowPlot);
+                	plotter.region(0).refresh();
+                
                 }
                 if (testX && x != plotX) {
                     continue;
@@ -148,7 +145,7 @@
                 }
                 windowPlot.reset();
                 for (int i = 0; i < window; i++) {
-                    windowPlot.fill(i, hit.getADCValues()[i]);
+                    windowPlot.fill(i, hit.getADCValues()[i]*ECalUtils.adcResolution);
 
                 }
             }
SVNspam 0.1