[HepData-svn] r1805 - trunk/hepdata-model/src/main/java/cedar/hepdata/model

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Jul 24 09:28:04 BST 2014


Author: watt
Date: Thu Jul 24 09:28:04 2014
New Revision: 1805

Log:
Allow all signs for errors and support experiment names starting with FNAL-T

Modified:
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java
   trunk/hepdata-model/src/main/java/cedar/hepdata/model/Uncertainty.java

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Fri Jul 11 18:58:45 2014	(r1804)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Thu Jul 24 09:28:04 2014	(r1805)
@@ -168,7 +168,7 @@
         }
         // Hack the FNAL entries to make Spires links work
         /// @todo Fix this in the database
-        if (ename.startsWith("FNAL-")) {
+        if (ename.startsWith("FNAL-") && !ename.startsWith("FNAL-T")) {
             if (ename.indexOf("FNAL-0") < 0) {
                 ename = ename.replaceFirst("-","-E-0");
             }

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java	Fri Jul 11 18:58:45 2014	(r1804)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java	Thu Jul 24 09:28:04 2014	(r1805)
@@ -330,13 +330,15 @@
         for (Uncertainty err : getAllErrors()) {
             try {
                 Uncertainty abserr = err.getAbsoluteError(this);
-                if (err.getSourceType() == ErrorSource.TOTAL) {
-		    if (abserr.getPlus() < 0.0) { totalPlusSq += abserr.getMinus() * abserr.getMinus(); }
-		    else { totalPlusSq += abserr.getPlus() * abserr.getPlus(); }
-		} else {
-		    if (abserr.getPlus() < 0.0) { errorPlusSq += abserr.getMinus() * abserr.getMinus(); }
-		    else { errorPlusSq += abserr.getPlus() * abserr.getPlus(); }
-		}
+
+		// G.W. 23/07/2014: plus = max(abserr.getPlus(),abserr.getMinus(),0.0);
+		double plus = 0.0;
+		if (abserr.getPlus() > plus) { plus = abserr.getPlus(); }
+		if (abserr.getMinus() > plus) { plus = abserr.getMinus(); }
+
+                if (err.getSourceType() == ErrorSource.TOTAL) { totalPlusSq += plus*plus; }
+		else { errorPlusSq += plus*plus; }
+
             } catch (HDException ex) {
                 //
             }
@@ -353,13 +355,15 @@
         for (Uncertainty err : getAllErrors()) {
             try {
                 Uncertainty abserr = err.getAbsoluteError(this);
-                if (err.getSourceType() == ErrorSource.TOTAL) {
-		    if (abserr.getPlus() < 0.0) { totalMinusSq += abserr.getPlus() * abserr.getPlus(); }
-		    else { totalMinusSq += abserr.getMinus() * abserr.getMinus(); }
-		} else {
-		    if (abserr.getPlus() < 0.0) { errorMinusSq += abserr.getPlus() * abserr.getPlus(); }
-		    else { errorMinusSq += abserr.getMinus() * abserr.getMinus(); }
-		}
+
+		// G.W. 23/07/2014: minus = min(abserr.getMinus(),abserr.getPlus(),0.0);
+		double minus = 0.0;
+		if (abserr.getMinus() < minus) { minus = abserr.getMinus(); }
+		if (abserr.getPlus() < minus) { minus = abserr.getPlus(); }
+
+                if (err.getSourceType() == ErrorSource.TOTAL) { totalMinusSq += minus*minus; }
+		else { errorMinusSq += minus*minus; }		
+
             } catch (HDException ex) {
                 //
             }

Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Uncertainty.java
==============================================================================
--- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Uncertainty.java	Fri Jul 11 18:58:45 2014	(r1804)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Uncertainty.java	Thu Jul 24 09:28:04 2014	(r1805)
@@ -87,14 +87,14 @@
 
     /** Are the plus and minus errors symmetric? */
     public boolean isSymmetric() {
-        return (getPlus().equals(getMinus()));
+        return (getPlus()>0.0 && getPlus().equals(-getMinus()));
     }
     /** Are the plus and minus errors symmetric? */
     public boolean isSymmetricReversed() {
         Double plus = getPlus();
         Double minus = getMinus();
         plus = -plus;
-        return (plus.equals(minus));
+        return (getPlus()<0.0 && plus.equals(minus));
     }
 
 


More information about the HepData-svn mailing list