diff --git a/DDCAD/include/DDCAD/Utilities.h b/DDCAD/include/DDCAD/Utilities.h index a7e8f511d..dcd5b21f6 100644 --- a/DDCAD/include/DDCAD/Utilities.h +++ b/DDCAD/include/DDCAD/Utilities.h @@ -26,24 +26,30 @@ namespace dd4hep { /// Namespace for implementation details of the AIDA detector description toolkit namespace cad { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,31,1) inline std::string streamFacet(TGeoFacet const& facet, - TGeoTessellated const& shape) { + TGeoTessellated const& shape) { using ::operator<<; std::stringstream str; -#if ROOT_VERSION_CODE >= ROOT_VERSION(6,31,1) str << "{"; for (int i = 0; i < facet.GetNvert(); ++i) { - str << shape.GetVertex(facet[i]); - if (i != facet.GetNvert() - 1) - str << ", "; + str << shape.GetVertex(facet[i]); + if (i != facet.GetNvert() - 1) + str << ", "; } str << "}"; + return str.str(); + } #else + inline std::string streamFacet(TGeoFacet const& facet, + TGeoTessellated const& /* shape */) { + using ::operator<<; + std::stringstream str; str << facet; -#endif return str.str(); } - +#endif + inline std::string streamVertices(ROOT::Geom::Vertex_t const& v1, ROOT::Geom::Vertex_t const& v2, ROOT::Geom::Vertex_t const& v3) { diff --git a/DDCAD/src/ASSIMPReader.cpp b/DDCAD/src/ASSIMPReader.cpp index 03b9166f5..07fa11651 100644 --- a/DDCAD/src/ASSIMPReader.cpp +++ b/DDCAD/src/ASSIMPReader.cpp @@ -127,12 +127,21 @@ ASSIMPReader::readVolumes(const std::string& source, double unit_length) const printout(DEBUG, "ASSIMPReader", "+++ %s: Drop degenerated facet: %d %d %d", name.c_str(), idx[0], idx[1], idx[2]); } +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,31,1) else if ( mesh->mFaces[i].mNumIndices == 3 ) { shape->AddFacet(vertices[idx[0]], vertices[idx[1]], vertices[idx[2]]); } else if ( mesh->mFaces[i].mNumIndices == 4 ) { shape->AddFacet(vertices[idx[0]], vertices[idx[1]], vertices[idx[2]], vertices[idx[3]]); } +#else + else if ( mesh->mFaces[i].mNumIndices == 3 ) { + shape->AddFacet(idx[0], idx[1], idx[2]); + } + else if ( mesh->mFaces[i].mNumIndices == 4 ) { + shape->AddFacet(idx[0], idx[1], idx[2], idx[3]); + } +#endif else { printout(INFO, "ASSIMPReader", "+++ %s: Fancy facet with %d indices.", name.c_str(), mesh->mFaces[i].mNumIndices);