From 691e33a535f10229812c926e1b0ee917ffbf953c Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Thu, 13 Jul 2017 14:24:53 +0200
Subject: [PATCH] ROOT Persistency mechanism for detector descriptions works
 now....

---
 examples/Persistency/CMakeLists.txt              | 4 ++--
 examples/Persistency/src/PersistencySetup.cpp    | 5 +++--
 examples/Persistency/src/TestWriteConditions.cpp | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/examples/Persistency/CMakeLists.txt b/examples/Persistency/CMakeLists.txt
index d56251dbb..8ed335005 100644
--- a/examples/Persistency/CMakeLists.txt
+++ b/examples/Persistency/CMakeLists.txt
@@ -28,7 +28,7 @@ dd4hep_add_test_reg( Persist_Conditions_Save
   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
   EXEC_ARGS  geoPluginRun
   -plugin DD4hep_PersistencyExample_write_cond -output Conditions.root
-  REGEX_PASS "\\+\\+\\+ Wrote 1360 bytes to file Conditions.root"
+  REGEX_PASS "\\+\\+\\+ PASSED Wrote 14 conditions to file."
   REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED"
   )
 #
@@ -37,7 +37,7 @@ dd4hep_add_test_reg( Persist_Conditions_Restore
   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
   EXEC_ARGS  geoPluginRun
   -plugin DD4hep_PersistencyExample_read_cond -input Conditions.root
-  REGEX_PASS "\\+\\+\\+ Read successfully 14 conditions. Result=1637"
+  REGEX_PASS "\\+\\+\\+ Read successfully 14 conditions. Result=172"
   REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED"
   )
 #
diff --git a/examples/Persistency/src/PersistencySetup.cpp b/examples/Persistency/src/PersistencySetup.cpp
index aea2ad59b..95f170b08 100644
--- a/examples/Persistency/src/PersistencySetup.cpp
+++ b/examples/Persistency/src/PersistencySetup.cpp
@@ -37,7 +37,7 @@ int dd4hep::PersistencyExamples::printCondition(Condition cond)   {
   else if ( gr->type() == typeid(string) )
     result += cond.get<string>().length();
   else if ( gr->type() == typeid(Delta) )
-    result += sizeof(cond.get<Delta>());
+  { ++result; cond.get<Delta>(); }
   else if ( gr->type() == typeid(AlignmentData) )   {
     if ( dynamic_cast<detail::AlignmentObject*>(cond.ptr()) )  {
       AlignmentCondition ac = cond;
@@ -47,7 +47,8 @@ int dd4hep::PersistencyExamples::printCondition(Condition cond)   {
                ok ? "SUCCESS" : "ERROR", cond.name(),cond.data().ptr(),&ac->values(),
                ok ? "[Good-payload-mapping]" : "[Bad-payload-mapping]");
     }
-    result += sizeof(cond.get<AlignmentData>());    
+    ++result;
+    cond.get<AlignmentData>();
   }
   else if ( gr->type() == typeid(vector<int>) )
     result += int(cond.get<vector<int> >().size());
diff --git a/examples/Persistency/src/TestWriteConditions.cpp b/examples/Persistency/src/TestWriteConditions.cpp
index dbf5580e9..8ee682f1f 100644
--- a/examples/Persistency/src/TestWriteConditions.cpp
+++ b/examples/Persistency/src/TestWriteConditions.cpp
@@ -108,7 +108,8 @@ static int persistency_example (Detector& /* description */, int argc, char** ar
   printout(INFO,"Example","+++ Writing generic conditions vector to %s",output.c_str());
   int nbytes = io.write(output,"Conditions",conditions);
   printout(INFO,"Example","+++ Wrote %d bytes to file %s",nbytes,output.c_str());
-  
+  printout(INFO,"Example","+++ %s %ld conditions to file.",
+           nbytes > 0 ? "PASSED Wrote" : "FAILED +++ Could not write",conditions.size());
   // All done.
   return 1;
 }
-- 
GitLab