From 35f5084bc928f872d6f6dc51f9d8ad0132acdbce Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Mon, 11 Mar 2019 11:42:59 +0100
Subject: [PATCH] Fix according to pull request comments

---
 DDCore/include/DD4hep/OpticalSurfaceManager.h |  2 +-
 DDCore/include/DD4hep/OpticalSurfaces.h       |  2 +-
 DDCore/include/DD4hep/PropertyTable.h         |  2 +-
 .../detail/OpticalSurfaceManagerInterna.h     |  2 +-
 DDCore/src/OpticalSurfaceManager.cpp          |  2 +-
 DDCore/src/OpticalSurfaces.cpp                |  2 +-
 DDCore/src/PropertyTable.cpp                  |  2 +-
 DDCore/src/plugins/Compact2Objects.cpp        | 12 +++++------
 DDCore/src/plugins/StandardPlugins.cpp        | 16 +++++++--------
 DDG4/include/DDG4/Geant4Converter.h           |  2 +-
 DDG4/include/DDG4/Geant4GeometryInfo.h        |  2 +-
 DDG4/src/Geant4Converter.cpp                  | 20 +++++++++----------
 examples/OpticalSurfaces/src/OpNovice_geo.cpp |  2 +-
 13 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/DDCore/include/DD4hep/OpticalSurfaceManager.h b/DDCore/include/DD4hep/OpticalSurfaceManager.h
index a5029c112..07d909ef9 100644
--- a/DDCore/include/DD4hep/OpticalSurfaceManager.h
+++ b/DDCore/include/DD4hep/OpticalSurfaceManager.h
@@ -58,7 +58,7 @@ namespace dd4hep {
     /// static accessor calling DD4hepOpticalSurfaceManagerPlugin if necessary
     static OpticalSurfaceManager getOpticalSurfaceManager(Detector& description);
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
     /// Access skin surface by its full name
     SkinSurface    skinSurface(const std::string& full_name)  const;
     /// Access skin surface by its identifier tuple (DetElement, name)
diff --git a/DDCore/include/DD4hep/OpticalSurfaces.h b/DDCore/include/DD4hep/OpticalSurfaces.h
index 0cf4c7540..13773e525 100644
--- a/DDCore/include/DD4hep/OpticalSurfaces.h
+++ b/DDCore/include/DD4hep/OpticalSurfaces.h
@@ -17,7 +17,7 @@
 #include "DD4hep/Volumes.h"
 #include "DD4hep/DetElement.h"
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 
 // ROOT include files
 #include "TGeoOpticalSurface.h"
diff --git a/DDCore/include/DD4hep/PropertyTable.h b/DDCore/include/DD4hep/PropertyTable.h
index 06f00209c..79f3cc034 100644
--- a/DDCore/include/DD4hep/PropertyTable.h
+++ b/DDCore/include/DD4hep/PropertyTable.h
@@ -14,7 +14,7 @@
 #define DD4HEP_DDCORE_PROPERTYTABLE_H
 
 #include "RVersion.h"
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 
 // Framework include files
 #include "DD4hep/Handle.h"
diff --git a/DDCore/include/DD4hep/detail/OpticalSurfaceManagerInterna.h b/DDCore/include/DD4hep/detail/OpticalSurfaceManagerInterna.h
index 9d8826531..aba07e75c 100644
--- a/DDCore/include/DD4hep/detail/OpticalSurfaceManagerInterna.h
+++ b/DDCore/include/DD4hep/detail/OpticalSurfaceManagerInterna.h
@@ -46,7 +46,7 @@ namespace dd4hep {
 
       /// Reference to the main detector description object
       Detector& detector;
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
       std::map<LocalKey,    SkinSurface>    skinSurfaces;
       std::map<LocalKey,    BorderSurface>  borderSurfaces;
       std::map<std::string, OpticalSurface> opticalSurfaces;
diff --git a/DDCore/src/OpticalSurfaceManager.cpp b/DDCore/src/OpticalSurfaceManager.cpp
index 51259154e..1e43b4144 100644
--- a/DDCore/src/OpticalSurfaceManager.cpp
+++ b/DDCore/src/OpticalSurfaceManager.cpp
@@ -30,7 +30,7 @@ OpticalSurfaceManager OpticalSurfaceManager::getOpticalSurfaceManager(Detector&
   return description.surfaceManager();
 }
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 
 /// Access skin surface by its identifier
 SkinSurface  OpticalSurfaceManager::skinSurface(DetElement de, const string& nam)  const   {
diff --git a/DDCore/src/OpticalSurfaces.cpp b/DDCore/src/OpticalSurfaces.cpp
index f459af5c8..f816c0855 100644
--- a/DDCore/src/OpticalSurfaces.cpp
+++ b/DDCore/src/OpticalSurfaces.cpp
@@ -27,7 +27,7 @@
 using namespace std;
 using namespace dd4hep;
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 
 DD4HEP_INSTANTIATE_HANDLE(TGeoSkinSurface);
 DD4HEP_INSTANTIATE_HANDLE(TGeoBorderSurface);
diff --git a/DDCore/src/PropertyTable.cpp b/DDCore/src/PropertyTable.cpp
index 6bc9fecaa..d42e43d61 100644
--- a/DDCore/src/PropertyTable.cpp
+++ b/DDCore/src/PropertyTable.cpp
@@ -26,7 +26,7 @@
 using namespace std;
 using namespace dd4hep;
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 
 DD4HEP_INSTANTIATE_HANDLE(TGDMLMatrix);
 
diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 1c5e1fbd4..a83390943 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -33,7 +33,7 @@
 // Root/TGeo include files
 #include "TGeoManager.h"
 #include "TGeoMaterial.h"
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 #include "TGDMLMatrix.h"
 #endif
 
@@ -78,7 +78,7 @@ namespace dd4hep {
   template <> void Converter<Property>::operator()(xml_h element) const;
   template <> void Converter<CartesianField>::operator()(xml_h element) const;
   template <> void Converter<SensitiveDetector>::operator()(xml_h element) const;
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   template <> void Converter<OpticalSurface>::operator()(xml_h element) const;
   template <> void Converter<PropertyTable>::operator()(xml_h element) const;
 #endif
@@ -460,7 +460,7 @@ template <> void Converter<Material>::operator()(xml_h e) const {
 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,12,0)
     mix->ComputeDerivedQuantities();
 #endif
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
     /// In case there were material properties specified: convert them here
     for(xml_coll_t properties(x_mat, _U(property)); properties; ++properties) {
       xml_elt_t p = properties;
@@ -619,7 +619,7 @@ template <> void Converter<Atom>::operator()(xml_h e) const {
   }
 }
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 /** Convert compact optical surface objects (defines)
  *
  *
@@ -1202,7 +1202,7 @@ template <> void Converter<DetElement>::operator()(xml_h element) const {
       throw runtime_error("Failed to execute subdetector creation plugin. " + dbg.missingFactory(type));
     }
     description.addDetector(det);
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
     description.surfaceManager().registerSurfaces(det);
 #endif
     return;
@@ -1402,7 +1402,7 @@ template <> void Converter<Compact>::operator()(xml_h element) const {
     (Converter<Header>(description))(xml_h(compact.child(_U(info))));
 
   xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter<Property>(description));
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   /// These two must be parsed early, because they are needed by the detector constructors
   xml_coll_t(compact, _U(properties)).for_each(_U(matrix), Converter<PropertyTable>(description));
   xml_coll_t(compact, _U(surfaces)).for_each(_U(opticalsurface), Converter<OpticalSurface>(description));
diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp
index b2971ce38..a0227d6dd 100644
--- a/DDCore/src/plugins/StandardPlugins.cpp
+++ b/DDCore/src/plugins/StandardPlugins.cpp
@@ -36,7 +36,7 @@
 #include "TSystem.h"
 #include "TClass.h"
 #include "TRint.h"
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 #include "TGDMLMatrix.h"
 #endif
 
@@ -275,7 +275,7 @@ DECLARE_APPLY(DD4hep_InteractiveUI,root_ui)
 static long root_dump_gdml_tables(Detector& description, int /* argc */, char** /* argv */) {
   size_t num_tables = 0;
   size_t num_elements = 0;
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   const TObjArray* c = description.manager().GetListOfGDMLMatrices();
   TObjArrayIter arr(c);
   printout(INFO,"Dump_GDMLTables","+++ Dumping known GDML tables from TGeoManager.");
@@ -307,7 +307,7 @@ DECLARE_APPLY(DD4hep_Dump_GDMLTables,root_dump_gdml_tables)
 static long root_dump_optical_surfaces(Detector& description, int /* argc */, char** /* argv */) {
   size_t num_surfaces = 0;
   printout(ALWAYS,"","");
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   const TObjArray* c = description.manager().GetListOfOpticalSurfaces();
   TObjArrayIter arr(c);
   printout(ALWAYS,"Dump_OpticalSurfaces","+++ Dumping known Optical Surfaces from TGeoManager.");
@@ -337,7 +337,7 @@ DECLARE_APPLY(DD4hep_Dump_OpticalSurfaces,root_dump_optical_surfaces)
 static long root_dump_skin_surfaces(Detector& description, int /* argc */, char** /* argv */) {
   size_t num_surfaces = 0;
   printout(ALWAYS,"","");
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   const TObjArray* c = description.manager().GetListOfSkinSurfaces();
   TObjArrayIter arr(c);
   printout(ALWAYS,"Dump_SkinSurfaces","+++ Dumping known Skin Surfaces from TGeoManager.");
@@ -367,7 +367,7 @@ DECLARE_APPLY(DD4hep_Dump_SkinSurfaces,root_dump_skin_surfaces)
 static long root_dump_border_surfaces(Detector& description, int /* argc */, char** /* argv */) {
   size_t num_surfaces = 0;
   printout(ALWAYS,"","");
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   const TObjArray* c = description.manager().GetListOfBorderSurfaces();
   TObjArrayIter arr(c);
   printout(ALWAYS,"Dump_BorderSurfaces","+++ Dumping known Border Surfaces from TGeoManager.");
@@ -517,7 +517,7 @@ static long root_materials(Detector& description, int argc, char** argv) {
       ::printf("  %-6s Fraction: %7.3f Z=%3d A=%6.2f N=%3d Neff=%6.2f\n",
                elt->GetName(), frac, elt->Z(), elt->A(), elt->N(), elt->Neff());
     }
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
     virtual void printProperty(elt_h, TNamed* prop, TGDMLMatrix* matrix)   {
       if ( matrix )
         ::printf("  Property: %-20s [%ld x %ld] --> %s\n",
@@ -534,7 +534,7 @@ static long root_materials(Detector& description, int argc, char** argv) {
         TGeoElement* elt = mat->GetElement(i);
         print(mh, elt, mix ? mix[i] : 1);
       }
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
       TListIter mat_iter(&mat->GetProperties());
       for(TObject* i = mat_iter.Next(); i; i=mat_iter.Next())   {
         printProperty(mh, (TNamed*)i, description.manager().GetGDMLMatrix(i->GetTitle()));
@@ -566,7 +566,7 @@ static long root_materials(Detector& description, int argc, char** argv) {
       elt.setAttr(_U(n),frac);
       elt.setAttr(_U(ref),element->GetName());
     }
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
     virtual void printProperty(elt_h mat, TNamed* prop, TGDMLMatrix* /* matrix */)   {
       elt_h elt = mat.addChild(_U(property));
       elt.setAttr(_U(name),prop->GetName());
diff --git a/DDG4/include/DDG4/Geant4Converter.h b/DDG4/include/DDG4/Geant4Converter.h
index 71478cff1..b3c190f65 100644
--- a/DDG4/include/DDG4/Geant4Converter.h
+++ b/DDG4/include/DDG4/Geant4Converter.h
@@ -68,7 +68,7 @@ namespace dd4hep {
       /// Create geometry conversion
       Geant4Converter& create(DetElement top);
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
       /// Convert the geometry type material into the corresponding Geant4 object(s).
       virtual void* handleMaterialProperties(TObject* matrix) const;
 
diff --git a/DDG4/include/DDG4/Geant4GeometryInfo.h b/DDG4/include/DDG4/Geant4GeometryInfo.h
index 398809e19..c27f91e49 100644
--- a/DDG4/include/DDG4/Geant4GeometryInfo.h
+++ b/DDG4/include/DDG4/Geant4GeometryInfo.h
@@ -106,7 +106,7 @@ namespace dd4hep {
         PropertyVector() = default;
         ~PropertyVector() = default;
       };
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
       std::map<PropertyTable,  PropertyVector*>                g4OpticalProperties;
       std::map<OpticalSurface, G4OpticalSurface*>              g4OpticalSurfaces;
       std::map<SkinSurface,    G4LogicalSkinSurface*>          g4SkinSurfaces;
diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp
index 1b839ef23..63ea9c63b 100644
--- a/DDG4/src/Geant4Converter.cpp
+++ b/DDG4/src/Geant4Converter.cpp
@@ -404,7 +404,7 @@ void* Geant4Converter::handleMaterial(const string& name, Material medium) const
       stringstream str;
       str << (*mat);
       printout(lvl, "Geant4Converter", "++ Created G4 %s", str.str().c_str());
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
       /// Attach the material properties if any
       G4MaterialPropertiesTable* tab = 0;
       TListIter propIt(&material->GetProperties());
@@ -1055,7 +1055,7 @@ void Geant4Converter::handleProperties(Detector::Properties& prp) const {
   }
 }
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 /// Convert the geometry type material into the corresponding Geant4 object(s).
 void* Geant4Converter::handleMaterialProperties(TObject* matrix) const    {
   TGDMLMatrix* m = (TGDMLMatrix*)matrix;
@@ -1147,7 +1147,7 @@ static G4SurfaceType geant4_surface_type(TGeoOpticalSurface::ESurfaceType t)   {
     TO_G4_TYPE(firsov);                // for Firsov Process
     TO_G4_TYPE(x_ray);                  // for x-ray mirror process
   default:
-    printout(ERROR,"Geant4Surfaces","++ Unknown finish style: %d [%s]. Assume polished!",
+    printout(ERROR,"Geant4Surfaces","++ Unknown surface type: %d [%s]. Assume dielectric_metal!",
              int(t), TGeoOpticalSurface::TypeToString(t));
     return dielectric_metal;
   }
@@ -1157,13 +1157,13 @@ static G4SurfaceType geant4_surface_type(TGeoOpticalSurface::ESurfaceType t)   {
 static G4OpticalSurfaceModel geant4_surface_model(TGeoOpticalSurface::ESurfaceModel m)   {
 #define TO_G4_MODEL(x)  case TGeoOpticalSurface::kM##x : return x;
   switch(m)   {
-    TO_G4_MODEL(glisur);  // original GEANT3 model
-    TO_G4_MODEL(unified); // UNIFIED model
-    TO_G4_MODEL(LUT);     // Look-Up-Table model
-    TO_G4_MODEL(DAVIS);   // DAVIS model
+    TO_G4_MODEL(glisur);   // original GEANT3 model
+    TO_G4_MODEL(unified);  // UNIFIED model
+    TO_G4_MODEL(LUT);      // Look-Up-Table model
+    TO_G4_MODEL(DAVIS);    // DAVIS model
     TO_G4_MODEL(dichroic); // dichroic filter
   default:
-    printout(ERROR,"Geant4Surfaces","++ Unknown finish style: %d [%s]. Assume polished!",
+    printout(ERROR,"Geant4Surfaces","++ Unknown surface model: %d [%s]. Assume glisur!",
              int(m), TGeoOpticalSurface::ModelToString(m));
     return glisur;
   }
@@ -1370,7 +1370,7 @@ Geant4Converter& Geant4Converter::create(DetElement top) {
   //outputLevel = WARNING;
   //setPrintLevel(VERBOSE);
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   handleArray(this, geo.manager->GetListOfGDMLMatrices(), &Geant4Converter::handleMaterialProperties);
   handleArray(this, geo.manager->GetListOfOpticalSurfaces(), &Geant4Converter::handleOpticalSurface);
 #endif
@@ -1389,7 +1389,7 @@ Geant4Converter& Geant4Converter::create(DetElement top) {
   handleRMap(this, *m_data,     &Geant4Converter::handleAssembly);
   // Now place all this stuff appropriately
   handleRMap(this, *m_data,     &Geant4Converter::handlePlacement);
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   /// Handle concrete surfaces
   handleArray(this, geo.manager->GetListOfSkinSurfaces(),   &Geant4Converter::handleSkinSurface);
   handleArray(this, geo.manager->GetListOfBorderSurfaces(), &Geant4Converter::handleBorderSurface);
diff --git a/examples/OpticalSurfaces/src/OpNovice_geo.cpp b/examples/OpticalSurfaces/src/OpNovice_geo.cpp
index a54b16ba6..b941516e5 100644
--- a/examples/OpticalSurfaces/src/OpNovice_geo.cpp
+++ b/examples/OpticalSurfaces/src/OpNovice_geo.cpp
@@ -44,7 +44,7 @@ static Ref_t create_detector(Detector &description, xml_h e, SensitiveDetector /
   PlacedVolume tankPlace   = description.pickMotherVolume(sdet).placeVolume(tank_vol);
   sdet.setPlacement(tankPlace);
 
-#if ROOT_VERSION_CODE > ROOT_VERSION(6,16,0)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   // Now attach the surface
   OpticalSurfaceManager surfMgr = description.surfaceManager();
   PlacedVolume   hallPlace(description.manager().GetTopNode());
-- 
GitLab