From 1a2748037caabd6be672b17c1c12508a50b1c1f9 Mon Sep 17 00:00:00 2001
From: scott snyder <scott.snyder@cern.ch>
Date: Tue, 27 Nov 2018 15:36:47 +0100
Subject: [PATCH] MuonAGDDBase: Avoid use of non-bound DataHandle.

Deprecating use of non-bound DataHandle, especially non-const.
Also adding const for materials.


Former-commit-id: cb10917a694ae3f9c82bd6f22cecbf9b97841675
---
 .../MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h  |  4 +---
 .../MuonAGDDBase/AGDDMuonStation.h            |  4 ++--
 .../MuonAGDDBase/src/AGDDMMSpacer.cxx         | 19 +------------------
 .../MuonAGDDBase/src/AGDDMuonStation.cxx      |  8 ++++----
 4 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h
index 3d585c25661..125029ef54b 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMMSpacer.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef AGDDMMSpacer_H
@@ -38,8 +38,6 @@ private:
 	double m_large_x;
 	double m_y;
 	double m_z;
-	
-	GeoMaterial* GetMMMaterial(std::string);
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h
index 2c8249903dd..5525ac8000f 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/MuonAGDDBase/AGDDMuonStation.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef AGDDMuonStation_H
@@ -38,7 +38,7 @@ private:
 	double m_y;
 	double m_z;
 	
-	GeoMaterial* GetMMMaterial(std::string);
+        const GeoMaterial* GetMMMaterial(std::string);
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx
index e75edb27a1e..dc8312d152e 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMMSpacer.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -47,20 +47,3 @@ void AGDDMMSpacer::CreateVolume()
 //		std::cout<<"done creating volume "<<std::endl;
 	}
 }
-
-GeoMaterial* AGDDMMSpacer::GetMMMaterial(std::string name)
-{
-	StoreGateSvc* pDetStore=0;
-	ISvcLocator* svcLocator = Gaudi::svcLocator();
-	StatusCode sc=svcLocator->service("DetectorStore",pDetStore);
-	if(sc.isSuccess())
-	{
-		DataHandle<StoredMaterialManager> theMaterialManager;
-		sc = pDetStore->retrieve(theMaterialManager, "MATERIALS");
-		if(sc.isSuccess())
-        {
-			return theMaterialManager->getMaterial(name);
-        }
-	}
-	return 0;
-}
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx
index 9660320df17..c33b93bbf26 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMuonStation.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -33,7 +33,7 @@ void AGDDMuonStation::CreateVolume()
 {
     std::cout<<"this is AGDDMuonStation::CreateVolume()"<<std::endl;
 	static int ifirst=1;
-	static GeoMaterial* air=0;
+	static const GeoMaterial* air=0;
 	if (ifirst)
 	{
 		ifirst=0;
@@ -55,14 +55,14 @@ void AGDDMuonStation::CreateVolume()
 	}
 }
 
-GeoMaterial* AGDDMuonStation::GetMMMaterial(std::string name)
+const GeoMaterial* AGDDMuonStation::GetMMMaterial(std::string name)
 {
 	StoreGateSvc* pDetStore=0;
 	ISvcLocator* svcLocator = Gaudi::svcLocator();
 	StatusCode sc=svcLocator->service("DetectorStore",pDetStore);
 	if(sc.isSuccess())
 	{
-		DataHandle<StoredMaterialManager> theMaterialManager;
+                const StoredMaterialManager* theMaterialManager = nullptr;
 		sc = pDetStore->retrieve(theMaterialManager, "MATERIALS");
 		if(sc.isSuccess())
         {
-- 
GitLab