LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  March 2015

HPS-SVN March 2015

Subject:

r2368 - in /java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots: EcalClusterPlots.java EcalHitPlots.java EcalMonitoringPlots.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 9 Mar 2015 03:06:15 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (624 lines)

Author: [log in to unmask]
Date: Sun Mar  8 20:06:08 2015
New Revision: 2368

Log:
Work on the monitoring drivers

Modified:
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java	Sun Mar  8 20:06:08 2015
@@ -35,9 +35,7 @@
  * <li>The third sub-tab shows the time distribution of the cluster
  * (Histogram1D), taken from the mean of the times forming the cluster,
  * as well as the RMS (Histogram1D).</li>
- * <li>The fourth sub-tab is a larger version of the the cluster centers
- * distribution.</li>
- * <li>The fifth tab displays the cluster pair distribution for the
+ * <li>The fourth tab displays the cluster pair distribution for the
  * energy sum, energy difference, energy slope, and coplanarity cuts
  * for all top/bottom pairs received. It also displays the average x-
  * and y-coordinates for the pairs.</li>
@@ -56,7 +54,7 @@
     private boolean logScale = false;
 	private AIDA aida = AIDA.defaultInstance();
     private double maxE = 5000 * ECalUtils.MeV;
-	private IPlotter[] plotter = new IPlotter[5];
+	private IPlotter[] plotter = new IPlotter[4];
 	private String clusterCollectionName = "EcalClusters";
 	
 	// Monitoring plot variables.
@@ -79,10 +77,9 @@
     private static final int TAB_CLUSTER_COUNT = 0;
     private static final int TAB_CLUSTER_ENERGY = 1;
     private static final int TAB_CLUSTER_TIME = 2;
-    private static final int TAB_CLUSTER_CENTER = 3;
-    private static final int TAB_CLUSTER_PAIR = 4;
+    private static final int TAB_CLUSTER_PAIR = 3;
     private static final String[] TAB_NAMES = { "Cluster Count Plots", "Cluster Energy Plots",
-    	"Cluster Time Plots", "Cluster Center Plot", "Cluster Pair Plots" };
+    	"Cluster Time Plots", "Cluster Pair Plots" };
     
     /**
      * Resets all of the plots for the new detector.
@@ -136,13 +133,7 @@
         plotter[TAB_CLUSTER_TIME].createRegions(1, 2);
         plotter[TAB_CLUSTER_TIME].region(0).plot(clusterTimes);
         plotter[TAB_CLUSTER_TIME].region(1).plot(clusterTimeSigma);
-        
-        // Define the Cluster Center tab.
-        plotter[TAB_CLUSTER_CENTER].createRegion();
-        plotter[TAB_CLUSTER_CENTER].region(0).plot(edgePlot);
-        plotter[TAB_CLUSTER_CENTER].style().setParameter("hist2DStyle", "colorMap");
-        plotter[TAB_CLUSTER_CENTER].style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        
+               
          // Create the Cluster Pair tab.
         plotter[TAB_CLUSTER_PAIR].createRegions(2, 3);
         plotter[TAB_CLUSTER_PAIR].region(0).plot(pairEnergySum);

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java	Sun Mar  8 20:06:08 2015
@@ -15,6 +15,8 @@
 import org.lcsim.geometry.Detector;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
+
+import org.hps.readout.ecal.triggerbank.SSPData;
 //import org.jfree.chart.ChartPanel;
 
 /**
@@ -45,20 +47,19 @@
     IHistogram1D topTimePlot, botTimePlot, orTimePlot;
     IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
     IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
-   // IHistogram2D topX, botX, topY, botY;
-//    IHistogram2D hitNumberPlot;
-//    IHistogram2D occupancyPlot;
-   
-  
+    IHistogram2D hitNumberPlot;
+    IHistogram2D occupancyPlot;
+
+
     IPlotterFactory plotterFactory;
-  
+
     int eventn = 0;
 
     double maxE = 5000 * ECalUtils.MeV;
-    
+
     boolean logScale = false;
     boolean hide = false;
-    
+
     public void setInputCollection(String inputCollection) {
         this.inputCollection = inputCollection;
     }
@@ -66,7 +67,7 @@
     public void setMaxE(double maxE) {
         this.maxE = maxE;
     }
-    
+
 
     public void setLogScale(boolean logScale) {
         this.logScale = logScale;
@@ -74,35 +75,36 @@
 
     @Override
     protected void detectorChanged(Detector detector) {
-        
+
         System.out.println("Detector changed called: "+ detector.getClass().getName());
         aida.tree().cd("/");
         plotterFactory = aida.analysisFactory().createPlotterFactory("Ecal Hit Plots");
 
-       
-        
+
+
         // 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");
+        hitCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count In Event", 30, -0.5, 29.5);     
+        hitNumberPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Rate KHz");        
+        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", 1024, 0, 4096);
-        botTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Bottom", 1024, 0, 4096);
+        
+        hitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time", 100, 0 * 4.0, 100 * 4.0);
+        topTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Top", 101, -2, 402);
+        botTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Bottom", 101, -2, 402);
         orTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Or", 1024, 0, 4096);
 
-        topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 512, 0, 4096);
-        botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 100, 0, 100 * 4.0, 512, 0, 4096);
-        orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 100, 0, 100 * 4.0, 512, 0, 4096);
+        topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 101, -2, 402);
+        botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 100, 0, 100 * 4.0, 101, -2, 402);
+        orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 100, 0, 100 * 4.0, 101, -2, 402);
 
         hitEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy", 100, -0.1, maxE);
         hitMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Hit Energy In Event", 100, -0.1, maxE);
 
-        
-    
+
+
         // Setup the plotter.
         plotter = plotterFactory.create("Hit Counts");
         plotter.setTitle("Hit Counts");
@@ -110,65 +112,65 @@
         pstyle.setParameter("hist2DStyle", "colorMap");
         pstyle.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
         pstyle.dataStyle().fillStyle().setParameter("showZeroHeightBins",Boolean.FALSE.toString());
-        
-        
+
+
         // Create the plotter regions.
         plotter.createRegions(2,2);
-//        plotter.region(0).plot(hitNumberPlot);
+        plotter.region(0).plot(hitNumberPlot);
         plotter.region(1).plot(hitTimePlot,pstyle);
-//        plotter.region(2).plot(occupancyPlot,pstyle);
+        plotter.region(2).plot(occupancyPlot,pstyle);
         plotter.region(3).plot(hitCountPlot,pstyle);
-      
-        
-     
+
+
+
         if (logScale){
-        	 pstyle.zAxisStyle().setParameter("scale", "log");
+            pstyle.zAxisStyle().setParameter("scale", "log");
         }
         else pstyle.zAxisStyle().setParameter("scale", "lin");
-//        plotter.region(0).plot(hitNumberPlot,pstyle);
-        
-        
+        //        plotter.region(0).plot(hitNumberPlot,pstyle);
+
+
         // Setup the plotter.
         plotter2 = plotterFactory.create("Hit Energies");
         plotter2.setTitle("Hit Energies");
         pstyle.zAxisStyle().setParameter("scale", "lin");
-        
+
         if (logScale) {
-        	 pstyle.yAxisStyle().setParameter("scale", "log");
+            pstyle.yAxisStyle().setParameter("scale", "log");
         }
         else  pstyle.yAxisStyle().setParameter("scale", "lin");
         // Create the plotter regions.
         plotter2.createRegions(1, 2);
         plotter2.region(0).plot(hitEnergyPlot,pstyle);
         plotter2.region(1).plot(hitMaxEnergyPlot,pstyle); 
-               
+
         plotter3 = plotterFactory.create("Hit Times");
         plotter3.setTitle("Hit Times");
         plotter3.createRegions(3, 3);      
-        
+
         if (logScale) {
-       	 pstyle.yAxisStyle().setParameter("scale", "log");
-       }
-       else  pstyle.yAxisStyle().setParameter("scale", "lin");
-        
+            pstyle.yAxisStyle().setParameter("scale", "log");
+        }
+        else  pstyle.yAxisStyle().setParameter("scale", "lin");
+
         plotter3.region(0).plot(topTimePlot,pstyle);
         plotter3.region(1).plot(botTimePlot,pstyle);
         plotter3.region(2).plot(orTimePlot,pstyle);
         plotter3.region(3).plot(topTrigTimePlot,pstyle);
         plotter3.region(4).plot(botTrigTimePlot,pstyle);
         plotter3.region(5).plot(orTrigTimePlot,pstyle);
-        
+
         pstyle.yAxisStyle().setParameter("scale", "lin");
         if (logScale){
-        	 pstyle.zAxisStyle().setParameter("scale", "log");
+            pstyle.zAxisStyle().setParameter("scale", "log");
         }
         else pstyle.zAxisStyle().setParameter("scale", "lin");
-      
+
         plotter3.region(6).plot(topTimePlot2D,pstyle);
         plotter3.region(7).plot(botTimePlot2D,pstyle);
         plotter3.region(8).plot(orTimePlot2D,pstyle);
-       
-        
+
+
         if (!hide) {
             plotter.show();
             plotter2.show();
@@ -178,28 +180,29 @@
 
     @Override
     public void process(EventHeader event) {
-        
-        
+
+
         int orTrigTime=4097;
         int topTrigTime=4097;
         int botTrigTime=4097;
-        
+
         if (event.hasCollection(GenericObject.class, "TriggerBank")) {
             List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank");
             if (!triggerList.isEmpty()) {
                 GenericObject triggerData = triggerList.get(0);
-/*  mgraham12/14/2014 ...comment this out for now as it seems to through a null pointer
+               
                 if (triggerData instanceof SSPData){ 
                 	orTrigTime=((SSPData)triggerData).getOrTrig();
                 	topTrigTime=((SSPData)triggerData).getTopTrig();
                 	botTrigTime =((SSPData)triggerData).getBotTrig(); 
-                    
+
+                	
                 	orTrigTimePlot.fill(orTrigTime);
                     topTrigTimePlot.fill(topTrigTime);
                 	botTrigTimePlot.fill(botTrigTime);
-                	
+
                 }       
-                */
+                
             }//end if triggerList isEmpty
         }
 
@@ -215,11 +218,11 @@
             double orTime = Double.POSITIVE_INFINITY;
             for (CalorimeterHit hit : hits) {
 
-               
+
                 hitEnergyPlot.fill(hit.getRawEnergy());
                 hitTimePlot.fill(hit.getTime());
-               
-                
+
+
                 if (hit.getTime() < orTime) {
                     orTime = hit.getTime();
                 }
@@ -233,7 +236,7 @@
                     maxEnergy = hit.getRawEnergy();
                 }
             }
-            
+
             if (orTime != Double.POSITIVE_INFINITY) {
                 orTimePlot.fill(orTime);
                 orTimePlot2D.fill(orTime, orTrigTime);
@@ -247,8 +250,8 @@
                 botTimePlot2D.fill(botTime, botTrigTime);
             }
             hitMaxEnergyPlot.fill(maxEnergy);
-        
-            for (int i = 0; i < hits.size(); i++) {
+
+            /* for (int i = 0; i < hits.size(); i++) {
                 CalorimeterHit hit1 = hits.get(i);
                 int x1 = hit1.getIdentifierFieldValue("ix");
                 int y1 = hit1.getIdentifierFieldValue("iy");
@@ -258,11 +261,11 @@
                     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);
+                          edgePlot.fill((x1 + x2) / 2.0, (y1 + y2) / 2.0);
                         }
                     }
                 }
-            }
+            }*/
         } else {
             hitCountPlot.fill(0);
         }         
@@ -277,54 +280,54 @@
     {
         this.hide=hide;
     }
-        
-    
+
+
     /**
-	 * Initializes the default style for plots.
-	 * @return Returns an <code>IPlotterStyle</code> object that
-	 * represents the default style for plots.
-	 */
-	public IPlotterStyle createDefaultStyle() {
-		IPlotterStyle pstyle = plotterFactory.createPlotterStyle();
-		// Set the appearance of the axes.
-		pstyle.xAxisStyle().labelStyle().setBold(true);
-		pstyle.yAxisStyle().labelStyle().setBold(true);
-		pstyle.xAxisStyle().tickLabelStyle().setBold(true);
-		pstyle.yAxisStyle().tickLabelStyle().setBold(true);
-		pstyle.xAxisStyle().lineStyle().setColor("black");
-		pstyle.yAxisStyle().lineStyle().setColor("black");
-		pstyle.xAxisStyle().lineStyle().setThickness(2);
-		pstyle.yAxisStyle().lineStyle().setThickness(2);
-		
-		// Set color settings.
-		pstyle.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-		pstyle.dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
-		pstyle.dataStyle().errorBarStyle().setVisible(false);
-		pstyle.setParameter("hist2DStyle", "colorMap");
-		
-		// Force auto range to zero.
-		pstyle.yAxisStyle().setParameter("allowZeroSuppression", "false");
-		pstyle.xAxisStyle().setParameter("allowZeroSuppression", "false");
-		
-		// Set the title style.
-		pstyle.titleStyle().textStyle().setFontSize(20);
-		
-		// Draw caps on error bars.
-		pstyle.dataStyle().errorBarStyle().setParameter("errorBarDecoration", (new Float(1.0f)).toString());
-		
-		// Turn off grid lines until explicitly enabled.
-		pstyle.gridStyle().setVisible(false);
-		
-		// Return the style.
-		return pstyle;
-	}
-    
-    
-    
-    
-    
-    
-    
+     * Initializes the default style for plots.
+     * @return Returns an <code>IPlotterStyle</code> object that
+     * represents the default style for plots.
+     */
+    public IPlotterStyle createDefaultStyle() {
+        IPlotterStyle pstyle = plotterFactory.createPlotterStyle();
+        // Set the appearance of the axes.
+        pstyle.xAxisStyle().labelStyle().setBold(true);
+        pstyle.yAxisStyle().labelStyle().setBold(true);
+        pstyle.xAxisStyle().tickLabelStyle().setBold(true);
+        pstyle.yAxisStyle().tickLabelStyle().setBold(true);
+        pstyle.xAxisStyle().lineStyle().setColor("black");
+        pstyle.yAxisStyle().lineStyle().setColor("black");
+        pstyle.xAxisStyle().lineStyle().setThickness(2);
+        pstyle.yAxisStyle().lineStyle().setThickness(2);
+
+        // Set color settings.
+        pstyle.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        pstyle.dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
+        pstyle.dataStyle().errorBarStyle().setVisible(false);
+        pstyle.setParameter("hist2DStyle", "colorMap");
+
+        // Force auto range to zero.
+        pstyle.yAxisStyle().setParameter("allowZeroSuppression", "false");
+        pstyle.xAxisStyle().setParameter("allowZeroSuppression", "false");
+
+        // Set the title style.
+        pstyle.titleStyle().textStyle().setFontSize(20);
+
+        // Draw caps on error bars.
+        pstyle.dataStyle().errorBarStyle().setParameter("errorBarDecoration", (new Float(1.0f)).toString());
+
+        // Turn off grid lines until explicitly enabled.
+        pstyle.gridStyle().setVisible(false);
+
+        // Return the style.
+        return pstyle;
+    }
+
+
+
+
+
+
+
 }
 
-   
+

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java	Sun Mar  8 20:06:08 2015
@@ -42,10 +42,12 @@
     IHistogram2D clusterCountDrawPlot;
     int eventRefreshRate = 1;
     int eventn = 0;
+    int thisEventN,prevEventN;
+
     boolean hide = false;
-    boolean accumulateHits = false;
     long thisTime,prevTime;
-    
+    double thisEventTime,prevEventTime;
+
     public EcalMonitoringPlots() {
     }
 
@@ -61,9 +63,7 @@
         this.hide = hide;
     }
 
-    public void setAccumulateHits(boolean accumulateHits) {
-        this.accumulateHits = accumulateHits;
-    }
+
     /**
      * Set the refresh rate for histograms in this driver
      * @param eventRefreshRate: the refresh rate, defined as number of events to accumulate before
@@ -80,21 +80,20 @@
         // Setup plots.
         aida.tree().cd("/");
         String hitCountDrawPlotTitle;
-       if (accumulateHits)  hitCountDrawPlotTitle = detector.getDetectorName() + " : " + inputCollection + " : Hit Count (accumulated)";
-       else hitCountDrawPlotTitle = detector.getDetectorName() + " : " + inputCollection + " : Hit Count (refreshed)";
-       
-       hitCountDrawPlot = aida.histogram2D(hitCountDrawPlotTitle, 47, -23.5, 23.5, 11, -5.5, 5.5);
-       hitCountFillPlot = makeCopy(hitCountDrawPlot);
+        hitCountDrawPlotTitle = detector.getDetectorName() + " : " + inputCollection + " : Hit Rate KHz";
+
+        hitCountDrawPlot = aida.histogram2D(hitCountDrawPlotTitle, 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);
+        clusterCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Rate KHz", 47, -23.5, 23.5, 11, -5.5, 5.5);
         clusterCountFillPlot = makeCopy(clusterCountDrawPlot);
 
-      
+
         NoccupancyFill=1; //to avoid a "NaN" at beginning
         for (int ii = 0; ii < (11 * 47); ii++) {
             int row = EcalMonitoringUtilities.getRowFromHistoID(ii);
             int column = EcalMonitoringUtilities.getColumnFromHistoID(ii);
-            occupancyFill[ii]=0;
+            occupancyFill[ii]=0.;
         }
 
         // Create the plotter regions.
@@ -122,24 +121,18 @@
         }
         prevTime=0; //init the time 
         thisTime=0; //init the time 
+
+        thisEventN=0;
+        prevEventN=0;
+
+        thisEventTime=0;
+        prevEventTime=0;
     }
 
     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) {
@@ -148,15 +141,15 @@
                 int id = EcalMonitoringUtilities.getHistoIDFromRowColumn(row, column);
                 hitCountFillPlot.fill(column, row);
                 {
-                 chits[id]++;
-                 nhits++;
+                    chits[id]++;
+                    nhits++;
                 }
             }
         }
 
         if (nhits > 0) {
             for (int ii = 0; ii < (11 * 47); ii++) {
-                occupancyFill[ii]+=1.*chits[ii]/nhits;
+                occupancyFill[ii]+=(1.*chits[ii])/nhits;
             }
         }
 
@@ -166,16 +159,32 @@
                 clusterCountFillPlot.fill(cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"), cluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"));
             }
         }
-       
+
         thisTime=System.currentTimeMillis()/1000;
-        
+        thisEventN=event.getEventNumber();
+        thisEventTime=event.getTimeStamp()/1E9;
         if ((thisTime-prevTime)>eventRefreshRate){
-        	prevTime=thisTime;
-        	redraw();
-        	NoccupancyFill=0;
+            double scale=1.;
+
+            if (NoccupancyFill>0){
+                scale=(thisEventN-prevEventN)/NoccupancyFill;
+                scale=scale/(thisEventTime-prevEventTime);
+                scale/=1000. ; //do KHz
+            }
+            //System.out.println("Event: "+thisEventN+" "+prevEventN);
+            //System.out.println("Time: "+thisEventTime+" "+prevEventTime);
+            // System.out.println("Monitor: "+thisTime+" "+prevTime+" "+NoccupancyFill);
+
+            hitCountFillPlot.scale(scale);
+            clusterCountFillPlot.scale(scale);
+            redraw();
+            prevTime=thisTime;
+            prevEventN=thisEventN;
+            prevEventTime=thisEventTime;
+            NoccupancyFill=0;
         }
         else{
-        	NoccupancyFill++;
+            NoccupancyFill++;
         }
     }
 
@@ -190,22 +199,21 @@
         plotter.region(0).clear();
         plotter.region(0).plot(hitCountDrawPlot);
         plotter.region(0).refresh();
-        
-        if (!accumulateHits){
-        	hitCountFillPlot.reset();
-        }
+        hitCountFillPlot.reset();
+
         clusterCountDrawPlot.reset();
         clusterCountDrawPlot.add(clusterCountFillPlot);
         plotter.region(1).clear();
         plotter.region(1).plot(clusterCountDrawPlot);
         plotter.region(1).refresh();
-        
+        clusterCountFillPlot.reset();
+
         occupancyDrawPlot.reset();
         for (int id = 0; id < (47 * 11); id++) {
             int row = EcalMonitoringUtilities.getRowFromHistoID(id);
             int column = EcalMonitoringUtilities.getColumnFromHistoID(id);
             double mean = occupancyFill[id]/NoccupancyFill;
-            
+
             occupancyFill[id]=0;
             if ((row != 0) && (column != 0) && (!EcalMonitoringUtilities.isInHole(row, column)))
                 occupancyDrawPlot.fill(column, row, mean);

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use