[yoda-svn] yoda: 2 new changesets

YODA Mercurial yoda at projects.hepforge.org
Thu Aug 24 22:00:01 BST 2017


details:   https://yoda.hepforge.org/hg/yoda/rev/1b9d9bebd321
branches:  release-1-6
changeset: 1369:1b9d9bebd321
user:      Andy Buckley <andy at insectnation.org>
date:      Thu Aug 24 21:42:52 2017 +0100
description:
Use a slightly enhanced fast numeric parser in ReaderYODA (taken from LHAPDF, originally inspired by Gavin Salam).

details:   https://yoda.hepforge.org/hg/yoda/rev/7fd2d5eb17bc
branches:  release-1-6
changeset: 1370:7fd2d5eb17bc
user:      Andy Buckley <andy at insectnation.org>
date:      Thu Aug 24 21:45:12 2017 +0100
description:
Remove printouts

diffs (truncated from 212 to 50 lines):

--- a/ChangeLog	Thu Aug 24 11:35:23 2017 +0100
+++ b/ChangeLog	Thu Aug 24 21:45:12 2017 +0100
@@ -1,5 +1,8 @@
 2017-08-24  Andy Buckley  <andy.buckley at cern.ch>
 
+	* Use a slightly enhanced fast numeric parser in ReaderYODA (taken
+	from LHAPDF, originally inspired by Gavin Salam).
+
 	* Add an UNSCALE spec option to yodascale, to undo ScaledBy effects.
 
 2017-08-16  Andy Buckley  <andy.buckley at cern.ch>
--- a/bin/yodascale	Thu Aug 24 11:35:23 2017 +0100
+++ b/bin/yodascale	Thu Aug 24 21:45:12 2017 +0100
@@ -23,6 +23,7 @@
 definition of the scaling to be done on that histogram (or histograms). The path
 pattern consists of a regular expression, optionally followed by a range
 specifier. The best explanation is probably a few examples:
+
   /path/to/hist      (match all bins in that particular histogram)
   /.*pt              (match all bins in histograms ending in 'pt')
   /myhist at 5          (match bins with high edge >= 5 in /myhist)
--- a/src/ReaderYODA.cc	Thu Aug 24 11:35:23 2017 +0100
+++ b/src/ReaderYODA.cc	Thu Aug 24 21:45:12 2017 +0100
@@ -18,11 +18,67 @@
 #include "YODA/Scatter3D.h"
 
 #include <iostream>
+#include <cstring>
 using namespace std;
 
 namespace YODA {
 
 
+  namespace {
+
+    // A wrapper for std::strtod and std::strtol, for fast tokenizing when all
+    // input is guaranteed to be numeric (as in this data block). Based very
+    // closely on FastIStringStream by Gavin Salam.
+    class NumParser {
+    public:
+      // Constructor from char*
+      NumParser(const char* line=0) { reset(line); }
+      // Constructor from std::string
+      NumParser(const string& line) { reset(line); }
+
+      // Re-init to new line as char*
+      void reset(const char* line=0) {
+        _next = const_cast<char*>(line);
+        _new_next = _next;
+        _error = false;


More information about the yoda-svn mailing list