From 9a2bffc1d80b1210be47885a46babb8a5985e105 Mon Sep 17 00:00:00 2001
From: Dave Casper <dcasper@uci.edu>
Date: Wed, 8 May 2024 13:24:09 -0700
Subject: [PATCH] Simulation writing legible output(?)

---
 CMakeLists.txt                                |  1 +
 .../G4FaserAlg/python/G4FaserAlgConfig.py     | 45 +++++++++++++++----
 .../G4Faser/G4FaserAlg/src/G4FaserAlg.cxx     | 10 ++---
 .../G4FaserAlg/test/G4FaserAlgConfig_Test.py  | 29 +++++++++---
 .../G4FaserAlg/test/runGeantinoScan.py        |  2 +-
 Simulation/G4Faser/G4FaserAlg/test/runGen.py  |  2 +-
 .../python/G4FaserServicesConfig.py           |  2 +-
 .../src/G4FaserGeometryNotifierSvc.cxx        | 38 ++++++++++++++++
 .../src/G4FaserGeometryNotifierSvc.h          | 39 ++++++++++++++++
 .../G4FaserServices/src/LVNotifier.cxx        | 29 ++++++++++++
 .../G4Faser/G4FaserServices/src/LVNotifier.h  | 31 +++++++++++++
 .../G4FaserServices/src/PVNotifier.cxx        | 33 ++++++++++++++
 .../G4Faser/G4FaserServices/src/PVNotifier.h  | 32 +++++++++++++
 .../components/G4FaserServices_entries.cxx    |  4 +-
 .../python/G4GeometryToolConfig.py            |  4 +-
 15 files changed, 276 insertions(+), 25 deletions(-)
 create mode 100644 Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.cxx
 create mode 100644 Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.h
 create mode 100644 Simulation/G4Faser/G4FaserServices/src/LVNotifier.cxx
 create mode 100644 Simulation/G4Faser/G4FaserServices/src/LVNotifier.h
 create mode 100644 Simulation/G4Faser/G4FaserServices/src/PVNotifier.cxx
 create mode 100644 Simulation/G4Faser/G4FaserServices/src/PVNotifier.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03794e536..3a4d34c4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ set( ATLAS_PROJECT Athena
 find_package( Athena )
 
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+set(ATLAS_GEANT4_USE_LTO OFF)
 
 atlas_ctest_setup()
 
diff --git a/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py b/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py
index 7b1e41627..902141fad 100644
--- a/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py
+++ b/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py
@@ -98,23 +98,52 @@ def G4FaserAlgBasicCfg(ConfigFlags, name="G4FaserAlg", **kwargs):
 
     # Set commands for the G4AtlasAlg
     kwargs.setdefault("G4Commands", ConfigFlags.Sim.G4Commands)
+    kwargs.setdefault("ExtraOutputs", SimHitContainerListCfg(ConfigFlags))
 
     result.addEventAlgo(CompFactory.G4FaserAlg(name, **kwargs))
 
     return result
 
 
-def G4FaserAlgOutputCfg(ConfigFlags):
+def SimHitContainerListCfg(flags):
+    extraOutput = []
+    if flags.Detector.EnableEmulsion:
+        extraOutput += [("NeutrinoHitCollection","EmulsionHits")]
+
+    if flags.Detector.EnableFaserSCT:
+        extraOutput += [("FaserSiHitCollection","SCT_Hits")]
+
+    if flags.Detector.EnableEcal:
+        extraOutput += [("CaloHitCollection","EcalHits")]
+
+    if flags.Detector.EnableVeto:
+        extraOutput += [("ScintHitCollection","VetoHits")]
+
+    if flags.Detector.EnableVetoNu:
+        extraOutput += [("ScintHitCollection","VetoNuHits")]
+
+    if flags.Detector.EnableTrigger:
+        extraOutput += [("ScintHitCollection","TriggerHits")]
+
+    if flags.Detector.EnablePreshower:
+        extraOutput += [("ScintHitCollection","PreshowerHits")]
+    return extraOutput
+
+
+
+def getG4FaserAlgItemList(ConfigFlags):
     """
     Return ComponentAccumulator with output for G4 simulation. Not standalone.
 
     follows G4Atlas.flat.configuration.py
     """
-    ItemList = ["EventInfo#*",
+    ItemList = ["xAOD::EventInfo#*",
+                "xAOD::EventAuxInfo#EventInfoAux.",
                 "McEventCollection#TruthEvent"]
 
     if ConfigFlags.Sim.IncludeParentsInG4Event:
         ItemList += ["McEventCollection#BeamTruthEvent"]
+        ItemList += ["McEventCollection#GEN_EVENT"]
 
     if ConfigFlags.Detector.EnableEmulsion:
         ItemList += ["NeutrinoHitCollection#*"]
@@ -140,11 +169,11 @@ def G4FaserAlgOutputCfg(ConfigFlags):
     # TimingAlg
     # ItemList += ["RecoTimingObj#EVNTtoHITS_timings"]
 
-    acc = OutputStreamCfg(ConfigFlags,"HITS", ItemList=ItemList, disableEventTag=True)
+    # acc = OutputStreamCfg(ConfigFlags,"HITS", ItemList=ItemList, disableEventTag=True)
 
-    # Make stream aware of aborted events
-    OutputStreamHITS = acc.getEventAlgo(outputStreamName("HITS"))
-    OutputStreamHITS.AcceptAlgs += ["G4FaserAlg"]
+    # # Make stream aware of aborted events
+    # OutputStreamHITS = acc.getEventAlgo(outputStreamName("HITS"))
+    # OutputStreamHITS.AcceptAlgs += ["G4FaserAlg"]
 
     # G4Atlas.flat.configuration.py#0333 onwards
     # FIXME unifyset now fails
@@ -152,11 +181,11 @@ def G4FaserAlgOutputCfg(ConfigFlags):
     #PoolAttributes += ["DatabaseName = '" + ConfigFlags.Output.HITSFileName + "'; ContainerName = 'TTree=CollectionTree'; TREE_AUTO_FLUSH = '1'"]
     #acc.addService(CompFactory.AthenaPoolCnvSvc(PoolAttributes=PoolAttributes))
 
-    return acc
+    # return acc
+    return ItemList
 
 
 def G4FaserAlgCfg(ConfigFlags, name="G4FaserAlg", **kwargs):
     """Return ComponentAccumulator configured for Faser G4 simulation, with output"""
     acc = G4FaserAlgBasicCfg(ConfigFlags, **kwargs)
-    acc.merge(G4FaserAlgOutputCfg(ConfigFlags))
     return acc
diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx
index d47d6f0fa..d030b9b0a 100644
--- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx
+++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx
@@ -105,11 +105,11 @@ StatusCode G4FaserAlg::initialize()
 
   ATH_CHECK(m_inputConverter.retrieve());
 
-  G4LogicalVolumeStore* logicalVolumeStore = G4LogicalVolumeStore::GetInstance();
-  for (auto* ilv : *logicalVolumeStore ) 
-  {
-    ATH_MSG_ALWAYS("Found logical volume " << ilv->GetName());
-  }
+  // G4LogicalVolumeStore* logicalVolumeStore = G4LogicalVolumeStore::GetInstance();
+  // for (auto* ilv : *logicalVolumeStore ) 
+  // {
+  //   ATH_MSG_ALWAYS("Found logical volume " << ilv->GetName());
+  // }
 
 
   ATH_MSG_DEBUG("End of initialize()");
diff --git a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py
index fcce333de..677452f7b 100755
--- a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py
+++ b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py
@@ -31,11 +31,13 @@ if __name__ == '__main__':
 #
 # All these must be specified to avoid auto-configuration
 #
-    configFlags.Input.RunNumbers = [1000001] #Isn't updating - todo: investigate
+    configFlags.Input.RunNumbers = [1000001]
     configFlags.Input.OverrideRunNumber = True
     configFlags.Input.LumiBlockNumbers = [1]
     configFlags.Input.isMC = True
     configFlags.Input.MCCampaign = Campaign.Unknown
+    configFlags.Input.TypedCollections = []
+    configFlags.Input.MetadataItems = []
     configFlags.Beam.Type = BeamType.Collisions
 #
 # Output file name
@@ -178,9 +180,8 @@ if __name__ == '__main__':
 #
 # Output file
 #
-    from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
-    cfg.merge(PoolWriteCfg(configFlags))
-
+    # from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
+    # cfg.merge(PoolWriteCfg(configFlags))
 # #
 # # Shift LOS (original version where the configuration tool handled the AlgSequence)
 # #
@@ -193,12 +194,29 @@ if __name__ == '__main__':
 #                               xcross = configFlags.Sim.Beam.xangle, ycross = configFlags.Sim.Beam.yangle,
 #                               xshift = configFlags.Sim.Beam.xshift, yshift = configFlags.Sim.Beam.yshift))
 
+
+    from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
+    cfg.merge(EventInfoCnvAlgCfg(configFlags, disableBeamSpot=True))
+
+
 #
 # Add the G4FaserAlg
 #
     from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg
     cfg.merge(G4FaserAlgCfg(configFlags))
 #
+# Output file
+#
+    AcceptAlgNames = ['G4FaserAlg']
+
+    from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
+    from G4FaserAlg.G4FaserAlgConfig import getG4FaserAlgItemList
+    cfg.merge(OutputStreamCfg(configFlags, "HITS", ItemList=getG4FaserAlgItemList(configFlags), disableEventTag=True, AcceptAlgs=AcceptAlgNames))
+    # Add in-file MetaData
+    from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
+    cfg.merge(SetupMetaDataForStreamCfg(configFlags, "HITS", AcceptAlgs=AcceptAlgNames))
+
+#
 # Uncomment to check volumes for overlap - will cause CTest to fail due to overwriting file
 #
 #    from G4DebuggingTools.G4DebuggingToolsConfigNew import VolumeDebugger
@@ -206,11 +224,12 @@ if __name__ == '__main__':
 #
 # Dump config
 #
-    cfg.getService("G4GeometryNotifierSvc").OutputLevel=VERBOSE
+    cfg.getService("G4FaserGeometryNotifierSvc").OutputLevel=VERBOSE
     from AthenaConfiguration.ComponentFactory import CompFactory
     cfg.addEventAlgo(CompFactory.JobOptsDumperAlg(FileName="G4FaserTestConfig.txt"))
     cfg.getService("StoreGateSvc").Dump = True
     cfg.getService("ConditionStore").Dump = True
+    cfg.getService("MetaDataStore").Dump = True
     cfg.printConfig(withDetails=True, summariseProps = False)  # gags on ParticleGun if summariseProps = True?
 
     configFlags.dump()
diff --git a/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py b/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py
index 1935a7057..1bdf3ed40 100644
--- a/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py
+++ b/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py
@@ -101,7 +101,7 @@ if __name__ == "__main__":
     acc.merge(FaserGeometryCfg(configFlags))
     acc.merge(UserActionMaterialStepRecorderSvcCfg(configFlags))
     acc.merge(G4FaserAlgCfg(configFlags))
-    acc.addService(G4GeometryNotifierSvcCfg(configFlags, ActivateLVNotifier=True))
+    acc.addService(G4FaserGeometryNotifierSvcCfg(configFlags, ActivateLVNotifier=True))
 #
 # Verbosity
 #
diff --git a/Simulation/G4Faser/G4FaserAlg/test/runGen.py b/Simulation/G4Faser/G4FaserAlg/test/runGen.py
index d963701f9..59f794416 100755
--- a/Simulation/G4Faser/G4FaserAlg/test/runGen.py
+++ b/Simulation/G4Faser/G4FaserAlg/test/runGen.py
@@ -107,7 +107,7 @@ if __name__ == "__main__":
 #    
 #    acc.merge(FaserGeometryCfg(configFlags))
 #    acc.merge(G4FaserAlgCfg(configFlags))
-#    acc.addService(G4GeometryNotifierSvcCfg(configFlags, ActivateLVNotifier=True))
+#    acc.addService(G4FaserGeometryNotifierSvcCfg(configFlags, ActivateLVNotifier=True))
 #
 # Verbosity
 #
diff --git a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py
index 60bce8d2d..ec76dcaa9 100644
--- a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py
+++ b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py
@@ -3,7 +3,7 @@ from __future__ import print_function
 from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 
-DetectorGeometrySvc, G4AtlasSvc, G4GeometryNotifierSvc, FaserPhysicsListSvc=CompFactory.getComps("DetectorGeometrySvc","G4AtlasSvc","G4GeometryNotifierSvc","FaserPhysicsListSvc",)
+DetectorGeometrySvc, G4AtlasSvc, G4FaserGeometryNotifierSvc, FaserPhysicsListSvc=CompFactory.getComps("DetectorGeometrySvc","G4AtlasSvc","G4FaserGeometryNotifierSvc","FaserPhysicsListSvc",)
 from G4FaserTools.G4GeometryToolConfig import G4AtlasDetectorConstructionToolCfg
 from G4StepLimitation.G4StepLimitationConfig import G4StepLimitationToolCfg
 from Pythia8Decayer.Pythia8DecayerConfigNew import Pythia8DecayerPhysicsToolCfg
diff --git a/Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.cxx b/Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.cxx
new file mode 100644
index 000000000..a52c84392
--- /dev/null
+++ b/Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.cxx
@@ -0,0 +1,38 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4FaserGeometryNotifierSvc.h"
+
+#include "PVNotifier.h"
+#include "LVNotifier.h"
+
+G4FaserGeometryNotifierSvc::G4FaserGeometryNotifierSvc( const std::string& name, ISvcLocator* pSvcLocator )
+  : base_class(name,pSvcLocator)
+{
+  ATH_MSG_DEBUG( "G4FaserGeometryNotifierSvc being created!" );
+}
+
+G4FaserGeometryNotifierSvc::~G4FaserGeometryNotifierSvc()
+{
+  if (lvNotifier) delete lvNotifier;
+  if (pvNotifier) delete pvNotifier;
+}
+
+StatusCode G4FaserGeometryNotifierSvc::initialize(){
+  if (m_activateLVNotifier || m_activatePVNotifier)
+    {
+      ATH_MSG_DEBUG( "Notifiers being instantiated " );
+      if (m_activateLVNotifier) lvNotifier=new LVNotifier(this);
+      if (m_activatePVNotifier) pvNotifier=new PVNotifier(this);
+    }
+
+  ATH_MSG_DEBUG( "G4FaserGeometryNotifierSvc initialized!!!" );
+  return StatusCode::SUCCESS;
+}
+
+StatusCode G4FaserGeometryNotifierSvc::finalize(){
+  ATH_MSG_DEBUG( "G4FaserGeometryNotifierSvc being finalized!!!" );
+  return StatusCode::SUCCESS;
+}
+
diff --git a/Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.h b/Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.h
new file mode 100644
index 000000000..39dcf4904
--- /dev/null
+++ b/Simulation/G4Faser/G4FaserServices/src/G4FaserGeometryNotifierSvc.h
@@ -0,0 +1,39 @@
+/*
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef G4FASERSERVICES_G4FASERGEOMETRYNOTIFIERSVC_H
+#define G4FASERSERVICES_G4FASERGEOMETRYNOTIFIERSVC_H
+
+// Base classes
+#include "AthenaBaseComps/AthService.h"
+#include "G4AtlasInterfaces/IG4GeometryNotifierSvc.h"
+
+class G4VNotifier;
+
+class G4FaserGeometryNotifierSvc : public extends<AthService, IG4GeometryNotifierSvc> {
+public:
+  // Standard constructor and destructor
+  G4FaserGeometryNotifierSvc( const std::string& name, ISvcLocator* pSvcLocator );
+  virtual ~G4FaserGeometryNotifierSvc();
+
+  // Gaudi methods
+  StatusCode initialize() override final;
+  StatusCode finalize() override final;
+
+  //FIXME This is a bit nasty as it is not thread-safe, but we assume
+  //that the geometry building will be done in a single thread.
+  void SetCurrentDetectorName(const std::string& s) override final {m_currentDetectorName=s;}
+  const std::string GetCurrentDetectorName() const override final {return m_currentDetectorName;}
+
+private:
+  std::string m_currentDetectorName{""};
+
+  Gaudi::Property<bool> m_activateLVNotifier{this, "ActivateLVNotifier", true, "Toggle on/off the G4 LV notifier"};
+  Gaudi::Property<bool> m_activatePVNotifier{this, "ActivatePVNotifier", false, "Toggle on/off the G4 PV notifier"};
+  G4VNotifier* lvNotifier{};
+  G4VNotifier* pvNotifier{};
+};
+
+#endif //G4FASERSERVICES_G4FASERGEOMETRYNOTIFIERSVC_H
+
diff --git a/Simulation/G4Faser/G4FaserServices/src/LVNotifier.cxx b/Simulation/G4Faser/G4FaserServices/src/LVNotifier.cxx
new file mode 100644
index 000000000..b12569c5e
--- /dev/null
+++ b/Simulation/G4Faser/G4FaserServices/src/LVNotifier.cxx
@@ -0,0 +1,29 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "LVNotifier.h"
+
+#include "G4LogicalVolumeStore.hh"
+#include "G4LogicalVolume.hh"
+
+#include "G4FaserGeometryNotifierSvc.h"
+
+LVNotifier::LVNotifier(G4FaserGeometryNotifierSvc* gs)
+  : m_notifierSvc(gs)
+{
+  G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance();
+  store->SetNotifier(this);
+}
+
+void LVNotifier::NotifyRegistration()
+{
+  G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance();
+  G4LogicalVolume* lV = store->back();
+//   std::cout << "LVNotifier:  " << m_notifierSvc->GetCurrentDetectorName() + "::" + lV->GetName() << std::endl;
+  lV->SetName( m_notifierSvc->GetCurrentDetectorName() + "::" + lV->GetName() );
+}
+
+void LVNotifier::NotifyDeRegistration()
+{
+}
diff --git a/Simulation/G4Faser/G4FaserServices/src/LVNotifier.h b/Simulation/G4Faser/G4FaserServices/src/LVNotifier.h
new file mode 100644
index 000000000..b12491733
--- /dev/null
+++ b/Simulation/G4Faser/G4FaserServices/src/LVNotifier.h
@@ -0,0 +1,31 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef LVNotifier_H
+#define LVNotifier_H
+
+#include "G4VNotifier.hh"
+
+class G4FaserGeometryNotifierSvc;
+
+/// @class LVNotifier
+/// @todo NEEDS DOCUMENTATION
+class LVNotifier : public G4VNotifier
+{
+  friend class G4FaserGeometryNotifierSvc;
+
+  public:
+
+    void NotifyRegistration();
+    void NotifyDeRegistration();
+
+  private:
+
+    LVNotifier(G4FaserGeometryNotifierSvc*);
+
+    G4FaserGeometryNotifierSvc* m_notifierSvc;
+};
+
+#endif
+
diff --git a/Simulation/G4Faser/G4FaserServices/src/PVNotifier.cxx b/Simulation/G4Faser/G4FaserServices/src/PVNotifier.cxx
new file mode 100644
index 000000000..0e3e6617d
--- /dev/null
+++ b/Simulation/G4Faser/G4FaserServices/src/PVNotifier.cxx
@@ -0,0 +1,33 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "PVNotifier.h"
+
+#include "G4PhysicalVolumeStore.hh"
+#include "G4VPhysicalVolume.hh"
+
+#include "G4FaserGeometryNotifierSvc.h"
+
+PVNotifier::PVNotifier(G4FaserGeometryNotifierSvc* gs)
+  : m_notifierSvc(gs)
+{
+  G4PhysicalVolumeStore* store = G4PhysicalVolumeStore::GetInstance();
+  store->SetNotifier(this);
+}
+
+void PVNotifier::NotifyRegistration()
+{
+  G4PhysicalVolumeStore* store = G4PhysicalVolumeStore::GetInstance();
+  unsigned int current = store->size();
+  G4VPhysicalVolume* lV = (*store)[current-1];
+  std::string temp1 = m_notifierSvc->GetCurrentDetectorName() + "::";
+  std::string temp2 = lV->GetName().substr(0, temp1.size());
+  if (temp1 != temp2)
+    lV->SetName(temp1 + lV->GetName());
+}
+
+void PVNotifier::NotifyDeRegistration()
+{
+}
+
diff --git a/Simulation/G4Faser/G4FaserServices/src/PVNotifier.h b/Simulation/G4Faser/G4FaserServices/src/PVNotifier.h
new file mode 100644
index 000000000..ea741ffcc
--- /dev/null
+++ b/Simulation/G4Faser/G4FaserServices/src/PVNotifier.h
@@ -0,0 +1,32 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef PVNotifier_H
+#define PVNotifier_H
+
+#include "G4VNotifier.hh"
+
+class G4FaserGeometryNotifierSvc;
+
+/// @class PVNotifier
+/// Notifier class to prepend detector name to all G4 Physical Volumes
+/// Only to be used by the G4GeometryNotifierSvc
+class PVNotifier :  public G4VNotifier
+{
+  friend class G4FaserGeometryNotifierSvc;
+
+  public:
+
+    void NotifyRegistration();
+    void NotifyDeRegistration();
+
+  private:
+
+    PVNotifier(G4FaserGeometryNotifierSvc*);
+
+    G4FaserGeometryNotifierSvc* m_notifierSvc;
+};
+
+#endif
+
diff --git a/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx b/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx
index 1f65a5aac..5626e1b0b 100644
--- a/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx
+++ b/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx
@@ -1,7 +1,7 @@
 #include "../FaserPhysicsListSvc.h"
 // #include "../UserLimitsSvc.h"
 // #include "../G4AtlasSvc.h"
-// #include "../G4GeometryNotifierSvc.h"
+#include "../G4FaserGeometryNotifierSvc.h"
 // #include "../DetectorGeometrySvc.h"
 #include "../FaserUserActionSvc.h"
 // #include "../ConstantFieldSvc.h"
@@ -10,7 +10,7 @@
 DECLARE_COMPONENT( FaserPhysicsListSvc )
 // DECLARE_COMPONENT( UserLimitsSvc )
 // DECLARE_COMPONENT( G4AtlasSvc )
-// DECLARE_COMPONENT( G4GeometryNotifierSvc )
+DECLARE_COMPONENT( G4FaserGeometryNotifierSvc )
 // DECLARE_COMPONENT( DetectorGeometrySvc )
 DECLARE_COMPONENT( G4UA::FaserUserActionSvc )
 // DECLARE_COMPONENT( ConstantFieldSvc )
diff --git a/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py b/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py
index 0d9580e4b..1b46a7cbb 100644
--- a/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py
+++ b/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py
@@ -32,11 +32,11 @@ from AthenaCommon.SystemOfUnits import mm
 #     kwargs.setdefault("ActivatePVNotifier", False)
 #     return G4GeometryNotifierSvc(name, **kwargs)
 
-def G4GeometryNotifierSvcCfg(flags, name="G4GeometryNotifierSvc", **kwargs):
+def G4GeometryNotifierSvcCfg(flags, name="G4FaserGeometryNotifierSvc", **kwargs):
     result = ComponentAccumulator()
     kwargs.setdefault("ActivateLVNotifier", True)
     kwargs.setdefault("ActivatePVNotifier", False)
-    result.addService(CompFactory.G4GeometryNotifierSvc(name, **kwargs), primary = True)
+    result.addService(CompFactory.G4FaserGeometryNotifierSvc(name, **kwargs), primary = True)
     return result
 
 
-- 
GitLab