[yoda-svn] yoda: 6 new changesets

YODA Mercurial yoda at projects.hepforge.org
Mon Apr 30 22:45:02 BST 2018


details:   https://yoda.hepforge.org/hg/yoda/rev/46c56c98bdd8
branches:  release-1-7
changeset: 1450:46c56c98bdd8
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Apr 30 17:29:36 2018 +0100
description:
Convert Python read/methods with filename arguments to use the gzip-aware IO functions.

details:   https://yoda.hepforge.org/hg/yoda/rev/64955a3e7257
branches:  release-1-7
changeset: 1451:64955a3e7257
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Apr 30 18:02:00 2018 +0100
description:
Convert format-specific Python read/write to use gzip-aware lib functions

details:   https://yoda.hepforge.org/hg/yoda/rev/62aae29a55d2
branches:  release-1-7
changeset: 1452:62aae29a55d2
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Apr 30 21:50:03 2018 +0100
description:
Convert remaining Python read/write methods to use the C++ IO functions.

details:   https://yoda.hepforge.org/hg/yoda/rev/404f479bd854
branches:  release-1-7
changeset: 1453:404f479bd854
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Apr 30 21:50:40 2018 +0100
description:
Add '-' = stdin/stdout recognition to C++ IO functions.

details:   https://yoda.hepforge.org/hg/yoda/rev/68f976137046
branches:  release-1-7
changeset: 1454:68f976137046
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Apr 30 22:07:07 2018 +0100
description:
Tidy

details:   https://yoda.hepforge.org/hg/yoda/rev/37e84091e8b3
branches:  release-1-7
changeset: 1455:37e84091e8b3
user:      Andy Buckley <andy at insectnation.org>
date:      Mon Apr 30 22:36:08 2018 +0100
description:
Detect a gz filename in the remaining write method!!

diffs (truncated from 485 to 50 lines):

--- a/ChangeLog	Fri Apr 27 17:02:57 2018 +0100
+++ b/ChangeLog	Mon Apr 30 22:36:08 2018 +0100
@@ -1,3 +1,11 @@
+2018-04-30  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Add "-" = stdin/stdout recognition to C++ IO functions.
+
+	* Convert remaining Python read/write methods to use the C++ IO functions.
+
+	* Convert Python read/write methods with filename arguments to use the gzip-aware IO functions.
+
 2018-04-27  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Fix missing lock=false flag initialisation in Histo2D constructor from a Bins vector.
--- a/bin/yoda2yoda	Fri Apr 27 17:02:57 2018 +0100
+++ b/bin/yoda2yoda	Mon Apr 30 22:36:08 2018 +0100
@@ -17,12 +17,14 @@
                   help="exclude histograms whose path matches this regex")
 parser.add_option("--as-scatters", dest="AS_SCATTERS", action="store_true", default=False,
                   help="convert all input analysis objects to Scatter types")
+# -z/--gzip option?
 
 opts, args = parser.parse_args()
-in_out = parse_x2y_args(args, ".yoda", ".yoda")
+in_out = parse_x2y_args(args, [".yoda", ".yoda.gz"], [".yoda", ".yoda.gz"])
 if not in_out:
     sys.stderr.write("You must specify the YODA input and output file names\n")
     sys.exit(1)
+# print in_out
 
 for i, o in in_out:
     analysisobjects = yoda.readYODA(i)
--- a/include/YODA/Reader.h	Fri Apr 27 17:02:57 2018 +0100
+++ b/include/YODA/Reader.h	Mon Apr 30 22:36:08 2018 +0100
@@ -87,10 +87,22 @@
     /// and is hence CPU efficient.
     ///
     void read(const std::string& filename, std::vector<AnalysisObject*>& aos) {
-      std::ifstream instream;
-      instream.open(filename.c_str());
-      read(instream, aos);
-      instream.close();
+      if (filename != "-") {
+        try {
+          std::ifstream instream;
+          instream.open(filename.c_str());
+          read(instream, aos);
+          instream.close();
+        } catch (std::ifstream::failure& e) {
+          throw WriteError("Writing to filename " + filename + " failed: " + e.what());


More information about the yoda-svn mailing list