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:

r1789 - /java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java

From:

[log in to unmask]

Reply-To:

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

Date:

Thu, 18 Dec 2014 22:58:44 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (573 lines)

Author: [log in to unmask]
Date: Thu Dec 18 14:58:39 2014
New Revision: 1789

Log:
Updated the cluster plots for the monitoring application. The pair plots now correctly form from cluster top/bottom pairs. Additionally, the energy slope and coplanarity pair plots were added. Lastly, general code clean-up and documentation was added.

Modified:
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.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	Thu Dec 18 14:58:39 2014
@@ -4,258 +4,318 @@
 import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
 import hep.aida.IPlotterFactory;
+
+import java.util.ArrayList;
 import java.util.List;
+
 import org.apache.commons.math.stat.StatUtils;
-import org.hps.readout.ecal.TriggerData;
+import org.hps.readout.ecal.SSPTriggerLogic;
 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.
- * 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).
- * - 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.
- *
- * @author Andrea Celentano
- *
+ * The driver <code>EcalCluster</code> implements the histograms shown
+ * to the user in the third tab of the Monitoring Application, when using
+ * the Ecal monitoring application.<br/>
+ * <br/>
+ * These histograms show the single-channel distributions:
+ * <ul>
+ * <li>The first sub-tab shows the cluster counts per event (Histogram1D),
+ * the number of hits in a cluster (Histogram1D), the cluster centers
+ * distribution (Histogram2D), and the maximum cluster energy in an
+ * event (Histogram1D).</li>
+ * <li>The second sub-tab shows the energy distribution of the cluster
+ * (Histogram1D) and the maximum cluster energy in each event
+ * (Histogram1D)</li>
+ * <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
+ * 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>
+ * </ul>
+ * All histograms are updated continuously.<br/>
+ * <br/>
+ * The cluster center is calculated from the average of the positions
+ * of the constituent hits, weighted by the hit energies.<br/>
+ * <br/>
+ * @author Andrea Celentano <[log in to unmask]>
+ * @author Kyle McCarty <[log in to unmask]>
  */
-public class EcalClusterPlots extends Driver implements Resettable {
-
-    String inputCollection = "EcalClusters";
-    AIDA aida = AIDA.defaultInstance();
-
-    IPlotter plotter1, plotter2, plotter3, plotter4, plotter5;
-    IHistogram1D clusterCountPlot;
-    IHistogram1D clusterSizePlot;
-    IHistogram1D clusterEnergyPlot;
-    IHistogram1D clusterMaxEnergyPlot;
-    IHistogram1D clusterTimes;
-    IHistogram1D clusterTimeSigma;
-    IHistogram2D edgePlot;
-    //mg...12/13/2014
-    IHistogram1D  twoclusterTotEnergy;
-    IHistogram1D  twoclusterEnergyDiff;
-    IHistogram1D  twoclusterEnergyMeanYPos;
-    IHistogram1D  twoclusterEnergyMeanXPos;    
-    //
-    int eventn = 0;
-    double maxE = 5000 * ECalUtils.MeV;
-    boolean logScale = false;
-    boolean hide = false;
-
-    public void setInputCollection(String inputCollection) {
-        this.inputCollection = inputCollection;
-    }
-
+public class EcalClusterPlots extends Driver {
+	// Internal variables.
+    private boolean hide = false;
+    private boolean logScale = false;
+	private AIDA aida = AIDA.defaultInstance();
+    private double maxE = 5000 * ECalUtils.MeV;
+	private IPlotter[] plotter = new IPlotter[5];
+	private String clusterCollectionName = "EcalClusters";
+	
+	// Monitoring plot variables.
+    private IHistogram1D clusterCountPlot;
+    private IHistogram1D clusterSizePlot;
+    private IHistogram1D clusterEnergyPlot;
+    private IHistogram1D clusterMaxEnergyPlot;
+    private IHistogram1D clusterTimes;
+    private IHistogram1D clusterTimeSigma;
+    private IHistogram2D edgePlot;
+    
+    private IHistogram1D pairEnergySum;
+    private IHistogram1D pairEnergyDifference;
+    private IHistogram1D pairCoplanarity;
+    private IHistogram1D pairEnergySlope;
+    private IHistogram1D pairEnergyPositionMeanX;
+    private IHistogram1D pairEnergyPositionMeanY;
+    
+    // Class variables.
+    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 String[] TAB_NAMES = { "Cluster Count Plots", "Cluster Energy Plots",
+    	"Cluster Time Plots", "Cluster Center Plot", "Cluster Pair Plots" };
+    
+    /**
+     * Resets all of the plots for the new detector.
+     * @param detector - The <code>Detector</code> object representing
+     * the new detector.
+     */
+    @Override
+    protected void detectorChanged(Detector detector) {
+        // Re-instantiate all of the histograms.
+        aida.tree().cd("/");
+        clusterCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : Cluster Count per Event", 10, -0.5, 9.5);
+        clusterSizePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : Cluster Size", 10, -0.5, 9.5);
+        clusterEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : Cluster Energy", 100, -0.1, maxE);
+        clusterMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : Maximum Cluster Energy in Event", 100, -0.1, maxE);
+        edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollectionName + " : Weighted Cluster", 47, -23.25, 23.25, 11, -5.25, 5.25);
+        clusterTimes = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : Cluster Time Mean", 400, 0, 4.0 * 100);
+        clusterTimeSigma = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollectionName + " : Cluster Time Sigma", 100, 0, 40);
+        
+        pairEnergySum = aida.histogram1D("Pair Energy Sum Distribution", 176, 0.0, maxE);
+        pairEnergyDifference = aida.histogram1D("Pair Energy Difference Distribution", 176, 0.0, 2.2);
+        pairCoplanarity = aida.histogram1D("Pair Coplanarity Distribution", 90, 0.0, 180.0);
+        pairEnergySlope = aida.histogram1D("Pair Energy Slope Distribution", 150, 0.0, 3.0);
+        pairEnergyPositionMeanX = aida.histogram1D("Cluster Pair Weighted Energy Position (x-Index)", 100, -250, 250);
+        pairEnergyPositionMeanY = aida.histogram1D("Cluster Pair Weighted Energy Position (y-Index)", 100, -100, 100);
+        
+        // Setup the plotter factory.
+        IPlotterFactory plotterFactory = aida.analysisFactory().createPlotterFactory("Ecal Cluster Plots");
+        
+        // Apply formatting that is constant across all tabs.
+        for(int tabIndex = 0; tabIndex < plotter.length; tabIndex++) {
+        	plotter[tabIndex] = plotterFactory.create(TAB_NAMES[tabIndex]);
+        	plotter[tabIndex].setTitle(TAB_NAMES[tabIndex]);
+        	plotter[tabIndex].style().dataStyle().errorBarStyle().setVisible(false);
+        	plotter[tabIndex].style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
+            if(logScale) { plotter[tabIndex].style().yAxisStyle().setParameter("scale", "log"); }
+        }
+        
+        // Define the Cluster Counts tab.
+        plotter[TAB_CLUSTER_COUNT].createRegions(2, 2);
+        plotter[TAB_CLUSTER_COUNT].region(0).plot(clusterCountPlot);
+        plotter[TAB_CLUSTER_COUNT].region(1).plot(clusterSizePlot);
+        plotter[TAB_CLUSTER_COUNT].region(2).plot(edgePlot);
+        plotter[TAB_CLUSTER_COUNT].region(3).plot(clusterMaxEnergyPlot);
+        
+        // Define the Cluster Energy tab.
+        plotter[TAB_CLUSTER_ENERGY].createRegions(1, 2);
+        plotter[TAB_CLUSTER_ENERGY].region(0).plot(clusterEnergyPlot);
+        plotter[TAB_CLUSTER_ENERGY].region(1).plot(clusterMaxEnergyPlot);
+        
+        // Define the Cluster Time tab.
+        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);
+        plotter[TAB_CLUSTER_PAIR].region(3).plot(pairEnergyDifference);
+        plotter[TAB_CLUSTER_PAIR].region(1).plot(pairEnergySlope);
+        plotter[TAB_CLUSTER_PAIR].region(4).plot(pairCoplanarity);
+        plotter[TAB_CLUSTER_PAIR].region(2).plot(pairEnergyPositionMeanX);
+        plotter[TAB_CLUSTER_PAIR].region(5).plot(pairEnergyPositionMeanY);
+        
+        // If they should not be hidden, display the tabs.
+        if(!hide) {
+        	for(IPlotter tab : plotter) {
+        		tab.show();
+        	}
+        }
+    }
+    
+    /**
+     * Populates all histograms from event clusters, if they are present.
+     * @param event - The event from which to draw clusters.
+     */
+    @Override
+    public void process(EventHeader event) {
+    	// Check whether the event has clusters or not.
+    	if(event.hasCollection(HPSEcalCluster.class, clusterCollectionName)) {
+    		// Get the list of clusters.
+    		List<HPSEcalCluster> clusterList = event.get(HPSEcalCluster.class, clusterCollectionName);
+    		
+    		// Create lists to store the clusters from the top of the
+    		// calorimeter and the bottom.
+    		List<HPSEcalCluster> topList = new ArrayList<HPSEcalCluster>();
+    		List<HPSEcalCluster> bottomList = new ArrayList<HPSEcalCluster>();
+    		
+    		// Track the highest energy cluster in the event.
+    		double maxEnergy = 0.0;
+    		
+    		// Process each of the clusters.
+    		for(HPSEcalCluster cluster : clusterList) {
+    			// If this cluster has a higher energy then was seen
+    			// previously, it is now the highest energy cluster.
+				if (cluster.getEnergy() > maxEnergy) {
+					maxEnergy = cluster.getEnergy();
+				}
+				
+				
+				// Get the list of calorimeter hits and its size.
+				List<CalorimeterHit> hitList = cluster.getCalorimeterHits();
+				int hitCount = hitList.size();
+				
+				// Track cluster statistics.
+				double xEnergyWeight = 0.0;
+				double yEnergyWeight = 0.0;
+				double[] hitTimes = new double[hitCount];
+				double totalHitEnergy = 0.0;
+				
+				// Iterate over the hits and extract statistics from them.
+				for(int hitIndex = 0; hitIndex < hitCount; hitIndex++) {
+					hitTimes[hitIndex] = hitList.get(hitIndex).getTime();
+					totalHitEnergy += hitList.get(hitIndex).getRawEnergy();
+					xEnergyWeight += (hitList.get(hitIndex).getRawEnergy() * hitList.get(hitIndex).getIdentifierFieldValue("ix"));
+					yEnergyWeight += (hitList.get(hitIndex).getRawEnergy() * hitList.get(hitIndex).getIdentifierFieldValue("iy"));
+				}
+				
+				// If the cluster energy exceeds zero, plot the cluster
+				// statistics.
+				if(cluster.getEnergy() > 0) {
+					clusterSizePlot.fill(hitCount);
+					clusterTimes.fill(StatUtils.mean(hitTimes, 0, hitCount));
+					clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(hitTimes, 0, hitCount)));
+					edgePlot.fill(xEnergyWeight / totalHitEnergy, yEnergyWeight / totalHitEnergy);
+				}
+				
+				// Fill the single cluster plots.
+				clusterEnergyPlot.fill(cluster.getEnergy());
+				
+    			// Cluster pairs are formed from all top/bottom cluster
+    			// combinations. To create these pairs, separate the
+    			// clusters into two lists based on their y-indices.
+    			if(cluster.getSeedHit().getIdentifierFieldValue("ix") > 0) {
+    				topList.add(cluster);
+    			} else {
+    				bottomList.add(cluster);
+    			}
+    		}
+    		
+    		// Populate the event plots.
+    		clusterCountPlot.fill(clusterList.size());
+    		if(maxEnergy > 0) { clusterMaxEnergyPlot.fill(maxEnergy); }
+    		
+    		// Create a list to store cluster pairs.
+    		List<HPSEcalCluster[]> pairList = new ArrayList<HPSEcalCluster[]>(topList.size() * bottomList.size());
+    		
+    		// Form pairs from all possible combinations of clusters
+    		// from the top and bottom lists.
+    		for(HPSEcalCluster topCluster : topList) {
+    			for(HPSEcalCluster bottomCluster : bottomList) {
+    				// Make a cluster pair array.
+    				HPSEcalCluster[] pair = new HPSEcalCluster[2];
+    				
+    				// The lower energy cluster goes in the second slot.
+    				if(topCluster.getEnergy() > bottomCluster.getEnergy()) {
+    					pair[0] = topCluster;
+    					pair[1] = bottomCluster;
+    				} else {
+    					pair[0] = bottomCluster;
+    					pair[1] = topCluster;
+    				}
+    				
+    				// Add the pair to the pair list.
+    				pairList.add(pair);
+    			}
+    		}
+    		
+    		// Iterate over each pair and calculate the pair cut values.
+    		for(HPSEcalCluster[] pair : pairList) {
+    			// Get the energy slope value.
+    			double energySumValue = SSPTriggerLogic.getValueEnergySum(pair);
+    			double energyDifferenceValue = SSPTriggerLogic.getValueEnergyDifference(pair);
+    			double energySlopeValue = SSPTriggerLogic.getValueEnergySlope(pair, 0.005500);
+    			double coplanarityValue = SSPTriggerLogic.getValueCoplanarity(pair);
+    			double xMean = ((pair[0].getEnergy() * pair[0].getPosition()[0]) +
+    					(pair[1].getEnergy() * pair[1].getPosition()[0])) / energySumValue;
+    			double yMean = ((pair[0].getEnergy() * pair[0].getPosition()[1]) +
+    					(pair[1].getEnergy() * pair[1].getPosition()[1])) / energySumValue;
+    			
+    			// Populate the cluster pair plots.
+    			pairEnergySum.fill(energySumValue, 1);;
+    			pairEnergyDifference.fill(energyDifferenceValue, 1);
+    			pairEnergySlope.fill(energySlopeValue, 1);
+    			pairCoplanarity.fill(coplanarityValue, 1);
+    			pairEnergyPositionMeanX.fill(xMean);
+    			pairEnergyPositionMeanY.fill(yMean);
+    		}
+    	}
+    	
+    	// If the event does not contain clusters, update the "Event
+    	// Clusters" plot accordingly.
+    	else { clusterCountPlot.fill(0); }
+    }
+    
+    /**
+     * Sets the whether the histograms should be hidden or not.
+     * @param hide - <code>true</code> indicates that the histograms
+     * will be hidden and <code>false</code> that they will not.
+     */
+    public void setHide(boolean hide) {
+        this.hide = hide;
+    }
+    
+    /**
+     * Sets the collection name for the input LCIO cluster collection.
+     * @param clusterCollectionName - The LCIO collection name.
+     */
+    public void setInputCollection(String clusterCollectionName) {
+        this.clusterCollectionName = clusterCollectionName;
+    }
+    
+    /**
+     * Sets whether the histograms are scaled on a logarithmic scale
+     * or a linear scale.
+     * @param logScale - <code>true</code> indicates that a logarithmic
+     * scale will be used and <code>false</code> that a linear scale
+     * will be used.
+     */
+    public void setLogScale(boolean logScale) {
+        this.logScale = logScale;
+    }
+    
+    /**
+     * Sets the maximum value allowed for the energy scale.
+     * @param maxE - The maximum value in GeV.
+     */
     public void setMaxE(double maxE) {
         this.maxE = maxE;
     }
-
-    public void setLogScale(boolean logScale) {
-        this.logScale = logScale;
-    }
-
-    @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", 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);
-        //mg..12/13/2014
-        twoclusterTotEnergy=aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Two Cluster Energy Sum",100,0,maxE);
-        twoclusterEnergyDiff=aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Two Cluster Energy Diff",100,0,maxE/2);
-        twoclusterEnergyMeanYPos=aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Two Cluster Energy Weighted Y",100,-100,100);
-        twoclusterEnergyMeanXPos=aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Two Cluster Energy Weighted X",100,-250,250);
-        
-        // 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.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.setTitle("Cluster Energies");
-        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
-        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().errorBarStyle().setVisible(false);
-        plotter3.createRegions(1, 2);
-        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("colorMapScheme", "rainbow");
-        if (logScale)
-            plotter4.style().zAxisStyle().setParameter("scale", "log");
-        plotter4.createRegion();
-        plotter4.region(0).plot(edgePlot);
-
-         // Create the plotter regions.
-        plotter5 = plotterFactory.create("Two Clusters");
-        plotter5.setTitle("Two Clusters");
-        plotter5.style().dataStyle().errorBarStyle().setVisible(false);
-        plotter5.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", Boolean.FALSE.toString());
-        plotter5.createRegions(2, 2);
-        plotter5.region(0).plot(twoclusterTotEnergy);
-        plotter5.region(1).plot(twoclusterEnergyDiff);
-        plotter5.region(2).plot(twoclusterEnergyMeanXPos);
-        plotter5.region(3).plot(twoclusterEnergyMeanYPos);
-        
-        if (!hide) {
-            plotter1.show();
-            plotter2.show();
-            plotter3.show();
-            plotter4.show();
-            plotter5.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();
-            }
-        }
-        //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();
-            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 (maxEnergy > 0)
-            clusterMaxEnergyPlot.fill(maxEnergy);
-        //make some interesting 2-cluster plots
-        if(clusters.size()==2){
-            BaseCluster cl1=clusters.get(0);
-            BaseCluster cl2=clusters.get(1);
-            double[] p1=cl1.getPosition();
-            double[] p2=cl2.getPosition();
-            double e1=cl1.getEnergy();
-            double e2=cl2.getEnergy();
-            twoclusterTotEnergy.fill(e1+e2);
-            twoclusterEnergyDiff.fill(Math.abs(e1-e2));            
-            twoclusterEnergyMeanXPos.fill((e1*p1[0]+e2*p2[0])/(e1+e2));
-            twoclusterEnergyMeanYPos.fill((e1*p1[1]+e2*p2[1])/(e1+e2));
-        }
-    }
-
-    @Override
-    public void reset() {
-        clusterCountPlot.reset();
-        clusterSizePlot.reset();
-        clusterEnergyPlot.reset();
-        clusterMaxEnergyPlot.reset();
-    }
-
-    @Override
-    public void endOfData() {
-        //plotterFrame.dispose();
-    }
-
-    public void setHide(boolean hide)
-    {
-        this.hide=hide;
-    }
 }

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