From f6d10f9a80c4bd29065224af75c89075e0effdfb Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Wed, 26 Jul 2023 11:59:55 -0500
Subject: [PATCH] feat: use const Detector in several DDRec constructors

---
 DDRec/include/DDRec/CellIDPositionConverter.h | 2 +-
 DDRec/include/DDRec/MaterialScan.h            | 4 ++--
 DDRec/include/DDRec/SurfaceManager.h          | 4 ++--
 DDRec/src/MaterialScan.cpp                    | 2 +-
 DDRec/src/SurfaceManager.cpp                  | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/DDRec/include/DDRec/CellIDPositionConverter.h b/DDRec/include/DDRec/CellIDPositionConverter.h
index 5a9b2fbc5..7aace1d09 100644
--- a/DDRec/include/DDRec/CellIDPositionConverter.h
+++ b/DDRec/include/DDRec/CellIDPositionConverter.h
@@ -48,7 +48,7 @@ namespace dd4hep {
     public:
       
       /// The constructor - takes the main description object.
-      CellIDPositionConverter( Detector& description ) : _description( &description )  {
+      CellIDPositionConverter(const Detector& description ) : _description( &description )  {
         _volumeManager = VolumeManager::getVolumeManager(description);
       }
 
diff --git a/DDRec/include/DDRec/MaterialScan.h b/DDRec/include/DDRec/MaterialScan.h
index 512619026..31dc4ebc5 100644
--- a/DDRec/include/DDRec/MaterialScan.h
+++ b/DDRec/include/DDRec/MaterialScan.h
@@ -53,7 +53,7 @@ namespace dd4hep {
     private:
       
       /// Reference to detector setup
-      Detector&                        m_detector;
+      const Detector&                  m_detector;
       /// Material manager
       std::unique_ptr<MaterialManager> m_materialMgr;  //!
       /// Local cache: subdetector placements
@@ -64,7 +64,7 @@ namespace dd4hep {
     public:
 
       /// Standard constructor for the master instance
-      MaterialScan(Detector& description);
+      MaterialScan(const Detector& description);
 
       /// Default destructor
       virtual ~MaterialScan();
diff --git a/DDRec/include/DDRec/SurfaceManager.h b/DDRec/include/DDRec/SurfaceManager.h
index 227645725..eb6d5b210 100644
--- a/DDRec/include/DDRec/SurfaceManager.h
+++ b/DDRec/include/DDRec/SurfaceManager.h
@@ -38,7 +38,7 @@ namespace dd4hep {
 
     public:
       /// The constructor
-      SurfaceManager(Detector& theDetector);
+      SurfaceManager(const Detector& theDetector);
 
       /// No default constructor
 #if defined(G__ROOT)
@@ -69,7 +69,7 @@ namespace dd4hep {
 
 
       /// initialize all known surface maps
-      void initialize(Detector& theDetector) ;
+      void initialize(const Detector& theDetector) ;
 
       SurfaceMapsMap _map ;
     };
diff --git a/DDRec/src/MaterialScan.cpp b/DDRec/src/MaterialScan.cpp
index d2969755c..cf1e7849e 100644
--- a/DDRec/src/MaterialScan.cpp
+++ b/DDRec/src/MaterialScan.cpp
@@ -35,7 +35,7 @@ MaterialScan::MaterialScan()
 }
 
 /// Default constructor
-MaterialScan::MaterialScan(Detector& description)
+MaterialScan::MaterialScan(const Detector& description)
   : m_detector(description)
 {
   m_materialMgr.reset(new MaterialManager(m_detector.world().volume()));
diff --git a/DDRec/src/SurfaceManager.cpp b/DDRec/src/SurfaceManager.cpp
index fd83a4d08..2576ebb41 100644
--- a/DDRec/src/SurfaceManager.cpp
+++ b/DDRec/src/SurfaceManager.cpp
@@ -25,7 +25,7 @@ namespace dd4hep {
   namespace rec {
     
 
-    SurfaceManager::SurfaceManager(Detector& theDetector){
+    SurfaceManager::SurfaceManager(const Detector& theDetector){
 
       // have to make sure the volume manager is populated once in order to have
       // the volumeIDs attached to the DetElements
@@ -52,7 +52,7 @@ namespace dd4hep {
       return 0 ;
     }
 
-    void SurfaceManager::initialize(Detector& description) {
+    void SurfaceManager::initialize(const Detector& description) {
       
       const std::vector<std::string>& types = description.detectorTypes() ;
 
-- 
GitLab