From 9f9459d008972c8944ae8185b5ee4da16010b3e5 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Wed, 7 Aug 2019 13:59:23 +0200
Subject: [PATCH] Fix bug in Polyhedra shape

---
 DDCore/include/DD4hep/Shapes.h                | 128 +++++++++---------
 DDCore/src/Plugins.cpp                        |   7 +-
 DDCore/src/Shapes.cpp                         |   4 +-
 DDCore/src/plugins/Compact2Objects.cpp        |   1 +
 DDDigi/include/DDDigi/DigiData.h              |  41 ++++--
 DDDigi/src/DigiData.cpp                       |  11 ++
 examples/OpticalSurfaces/compact/OpNovice.xml |   2 +-
 .../OpticalSurfaces/compact/OpNovice_gdml.xml |  37 +++++
 .../OpticalSurfaces/scripts/OpNovice_GDML.py  |  20 +++
 examples/OpticalSurfaces/src/OpNovice_geo.cpp |  20 ++-
 10 files changed, 182 insertions(+), 89 deletions(-)
 create mode 100644 examples/OpticalSurfaces/compact/OpNovice_gdml.xml
 create mode 100644 examples/OpticalSurfaces/scripts/OpNovice_GDML.py

diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h
index aa3b2f0dc..990780688 100644
--- a/DDCore/include/DD4hep/Shapes.h
+++ b/DDCore/include/DD4hep/Shapes.h
@@ -411,27 +411,27 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous tube object with attribute initialization
     Tube(double rmin, double rmax, double dz)
-    {   make("", rmin, rmax, dz, 0, 2*M_PI);                   }
+    {  this->make("", rmin, rmax, dz, 0, 2*M_PI);                   }
     /// Constructor to create a new anonymous tube object with attribute initialization
     Tube(double rmin, double rmax, double dz, double endPhi)
-    {   make("", rmin, rmax, dz, 0, endPhi);                   }
+    {  this->make("", rmin, rmax, dz, 0, endPhi);                   }
     /// Constructor to create a new anonymous tube object with attribute initialization
     Tube(double rmin, double rmax, double dz, double startPhi, double endPhi)
-    {   make("", rmin, rmax, dz, startPhi, endPhi);            }
+    {  this->make("", rmin, rmax, dz, startPhi, endPhi);            }
 
     /// Legacy: Constructor to create a new identifiable tube object with attribute initialization
     Tube(const std::string& nam, double rmin, double rmax, double dz)
-    {   make(nam, rmin, rmax, dz, 0, 2*M_PI);                  }
+    {  this->make(nam, rmin, rmax, dz, 0, 2*M_PI);                  }
     /// Legacy: Constructor to create a new identifiable tube object with attribute initialization
     Tube(const std::string& nam, double rmin, double rmax, double dz, double endPhi)
-    {  make(nam, rmin, rmax, dz, 0, endPhi);                   }
+    {  this->make(nam, rmin, rmax, dz, 0, endPhi);                   }
     /// Legacy: Constructor to create a new identifiable tube object with attribute initialization
     Tube(const std::string& nam, double rmin, double rmax, double dz, double startPhi, double endPhi)
-    {  make(nam, rmin, rmax, dz, startPhi, endPhi);            }
+    {  this->make(nam, rmin, rmax, dz, startPhi, endPhi);            }
     /// Constructor to create a new anonymous tube object with attribute initialization
     template <typename RMIN, typename RMAX, typename Z, typename ENDPHI=double>
     Tube(const RMIN& rmin, const RMAX& rmax, const Z& dz, const ENDPHI& endPhi = 2.0*M_PI)
-    {  make("", _toDouble(rmin), _toDouble(rmax), _toDouble(dz), 0, _toDouble(endPhi));   }
+    {  this->make("", _toDouble(rmin), _toDouble(rmax), _toDouble(dz), 0, _toDouble(endPhi));   }
 
     /// Move Assignment operator
     Tube& operator=(Tube&& copy) = default;
@@ -558,19 +558,19 @@ namespace dd4hep {
     template <typename Q> EllipticalTube(const Handle<Q>& e) : Solid_type<Object>(e) {   }
 
     /// Constructor to create a new anonymous tube object with attribute initialization
-    EllipticalTube(double a, double b, double dz) {  make("", a, b, dz);  }
+    EllipticalTube(double a, double b, double dz) {  this->make("", a, b, dz);  }
     /// Constructor to create a new anonymous tube object with attribute initialization
     template <typename A, typename B, typename DZ>
     EllipticalTube(const A& a, const B& b, const DZ& dz)
-    {  make("",_toDouble(a), _toDouble(b), _toDouble(dz));     }
+    {  this->make("",_toDouble(a), _toDouble(b), _toDouble(dz));     }
 
     /// Constructor to create a new identified tube object with attribute initialization
     EllipticalTube(const std::string& nam, double a, double b, double dz)
-    {  make(nam, a, b, dz);                                    }
+    {  this->make(nam, a, b, dz);                                    }
     /// Constructor to create a new identified tube object with attribute initialization
     template <typename A, typename B, typename DZ>
     EllipticalTube(const std::string& nam, const A& a, const B& b, const DZ& dz)
-    {  make(nam, _toDouble(a), _toDouble(b), _toDouble(dz));   }
+    {  this->make(nam, _toDouble(a), _toDouble(b), _toDouble(dz));   }
 
     /// Move Assignment operator
     EllipticalTube& operator=(EllipticalTube&& copy) = default;
@@ -607,19 +607,19 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous object with attribute initialization
     Cone(double z, double rmin1, double rmax1, double rmin2, double rmax2)
-    {     make("", z, rmin1, rmax1, rmin2, rmax2);                                 }
+    {     this->make("", z, rmin1, rmax1, rmin2, rmax2);                                 }
     /// Constructor to create a new anonymous object with attribute initialization
     template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2>
     Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2)
-    {     make("", _toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); }
+    {     this->make("", _toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); }
 
     /// Constructor to create a new anonymous object with attribute initialization
     Cone(const std::string& nam, double z, double rmin1, double rmax1, double rmin2, double rmax2)
-    {     make(nam, z, rmin1, rmax1, rmin2, rmax2);                                 }
+    {     this->make(nam, z, rmin1, rmax1, rmin2, rmax2);                                 }
     /// Constructor to create a new anonymous object with attribute initialization
     template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2>
     Cone(const std::string& nam, const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2)
-    {     make(nam, _toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); }
+    {     this->make(nam, _toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); }
 
     /// Move Assignment operator
     Cone& operator=(Cone&& copy) = default;
@@ -660,10 +660,10 @@ namespace dd4hep {
          double h2, double bl2, double tl2, double alpha2);
     /// Constructor to create a new anonymous object for right angular wedge from STEP (Se G4 manual for details)
     Trap(double pz, double py, double px, double pLTX)
-    {  make("", pz,py,px,pLTX);  }
+    { this->make("", pz,py,px,pLTX);  }
     /// Constructor to create a new anonymous object with attribute initialization
     template <typename PZ,typename PY,typename PX,typename PLTX> Trap(PZ pz, PY py, PX px, PLTX pLTX)
-    { make("", _toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); }
+    { this->make("", _toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); }
 
     /// Constructor to create a new identified object with attribute initialization
     Trap(const std::string& name,
@@ -672,11 +672,11 @@ namespace dd4hep {
          double h2, double bl2, double tl2, double alpha2);
     /// Constructor to create a new identified object for right angular wedge from STEP (Se G4 manual for details)
     Trap(const std::string& nam, double pz, double py, double px, double pLTX)
-    {  make(nam, pz,py,px,pLTX);  }
+    { this->make(nam, pz,py,px,pLTX);  }
     /// Constructor to create a new identified object with attribute initialization
     template <typename PZ,typename PY,typename PX,typename PLTX>
     Trap(const std::string& nam, PZ pz, PY py, PX px, PLTX pLTX)
-    { make(nam, _toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); }
+    { this->make(nam, _toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); }
 
     /// Move Assignment operator
     Trap& operator=(Trap&& copy) = default;
@@ -715,14 +715,14 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous object with attribute initialization
     PseudoTrap(double x1, double x2, double y1, double y2, double z, double radius, bool minusZ)
-    {  make("", x1, x2, y1, y2, z, radius, minusZ);    }
+    {  this->make("", x1, x2, y1, y2, z, radius, minusZ);    }
 
     /// Constructor to create a new identified object with attribute initialization
     PseudoTrap(const std::string& nam,
                double x1, double x2,
                double y1, double y2, double z,
                double radius, bool minusZ)
-    {  make(nam, x1, x2, y1, y2, z, radius, minusZ);    }
+    {  this->make(nam, x1, x2, y1, y2, z, radius, minusZ);    }
 
     /// Move Assignment operator
     PseudoTrap& operator=(PseudoTrap&& copy) = default;
@@ -759,19 +759,19 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous object with attribute initialization
     Trd1(double x1, double x2, double y, double z)
-    { make("", x1, x2, y, z);                                          }
+    { this->make("", x1, x2, y, z);                                           }
     /// Constructor to create a new anonymous object with attribute initialization
     template <typename X1,typename X2,typename Y,typename Z>
     Trd1(X1 x1, X2 x2, Y y, Z z)
-    { make("", _toDouble(x1),_toDouble(x2),_toDouble(y),_toDouble(z)); }
+    { this->make("", _toDouble(x1),_toDouble(x2),_toDouble(y),_toDouble(z));  }
 
     /// Constructor to create a new anonymous object with attribute initialization
     Trd1(const std::string& nam, double x1, double x2, double y, double z)
-    { make(nam, x1, x2, y, z);                                          }
+    { this->make(nam, x1, x2, y, z);                                          }
     /// Constructor to create a new anonymous object with attribute initialization
     template <typename X1,typename X2,typename Y,typename Z>
     Trd1(const std::string& nam, X1 x1, X2 x2, Y y, Z z)
-    { make(nam, _toDouble(x1),_toDouble(x2),_toDouble(y),_toDouble(z)); }
+    { this->make(nam, _toDouble(x1),_toDouble(x2),_toDouble(y),_toDouble(z)); }
 
     /// Move Assignment operator
     Trd1& operator=(Trd1&& copy) = default;
@@ -810,19 +810,19 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous object with attribute initialization
     Trd2(double x1, double x2, double y1, double y2, double z)
-    { make("", x1, x2, y1, y2, z);  }
+    { this->make("", x1, x2, y1, y2, z);  }
     /// Constructor to create a new anonymous object with attribute initialization
     template <typename X1,typename X2,typename Y1,typename Y2,typename Z>
     Trd2(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z)
-    { make("", _toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); }
+    { this->make("", _toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); }
 
     /// Constructor to create a new identified object with attribute initialization
     Trd2(const std::string& nam, double x1, double x2, double y1, double y2, double z)
-    { make(nam, x1, x2, y1, y2, z);  }
+    { this->make(nam, x1, x2, y1, y2, z);  }
     /// Constructor to create a new identified object with attribute initialization
     template <typename X1,typename X2,typename Y1,typename Y2,typename Z>
     Trd2(const std::string& nam, X1 x1, X2 x2, Y1 y1, Y2 y2, Z z)
-    { make(nam, _toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); }
+    { this->make(nam, _toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); }
 
     /// Copy Assignment operator
     Trd2& operator=(Trd2&& copy) = default;
@@ -862,18 +862,18 @@ namespace dd4hep {
     /// Constructor to create a new anonymous object with attribute initialization
     template<typename R, typename RMIN, typename RMAX, typename STARTPHI, typename DELTAPHI>
     Torus(R r, RMIN rmin, RMAX rmax, STARTPHI startPhi=M_PI, DELTAPHI deltaPhi = 2.*M_PI)
-    {   make("", _toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(startPhi),_toDouble(deltaPhi));  }
+    {   this->make("", _toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(startPhi),_toDouble(deltaPhi));  }
     /// Constructor to create a new anonymous object with attribute initialization
     Torus(double r, double rmin, double rmax, double startPhi=M_PI, double deltaPhi = 2.*M_PI)
-    {   make("", r, rmin, rmax, startPhi, deltaPhi);  }
+    {   this->make("", r, rmin, rmax, startPhi, deltaPhi);  }
 
     /// Constructor to create a new identified object with attribute initialization
     template<typename R, typename RMIN, typename RMAX, typename STARTPHI, typename DELTAPHI>
     Torus(const std::string& nam, R r, RMIN rmin, RMAX rmax, STARTPHI startPhi=M_PI, DELTAPHI deltaPhi = 2.*M_PI)
-    {   make(nam, _toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(startPhi),_toDouble(deltaPhi));  }
+    {   this->make(nam, _toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(startPhi),_toDouble(deltaPhi));  }
     /// Constructor to create a new identified object with attribute initialization
     Torus(const std::string& nam, double r, double rmin, double rmax, double startPhi=M_PI, double deltaPhi = 2.*M_PI)
-    {   make(nam, r, rmin, rmax, startPhi, deltaPhi);  }
+    {   this->make(nam, r, rmin, rmax, startPhi, deltaPhi);  }
 
     /// Move Assignment operator
     Torus& operator=(Torus&& copy) = default;
@@ -916,7 +916,7 @@ namespace dd4hep {
     Sphere(double rmin,            double rmax,
            double startTheta= 0.0, double endTheta = M_PI,
            double startPhi  = 0.0, double endPhi   = 2. * M_PI)
-    {  make("", rmin, rmax, startTheta, endTheta, startPhi, endPhi);     }
+    {  this->make("", rmin, rmax, startTheta, endTheta, startPhi, endPhi);     }
     /// Constructor to create a new anonymous object with generic attribute initialization
     template<typename RMIN,              typename RMAX,
              typename STARTTHETA=double, typename ENDTHETA=double,
@@ -924,10 +924,10 @@ namespace dd4hep {
     Sphere(RMIN  rmin,                   RMAX     rmax,
            STARTTHETA startTheta = 0.0,  ENDTHETA endTheta = M_PI,
            STARTPHI   startPhi   = 0.0,  ENDPHI   endPhi   = 2. * M_PI)  {
-      make("",
-           _toDOuble(rmin),       _toDouble(rmax),
-           _toDouble(startTheta), _toDouble(endTheta),
-           _toDouble(startPhi),   _toDouble(endPhi));
+      this->make("",
+                 _toDOuble(rmin),       _toDouble(rmax),
+                 _toDouble(startTheta), _toDouble(endTheta),
+                 _toDouble(startPhi),   _toDouble(endPhi));
     }
 
     /// Constructor to create a new identified object with attribute initialization
@@ -935,7 +935,7 @@ namespace dd4hep {
            double rmin,            double rmax,
            double startTheta= 0.0, double endTheta = M_PI,
            double startPhi  = 0.0, double endPhi   = 2. * M_PI)
-    {  make(nam, rmin, rmax, startTheta, endTheta, startPhi, endPhi);     }
+    {  this->make(nam, rmin, rmax, startTheta, endTheta, startPhi, endPhi);     }
     /// Constructor to create a new identified object with generic attribute initialization
     template<typename RMIN,              typename RMAX,
              typename STARTTHETA=double, typename ENDTHETA=double,
@@ -944,10 +944,10 @@ namespace dd4hep {
            RMIN  rmin,                   RMAX     rmax,
            STARTTHETA startTheta = 0.0,  ENDTHETA endTheta = M_PI,
            STARTPHI   startPhi   = 0.0,  ENDPHI   endPhi   = 2. * M_PI)  {
-      make(nam,
-           _toDOuble(rmin),       _toDouble(rmax),
-           _toDouble(startTheta), _toDouble(endTheta),
-           _toDouble(startPhi),   _toDouble(endPhi));
+      this->make(nam,
+                 _toDOuble(rmin),       _toDouble(rmax),
+                 _toDouble(startTheta), _toDouble(endTheta),
+                 _toDouble(startPhi),   _toDouble(endPhi));
     }
 
     /// Move Assignment operator
@@ -987,19 +987,19 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous object with attribute initialization
     Paraboloid(double r_low, double r_high, double delta_z)
-    {  make("", r_low, r_high, delta_z);  }
+    {  this->make("", r_low, r_high, delta_z);  }
     /// Constructor to create a new anonymous object with attribute initialization
     template<typename R_LOW, typename R_HIGH, typename DELTA_Z>
     Paraboloid(R_LOW r_low, R_HIGH r_high, DELTA_Z delta_z)
-    {  make("", _toDouble(r_low), _toDouble(r_high), _toDouble(delta_z));  }
+    {  this->make("", _toDouble(r_low), _toDouble(r_high), _toDouble(delta_z));  }
 
     /// Constructor to create a new identified object with attribute initialization
     Paraboloid(const std::string& nam, double r_low, double r_high, double delta_z)
-    {  make(nam, r_low, r_high, delta_z);  }
+    {  this->make(nam, r_low, r_high, delta_z);  }
     /// Constructor to create a new identified object with attribute initialization
     template<typename R_LOW, typename R_HIGH, typename DELTA_Z>
     Paraboloid(const std::string& nam, R_LOW r_low, R_HIGH r_high, DELTA_Z delta_z)
-    {  make(nam, _toDouble(r_low), _toDouble(r_high), _toDouble(delta_z));  }
+    {  this->make(nam, _toDouble(r_low), _toDouble(r_high), _toDouble(delta_z));  }
 
     /// Move Assignment operator
     Paraboloid& operator=(Paraboloid&& copy) = default;
@@ -1085,23 +1085,23 @@ namespace dd4hep {
 
     /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2
     PolyhedraRegular(int nsides, double rmin, double rmax, double zlen)
-    { make("", nsides, rmin, rmax, zlen / 2, -zlen / 2, 0, 2.0*M_PI);  }
+    { this->make("", nsides, rmin, rmax, zlen / 2, -zlen / 2, 0, 2.0*M_PI);           }
     /// Constructor to create a new object with phi_start, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2
     PolyhedraRegular(int nsides, double phi_start, double rmin, double rmax, double zlen)
-    { make("", nsides, rmin, rmax, zlen / 2, -zlen / 2, phi_start, 2.0*M_PI);  }
+    { this->make("", nsides, rmin, rmax, zlen / 2, -zlen / 2, phi_start, 2.0*M_PI);   }
     /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes a zplanes[0] and zplanes[1]
     PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2])
-    { make("", nsides, rmin, rmax, zplanes[0], zplanes[1], 0, 2.0*M_PI);  }
+    { this->make("", nsides, rmin, rmax, zplanes[0], zplanes[1], 0, 2.0*M_PI);        }
 
     /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2
     PolyhedraRegular(const std::string& nam, int nsides, double rmin, double rmax, double zlen)
-    { make(nam, nsides, rmin, rmax, zlen / 2, -zlen / 2, 0, 2.0*M_PI);  }
+    { this->make(nam, nsides, rmin, rmax, zlen / 2, -zlen / 2, 0, 2.0*M_PI);          }
     /// Constructor to create a new object with phi_start, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2
     PolyhedraRegular(const std::string& nam, int nsides, double phi_start, double rmin, double rmax, double zlen)
-    { make(nam, nsides, rmin, rmax, zlen / 2, -zlen / 2, phi_start, 2.0*M_PI);  }
+    { this->make(nam, nsides, rmin, rmax, zlen / 2, -zlen / 2, phi_start, 2.0*M_PI);  }
     /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes a zplanes[0] and zplanes[1]
     PolyhedraRegular(const std::string& nam, int nsides, double rmin, double rmax, double zplanes[2])
-    { make(nam, nsides, rmin, rmax, zplanes[0], zplanes[1], 0, 2.0*M_PI);  }
+    { this->make(nam, nsides, rmin, rmax, zplanes[0], zplanes[1], 0, 2.0*M_PI);       }
     /// Move Assignment operator
     PolyhedraRegular& operator=(PolyhedraRegular&& copy) = default;
     /// Copy Assignment operator
@@ -1132,31 +1132,31 @@ namespace dd4hep {
     /// Copy Constructor
     Polyhedra(const Polyhedra& e) = default;
     /// Constructor to be used with an existing object
-    template <typename Q> Polyhedra(const Q* p) : Solid_type<Object>(p) {  }
+    template <typename Q> Polyhedra(const Q* p) : Solid_type<Object>(p)  {         }
     /// Constructor to be used when passing an already created object
     template <typename Q> Polyhedra(const Handle<Q>& e) : Solid_type<Object>(e) {  }
 
     /// Constructor to create a new object. Phi(start), deltaPhi, Z-planes at specified positions
     Polyhedra(int nsides, double start, double delta,
               const std::vector<double>& z, const std::vector<double>& r)   {
-      std::vector<double> rmin(r.size(), 0.);
-      make("", nsides, start, delta, z, rmin, r);
+      std::vector<double> rmin(r.size(), 0e0);
+      this->make("", nsides, start, delta, z, rmin, r);
     }
     /// Constructor to create a new object. Phi(start), deltaPhi, Z-planes at specified positions
     Polyhedra(int nsides, double start, double delta,
               const std::vector<double>& z, const std::vector<double>& rmin, const std::vector<double>& rmax)
-    {  make("", nsides, start, delta, z, rmin, rmax);   }
+    {  this->make("", nsides, start, delta, z, rmin, rmax);   }
 
     /// Constructor to create a new object. Phi(start), deltaPhi, Z-planes at specified positions
     Polyhedra(const std::string& nam, int nsides, double start, double delta,
               const std::vector<double>& z, const std::vector<double>& r)   {
-      std::vector<double> rmin(r.size(), 0.);
-      make(nam, nsides, start, delta, z, rmin, r);
+      std::vector<double> rmin(r.size(), 0e0);
+      this->make(nam, nsides, start, delta, z, rmin, r);
     }
     /// Constructor to create a new object. Phi(start), deltaPhi, Z-planes at specified positions
     Polyhedra(const std::string& nam, int nsides, double start, double delta,
               const std::vector<double>& z, const std::vector<double>& rmin, const std::vector<double>& rmax)
-    {  make(nam, nsides, start, delta, z, rmin, rmax);   }
+    {  this->make(nam, nsides, start, delta, z, rmin, rmax);   }
     /// Move Assignment operator
     Polyhedra& operator=(Polyhedra&& copy) = default;
     /// Copy Assignment operator
@@ -1201,7 +1201,7 @@ namespace dd4hep {
                     const std::vector<double> & sec_x,
                     const std::vector<double> & sec_y,
                     const std::vector<double> & zscale)
-    {  make("", pt_x, pt_y, sec_z, sec_x, sec_y, zscale);   }
+    {  this->make("", pt_x, pt_y, sec_z, sec_x, sec_y, zscale);   }
 
     /// Constructor to create a new identified object. 
     ExtrudedPolygon(const std::string& nam,
@@ -1211,7 +1211,7 @@ namespace dd4hep {
                     const std::vector<double> & sec_x,
                     const std::vector<double> & sec_y,
                     const std::vector<double> & zscale)
-    {  make(nam, pt_x, pt_y, sec_z, sec_x, sec_y, zscale);   }
+    {  this->make(nam, pt_x, pt_y, sec_z, sec_x, sec_y, zscale);   }
     /// Move Assignment operator
     ExtrudedPolygon& operator=(ExtrudedPolygon&& copy) = default;
     /// Copy Assignment operator
@@ -1245,11 +1245,11 @@ namespace dd4hep {
 
     /// Constructor to create a new anonymous object with attribute initialization
     EightPointSolid(double dz, const double* vertices)
-    { make("", dz, vertices);    }
+    { this->make("", dz, vertices);    }
 
     /// Constructor to create a new identified object with attribute initialization
     EightPointSolid(const std::string& nam, double dz, const double* vertices)
-    { make(nam, dz, vertices);   }
+    { this->make(nam, dz, vertices);   }
 
     /// Move Assignment operator
     EightPointSolid& operator=(EightPointSolid&& copy) = default;
diff --git a/DDCore/src/Plugins.cpp b/DDCore/src/Plugins.cpp
index 89141d486..c0c80f7be 100644
--- a/DDCore/src/Plugins.cpp
+++ b/DDCore/src/Plugins.cpp
@@ -118,11 +118,10 @@ namespace   {
     if ( 0 == plugin_name )   {
       plugin_name = "libDD4hepGaudiPluginMgr";
     }
-    else
 #if defined(DD4HEP_PARSERS_NO_ROOT)
-    {
-      handle = ::dlopen(plugin_name, RTLD_LAZY | RTLD_GLOBAL);
-    }
+    handle = ::dlopen(plugin_name, RTLD_LAZY | RTLD_GLOBAL);
+#else
+    if ( 0 != gSystem->Load(plugin_name) ) {}
 #endif
     getDebug = get_func< int (*) ()>(handle, plugin_name,"dd4hep_pluginmgr_getdebug");
     setDebug = get_func< int (*) (int)>(handle, plugin_name,"dd4hep_pluginmgr_getdebug");
diff --git a/DDCore/src/Shapes.cpp b/DDCore/src/Shapes.cpp
index e5b1ce41c..4e97b6994 100644
--- a/DDCore/src/Shapes.cpp
+++ b/DDCore/src/Shapes.cpp
@@ -1040,8 +1040,8 @@ void Polyhedra::make(const std::string& nam, int nsides, double start, double de
   }
   // No need to transform coordinates to cm. We are in the dd4hep world: all is already in cm.
   temp.reserve(4+z.size()*2);
-  temp.emplace_back(start);
-  temp.emplace_back(delta);
+  temp.emplace_back(start/units::deg);
+  temp.emplace_back(delta/units::deg);
   temp.emplace_back(double(nsides));
   temp.emplace_back(double(z.size()));
   for(size_t i=0; i<z.size(); ++i)   {
diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 6089bec21..754d4f432 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -750,6 +750,7 @@ template <> void Converter<PropertyTable>::operator()(xml_h e) const {
   PropertyTable table(description, e.attr<string>(_U(name)), "", values.size()/cols, cols);
   for (size_t i=0, n=values.size(); i<n; ++i)
     table->Set(i/cols, i%cols, values[i]);
+  //if ( s_debug.matrix ) table->Print();
 }
 #endif
 
diff --git a/DDDigi/include/DDDigi/DigiData.h b/DDDigi/include/DDDigi/DigiData.h
index 175247668..1e4c73318 100644
--- a/DDDigi/include/DDDigi/DigiData.h
+++ b/DDDigi/include/DDDigi/DigiData.h
@@ -40,14 +40,19 @@ namespace dd4hep {
      *  \version 1.0
      *  \ingroup DD4HEP_DIGITIZATION
      */
-    template <typename T> class DigiContainer  {
+    template <typename T> class DigiContainer : public std::vector<T>    {
+      /// Unique name within the event
+      std::string    name;
+
     public:
       /// Default constructor
       DigiContainer() = default;
       /// Disable move constructor
-      DigiContainer(DigiContainer&& copy) = delete;
+      DigiContainer(DigiContainer&& copy) = default;
       /// Disable copy constructor
-      DigiContainer(const DigiContainer& copy) = delete;      
+      DigiContainer(const DigiContainer& copy) = default;      
+      /// Default constructor
+      DigiContainer(const std::string& nam) : name(nam) {}
       /// Default destructor
       virtual ~DigiContainer() = default;
       /// Disable move assignment
@@ -92,9 +97,9 @@ namespace dd4hep {
       /// Default constructor
       DigiCount() = default;
       /// Disable move constructor
-      DigiCount(DigiCount&& copy) = delete;
+      DigiCount(DigiCount&& copy) = default;
       /// Disable copy constructor
-      DigiCount(const DigiCount& copy) = delete;      
+      DigiCount(const DigiCount& copy) = default;
       /// Default destructor
       virtual ~DigiCount() = default;
       /// Disable move assignment
@@ -103,8 +108,8 @@ namespace dd4hep {
       DigiCount& operator=(const DigiCount& copy) = delete;      
     };
 
-    typedef DigiContainer<DigiDeposit> DigiEnergyDeposits;
-    typedef DigiContainer<DigiCount>   DigiCounts;
+    typedef DigiContainer<DigiDeposit*> DigiEnergyDeposits;
+    typedef DigiContainer<DigiCount*>   DigiCounts;
 
     ///  Key defintion to access the event data
     /**
@@ -130,6 +135,7 @@ namespace dd4hep {
       Key(mask_type mask, const std::string& item);
       Key& operator=(const Key&);
       key_type toLong()  const  {  return key; }
+      void set(const std::string& name, int mask);
     };
     
     ///  User event data for DDDigi
@@ -163,26 +169,37 @@ namespace dd4hep {
       /// Default destructor
       virtual ~DigiEvent();
       /// Add item by key to the data 
-      template<typename T> bool put(const Key& key, dd4hep::any&& object)     {
-        bool ret = data.emplace(key.toLong(),object).second;
+      template<typename T> bool put(const Key& key, T&& object)     {
+        bool ret = data.emplace(key.toLong(),std::make_any<T>(object)).second;
         if ( ret ) return ret;
         except("DigiEvent","Invalid requested to store data in event container. Key:%ld",key.toLong());
         throw std::runtime_error("DigiEvent"); // Will never get here!
       }
+
       /// Retrieve item by key from the event data container
       template<typename T> T& get(const Key& key)     {
         auto iter = data.find(key.toLong());
-        if ( iter != data.end() ) return dd4hep::any_cast<T&>((*iter).second);
+        if ( iter != data.end() )  {
+          T* ptr = dd4hep::any_cast<T>(&(*iter).second);
+          if ( ptr ) return *ptr;
+          except("DigiEvent","Invalid data requested from event container [cast failed]. Key:%ld",key.toLong());
+        }
         except("DigiEvent","Invalid data requested from event container. Key:%ld",key.toLong());
         throw std::runtime_error("DigiEvent"); // Will never get here!
       }
+
       /// Retrieve item by key from the event data container
       template<typename T> const T& get(const Key& key)  const    {
-        auto iter = data.find(key.toLong());
-        if ( iter != data.end() ) return dd4hep::any_cast<const T&>((*iter).second);
+        std::map<key_type, dd4hep::any>::const_iterator iter = data.find(key.toLong());
+        if ( iter != data.end() )  {
+          const T* ptr = dd4hep::any_cast<T>(&(*iter).second);
+          if ( ptr ) return *ptr;
+          except("DigiEvent","Invalid data requested from event container [cast failed]. Key:%ld",key.toLong());
+        }
         except("DigiEvent","Invalid data requested from event container. Key:%ld",key.toLong());
         throw std::runtime_error("DigiEvent"); // Will never get here!
       }
+
       /// Add an extension object to the detector element
       void* addExtension(unsigned long long int k, ExtensionEntry* e)  {
         return ObjectExtensions::addExtension(k, e);
diff --git a/DDDigi/src/DigiData.cpp b/DDDigi/src/DigiData.cpp
index 6f484f9a9..c66cf1f50 100644
--- a/DDDigi/src/DigiData.cpp
+++ b/DDDigi/src/DigiData.cpp
@@ -19,6 +19,7 @@
 #include "DDDigi/DigiData.h"
 
 // C/C++ include files
+#include <mutex>
 
 using namespace std;
 using namespace dd4hep;
@@ -49,6 +50,16 @@ Key& Key::operator=(const Key& copy)   {
   return *this;
 }
 
+void Key::set(const std::string& name, int mask)    {
+  static std::mutex mtx;
+  std::lock_guard lock(mtx);
+  if ( name.empty() )   {
+    except("DDDigi::Key", "+++ No key name was specified  --  this is illegal!");
+  }
+  values.mask = (unsigned char)(0xFF&mask);
+  values.item = detail::hash32(name);
+}
+
 /// Intializing constructor
 DigiEvent::DigiEvent()
   : ObjectExtensions(typeid(DigiEvent))
diff --git a/examples/OpticalSurfaces/compact/OpNovice.xml b/examples/OpticalSurfaces/compact/OpNovice.xml
index 8a4e5bb95..e12e5dbe2 100644
--- a/examples/OpticalSurfaces/compact/OpNovice.xml
+++ b/examples/OpticalSurfaces/compact/OpNovice.xml
@@ -368,7 +368,7 @@
 
   <readouts>
     <readout name="BubbleDeviceHits">
-      <id>system:6,x:12:-6,y:24:-6</id>
+      <id>system:6,tank:2,bubble:2,x:12:-6,y:24:-6</id>
     </readout>
   </readouts>
 
diff --git a/examples/OpticalSurfaces/compact/OpNovice_gdml.xml b/examples/OpticalSurfaces/compact/OpNovice_gdml.xml
new file mode 100644
index 000000000..9ed6dc80f
--- /dev/null
+++ b/examples/OpticalSurfaces/compact/OpNovice_gdml.xml
@@ -0,0 +1,37 @@
+<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" 
+       xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+       xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
+
+  <info name="gdml_import_test"
+        title="GDML import test"
+        author="Markus FRANK"
+        url=""
+        status="development"
+        version="$Id$">
+    <comment/>
+  </info>
+
+  <includes>
+    <gdmlFile  ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/>
+    <gdmlFile  ref="${DD4hepINSTALL}/DDDetectors/compact/materials.xml"/>
+  </includes>
+  
+  <define>
+    <constant name="world_side" value="1*m"/>
+    <constant name="world_x" value="world_side/2"/>
+    <constant name="world_y" value="world_side/2"/>
+    <constant name="world_z" value="world_side/2"/>
+  </define>
+  <debug>
+    <type name="surface" value="1"/>
+  </debug>
+
+  <display>
+    <vis name="TankVis"    alpha="0.5"   r="0"   g="0.0" b="1.0"  showDaughters="true"  visible="true"/>
+    <vis name="BubbleVis"  alpha="0.3"   r="1"   g="0.0" b="0.0"  showDaughters="true"  visible="true"/>
+  </display>
+
+  <detectors>
+  </detectors>
+
+</lccdd>
diff --git a/examples/OpticalSurfaces/scripts/OpNovice_GDML.py b/examples/OpticalSurfaces/scripts/OpNovice_GDML.py
new file mode 100644
index 000000000..75e49f462
--- /dev/null
+++ b/examples/OpticalSurfaces/scripts/OpNovice_GDML.py
@@ -0,0 +1,20 @@
+"""
+
+   Perform a material scan using Geant4 shotting geantinos
+
+   @author  M.Frank
+   @version 1.0
+
+"""
+import os, sys, time, logging, DDG4
+from DDG4 import OutputLevel as Output
+
+def run():
+  kernel = DDG4.Kernel()
+  install_dir = os.environ['DD4hepExamplesINSTALL']
+  kernel.loadGeometry("file:"+install_dir+"/examples/OpticalSurfaces/compact/OpNovice.xml")
+
+  logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
+
+if __name__ == "__main__":
+  run()
diff --git a/examples/OpticalSurfaces/src/OpNovice_geo.cpp b/examples/OpticalSurfaces/src/OpNovice_geo.cpp
index 49d77e413..c4221a7a9 100644
--- a/examples/OpticalSurfaces/src/OpNovice_geo.cpp
+++ b/examples/OpticalSurfaces/src/OpNovice_geo.cpp
@@ -32,25 +32,33 @@ static Ref_t create_detector(Detector &description, xml_h e, SensitiveDetector /
   xml_det_t x_tank   = x_det.child(_Unicode(tank));
   xml_det_t x_bubble = x_det.child(_Unicode(bubble));
 
+  Assembly hall_vol("Hall");
+  Box    encl_box(_toDouble("world_x-2*cm"),_toDouble("world_y-2*cm"),_toDouble("world_z-2*cm"));
+  Volume encl_vol("Enclosure",encl_box,description.air());
   Box    tank_box(x_tank.x(), x_tank.y(), x_tank.z());
-  Volume tank_vol("Tank",tank_box,description.material(x_tank.materialStr()));
+  Volume tank_vol("Tank",tank_box,description.material(x_tank.attr<string>(_U(material))));
   Box    bubble_box(x_bubble.x(), x_bubble.y(), x_bubble.z());
-  Volume bubble_vol("Bubble",bubble_box,description.material(x_bubble.materialStr()));
+  Volume bubble_vol("Bubble",bubble_box,description.material(x_bubble.attr<string>(_U(material))));
 
+  encl_vol.setVisAttributes(description.invisible());
   tank_vol.setVisAttributes(description, x_tank.visStr());
   bubble_vol.setVisAttributes(description, x_bubble.visStr());
   
   PlacedVolume bubblePlace = tank_vol.placeVolume(bubble_vol);
-  PlacedVolume tankPlace   = description.pickMotherVolume(sdet).placeVolume(tank_vol);
-  sdet.setPlacement(tankPlace);
+  bubblePlace.addPhysVolID("bubble",1);
+  PlacedVolume tankPlace   = encl_vol.placeVolume(tank_vol);
+  tankPlace.addPhysVolID("tank",1);
+  PlacedVolume enclPlace   = hall_vol.placeVolume(encl_vol);
+  PlacedVolume hallPlace   = description.pickMotherVolume(sdet).placeVolume(hall_vol);
+  hallPlace.addPhysVolID("system",x_det.id());
+  sdet.setPlacement(hallPlace);
 
 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
   // Now attach the surface
   OpticalSurfaceManager surfMgr = description.surfaceManager();
-  PlacedVolume   hallPlace(description.manager().GetTopNode());
   OpticalSurface waterSurf  = surfMgr.opticalSurface("/world/"+det_name+"#WaterSurface");
   OpticalSurface airSurf    = surfMgr.opticalSurface("/world/"+det_name+"#AirSurface");
-  BorderSurface  tankSurf   = BorderSurface(description, sdet, "HallTank",   waterSurf, tankPlace,   hallPlace);
+  BorderSurface  tankSurf   = BorderSurface(description, sdet, "HallTank",   waterSurf, tankPlace,   enclPlace);
   BorderSurface  bubbleSurf = BorderSurface(description, sdet, "TankBubble", airSurf,   bubblePlace, tankPlace);
   bubbleSurf.isValid();
   tankSurf.isValid();
-- 
GitLab