|
[HepData-svn] r1770 - trunk/hepdata-model/src/main/java/cedar/hepdata/modelblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Mar 26 14:58:12 GMT 2014
Author: whalley Date: Wed Mar 26 14:58:12 2014 New Revision: 1770 Log: modifiyibg to handle total errors Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/ErrorSource.java trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/ErrorSource.java ============================================================================== --- trunk/hepdata-model/src/main/java/cedar/hepdata/model/ErrorSource.java Tue Mar 25 12:48:02 2014 (r1769) +++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/ErrorSource.java Wed Mar 26 14:58:12 2014 (r1770) @@ -4,7 +4,7 @@ STAT ("statistical", "stat"), SYS ("systematic", "sys"), - TOTAL ("total", "tot"), + TOTAL ("total", "total"), UNKNOWN ("unknown", "?"); private final String name; Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java ============================================================================== --- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java Tue Mar 25 12:48:02 2014 (r1769) +++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Point.java Wed Mar 26 14:58:12 2014 (r1770) @@ -326,30 +326,36 @@ /** Plus error combined in quadrature (uncorrelated). */ public Double getQuadCombinedPlusError() { double errorPlusSq = 0.0; + double totalPlusSq = 0.0; for (Uncertainty err : getAllErrors()) { try { Uncertainty abserr = err.getAbsoluteError(this); - errorPlusSq += abserr.getPlus() * abserr.getPlus(); + if(err.getSourceType() == ErrorSource.TOTAL){ totalPlusSq += abserr.getPlus() * abserr.getPlus(); } + else { errorPlusSq += abserr.getPlus() * abserr.getPlus(); } } catch (HDException ex) { // } } - return Math.sqrt(errorPlusSq); + if(totalPlusSq > 0.0) { return Math.sqrt(totalPlusSq); } + else { return Math.sqrt(errorPlusSq); } } /** Minus error combined in quadrature (uncorrelated). */ public Double getQuadCombinedMinusError() { double errorMinusSq = 0.0; + double totalMinusSq = 0.0; for (Uncertainty err : getAllErrors()) { try { Uncertainty abserr = err.getAbsoluteError(this); - errorMinusSq += abserr.getMinus() * abserr.getMinus(); + if(err.getSourceType() == ErrorSource.TOTAL){ totalMinusSq += abserr.getMinus() * abserr.getMinus(); } + else { errorMinusSq += abserr.getMinus() * abserr.getMinus(); } } catch (HDException ex) { // } } - return Math.sqrt(errorMinusSq); + if(totalMinusSq > 0.0) { return Math.sqrt(totalMinusSq); } + else { return Math.sqrt(errorMinusSq); } }
More information about the HepData-svn mailing list |