From f03689f8f6898bb8c3e8f27ee2b3c58e07ecf2c5 Mon Sep 17 00:00:00 2001
From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch>
Date: Thu, 24 Aug 2023 14:59:33 +0200
Subject: [PATCH] Update World volume interface

---
 FullSimLight/include/FSLDetectorConstruction.hh  |  3 ++-
 FullSimLight/include/MassCalculator.hh           |  2 +-
 FullSimLight/src/FSLDetectorConstruction.cc      |  4 ++--
 FullSimLight/src/MassCalculator.cc               |  2 +-
 .../GeoModelKernel/GeoVGeometryPlugin.h          |  4 ++--
 GeoModelTools/GDMLtoGM/src/GDMLtoGM.cxx          |  4 ++--
 GeoModelTools/GMCAT/src/gmcat.cxx                |  4 ++--
 .../GeoModelXML/GMXPlugin/src/GMXPlugin.cxx      |  6 +++---
 .../VP1GeometrySystems/src/VP1GeometrySystem.cxx | 16 ++++++++--------
 9 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/FullSimLight/include/FSLDetectorConstruction.hh b/FullSimLight/include/FSLDetectorConstruction.hh
index 2da0c439f..3eff8593f 100644
--- a/FullSimLight/include/FSLDetectorConstruction.hh
+++ b/FullSimLight/include/FSLDetectorConstruction.hh
@@ -2,6 +2,7 @@
 #ifndef FSLDetectorConstruction_h
 #define FSLDetectorConstruction_h 1
 
+#include "GeoModelKernel/GeoVPhysVol.h"
 #include "G4VUserDetectorConstruction.hh"
 
 #include "G4GDMLParser.hh"
@@ -86,7 +87,7 @@ public:
   static G4double GetFieldValue() { return gFieldValue; }
   G4double GetTolerance (){return fTolerance;}
 
-  GeoPhysVol* CreateTheWorld(GeoPhysVol* world);
+  GeoVPhysVol* CreateTheWorld(GeoVPhysVol* world);
 
   /// Clean the geometry  from Unidentified volumes before dumping it in GDML format
   void PullUnidentifiedVolumes( G4LogicalVolume* v );
diff --git a/FullSimLight/include/MassCalculator.hh b/FullSimLight/include/MassCalculator.hh
index 249c84b9f..11d07b235 100644
--- a/FullSimLight/include/MassCalculator.hh
+++ b/FullSimLight/include/MassCalculator.hh
@@ -44,7 +44,7 @@ public:
     double inclusiveMass(const PVConstLink& pv);
     void calculateMass(G4LogicalVolume* logVol, G4VPhysicalVolume * physVol, std::vector<json>& jlist, double& exclusiveMass, bool writeRep);
     void iterateFromWorldMass(G4LogicalVolume* logVolume, std::vector<json>& jlist, double& inclusiveMass, double& exclusiveMass, G4String prefix, G4String material);
-    void recursiveMassCalculation (G4VPhysicalVolume* worldg4, GeoPhysVol* /*worldgeoModel*/, std::vector<json>& jlist);
+    void recursiveMassCalculation (G4VPhysicalVolume* worldg4, GeoVPhysVol* /*worldgeoModel*/, std::vector<json>& jlist);
     void SetPrefixLogicalVolume(const G4String &prefixLV) { fPrefixLogicalVolume = prefixLV; }
     void SetMaterial(const G4String &material) { fMaterial = material; }
     void SetVerbosity(const int verbosity){ fVerbosityFlag = verbosity; }
diff --git a/FullSimLight/src/FSLDetectorConstruction.cc b/FullSimLight/src/FSLDetectorConstruction.cc
index 904d3e096..b835b761c 100644
--- a/FullSimLight/src/FSLDetectorConstruction.cc
+++ b/FullSimLight/src/FSLDetectorConstruction.cc
@@ -108,7 +108,7 @@ FSLDetectorConstruction::~FSLDetectorConstruction()
   delete fDetectorMessenger;
 }
 
-GeoPhysVol*  FSLDetectorConstruction::CreateTheWorld(GeoPhysVol* world)
+GeoVPhysVol*  FSLDetectorConstruction::CreateTheWorld(GeoVPhysVol* world)
 {
     if (world == nullptr)
     {
@@ -139,7 +139,7 @@ G4VPhysicalVolume *FSLDetectorConstruction::Construct()
 {
     fTimer.Start();
 
-    GeoPhysVol* world = nullptr;
+    GeoVPhysVol* world = nullptr;
     G4LogicalVolume* envelope;
     if (fGeometryFileName.contains(".dylib") || fGeometryFileName.contains(".so"))
     {
diff --git a/FullSimLight/src/MassCalculator.cc b/FullSimLight/src/MassCalculator.cc
index b5e491fc6..edf495781 100644
--- a/FullSimLight/src/MassCalculator.cc
+++ b/FullSimLight/src/MassCalculator.cc
@@ -222,7 +222,7 @@ void MassCalculator::iterateFromWorldMass(G4LogicalVolume* logVolume, std::vecto
     
 }
 
-void MassCalculator::recursiveMassCalculation (G4VPhysicalVolume* worldg4, GeoPhysVol* /*worldgeoModel*/, std::vector<json>& jlist){
+void MassCalculator::recursiveMassCalculation (G4VPhysicalVolume* worldg4, GeoVPhysVol* /*worldgeoModel*/, std::vector<json>& jlist){
     
     masscalc::massReport singleMassReport;
     json jSingleMassReport;
diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVGeometryPlugin.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVGeometryPlugin.h
index b2c29a636..ec9b5aa56 100644
--- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVGeometryPlugin.h
+++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVGeometryPlugin.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef GEOMODELKERNEL_GEOVGEOMETRYPLUGIN_H
@@ -33,7 +33,7 @@ class GeoVGeometryPlugin
 
   //! Create the system geometry.
   /// Note: this is a pure virtual method, so you need to implement it in your derived plugin class
-  virtual void create ( GeoPhysVol* world, bool publish = false ) = 0;
+  virtual void create ( GeoVPhysVol* world, bool publish = false ) = 0;
 
   //! Returns the plugin's name
   std::string getName() { return m_pluginName; }
diff --git a/GeoModelTools/GDMLtoGM/src/GDMLtoGM.cxx b/GeoModelTools/GDMLtoGM/src/GDMLtoGM.cxx
index 4530b696d..e27c4ff5e 100644
--- a/GeoModelTools/GDMLtoGM/src/GDMLtoGM.cxx
+++ b/GeoModelTools/GDMLtoGM/src/GDMLtoGM.cxx
@@ -31,7 +31,7 @@ class GDMLtoGM : public GeoVGeometryPlugin  {
   ~GDMLtoGM();
 
   // Creation of geometry:
-  virtual void create(GeoPhysVol *world, bool publish = false ) override;
+  virtual void create(GeoVPhysVol *world, bool publish = false ) override;
 
  private:
 
@@ -48,7 +48,7 @@ GDMLtoGM::~GDMLtoGM()
 
 
 //## Other Operations (implementation)
-void GDMLtoGM::create(GeoPhysVol *world, bool /* 'publish' is not used here */)
+void GDMLtoGM::create(GeoVPhysVol *world, bool /* 'publish' is not used here */)
 {
 	char* fPath=getenv("GDML_FILE_NAME");
 	std::string fileName;
diff --git a/GeoModelTools/GMCAT/src/gmcat.cxx b/GeoModelTools/GMCAT/src/gmcat.cxx
index f2d37bbaa..d6d68e5ce 100644
--- a/GeoModelTools/GMCAT/src/gmcat.cxx
+++ b/GeoModelTools/GMCAT/src/gmcat.cxx
@@ -1,5 +1,5 @@
 /*
- *   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration   
+ *   Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration   
 */
 
 #include "GeoModelKernel/GeoVGeometryPlugin.h"
@@ -210,7 +210,7 @@ int main(int argc, char ** argv) {
     GeoModelIO::ReadGeoModel readInGeo = GeoModelIO::ReadGeoModel(db);
 
     /* build the GeoModel geometry */
-    GeoPhysVol* dbPhys = readInGeo.buildGeoModel(); // builds the whole GeoModel tree in memory
+    GeoVPhysVol* dbPhys = readInGeo.buildGeoModel(); // builds the whole GeoModel tree in memory
 
     /* get an handle on a Volume Cursor, to traverse the whole set of Volumes */
     GeoVolumeCursor aV(dbPhys);
diff --git a/GeoModelTools/GeoModelXML/GMXPlugin/src/GMXPlugin.cxx b/GeoModelTools/GeoModelXML/GMXPlugin/src/GMXPlugin.cxx
index f04800be9..9aea24799 100644
--- a/GeoModelTools/GeoModelXML/GMXPlugin/src/GMXPlugin.cxx
+++ b/GeoModelTools/GeoModelXML/GMXPlugin/src/GMXPlugin.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 
@@ -32,7 +32,7 @@ class GMXPlugin : public GeoVGeometryPlugin  {
   ~GMXPlugin();
 
   // Creation of geometry:
-  virtual void create(GeoPhysVol *world, bool publish) override;
+  virtual void create(GeoVPhysVol *world, bool publish) override;
 
  private:
 
@@ -79,7 +79,7 @@ GMXPlugin::~GMXPlugin()
 
 
 //## Other Operations (implementation)
-void GMXPlugin::create(GeoPhysVol *world, bool publish)
+void GMXPlugin::create(GeoVPhysVol *world, bool publish)
 {  
   std::cout<< "This is GMXPlugin: creating a GeoModelXml detector "<<std::endl;
   std::vector<std::string> filesToParse;
diff --git a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx
index b6b1d0f9a..db261694c 100644
--- a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx
+++ b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx
@@ -127,9 +127,9 @@ public:
   std::map<SoSeparator*,VolumeHandle*> sonodesep2volhandle;
   //Might be needed later:  std::map<GeoPVConstLink,VolumeHandle*> pv2volhandle;
 
-  GeoPhysVol* getGeometry();
-  GeoPhysVol* createTheWorld(GeoPhysVol* world = nullptr);
-  GeoPhysVol* getGeometryFromLocalDB();
+  GeoVPhysVol* getGeometry();
+  GeoVPhysVol* createTheWorld(GeoVPhysVol* world = nullptr);
+  GeoVPhysVol* getGeometryFromLocalDB();
 
   SoTexture2* getDummyTexture();
   SoMaterial* getDummyMaterial();
@@ -496,13 +496,13 @@ void VP1GeometrySystem::buildPermanentSceneGraph(StoreGateSvc*/*detstore*/, SoSe
 }
 
 //_____________________________________________________________________________________
-GeoPhysVol* VP1GeometrySystem::Imp::getGeometry()
+GeoVPhysVol* VP1GeometrySystem::Imp::getGeometry()
 {
   return getGeometryFromLocalDB(); // for production
 }
 
 //_____________________________________________________________________________________
-GeoPhysVol* VP1GeometrySystem::Imp::createTheWorld(GeoPhysVol* world)
+GeoVPhysVol* VP1GeometrySystem::Imp::createTheWorld(GeoVPhysVol* world)
 {
   if (world == nullptr)
   {
@@ -529,7 +529,7 @@ QString VP1GeometrySystem::Imp::selectGeometryFile() {
 }
 
 //_____________________________________________________________________________________
-GeoPhysVol* VP1GeometrySystem::Imp::getGeometryFromLocalDB()
+GeoVPhysVol* VP1GeometrySystem::Imp::getGeometryFromLocalDB()
 {
 
   QString path;
@@ -554,7 +554,7 @@ GeoPhysVol* VP1GeometrySystem::Imp::getGeometryFromLocalDB()
 
   if (path=="") return nullptr;
 
-  GeoPhysVol *world=getenv("GX_GEOMETRY_FILE1") ? createTheWorld(nullptr) : nullptr;
+  GeoVPhysVol *world=getenv("GX_GEOMETRY_FILE1") ? createTheWorld(nullptr) : nullptr;
 
   int g=0;
   while (path!="") {
@@ -572,7 +572,7 @@ GeoPhysVol* VP1GeometrySystem::Imp::getGeometryFromLocalDB()
       GeoModelIO::ReadGeoModel readInGeo = GeoModelIO::ReadGeoModel(db);
 
       /* build the GeoModel geometry */
-      GeoPhysVol* dbPhys = readInGeo.buildGeoModel(); // builds the whole GeoModel tree in memory
+      GeoVPhysVol* dbPhys = readInGeo.buildGeoModel(); // builds the whole GeoModel tree in memory
 
       if (world) {
 
-- 
GitLab