From 0422d4e91a1b3876ea6ed8153a345658126d22a3 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Wed, 8 Jun 2022 10:37:32 +0200
Subject: [PATCH] TileGeoModel+TileAncillary: make MaterialManager non-const

Adapt to interface changes of `StoredMaterialManager`.
---
 .../CombinedScintillator/src/CombinedScintillatorTool.cc     | 5 ++---
 .../TileAncillary/DeadMaterial/src/DeadMaterialTool.cxx      | 3 +--
 .../TileG4/TileAncillary/LarCrate/src/LArCrateTool.cxx       | 5 ++---
 .../TileG4/TileAncillary/MuonWall/src/MuonWallTool.cxx       | 2 +-
 .../PhantomCalorimeter/src/PhantomBarrelTool.cc              | 3 +--
 TileCalorimeter/TileGeoModel/src/TileAtlasFactory.cxx        | 2 +-
 TileCalorimeter/TileGeoModel/src/TileDetectorFactory.cxx     | 2 +-
 TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.cxx       | 2 +-
 TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.h         | 2 +-
 TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.cxx   | 2 +-
 TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.h     | 4 ++--
 TileCalorimeter/TileGeoModel/src/TileTBFactory.cxx           | 2 +-
 12 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/src/CombinedScintillatorTool.cc b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/src/CombinedScintillatorTool.cc
index bd03a89697e5..d74a41269629 100644
--- a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/src/CombinedScintillatorTool.cc
+++ b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/src/CombinedScintillatorTool.cc
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //class header
@@ -9,7 +9,6 @@
 #include "GeoModelInterfaces/StoredMaterialManager.h"
 #include "GeoModelKernel/GeoMaterial.h"
 #include "GeoMaterial2G4/Geo2G4MaterialFactory.h"
-#include "StoreGate/DataHandle.h"
 
 // Geant4 headers
 #include "G4LogicalVolume.hh"
@@ -53,7 +52,7 @@ void CombinedScintillatorTool::BuildGeometry() {
 
   G4Tubs* sci_mother = new G4Tubs("CScintillatorLayer", m_rMin, m_rMax, m_dzSci, phi1 * CLHEP::deg, dphi * CLHEP::deg);
   // Get the materials
-  const DataHandle<StoredMaterialManager> materialManager;
+  StoredMaterialManager* materialManager = nullptr;
   if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS"))) {
     //FIXME should probably at least print an ERROR here...
     return;
diff --git a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/src/DeadMaterialTool.cxx b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/src/DeadMaterialTool.cxx
index f23a00d4945a..b236448cee4c 100644
--- a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/src/DeadMaterialTool.cxx
+++ b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/src/DeadMaterialTool.cxx
@@ -9,7 +9,6 @@
 #include "GeoModelInterfaces/StoredMaterialManager.h"
 #include "GeoModelKernel/GeoMaterial.h"
 #include "GeoMaterial2G4/Geo2G4MaterialFactory.h"
-#include "StoreGate/DataHandle.h"
 
 // Geant4 headers
 #include "G4Box.hh"
@@ -50,7 +49,7 @@ void DeadMaterialTool::BuildGeometry()
   G4Box *wall = new G4Box("DeadMaterial",dxdeadmaterial,dydeadmaterial,dzdeadmaterial);
 
   // Get the materials
-  const DataHandle<StoredMaterialManager> materialManager;
+  StoredMaterialManager* materialManager = nullptr;
   if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS")))
     {
       //FIXME should probably at least print an ERROR here...
diff --git a/TileCalorimeter/TileG4/TileAncillary/LarCrate/src/LArCrateTool.cxx b/TileCalorimeter/TileG4/TileAncillary/LarCrate/src/LArCrateTool.cxx
index d2fad03748e6..25055bf3c13e 100644
--- a/TileCalorimeter/TileG4/TileAncillary/LarCrate/src/LArCrateTool.cxx
+++ b/TileCalorimeter/TileG4/TileAncillary/LarCrate/src/LArCrateTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //class header
@@ -9,7 +9,6 @@
 #include "GeoModelInterfaces/StoredMaterialManager.h"
 #include "GeoModelKernel/GeoMaterial.h"
 #include "GeoMaterial2G4/Geo2G4MaterialFactory.h"
-#include "StoreGate/DataHandle.h"
 
 // Geant4 headers
 #include "G4Box.hh"
@@ -43,7 +42,7 @@ void LArCrateTool::BuildGeometry()
   G4Box *emptybox = new G4Box("Crate",dxCrate,dyCrate,dzCrate);
 
   // Get the materials
-  const DataHandle<StoredMaterialManager> materialManager;
+  StoredMaterialManager* materialManager = nullptr;
   if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS")))
     {
       //FIXME should probably at least print an ERROR here...
diff --git a/TileCalorimeter/TileG4/TileAncillary/MuonWall/src/MuonWallTool.cxx b/TileCalorimeter/TileG4/TileAncillary/MuonWall/src/MuonWallTool.cxx
index 7e29017e54d0..89007671954b 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MuonWall/src/MuonWallTool.cxx
+++ b/TileCalorimeter/TileG4/TileAncillary/MuonWall/src/MuonWallTool.cxx
@@ -71,7 +71,7 @@ void MuonWallTool::BuildGeometry() {
   G4Box *wall = new G4Box("MuonWall", dxmuonwall, dymuonwall, dzmuonwall);
 
   // Get the materials
-  const StoredMaterialManager* materialManager = nullptr;
+  StoredMaterialManager* materialManager = nullptr;
   if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS"))) {
     ATH_MSG_ERROR( "Could not find Material Manager MATERIALS" );
     return;
diff --git a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/src/PhantomBarrelTool.cc b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/src/PhantomBarrelTool.cc
index ecb6e9e48e7b..26d016b6893d 100644
--- a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/src/PhantomBarrelTool.cc
+++ b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/src/PhantomBarrelTool.cc
@@ -9,7 +9,6 @@
 #include "GeoModelInterfaces/StoredMaterialManager.h"
 #include "GeoModelKernel/GeoMaterial.h"
 #include "GeoMaterial2G4/Geo2G4MaterialFactory.h"
-#include "StoreGate/DataHandle.h"
 
 // Geant4 headers
 #include "G4Box.hh"
@@ -54,7 +53,7 @@ void PhantomBarrelTool::BuildGeometry() {
   G4Box *barrel = new G4Box("PhantomBarrel", dxBarrel, dyBarrelwithEnvelop, dzBarrelwithEnvelop);
 
   // Get the materials
-  const DataHandle<StoredMaterialManager> materialManager;
+  StoredMaterialManager* materialManager = nullptr;
   if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS"))) {
     //FIXME should probably at least print an ERROR here...
     return ;
diff --git a/TileCalorimeter/TileGeoModel/src/TileAtlasFactory.cxx b/TileCalorimeter/TileGeoModel/src/TileAtlasFactory.cxx
index 1128b2e99731..ccc7e03ec4fe 100755
--- a/TileCalorimeter/TileGeoModel/src/TileAtlasFactory.cxx
+++ b/TileCalorimeter/TileGeoModel/src/TileAtlasFactory.cxx
@@ -91,7 +91,7 @@ void TileAtlasFactory::create(GeoPhysVol *world)
   (*m_log) << MSG::INFO <<" Entering TileAtlasFactory::create()" << endmsg;
 
   // -------- -------- MATERIAL MANAGER -------- ----------
-  const StoredMaterialManager* theMaterialManager = nullptr;
+  StoredMaterialManager* theMaterialManager = nullptr;
   if (StatusCode::SUCCESS != m_detectorStore->retrieve(theMaterialManager, "MATERIALS")) 
   {  
     (*m_log) << MSG::ERROR << "Could not find Material Manager MATERIALS" << endmsg; 
diff --git a/TileCalorimeter/TileGeoModel/src/TileDetectorFactory.cxx b/TileCalorimeter/TileGeoModel/src/TileDetectorFactory.cxx
index 16af2d8b97f1..697a233431d0 100755
--- a/TileCalorimeter/TileGeoModel/src/TileDetectorFactory.cxx
+++ b/TileCalorimeter/TileGeoModel/src/TileDetectorFactory.cxx
@@ -76,7 +76,7 @@ void TileDetectorFactory::create(GeoPhysVol *world)
   int nregion = 0;
 
   // -------- -------- MATERIAL MANAGER -------- ----------
-  const StoredMaterialManager* theMaterialManager = nullptr;
+  StoredMaterialManager* theMaterialManager = nullptr;
   if (StatusCode::SUCCESS != m_detectorStore->retrieve(theMaterialManager, "MATERIALS")) 
   { 
     (*m_log) << MSG::ERROR << "Could not find Material Manager MATERIALS" << endmsg; 
diff --git a/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.cxx b/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.cxx
index 2619391d1a57..2af93b987e01 100755
--- a/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.cxx
+++ b/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.cxx
@@ -33,7 +33,7 @@
 #include <iostream>
 #include <assert.h>
 
-TileGeoCutBuilder::TileGeoCutBuilder(const StoredMaterialManager* /*matManager*/,
+TileGeoCutBuilder::TileGeoCutBuilder(StoredMaterialManager* /*matManager*/,
 				     TileDddbManager * /*pDbManager*/,
                                      MsgStream * log)
   : m_log(log)
diff --git a/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.h b/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.h
index 8c76361438d1..210bc19edd04 100755
--- a/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.h
+++ b/TileCalorimeter/TileGeoModel/src/TileGeoCutBuilder.h
@@ -27,7 +27,7 @@ class TileGeoCutBuilder
 {
  public:
   /** Constructor */
-  TileGeoCutBuilder(const StoredMaterialManager* matManager,
+  TileGeoCutBuilder(StoredMaterialManager* matManager,
                     TileDddbManager* pDbManager,
                     MsgStream * log);
 
diff --git a/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.cxx b/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.cxx
index 5faaef4bc925..ef3278875072 100755
--- a/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.cxx
+++ b/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.cxx
@@ -50,7 +50,7 @@
 using namespace GeoGenfun;
 using namespace GeoXF;
   
-TileGeoSectionBuilder::TileGeoSectionBuilder(const StoredMaterialManager* matManager,
+TileGeoSectionBuilder::TileGeoSectionBuilder(StoredMaterialManager* matManager,
                          TileDddbManager * pDbManager,
                                              const TileSwitches & switches,
                                              MsgStream * log)
diff --git a/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.h b/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.h
index 2ec0667e042a..d9a4d992acc6 100755
--- a/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.h
+++ b/TileCalorimeter/TileGeoModel/src/TileGeoSectionBuilder.h
@@ -36,7 +36,7 @@ class TileGeoSectionBuilder
 {
  public:
   /** Constructor */
-  TileGeoSectionBuilder(const StoredMaterialManager* matManager,
+  TileGeoSectionBuilder(StoredMaterialManager* matManager,
                         TileDddbManager* pDbManager,
                         const TileSwitches & switches,
                         MsgStream * log);
@@ -183,7 +183,7 @@ class TileGeoSectionBuilder
 
  private:
 
-  const StoredMaterialManager*          m_theMaterialManager;
+  StoredMaterialManager*                m_theMaterialManager;
   TileDddbManager *                     m_dbManager;
   MsgStream *                           m_log;
 
diff --git a/TileCalorimeter/TileGeoModel/src/TileTBFactory.cxx b/TileCalorimeter/TileGeoModel/src/TileTBFactory.cxx
index 5af0c8fc7a31..15e1e8bbbd95 100755
--- a/TileCalorimeter/TileGeoModel/src/TileTBFactory.cxx
+++ b/TileCalorimeter/TileGeoModel/src/TileTBFactory.cxx
@@ -67,7 +67,7 @@ void TileTBFactory::create(GeoPhysVol *world)
   (*m_log) << MSG::INFO <<" Entering TileTBFactory::create()" << endmsg;
 
   // -------- -------- MATERIAL MANAGER -------- ----------
-  const StoredMaterialManager* theMaterialManager = nullptr;
+  StoredMaterialManager* theMaterialManager = nullptr;
   if (StatusCode::SUCCESS != m_detectorStore->retrieve(theMaterialManager, "MATERIALS")) 
   { 
     (*m_log) << MSG::ERROR << "Could not find Material Manager MATERIALS" << endmsg; 
-- 
GitLab