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  September 2015

HPS-SVN September 2015

Subject:

r3725 - /java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java

From:

[log in to unmask]

Reply-To:

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

Date:

Mon, 28 Sep 2015 14:24:53 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (129 lines)

Author: [log in to unmask]
Date: Mon Sep 28 07:24:50 2015
New Revision: 3725

Log:
Added auto-formatter for Rafo analysis driver plots.

Added:
    java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java   (with props)

Added: java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java	(added)
+++ java/trunk/users/src/main/java/org/hps/users/kmccarty/plots/formatter/RafoTridentFormatter.java	Mon Sep 28 07:24:50 2015
@@ -0,0 +1,113 @@
+package org.hps.users.kmccarty.plots.formatter;
+
+import java.io.IOException;
+
+import org.hps.users.kmccarty.plots.FormattedPlot1D;
+import org.hps.users.kmccarty.plots.FormattedPlot2D;
+import org.hps.users.kmccarty.plots.PlotFormatModule;
+import org.hps.users.kmccarty.plots.PlotsFormatter.ColorStyle;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.ITree;
+
+public class RafoTridentFormatter {
+	/**
+	 * Loads all plots in a file and formats them according to the
+	 * indicated style.
+	 * @param args - Unused default executable parameter.
+	 * @throws IOException Occurs if there is an issue opening the file.
+	 */
+	public static void main(String[] args) throws IOException {
+		// Define the root directory for the plots.
+		String rootDir = "D:\\cygwin64\\home\\Kyle\\";
+		
+		// Define the new name of the file containing the trigger plots.
+		String plotFile = rootDir + "mte-out.aida";
+		
+		// Get the plots file and open it.
+		IAnalysisFactory af = IAnalysisFactory.create();
+		ITree tree = af.createTreeFactory().create(plotFile);
+		if(tree == null) { throw new IllegalArgumentException("Unable to load plot file."); }
+		
+		// Declare the histogram names.
+		String energySumName = "Energy Sum";
+		String timeCoincidenceName = "Time Coincidence";
+		String timeEnergy2DName = "Cluster Time vs. Cluster Energy";
+		String hCoplanaritySum2DName = "Hardware Coplanarity vs. Energy Sum";
+		String coplanaritySum2DName = "Calculated Coplanarity vs. Energy Sum";
+		String energySum2DName = "Top Cluster Energy vs. Bottom Cluster Energy";
+		String fiducial = " (Fiducial Region)";
+		
+		// Get the histograms.
+		IHistogram1D[] energySum = {
+				(IHistogram1D) tree.find("Trident/" + energySumName),
+				(IHistogram1D) tree.find("Trident/" + energySumName + fiducial)
+		};
+		IHistogram1D[] timeCoincidence = {
+				(IHistogram1D) tree.find("Trident/" + timeCoincidenceName),
+				(IHistogram1D) tree.find("Trident/" + timeCoincidenceName + fiducial)
+		};
+		IHistogram2D[] coplanaritySum = {
+				(IHistogram2D) tree.find("Trident/" + coplanaritySum2DName),
+				(IHistogram2D) tree.find("Trident/" + coplanaritySum2DName + fiducial)
+		};
+		IHistogram2D[] hcoplanaritySum = {
+				(IHistogram2D) tree.find("Trident/" + hCoplanaritySum2DName),
+				(IHistogram2D) tree.find("Trident/" + hCoplanaritySum2DName + fiducial)
+		};
+		IHistogram2D[] energySum2D = {
+				(IHistogram2D) tree.find("Trident/" + energySum2DName),
+				(IHistogram2D) tree.find("Trident/" + energySum2DName + fiducial)
+		};
+		IHistogram2D[] timeEnergy = {
+				(IHistogram2D) tree.find("Trident/" + timeEnergy2DName),
+				(IHistogram2D) tree.find("Trident/" + timeEnergy2DName + fiducial)
+		};
+		
+		// Define the scaling factors for each plot.
+		double scaleFactor = 19000.0 / 9736969.0;
+		
+		// Define the plot titles and arrays for 1D plots.
+		IHistogram1D[][] plots = { energySum, timeCoincidence  };
+		String titles[] = { energySumName, timeCoincidenceName, coplanaritySum2DName, hCoplanaritySum2DName, energySum2DName, timeEnergy2DName };
+		String[] xTitles = { "Energy (GeV)", "Time Difference (ns)" };
+		String yTitle = "Rate (Hz)";
+		
+		// Define the plot titles and arrays for 2D plots.
+		IHistogram2D[][] plots2D = { coplanaritySum, hcoplanaritySum, energySum2D, timeEnergy };
+		String[] titles2D = { coplanaritySum2DName, hCoplanaritySum2DName, energySum2DName, timeEnergy2DName };
+		String[] xTitles2D = { "Coplanarity (Degrees)", "Coplanarity (Degrees)", "Top Cluster Energy (GeV)", "Time Coincidence (ns)" };
+		String[] yTitles2D = { "Energy Sum (GeV)", "Energy Sum (GeV)", "Bottom Cluster Energy (GeV)", "Energy Sum (GeV)" };
+		String zTitle2D = "Rate (Hz)";
+		
+		// Create a plot formatting module.
+		PlotFormatModule module = new PlotFormatModule();
+		
+		// Define the plot color.
+		ColorStyle plotColor = ColorStyle.MS_BLUE;
+		
+		// Define the plots to be read.
+		for(int i = 0; i < plots.length; i++) {
+			plots[i][0].scale(scaleFactor);
+			plots[i][1].scale(scaleFactor);
+			module.addPlot1D(new FormattedPlot1D(plots[i][0], plotColor, xTitles[i], yTitle, titles[i]));
+			module.addPlot1D(new FormattedPlot1D(plots[i][1], plotColor, xTitles[i],  yTitle, titles[i] + fiducial));
+		}
+		for(int i = 0; i < plots2D.length; i++) {
+			plots2D[i][0].scale(scaleFactor);
+			plots2D[i][1].scale(scaleFactor);
+			module.addPlot2D(new FormattedPlot2D(plots2D[i][0], false, xTitles2D[i], yTitles2D[i], titles2D[i]));
+			module.addPlot2D(new FormattedPlot2D(plots2D[i][1], false, xTitles2D[i], yTitles2D[i], titles2D[i] + fiducial));
+		}
+		
+		// Display the plots.
+		//module.displayPlots();
+		module.savePlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\run-5772\\RafoPlots\\");
+		module.exportPlots("C:\\Users\\Kyle\\Desktop\\EnergyShift\\run-5772\\RafoPlots\\");
+		
+		// Close the tree.
+		tree.close();
+	}
+}

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