[yoda-svn] r571 - in trunk: src tests

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Mar 7 10:51:00 GMT 2013


Author: hoeth
Date: Thu Mar  7 10:51:00 2013
New Revision: 571

Log:
Bugfix in WriterAIDA for histograms with flat namespace (e.g. "/myhisto")

Added:
   trunk/tests/test.yoda
      - copied, changed from r570, trunk/tests/test.dat
Deleted:
   trunk/tests/test.dat
Modified:
   trunk/src/WriterAIDA.cc
   trunk/tests/TestHisto1Db.cc

Modified: trunk/src/WriterAIDA.cc
==============================================================================
--- trunk/src/WriterAIDA.cc	Tue Mar  5 16:46:55 2013	(r570)
+++ trunk/src/WriterAIDA.cc	Thu Mar  7 10:51:00 2013	(r571)
@@ -64,7 +64,7 @@
     const size_t slashpos = s.path().rfind("/");
     if (slashpos != string::npos) {
       name = s.path().substr(slashpos+1, s.path().length() - slashpos - 1);
-      path = s.path().substr(0, slashpos);
+      if (slashpos > 0) path = s.path().substr(0, slashpos);
     }
     os << "  <dataPointSet name=\"" << Utils::encodeForXML(name) << "\"\n"
        << "    title=\"" << Utils::encodeForXML(s.title()) << "\""

Modified: trunk/tests/TestHisto1Db.cc
==============================================================================
--- trunk/tests/TestHisto1Db.cc	Tue Mar  5 16:46:55 2013	(r570)
+++ trunk/tests/TestHisto1Db.cc	Thu Mar  7 10:51:00 2013	(r571)
@@ -15,7 +15,7 @@
 int main() {
 
   Histo1D h1(20, 0.0, 1.0);
-  h1.setPath("/MyHisto1");
+  h1.setPath("/path/to/MyHisto1");
   Histo1D h2(40, 0.0, 1.0, "/MyHisto2");
   for (size_t n = 0; n < 2000; ++n) {
     const double num = rand()/static_cast<double>(RAND_MAX);
@@ -53,7 +53,7 @@
     }
   }
 
-  vector<AnalysisObject*> hs3 = ReaderYODA::create().read("test.dat");
+  vector<AnalysisObject*> hs3 = ReaderYODA::create().read("test.yoda");
   for (vector<AnalysisObject*>::const_iterator i = hs3.begin(); i != hs3.end(); ++i) {
     cout << (*i)->type() << endl;
     YODA::WriterYODA::write(std::cout, (**i));

Copied and modified: trunk/tests/test.yoda (from r570, trunk/tests/test.dat)
==============================================================================
--- trunk/tests/test.dat	Tue Mar  5 16:46:55 2013	(r570, copy source)
+++ trunk/tests/test.yoda	Thu Mar  7 10:51:00 2013	(r571)
@@ -1,4 +1,4 @@
-# BEGIN YODA_HISTO1D 
+# BEGIN YODA_HISTO1D /Myhisto1
 LineColor=red is a good color
 Title=Ein Titel
 Total          Total           5    3    4    5    5
@@ -8,7 +8,7 @@
 2              3               5    1    4    7    22
 # END YODA_HISTO1D
 
-# BEGIN YODA_HISTO1D 
+# BEGIN YODA_HISTO1D /some/other/histo
 Total           Total           3    3    4    5    55
 Underflow       Underflow       6    3    2    7    44
 Overflow        Overflow        8    3    2    9    33
@@ -16,7 +16,7 @@
 4.5             5.3             5    1    4    7    22
 # END YODA_HISTO1D
 
-# BEGIN YODA_PROFILE1D
+# BEGIN YODA_PROFILE1D /path/to/histo
 Title=A profile histogram
 Path=/path/to/histo
 Underflow   Underflow  1 2 3 4 5 6 11 


More information about the yoda-svn mailing list