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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 16 15:22:37 BST 2015


Author: whalley
Date: Tue Jun 16 15:22:37 2015
New Revision: 1869

Log:
more fixes

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

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Tue Jun 16 11:24:58 2015	(r1868)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Tue Jun 16 15:22:37 2015	(r1869)
@@ -150,7 +150,7 @@
 		    if (mcount==1) { s.append(sp+"{ action: 'Encoded'"); }
 		    else { s.append(sp+"{ action: 'Modified'"); }
 		}
-		s.append(", date: '"+m.getComment()+"', person: '"+m.getModifier()+"' }\n");
+		s.append(", date: '"+m.getComment()+"', who: '"+m.getModifier()+"' }\n");
             }
         }
 
@@ -234,6 +234,57 @@
                 else {s.append(", ");}  
             }
         }
+    
+       
+        Double ecmlow=99999.0;
+        Double ecmhigh=-99999.0; 
+        boolean haveecm=false;
+        for (YAxis yax : ds.getYAxes()){
+            for (Property prop : yax.getProperties()){
+                if(prop.getName().startsWith("SQRT(S)")){
+                    if(prop.getFocus() != null) {
+                        if(prop.getFocus()>ecmhigh) ecmhigh=prop.getFocus();
+                        if(prop.getFocus()<ecmlow)  ecmlow=prop.getFocus();
+                        haveecm=true;
+                    }
+                    if(prop.getLowValue() != null) {
+                        if(prop.getLowValue()<ecmlow)  ecmlow=prop.getLowValue();
+                        haveecm=true;
+                    }
+                    if(prop.getHighValue() != null) {
+                        if(prop.getHighValue()>ecmhigh)  ecmhigh=prop.getHighValue();
+                        haveecm=true;
+                    }
+                 }
+            }
+        }
+        if(!haveecm){
+            for (XAxis xax : ds.getXAxes()){
+                if(xax.getHeader().startsWith("SQRT(S)")){
+                    for (Bin bin : xax.getBins()){
+                        if(bin.getFocus() != null) {
+                            if(bin.getFocus()>ecmhigh) ecmhigh=bin.getFocus();
+                            if(bin.getFocus()<ecmlow)  ecmlow=bin.getFocus();
+                            haveecm=true;
+                        }
+                        if(bin.getLowValue() != null) {
+                            if(bin.getLowValue()<ecmlow)  ecmlow=bin.getLowValue();
+                            haveecm=true;
+                        }
+                        if(bin.getHighValue() != null) {
+                            if(bin.getHighValue()>ecmhigh)  ecmhigh=bin.getHighValue();
+                            haveecm=true;
+                        }
+                    } 
+                }
+            }
+        
+        }
+        if(haveecm){
+            s.append(sp+"{ name: cmenergies, values: [" + ecmlow);
+            if(!ecmlow.equals(ecmhigh)) s.append("-"+ecmhigh);
+            s.append("] }\n");
+        } 
 
         return s.toString();
     }
@@ -256,7 +307,7 @@
                 unit=xax.getHeader().substring(xax.getHeader().indexOf(" IN ")+4).trim();
             }
             s.append(sp+"header: {name: '"+name+"'");
-            if(!unit.equals("")){ s.append(", unit: '"+unit+"'"); }
+            if(!unit.equals("")){ s.append(", units: '"+unit+"'"); }
             s.append("}\n");
             s.append(s4+"bins:\n");
             for (Bin bin : xax.getBins()){
@@ -338,7 +389,7 @@
                 unit=yax.getHeader().substring(yax.getHeader().indexOf(" IN ")+4).trim();
             }
             s.append(sp+"header: {name: '"+name+"'");
-            if(!unit.equals("")){ s.append(", unit: '"+unit+"'"); }
+            if(!unit.equals("")){ s.append(", units: '"+unit+"'"); }
             s.append("}\n");
             boolean first=true;
             for (Property prop : yax.getProperties()){
@@ -369,7 +420,7 @@
                 }
                     
                 if (prop.getUnit().toString().equals("") || !prop.getUnit().isDimensionless()) {
-                   s.append(", unit: '");
+                   s.append(", units: '");
                    s.append(prop.getUnit().toString()+"'");
                 }
                   
@@ -388,7 +439,7 @@
                 s.append(s4+sp+"{type: "+type);
                 s.append(", value: '"+ value+"'");
                 if(!unit.equals("")){
-                    s.append(", unit: '"+ unit+"'");
+                    s.append(", units: '"+ unit+"'");
                 }
                 s.append("}\n");
             }


More information about the HepData-svn mailing list