From b55287b12826675337aed747a8d9d1a18ece4e5a Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Tue, 18 Oct 2016 19:15:57 +0200
Subject: [PATCH] Add more segmentation handle implementations

---
 DDCore/include/DD4hep/CartesianGridXY.h |  5 ++++-
 DDCore/src/CartesianGridXY.cpp          | 11 +++--------
 DDCore/src/Segmentations.cpp            |  3 ++-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/DDCore/include/DD4hep/CartesianGridXY.h b/DDCore/include/DD4hep/CartesianGridXY.h
index 7f4854278..34b2b59b9 100644
--- a/DDCore/include/DD4hep/CartesianGridXY.h
+++ b/DDCore/include/DD4hep/CartesianGridXY.h
@@ -15,7 +15,7 @@
 #define DD4HEP_DDCORE_CARTESIANGRIDXY_H 1
 
 // Framework include files
-#include "DD4hep/Segmentations.h"
+#include "DD4hep/Objects.h"
 
 /// Namespace for the AIDA detector description toolkit
 namespace DD4hep {
@@ -26,6 +26,9 @@ namespace DD4hep {
   /// Namespace for the geometry part of the AIDA detector description toolkit
   namespace Geometry {
 
+    // Forward declarations
+    class Segmentation;
+    
     /// Implementation class for the grid XY segmentation.
     /**
      * \author  M.Frank
diff --git a/DDCore/src/CartesianGridXY.cpp b/DDCore/src/CartesianGridXY.cpp
index cf9ade5ef..0222d229e 100644
--- a/DDCore/src/CartesianGridXY.cpp
+++ b/DDCore/src/CartesianGridXY.cpp
@@ -12,7 +12,6 @@
 //==========================================================================
 
 // Framework include files
-#include "DD4hep/Handle.inl"
 #include "DD4hep/Segmentations.h"
 #include "DD4hep/CartesianGridXY.h"
 #include "DDSegmentation/CartesianGridXY.h"
@@ -20,12 +19,8 @@
 // C/C++ include files
 
 using namespace std;
-using namespace DD4hep;
 using namespace DD4hep::Geometry;
 
-/// Instantiate handle functions
-DD4HEP_INSTANTIATE_HANDLE_UNNAMED(CartesianGridXY::Object);
-
 /// Copy Constructor from segmentation base object
 CartesianGridXY::CartesianGridXY(const Segmentation& e) : Handle<Object>()
 {
@@ -38,9 +33,9 @@ Position CartesianGridXY::position(const CellID& id) const   {
 }
 
 /// determine the cell ID based on the position
-CellID CartesianGridXY::cellID(const Position& local,
-                               const Position& global,
-                               const VolumeID& volID) const
+DD4hep::CellID CartesianGridXY::cellID(const Position& local,
+                                       const Position& global,
+                                       const VolumeID& volID) const
 {
   return access()->cellID(local, global, volID);
 }
diff --git a/DDCore/src/Segmentations.cpp b/DDCore/src/Segmentations.cpp
index dc2525f28..2398c75e6 100644
--- a/DDCore/src/Segmentations.cpp
+++ b/DDCore/src/Segmentations.cpp
@@ -15,8 +15,8 @@
 // Framework include files
 #include "DD4hep/Segmentations.h"
 #include "DD4hep/InstanceCount.h"
-#include "DD4hep/Handle.inl"
 #include "DD4hep/Printout.h"
+#include "DD4hep/Handle.inl"
 
 // C/C++ include files
 #include <iostream>
@@ -172,6 +172,7 @@ namespace DD4hep {
 } /* End namespace DD4hep                */
 
 #define IMPLEMENT_SEGMENTATION_HANDLE(X)                                \
+  DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DDSegmentation::X);                 \
   namespace DD4hep { namespace Geometry {                               \
       template DDSegmentation::X*                                       \
       Segmentation::get<DDSegmentation::X>(const Object* obj); }}
-- 
GitLab