[Rivet-svn] r3787 - in trunk/src: Core Tools

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Jul 2 12:17:38 BST 2012


Author: hoeth
Date: Mon Jul  2 12:17:38 2012
New Revision: 3787

Log:
fix histogram autobooking

Modified:
   trunk/src/Core/Analysis.cc
   trunk/src/Tools/RivetYODA.cc

Modified: trunk/src/Core/Analysis.cc
==============================================================================
--- trunk/src/Core/Analysis.cc	Mon Jul  2 10:40:26 2012	(r3786)
+++ trunk/src/Core/Analysis.cc	Mon Jul  2 12:17:38 2012	(r3787)
@@ -173,6 +173,9 @@
   const Scatter2D & Analysis::referenceData(const string& hname) const {
     _cacheRefData();
     MSG_TRACE("Using histo bin edges for " << name() << ":" << hname);
+    if (!_refdata[hname]) {
+      MSG_ERROR("Can't find reference histogram " << hname);
+    }
     return *_refdata[hname];
   }
 

Modified: trunk/src/Tools/RivetYODA.cc
==============================================================================
--- trunk/src/Tools/RivetYODA.cc	Mon Jul  2 10:40:26 2012	(r3786)
+++ trunk/src/Tools/RivetYODA.cc	Mon Jul  2 12:17:38 2012	(r3787)
@@ -1,6 +1,7 @@
 #include "Rivet/RivetYODA.hh"
 #include "Rivet/Rivet.hh"
 #include "Rivet/Tools/RivetPaths.hh"
+#include "boost/algorithm/string/split.hpp"
 
 using namespace std;
 
@@ -23,8 +24,6 @@
     YODA::Reader & reader =  ReaderAIDA::create();
     vector<YODA::AnalysisObject *> aovec;
     reader.read(xmlfile, aovec);
-    /// @todo Remove debug cerr
-    cerr << "HERE2 " << aovec.size() << '\n';
 
     // Return value, to be populated
     RefDataMap rtn;
@@ -32,8 +31,12 @@
       Scatter2DPtr refdata( dynamic_cast<Scatter2D *>(ao) );
       if (!refdata) continue;
       string plotpath = refdata->path();
-      /// @todo Remove debug cerr
-      cerr << plotpath << '\n';
+
+      // split path at "/" and only return the last field, i.e. the histogram ID
+      std::vector<string> pathvec;
+      split( pathvec, plotpath, is_any_of("/"), token_compress_on );
+      plotpath = pathvec.back();
+
       rtn[plotpath] = refdata;
     }
     return rtn;


More information about the Rivet-svn mailing list