[HepData-svn] r1361 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 22 15:50:53 BST 2010


Author: buckley
Date: Tue Jun 22 15:50:58 2010
New Revision: 1361

Log:
Making the ROOT formatters work (better)

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java	Tue Jun 22 15:40:01 2010	(r1360)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java	Tue Jun 22 15:50:58 2010	(r1361)
@@ -96,6 +96,7 @@
                         s.append(yv + "])\n");
                         s.append(yem + "])\n");
                         s.append(yep + "])\n");
+                        s.append("numpoints = " + d.getNumPoints() + "\n");
 
                         // Make name and path
                         StringTemplate name = new StringTemplate("d$did$x$xid$y$yid$");
@@ -111,10 +112,10 @@
 
                         // Append code to make the graph object
                         String varname = fullname.toString();
-                        s.append("numpoints = " + d.getNumPoints() + "\n");
                         s.append(varname + " = ROOT.TGraphAsymmErrors(numpoints, xval, yval, xerrminus, xerrplus, yerrminus, yerrplus)\n");
                         s.append(varname + ".SetName(\"" + path.toString() + "\")\n");
                         s.append(varname + ".SetTitle(\"" + path.toString() + "\")\n");
+                        s.append(varname + ".Draw(\"AP\")\n");
                         s.append("\n");
 
                     }

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java	Tue Jun 22 15:40:01 2010	(r1360)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java	Tue Jun 22 15:50:58 2010	(r1361)
@@ -45,7 +45,9 @@
 
 
     public static String _header() {
-        return "{\n\n";
+        String s = "#include \"TGraphAsymmErrors.h\"\n\n";
+        s += "{\n\n";
+        return s;
     }
 
 
@@ -63,12 +65,12 @@
                     for (YAxis y : d.getYAxes()) {
 
                         // Build Python point array strings
-                        StringBuffer xv = new StringBuffer("xval = {");
-                        StringBuffer xem = new StringBuffer("xerrminus = [");
-                        StringBuffer xep = new StringBuffer("xerrplus = [");
-                        StringBuffer yv = new StringBuffer("yval = [");
-                        StringBuffer yem = new StringBuffer("yerrminus = [");
-                        StringBuffer yep = new StringBuffer("yerrplus = [");
+                        StringBuffer xv = new StringBuffer("double xval[] = {");
+                        StringBuffer xem = new StringBuffer("double xerrminus[] = {");
+                        StringBuffer xep = new StringBuffer("double xerrplus[] = {");
+                        StringBuffer yv = new StringBuffer("double yval[] = {");
+                        StringBuffer yem = new StringBuffer("double yerrminus[] = {");
+                        StringBuffer yep = new StringBuffer("double yerrplus[] = {");
                         String sep = "";
                         for (int r = 1; r <= d.getMaxPointId(); ++r) {
                             Bin b = x.getBin(r);
@@ -92,12 +94,13 @@
                         }
 
                         // Append point array strings to output
-                        s.append(xv + "]\n");
-                        s.append(xem + "]\n");
-                        s.append(xep + "]\n");
-                        s.append(yv + "]\n");
-                        s.append(yem + "]\n");
-                        s.append(yep + "]\n");
+                        s.append(xv + "}\n");
+                        s.append(xem + "}\n");
+                        s.append(xep + "}\n");
+                        s.append(yv + "}\n");
+                        s.append(yem + "}\n");
+                        s.append(yep + "}\n");
+                        s.append("int numpoints = " + d.getNumPoints() + "\n");
 
                         // Make name and path
                         StringTemplate name = new StringTemplate("d$did$x$xid$y$yid$");
@@ -113,10 +116,10 @@
 
                         // Append code to make the graph object
                         String varname = fullname.toString();
-                        s.append("numpoints = " + d.getNumPoints() + "\n");
                         s.append(varname + " = TGraphAsymmErrors(numpoints, xval, yval, xerrminus, xerrplus, yerrminus, yerrplus)\n");
                         s.append(varname + ".SetName(\"" + path.toString() + "\")\n");
                         s.append(varname + ".SetTitle(\"" + path.toString() + "\")\n");
+                        s.append(varname + ".Draw(\"AP\")\n");
                         s.append("\n");
 
                     }


More information about the HepData-svn mailing list