Print

Print


Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
PrintCloud.java+35added 1.1
Simple utility to print out contents of an ICloud1D

lcsim/src/org/lcsim/contrib/uiowa
PrintCloud.java added at 1.1
diff -N PrintCloud.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PrintCloud.java	4 Apr 2007 18:15:22 -0000	1.1
@@ -0,0 +1,35 @@
+package org.lcsim.contrib.uiowa;
+
+import java.io.IOException; 
+import hep.aida.ITree;
+import hep.aida.IAnalysisFactory; 
+import hep.aida.IHistogramFactory; 
+import hep.aida.IHistogram1D; 
+import hep.aida.ICloud1D;
+import hep.aida.ICloud2D;
+
+/**
+ * A simple program to print out the contents of an ICloud1D, one line per entry.
+ */
+
+public class PrintCloud
+{
+    public static void main(String[] argv) throws java.io.IOException
+   {
+       if (argv.length != 2) {
+	   System.out.println("Call like this: PrintCloud [filename] [cloudname]");
+       } else {
+	   String filename = argv[0];
+	   String plotName = argv[1];
+
+	   IAnalysisFactory af = IAnalysisFactory.create();
+	   ITree tree = af.createTreeFactory().create(argv[0], "xml", true, false);
+	   ICloud1D inputCloud = (ICloud1D) (tree.find(plotName));
+	   
+	   for (int i=0; i<inputCloud.entries(); i++) {
+	       double currentValue = inputCloud.value(i);
+	       System.out.println(currentValue);
+	   }
+       }
+   }
+}
CVSspam 0.2.8