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  December 2014

HPS-SVN December 2014

Subject:

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

From:

[log in to unmask]

Reply-To:

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

Date:

Sat, 13 Dec 2014 15:21:37 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (359 lines)

Author: [log in to unmask]
Date: Sat Dec 13 07:21:30 2014
New Revision: 1713

Log:
some changes to get these Ecal monitoring drivers to work nicer; 

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

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	Sat Dec 13 07:21:30 2014
@@ -1,46 +1,53 @@
 package org.hps.monitoring.ecal.plots;
-
-
 
 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.hps.readout.ecal.TriggerData;
 import org.hps.recon.ecal.ECalUtils;
 import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.recon.ecal.HPSEcalClusterIC;
 import org.hps.util.Resettable;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;
+import org.lcsim.event.base.BaseCalorimeterHit;
+import org.lcsim.event.base.BaseCluster;
 import org.lcsim.geometry.Detector;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 
 /**
- * The driver <code>EcalCluster</code> implements the histogram shown to the user 
- * in the third tab of the Monitoring Application, when using the Ecal monitoring lcsim file.
+ * The driver <code>EcalCluster</code> implements the histogram shown to the
+ * user
+ * in the third tab of the Monitoring Application, when using the Ecal
+ * monitoring lcsim file.
  * These histograms shows single-channels distributions:
- * - First sub-tab shows the cluster counts per event (Histogram1D), the number of hits in a cluster (Histogram1D),  the cluster centers distribution* (Histogram2D), the maximum cluster energy in an event (Histogram1D)
- * - Second sub-tab shows the energy distribution of the cluster (Histogram1D), and the maximum cluster energy in each event (Histogram1D)
- * - 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).
+ * - First sub-tab shows the cluster counts per event (Histogram1D), the number
+ * of hits in a cluster (Histogram1D), the cluster centers distribution*
+ * (Histogram2D), the maximum cluster energy in an event (Histogram1D)
+ * - Second sub-tab shows the energy distribution of the cluster (Histogram1D),
+ * and the maximum cluster energy in each event (Histogram1D)
+ * - 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).
  * - Last sub-tab is a "zoom" of the the cluster centers distribution
  * All histograms are updated continously.
- * 
- * The cluster center is calculated from the energy center of gravity of the hits forming a cluster.
+ *
+ * The cluster center is calculated from the energy center of gravity of the
+ * hits forming a cluster.
+ *
  * @author Andrea Celentano
  *
  */
-
 public class EcalClusterPlots extends Driver implements Resettable {
 
     String inputCollection = "EcalClusters";
     AIDA aida = AIDA.defaultInstance();
-    
+
     IPlotter plotter1, plotter2, plotter3, plotter4;
     IHistogram1D clusterCountPlot;
     IHistogram1D clusterSizePlot;
@@ -53,7 +60,7 @@
     double maxE = 5000 * ECalUtils.MeV;
     boolean logScale = false;
     boolean hide = false;
-    
+
     public void setInputCollection(String inputCollection) {
         this.inputCollection = inputCollection;
     }
@@ -68,65 +75,62 @@
 
     @Override
     protected void detectorChanged(Detector detector) {
+        System.out.println(this.getClass().getSimpleName() + ":  detectorChanged...making plots");
         // 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);      
+        clusterEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Energy", 100, -0.1, maxE);
+        clusterMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Cluster Energy In Event", 100, -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);
-        
+
         // Setup the plotter factory.
         IPlotterFactory plotterFactory = aida.analysisFactory().createPlotterFactory("Ecal Cluster Plots");
-      
+
         // Create the plotter regions.
         plotter1 = plotterFactory.create("Cluster Counts");
         plotter1.setTitle("Cluster Counts");
         plotter1.style().dataStyle().errorBarStyle().setVisible(false);
-        plotter1.style().dataStyle().fillStyle().setParameter("showZeroHeightBins",Boolean.FALSE.toString());
+        plotter1.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
         plotter1.createRegions(2, 2);
         plotter1.region(0).plot(clusterCountPlot);
         plotter1.region(1).plot(clusterSizePlot);
         plotter1.region(2).plot(edgePlot);
         plotter1.region(3).plot(clusterMaxEnergyPlot);
 
-        
         plotter2 = plotterFactory.create("Cluster Energies");
-        plotter2.createRegions(1,2);
+        plotter2.createRegions(1, 2);
         plotter2.setTitle("Cluster Energies");
         plotter2.style().dataStyle().errorBarStyle().setVisible(false);
-        plotter2.style().dataStyle().fillStyle().setParameter("showZeroHeightBins",Boolean.FALSE.toString());
-        if (logScale) {
+        plotter2.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
+        if (logScale)
             plotter2.style().yAxisStyle().setParameter("scale", "log");
-        }
         plotter2.region(0).plot(clusterEnergyPlot);
         plotter2.region(1).plot(clusterMaxEnergyPlot);
 
         plotter3 = plotterFactory.create("Cluster Times");
         plotter3.setTitle("Cluster Times");
-        plotter3.style().dataStyle().fillStyle().setParameter("showZeroHeightBins",Boolean.FALSE.toString());
+        plotter3.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
         plotter3.style().dataStyle().errorBarStyle().setVisible(false);
         plotter3.createRegions(1, 2);
-        if (logScale){
+        if (logScale)
             plotter3.style().yAxisStyle().setParameter("scale", "log");
-        }
         plotter3.region(0).plot(clusterTimes);
         plotter3.region(1).plot(clusterTimeSigma);
 
         plotter4 = plotterFactory.create("Cluster Center");
         plotter4.setTitle("Edges");
         plotter4.style().setParameter("hist2DStyle", "colorMap");
-        plotter4.style().dataStyle().fillStyle().setParameter("showZeroHeightBins",Boolean.FALSE.toString());
+        plotter4.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
         plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        if (logScale) {
+        if (logScale)
             plotter4.style().zAxisStyle().setParameter("scale", "log");
-        }
-        plotter4.createRegion(); 
+        plotter4.createRegion();
         plotter4.region(0).plot(edgePlot);
-        
-        if (!hide){
+
+        if (!hide) {
             plotter1.show();
             plotter2.show();
             plotter3.show();
@@ -148,49 +152,57 @@
                 botTrig = triggerData.getBotTrig();
             }
         }
-        if (event.hasCollection(HPSEcalCluster.class, inputCollection)) {
-            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, inputCollection);
-            clusterCountPlot.fill(clusters.size());
-            double maxEnergy = 0;
-            for (HPSEcalCluster cluster : clusters) {
+        //mg..12/13/2014...put in kludge so that it handles HPSEcalClusterIC clusters as well. 
+        //clusters used BaseCluster now and what's below is jusa re-arrangement of what was
+        // there before
+        List<BaseCluster> clusters;
+        if (event.hasCollection(HPSEcalCluster.class, inputCollection))
+            clusters = event.get(BaseCluster.class, inputCollection);
+        else if (event.hasCollection(HPSEcalClusterIC.class, inputCollection))
+            clusters = event.get(BaseCluster.class, inputCollection);
+        else {
+            clusterCountPlot.fill(0);
+            return;
+        }
+
+        clusterCountPlot.fill(clusters.size());
+        double maxEnergy = 0;
+        for (BaseCluster 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();
+            clusterEnergyPlot.fill(cluster.getEnergy());
+            if (cluster.getEnergy() > maxEnergy)
+                maxEnergy = cluster.getEnergy();
+            int size = 0;
+            double eTOT = 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");
+                    eTOT += energies[size];
+                    size++;
+//                            System.out.format("x=%d, y=%d, time=%f, energy=%f\n", hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getTime(), hit.getRawEnergy());
                 }
-                int size = 0;
-                double eTOT = 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");
-                        eTOT+=energies[size];
-                        size++;
-//                            System.out.format("x=%d, y=%d, time=%f, energy=%f\n", hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getTime(), hit.getRawEnergy());
-                    }
-                }
-                if (eTOT>0){
-                    X/=eTOT;
-                    Y/=eTOT;
-                    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);
-                }
+            if (eTOT > 0) {
+                X /= eTOT;
+                Y /= eTOT;
+                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);
             }
-            if (maxEnergy>0) clusterMaxEnergyPlot.fill(maxEnergy);
-        } else {
-            clusterCountPlot.fill(0);
-        }
+        }
+        if (maxEnergy > 0)
+            clusterMaxEnergyPlot.fill(maxEnergy);
     }
 
     @Override
@@ -203,6 +215,6 @@
 
     @Override
     public void endOfData() {
-    //plotterFrame.dispose();
-    }
-}
+        //plotterFrame.dispose();
+    }
+}

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	Sat Dec 13 07:21:30 2014
@@ -49,8 +49,8 @@
     IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
     IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
    // IHistogram2D topX, botX, topY, botY;
-    IHistogram2D hitNumberPlot;
-    IHistogram2D occupancyPlot;
+//    IHistogram2D hitNumberPlot;
+//    IHistogram2D occupancyPlot;
    
   
     IPlotterFactory plotterFactory;
@@ -87,8 +87,8 @@
         // 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");
+      //  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);
@@ -101,8 +101,8 @@
         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);
 
-        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);
+        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);
 
         
     
@@ -117,9 +117,9 @@
         
         // 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);
       
         
@@ -128,7 +128,7 @@
         	 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.
@@ -191,7 +191,7 @@
             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();
@@ -201,7 +201,8 @@
                     topTrigTimePlot.fill(topTrigTime);
                 	botTrigTimePlot.fill(botTrigTime);
                 	
-                }             
+                }       
+                */
             }//end if triggerList isEmpty
         }
 

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