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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 22 18:29:32 BST 2010


Author: buckley
Date: Tue Jun 22 18:29:34 2010
New Revision: 1363

Log:
More ROOT formatter improvements

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

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 16:23:25 2010	(r1362)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java	Tue Jun 22 18:29:34 2010	(r1363)
@@ -47,12 +47,13 @@
     public static String _header() {
         String s = "#include \"TGraphAsymmErrors.h\"\n\n";
         s += "{\n\n";
+        s += "  gROOT->SetStyle(\"Plain\");\n\n");
         return s;
     }
 
 
     public static String _footer() {
-        return "\n}\n";
+        return "}\n";
     }
 
 
@@ -65,12 +66,12 @@
                     for (YAxis y : d.getYAxes()) {
 
                         // Build Python point array strings
-                        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[] = {");
+                        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);
@@ -94,13 +95,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("int numpoints = " + d.getNumPoints() + "\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$");
@@ -116,18 +117,17 @@
 
                         // Append code to make the graph object
                         String varname = fullname.toString();
-                        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("  " + 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");
-
                     }
                 }
                 out = s.toString();
             }
         } catch (NullPointerException npe) {
-            out = "// Can't render this dataset, due to missing/incompatible information: please report this problem!\n";
+            out = "// Can't render this dataset, due to missing/incompatible information: please report this problem!\n\n";
         }
         return out;
     }


More information about the HepData-svn mailing list