From 7e8d779fe1d43d85af2835e9c4c9873c90788bda Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Thu, 19 Mar 2015 13:04:13 +0000
Subject: [PATCH] Readout: Add proper treating of double vectors for
 segmentations

---
 DDCore/src/plugins/Compact2Objects.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 37504865c..b0196cd7c 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -556,6 +556,19 @@ template <> void Converter<Readout>::operator()(xml_h e) const {
             p->setValue(_toString(seg.attr<int>(Unicode(p->name()))));
           } else if (pType.compare("float") == 0) {
             p->setValue(_toString(seg.attr<float>(Unicode(p->name()))));
+          } else if (pType.compare("doublevec") == 0) {
+	    std::string theString = seg.attr<string>(Unicode(p->name()));
+	    printout(DEBUG, "Compact", "++ Converting this string structure: %s.", theString.c_str());
+	    // need to put things back to a string, because we can only set segmentation values via string
+	    std::stringstream theValueString;
+	    std::vector<std::string> elements = DD4hep::DDSegmentation::splitString(theString);
+	    for (std::vector<std::string>::const_iterator it = elements.begin(); it != elements.end(); ++it) {
+	      if (it->empty()) continue;
+	      double theDouble = DD4hep::Geometry::_toDouble((*it));
+	      theValueString << " " << theDouble;
+	    }
+	    printout(DEBUG, "Compact", "++ Converted this string structure: %s.", theValueString.str().c_str());
+	    p->setValue(theValueString.str());
           } else if (pType.compare("double") == 0) {
             p->setValue(_toString(seg.attr<double>(Unicode(p->name()))));
           } else {
-- 
GitLab