From c18c61a5a19994d947a26454129bb2d87c0f0de0 Mon Sep 17 00:00:00 2001
From: Dave Casper <dcasper@uci.edu>
Date: Tue, 7 May 2024 01:19:44 -0700
Subject: [PATCH] Debugging

---
 .../python/MainServicesConfig.py              | 443 +++++++++++++-----
 .../G4FaserAlg/python/G4FaserAlgConfig.py     |   3 +
 .../G4Faser/G4FaserAlg/src/G4FaserAlg.cxx     |   7 +
 .../G4FaserAlg/test/G4FaserAlgConfig_Test.py  |   4 +-
 .../python/G4FaserServicesConfig.py           |   8 +-
 .../python/G4GeometryToolConfig.py            |  35 +-
 6 files changed, 362 insertions(+), 138 deletions(-)

diff --git a/Control/CalypsoConfiguration/python/MainServicesConfig.py b/Control/CalypsoConfiguration/python/MainServicesConfig.py
index 75fe5b181..2f04aa8e5 100644
--- a/Control/CalypsoConfiguration/python/MainServicesConfig.py
+++ b/Control/CalypsoConfiguration/python/MainServicesConfig.py
@@ -1,14 +1,34 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-from AthenaConfiguration.ComponentFactory import CompFactory
+# from __future__ import print_function
+# from AthenaConfiguration.ComponentFactory import CompFactory
+
+# from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+# AthSequencer=CompFactory.AthSequencer
 
+# def MainServicesMiniCfg(loopMgr='AthenaEventLoopMgr', masterSequence='AthAlgSeq'):
+#     #Mininmal basic config, just good enough for HelloWorld and alike
+#     cfg=ComponentAccumulator(CompFactory.AthSequencer(masterSequence,Sequential=True))
+#     cfg.setAsTopLevel()
+#     cfg.setAppProperty('TopAlg',['AthSequencer/'+masterSequence])
+#     cfg.setAppProperty('MessageSvcType', 'MessageSvc')
+#     cfg.setAppProperty('EventLoop', loopMgr)
+#     cfg.setAppProperty('ExtSvcCreates', 'False')
+#     cfg.setAppProperty('JobOptionsSvcType', 'JobOptionsSvc')
+#     cfg.setAppProperty('JobOptionsType', 'NONE')
+#     cfg.setAppProperty('JobOptionsPostAction', '')
+#     cfg.setAppProperty('JobOptionsPreAction', '')
+#     cfg.setAppProperty('PrintAlgsSequence', True)
+#     return cfg
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
-AthSequencer=CompFactory.AthSequencer
+from AthenaConfiguration.ComponentFactory import CompFactory
+from AthenaCommon.Constants import INFO
+
 
-def MainServicesMiniCfg(loopMgr='AthenaEventLoopMgr', masterSequence='AthAlgSeq'):
-    #Mininmal basic config, just good enough for HelloWorld and alike
-    cfg=ComponentAccumulator(CompFactory.AthSequencer(masterSequence,Sequential=True))
+def MainServicesMiniCfg(flags, loopMgr='AthenaEventLoopMgr', masterSequence='AthAlgSeq'):
+    """Mininmal basic config, just good enough for HelloWorld and alike"""
+    cfg = ComponentAccumulator(CompFactory.AthSequencer(masterSequence,Sequential=True))
     cfg.setAsTopLevel()
     cfg.setAppProperty('TopAlg',['AthSequencer/'+masterSequence])
     cfg.setAppProperty('MessageSvcType', 'MessageSvc')
@@ -18,137 +38,330 @@ def MainServicesMiniCfg(loopMgr='AthenaEventLoopMgr', masterSequence='AthAlgSeq'
     cfg.setAppProperty('JobOptionsType', 'NONE')
     cfg.setAppProperty('JobOptionsPostAction', '')
     cfg.setAppProperty('JobOptionsPreAction', '')
-    cfg.setAppProperty('PrintAlgsSequence', True)
+    cfg.setAppProperty('PrintAlgsSequence', flags.Exec.PrintAlgsSequence)
+    return cfg
+
+def AthenaEventLoopMgrCfg(flags):
+    cfg = ComponentAccumulator()
+    elmgr = CompFactory.AthenaEventLoopMgr()
+    if flags.Input.OverrideRunNumber:
+        from AthenaKernel.EventIdOverrideConfig import EvtIdModifierSvcCfg
+        elmgr.EvtIdModifierSvc = cfg.getPrimaryAndMerge( EvtIdModifierSvcCfg(flags) ).name
+
+    if flags.Common.isOverlay:
+        if not flags.Overlay.DataOverlay:
+            elmgr.RequireInputAttributeList = True
+            elmgr.UseSecondaryEventNumber = True
+
+    cfg.addService( elmgr )
+
     return cfg
 
+def MessageSvcCfg(flags):
+    cfg = ComponentAccumulator()
+    msgsvc = CompFactory.MessageSvc()
+    msgsvc.OutputLevel = flags.Exec.OutputLevel
+    msgsvc.Format = "% F%{:d}W%C%7W%R%T %0W%M".format(flags.Common.MsgSourceLength)
+    msgsvc.enableSuppression = flags.Common.MsgSuppression
+    if flags.Common.ShowMsgStats:
+        msgsvc.showStats = True
+        from AthenaCommon.Constants import WARNING
+        msgsvc.statLevel = WARNING
+
+    from AthenaConfiguration.Enums import ProductionStep
+    # if flags.Common.ProductionStep not in [ProductionStep.Default, ProductionStep.Reconstruction, ProductionStep.Derivation]:
+    #     msgsvc.Format = "% F%18W%S%7W%R%T %0W%M" # Temporary to match legacy configuration for serial simulation/digitization/overlay jobs
+    if flags.Concurrency.NumThreads>0:
+        msgsvc.Format = "% F%{:d}W%C%6W%R%e%s%8W%R%T %0W%M".format(flags.Common.MsgSourceLength)
+    if flags.Exec.VerboseMessageComponents:
+        msgsvc.verboseLimit=0
+    if flags.Exec.DebugMessageComponents:
+        msgsvc.debugLimit=0
+    if flags.Exec.InfoMessageComponents:
+        msgsvc.infoLimit=0
+    if flags.Exec.WarningMessageComponents:
+        msgsvc.warningLimit=0
+    if flags.Exec.ErrorMessageComponents:
+        msgsvc.errorLimit=0
+
+    cfg.addService(msgsvc)
+    return cfg
 
-def MainServicesCfg(cfgFlags):
-    # Run a serial job for threads=0
-    LoopMgr = 'AthenaEventLoopMgr'
-    if cfgFlags.Concurrency.NumThreads>0:
-        if cfgFlags.Concurrency.NumConcurrentEvents==0:
-            # In a threaded job this will mess you up because no events will be processed
-            raise Exception("Requested Concurrency.NumThreads>0 and Concurrency.NumConcurrentEvents==0, which will not process events!")
-        LoopMgr = "AthenaHiveEventLoopMgr"
+def addMainSequences(flags, cfg):
+    """Add the standard sequences to cfg"""
 
-    ########################################################################
-    # Core components needed for serial and threaded jobs
-    cfg=MainServicesMiniCfg(loopMgr=LoopMgr, masterSequence='AthMasterSeq')
-    cfg.setAppProperty('OutStreamType', 'AthenaOutputStream')
+    # Build standard sequences:
+    AthSequencer = CompFactory.AthSequencer
+    cfg.addSequence(AthSequencer('AthAlgEvtSeq', Sequential=True, StopOverride=True), parentName='AthMasterSeq')
+    cfg.addSequence(AthSequencer('AthOutSeq', StopOverride=True), parentName='AthMasterSeq')
 
-    #Build standard sequences:
-    cfg.addSequence(AthSequencer('AthAlgEvtSeq',Sequential=True, StopOverride=True),parentName="AthMasterSeq") 
-    cfg.addSequence(AthSequencer('AthOutSeq',StopOverride=True),parentName="AthMasterSeq")
+    cfg.addSequence(AthSequencer('AthBeginSeq', Sequential=True), parentName='AthAlgEvtSeq')
+    cfg.addSequence(AthSequencer('AthAllAlgSeq', StopOverride=True), parentName='AthAlgEvtSeq')
 
-    cfg.addSequence(AthSequencer('AthBeginSeq',Sequential=True),parentName='AthAlgEvtSeq')
-    cfg.addSequence(AthSequencer('AthAllAlgSeq',StopOverride=True),parentName='AthAlgEvtSeq') 
+    athAlgSeq = AthSequencer('AthAlgSeq', IgnoreFilterPassed=True, StopOverride=True, ProcessDynamicDataDependencies=True, ExtraDataForDynamicConsumers=[])
+    athCondSeq = AthSequencer('AthCondSeq',StopOverride=True)
 
-    if cfgFlags.Concurrency.NumThreads==0:
+    if flags.Concurrency.NumThreads==0:
         # For serial execution, we need the CondAlgs to execute first.
-        cfg.addSequence(AthSequencer('AthCondSeq',StopOverride=True),parentName='AthAllAlgSeq')
-        cfg.addSequence(AthSequencer('AthAlgSeq',IgnoreFilterPassed=True,StopOverride=True, ProcessDynamicDataDependencies=True, ExtraDataForDynamicConsumers=[] ),parentName='AthAllAlgSeq')
+        cfg.addSequence(athCondSeq, parentName='AthAllAlgSeq')
+        cfg.addSequence(athAlgSeq, parentName='AthAllAlgSeq')
     else:
         # In MT, the order of execution is irrelevant (determined by data deps).
         # We add the conditions sequence later such that the CondInputLoader gets
         # initialized after all other user Algorithms for MT, so the base classes
-        # of data deps can be correctly determined. 
-        cfg.addSequence(AthSequencer('AthAlgSeq',IgnoreFilterPassed=True,StopOverride=True),parentName='AthAllAlgSeq')
-        cfg.addSequence(AthSequencer('AthCondSeq',StopOverride=True, ProcessDynamicDataDependencies=True, ExtraDataForDynamicConsumers=[]),parentName='AthAllAlgSeq')
+        # of data deps can be correctly determined.
+        cfg.addSequence(athAlgSeq, parentName='AthAllAlgSeq')
+        cfg.addSequence(athCondSeq, parentName='AthAllAlgSeq')
 
-    cfg.addSequence(AthSequencer('AthEndSeq',Sequential=True),parentName='AthAlgEvtSeq') 
-    cfg.setAppProperty('PrintAlgsSequence', True)
-    
-    #Set up incident firing:
-    AthIncFirerAlg=CompFactory.AthIncFirerAlg
-    IncidentProcAlg=CompFactory.IncidentProcAlg
+    cfg.addSequence(AthSequencer('AthEndSeq', Sequential=True), parentName='AthAlgEvtSeq')
 
-    cfg.addEventAlgo(AthIncFirerAlg("BeginIncFiringAlg",FireSerial=False,Incidents=['BeginEvent']),sequenceName='AthBeginSeq')
-    cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg1'),sequenceName='AthBeginSeq')
+    # Set up incident firing:
+    AthIncFirerAlg = CompFactory.AthIncFirerAlg
+    IncidentProcAlg = CompFactory.IncidentProcAlg
 
-    cfg.addEventAlgo(AthIncFirerAlg('EndIncFiringAlg',FireSerial=False,Incidents=['EndEvent']), sequenceName="AthEndSeq")
-    cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg2'),sequenceName="AthEndSeq")
+    previousPerfmonDomain = cfg.getCurrentPerfmonDomain()
+    cfg.flagPerfmonDomain('Incidents')
 
-    #Basic services:
-    ClassIDSvc=CompFactory.ClassIDSvc
-    cfg.addService(ClassIDSvc(CLIDDBFiles= ['clid.db',"Gaudi_clid.db" ]))
+    cfg.addEventAlgo(AthIncFirerAlg("BeginIncFiringAlg", FireSerial=False, Incidents=['BeginEvent']),
+                     sequenceName='AthBeginSeq')
 
-    StoreGateSvc=CompFactory.StoreGateSvc
-    cfg.addService(StoreGateSvc())
-    cfg.addService(StoreGateSvc("DetectorStore"))
-    cfg.addService(StoreGateSvc("HistoryStore"))
-    cfg.addService(StoreGateSvc("ConditionStore"))
+    cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg1'),
+                     sequenceName='AthBeginSeq')
 
-    from FaserGeoModel.GeoModelConfig import GeoModelCfg
-    cfg.merge( GeoModelCfg(cfgFlags) )
-    cfg.addService(CompFactory.DetDescrCnvSvc(), create=True)
-    cfg.addService(CompFactory.CoreDumpSvc(), create=True)
+    cfg.addEventAlgo(AthIncFirerAlg('EndIncFiringAlg', FireSerial=False, Incidents=['EndEvent']),
+                     sequenceName="AthEndSeq")
 
-    cfg.setAppProperty('InitializationLoopCheck',False)
+    cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg2'),
+                     sequenceName="AthEndSeq")
 
-    cfg.setAppProperty('EvtMax',cfgFlags.Exec.MaxEvents)
+    # Should be after all other algorithms:
+    cfg.addEventAlgo(AthIncFirerAlg('EndAlgorithmsFiringAlg', FireSerial=False, Incidents=['EndAlgorithms']),
+                     sequenceName="AthMasterSeq")
 
-    msgsvc=CompFactory.MessageSvc()
-    msgsvc.OutputLevel=cfgFlags.Exec.OutputLevel
-    cfg.addService(msgsvc)
+    cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg3'),
+                     sequenceName="AthMasterSeq")
+
+    cfg.flagPerfmonDomain(previousPerfmonDomain)
+
+def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr'):
+    # Set the Python OutputLevel on the root logger
+    from AthenaCommon.Logging import log
+    log.setLevel(flags.Exec.OutputLevel)
+
+    if flags.Exec.Interactive == "run":
+        LoopMgr="PyAthenaEventLoopMgr"
+        log.info("Interactive mode, switching to %s", LoopMgr)
+    else:
+        # Run a serial job for threads=0
+        if flags.Concurrency.NumThreads > 0:
+            if flags.Concurrency.NumConcurrentEvents==0:
+                raise Exception("Requested Concurrency.NumThreads>0 and Concurrency.NumConcurrentEvents==0, "
+                                "which will not process events!")
+            if flags.Exec.MTEventService:
+                LoopMgr = "AthenaMtesEventLoopMgr"
+            else:
+                LoopMgr = "AthenaHiveEventLoopMgr"
+
+        if flags.Concurrency.NumProcs > 0:
+            LoopMgr = "AthMpEvtLoopMgr"
+
+    # Core components needed for serial and threaded jobs:
+    cfg = MainServicesMiniCfg(flags, loopMgr=LoopMgr, masterSequence='AthMasterSeq')
+
+    # Main sequences and incident handling:
+    addMainSequences(flags, cfg)
+
+    # Basic services:
+    cfg.addService(CompFactory.ClassIDSvc(CLIDDBFiles = ['clid.db','Gaudi_clid.db']))
+
+    cfg.addService(CompFactory.AlgContextSvc(BypassIncidents=True))
+    cfg.addAuditor(CompFactory.AlgContextAuditor())
+
+    cfg.addService(CompFactory.StoreGateSvc(Dump=flags.Debug.DumpEvtStore))
+    cfg.addService(CompFactory.StoreGateSvc("DetectorStore",Dump=flags.Debug.DumpDetStore))
+    cfg.addService(CompFactory.StoreGateSvc("HistoryStore"))
+    cfg.addService(CompFactory.StoreGateSvc("ConditionStore",Dump=flags.Debug.DumpCondStore))
+
+    cfg.merge(MessageSvcCfg(flags))
+
+    from AthenaConfiguration.FPEAndCoreDumpConfig import FPEAndCoreDumpCfg
+    cfg.merge(FPEAndCoreDumpCfg(flags))
+
+    # Avoid stack traces to the exception handler. These traces
+    # aren't very useful since they just point to the handler, not
+    # the original bug.
+    cfg.addService(CompFactory.ExceptionSvc(Catch="NONE"))
+
+    # ApplicationMgr properties:
+    cfg.setAppProperty('AuditAlgorithms', True)
+    cfg.setAppProperty('InitializationLoopCheck', False)
+    cfg.setAppProperty('EvtMax', flags.Exec.MaxEvents)
+    if flags.Exec.OutputLevel > INFO:
+        # this turns off the appMgr spalsh
+        cfg.setAppProperty('AppName', '')
+    cfg.setAppProperty('OutputLevel', flags.Exec.OutputLevel)
+
+    if flags.Exec.DebugStage != "":
+        cfg.setDebugStage(flags.Exec.DebugStage)
+
+    cfg.interactive=flags.Exec.Interactive
+
+    if flags.Concurrency.NumProcs > 0:
+        cfg.merge(AthenaMpEventLoopMgrCfg(flags))
 
-    if cfgFlags.Exec.DebugStage != "":
-        cfg.setDebugStage(cfgFlags.Exec.DebugStage)
-
-
-    ########################################################################
-    # Additional components needed for threaded jobs only
-    if cfgFlags.Concurrency.NumThreads>0:
-
-        # Migrated code from AtlasThreadedJob.py
-        AuditorSvc=CompFactory.AuditorSvc
-        msgsvc.defaultLimit = 0
-        msgsvc.Format = "% F%40W%S%4W%R%e%s%8W%R%T %0W%M"
-
-        SG__HiveMgrSvc=CompFactory.SG.HiveMgrSvc
-        hivesvc = SG__HiveMgrSvc("EventDataSvc")
-        hivesvc.NSlots = cfgFlags.Concurrency.NumConcurrentEvents
-        cfg.addService( hivesvc )
-
-        AlgResourcePool=CompFactory.AlgResourcePool
-        from AthenaCommon.Constants import INFO
-        arp=AlgResourcePool( OutputLevel = INFO )
-        arp.TopAlg=["AthMasterSeq"] #this should enable control flow
-        cfg.addService( arp )
-
-        AvalancheSchedulerSvc=CompFactory.AvalancheSchedulerSvc
-        scheduler = AvalancheSchedulerSvc()
-        scheduler.CheckDependencies    = cfgFlags.Scheduler.CheckDependencies
-        scheduler.ShowDataDependencies = cfgFlags.Scheduler.ShowDataDeps
-        scheduler.ShowDataFlow         = cfgFlags.Scheduler.ShowDataFlow
-        scheduler.ShowControlFlow      = cfgFlags.Scheduler.ShowControlFlow
-        scheduler.ThreadPoolSize       = cfgFlags.Concurrency.NumThreads
-        cfg.addService(scheduler)
-
-        SGInputLoader=CompFactory.SGInputLoader
-        # FailIfNoProxy=False makes it a warning, not an error, if unmet data
-        # dependencies are not found in the store.  It should probably be changed
-        # to True eventually.
-        inputloader = SGInputLoader (FailIfNoProxy = False)
-        cfg.addEventAlgo( inputloader, "AthAlgSeq" )
-        scheduler.DataLoaderAlg = inputloader.getName()
-
-        AthenaHiveEventLoopMgr=CompFactory.AthenaHiveEventLoopMgr
-
-        elmgr = AthenaHiveEventLoopMgr()
-        elmgr.WhiteboardSvc = "EventDataSvc"
-        elmgr.SchedulerSvc = scheduler.getName()
-        cfg.addService( elmgr )
-
-        # enable timeline recording
-        TimelineSvc=CompFactory.TimelineSvc
-        cfg.addService( TimelineSvc( RecordTimeline = True, Partial = False ) )
-
-        #
-        ## Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute
-        #
-        SGCommitAuditor=CompFactory.SGCommitAuditor
-        cfg.addService( AuditorSvc(Auditors=[SGCommitAuditor().getFullJobOptName(),]))
-        cfg.setAppProperty("AuditAlgorithms", True)
+    # Additional components needed for threaded jobs only:
+    if flags.Concurrency.NumThreads > 0:
+        if flags.Exec.MTEventService:
+            cfg.merge(AthenaMtesEventLoopMgrCfg(flags,True,flags.Exec.MTEventServiceChannel))
+        else:
+            cfg.merge(AthenaHiveEventLoopMgrCfg(flags))
+        # Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute
+        cfg.addAuditor( CompFactory.SGCommitAuditor() )
+    elif LoopMgr == 'AthenaEventLoopMgr':
+        cfg.merge(AthenaEventLoopMgrCfg(flags))
+
+    # # Performance monitoring and profiling:
+    # if flags.PerfMon.doFastMonMT or flags.PerfMon.doFullMonMT:
+    #     from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
+    #     cfg.merge(PerfMonMTSvcCfg(flags))
+
+    # if flags.PerfMon.doGPerfProf:
+    #     from PerfMonGPerfTools.GPT_ProfilerServiceConfig import GPT_ProfilerServiceCfg
+    #     cfg.merge(GPT_ProfilerServiceCfg(flags))
+
+    # if len(flags.PerfMon.Valgrind.ProfiledAlgs)>0:
+    #     from Valkyrie.ValkyrieConfig import ValgrindServiceCfg
+    #     cfg.merge(ValgrindServiceCfg(flags))
 
     return cfg
+
+# def MainServicesCfg(cfgFlags):
+#     # Run a serial job for threads=0
+#     LoopMgr = 'AthenaEventLoopMgr'
+#     if cfgFlags.Concurrency.NumThreads>0:
+#         if cfgFlags.Concurrency.NumConcurrentEvents==0:
+#             # In a threaded job this will mess you up because no events will be processed
+#             raise Exception("Requested Concurrency.NumThreads>0 and Concurrency.NumConcurrentEvents==0, which will not process events!")
+#         LoopMgr = "AthenaHiveEventLoopMgr"
+
+#     ########################################################################
+#     # Core components needed for serial and threaded jobs
+#     cfg=MainServicesMiniCfg(loopMgr=LoopMgr, masterSequence='AthMasterSeq')
+#     cfg.setAppProperty('OutStreamType', 'AthenaOutputStream')
+
+#     #Build standard sequences:
+#     cfg.addSequence(AthSequencer('AthAlgEvtSeq',Sequential=True, StopOverride=True),parentName="AthMasterSeq") 
+#     cfg.addSequence(AthSequencer('AthOutSeq',StopOverride=True),parentName="AthMasterSeq")
+
+#     cfg.addSequence(AthSequencer('AthBeginSeq',Sequential=True),parentName='AthAlgEvtSeq')
+#     cfg.addSequence(AthSequencer('AthAllAlgSeq',StopOverride=True),parentName='AthAlgEvtSeq') 
+
+#     if cfgFlags.Concurrency.NumThreads==0:
+#         # For serial execution, we need the CondAlgs to execute first.
+#         cfg.addSequence(AthSequencer('AthCondSeq',StopOverride=True),parentName='AthAllAlgSeq')
+#         cfg.addSequence(AthSequencer('AthAlgSeq',IgnoreFilterPassed=True,StopOverride=True, ProcessDynamicDataDependencies=True, ExtraDataForDynamicConsumers=[] ),parentName='AthAllAlgSeq')
+#     else:
+#         # In MT, the order of execution is irrelevant (determined by data deps).
+#         # We add the conditions sequence later such that the CondInputLoader gets
+#         # initialized after all other user Algorithms for MT, so the base classes
+#         # of data deps can be correctly determined. 
+#         cfg.addSequence(AthSequencer('AthAlgSeq',IgnoreFilterPassed=True,StopOverride=True),parentName='AthAllAlgSeq')
+#         cfg.addSequence(AthSequencer('AthCondSeq',StopOverride=True, ProcessDynamicDataDependencies=True, ExtraDataForDynamicConsumers=[]),parentName='AthAllAlgSeq')
+
+#     cfg.addSequence(AthSequencer('AthEndSeq',Sequential=True),parentName='AthAlgEvtSeq') 
+#     cfg.setAppProperty('PrintAlgsSequence', True)
+    
+#     #Set up incident firing:
+#     AthIncFirerAlg=CompFactory.AthIncFirerAlg
+#     IncidentProcAlg=CompFactory.IncidentProcAlg
+
+#     cfg.addEventAlgo(AthIncFirerAlg("BeginIncFiringAlg",FireSerial=False,Incidents=['BeginEvent']),sequenceName='AthBeginSeq')
+#     cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg1'),sequenceName='AthBeginSeq')
+
+#     cfg.addEventAlgo(AthIncFirerAlg('EndIncFiringAlg',FireSerial=False,Incidents=['EndEvent']), sequenceName="AthEndSeq")
+#     cfg.addEventAlgo(IncidentProcAlg('IncidentProcAlg2'),sequenceName="AthEndSeq")
+
+#     #Basic services:
+#     ClassIDSvc=CompFactory.ClassIDSvc
+#     cfg.addService(ClassIDSvc(CLIDDBFiles= ['clid.db',"Gaudi_clid.db" ]))
+
+#     StoreGateSvc=CompFactory.StoreGateSvc
+#     cfg.addService(StoreGateSvc())
+#     cfg.addService(StoreGateSvc("DetectorStore"))
+#     cfg.addService(StoreGateSvc("HistoryStore"))
+#     cfg.addService(StoreGateSvc("ConditionStore"))
+
+#     from FaserGeoModel.GeoModelConfig import GeoModelCfg
+#     cfg.merge( GeoModelCfg(cfgFlags) )
+#     cfg.addService(CompFactory.DetDescrCnvSvc(), create=True)
+#     cfg.addService(CompFactory.CoreDumpSvc(), create=True)
+
+#     cfg.setAppProperty('InitializationLoopCheck',False)
+
+#     cfg.setAppProperty('EvtMax',cfgFlags.Exec.MaxEvents)
+
+#     msgsvc=CompFactory.MessageSvc()
+#     msgsvc.OutputLevel=cfgFlags.Exec.OutputLevel
+#     cfg.addService(msgsvc)
+
+#     if cfgFlags.Exec.DebugStage != "":
+#         cfg.setDebugStage(cfgFlags.Exec.DebugStage)
+
+
+#     ########################################################################
+#     # Additional components needed for threaded jobs only
+#     if cfgFlags.Concurrency.NumThreads>0:
+
+#         # Migrated code from AtlasThreadedJob.py
+#         AuditorSvc=CompFactory.AuditorSvc
+#         msgsvc.defaultLimit = 0
+#         msgsvc.Format = "% F%40W%S%4W%R%e%s%8W%R%T %0W%M"
+
+#         SG__HiveMgrSvc=CompFactory.SG.HiveMgrSvc
+#         hivesvc = SG__HiveMgrSvc("EventDataSvc")
+#         hivesvc.NSlots = cfgFlags.Concurrency.NumConcurrentEvents
+#         cfg.addService( hivesvc )
+
+#         AlgResourcePool=CompFactory.AlgResourcePool
+#         from AthenaCommon.Constants import INFO
+#         arp=AlgResourcePool( OutputLevel = INFO )
+#         arp.TopAlg=["AthMasterSeq"] #this should enable control flow
+#         cfg.addService( arp )
+
+#         AvalancheSchedulerSvc=CompFactory.AvalancheSchedulerSvc
+#         scheduler = AvalancheSchedulerSvc()
+#         scheduler.CheckDependencies    = cfgFlags.Scheduler.CheckDependencies
+#         scheduler.ShowDataDependencies = cfgFlags.Scheduler.ShowDataDeps
+#         scheduler.ShowDataFlow         = cfgFlags.Scheduler.ShowDataFlow
+#         scheduler.ShowControlFlow      = cfgFlags.Scheduler.ShowControlFlow
+#         scheduler.ThreadPoolSize       = cfgFlags.Concurrency.NumThreads
+#         cfg.addService(scheduler)
+
+#         SGInputLoader=CompFactory.SGInputLoader
+#         # FailIfNoProxy=False makes it a warning, not an error, if unmet data
+#         # dependencies are not found in the store.  It should probably be changed
+#         # to True eventually.
+#         inputloader = SGInputLoader (FailIfNoProxy = False)
+#         cfg.addEventAlgo( inputloader, "AthAlgSeq" )
+#         scheduler.DataLoaderAlg = inputloader.getName()
+
+#         AthenaHiveEventLoopMgr=CompFactory.AthenaHiveEventLoopMgr
+
+#         elmgr = AthenaHiveEventLoopMgr()
+#         elmgr.WhiteboardSvc = "EventDataSvc"
+#         elmgr.SchedulerSvc = scheduler.getName()
+#         cfg.addService( elmgr )
+
+#         # enable timeline recording
+#         TimelineSvc=CompFactory.TimelineSvc
+#         cfg.addService( TimelineSvc( RecordTimeline = True, Partial = False ) )
+
+#         #
+#         ## Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute
+#         #
+#         SGCommitAuditor=CompFactory.SGCommitAuditor
+#         cfg.addService( AuditorSvc(Auditors=[SGCommitAuditor().getFullJobOptName(),]))
+#         cfg.setAppProperty("AuditAlgorithms", True)
+
+#     return cfg
     
diff --git a/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py b/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py
index 5eafdc3d1..7b1e41627 100644
--- a/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py
+++ b/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py
@@ -93,6 +93,9 @@ def G4FaserAlgBasicCfg(ConfigFlags, name="G4FaserAlg", **kwargs):
     #    print verbosities
     kwargs.setdefault("Verbosities", verbosities)
 
+    # Configure GDML output; crashes if file already exists
+    # kwargs.setdefault("GDMLfile", "Faser.gdml")
+
     # Set commands for the G4AtlasAlg
     kwargs.setdefault("G4Commands", ConfigFlags.Sim.G4Commands)
 
diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx
index 157f14d08..d47d6f0fa 100644
--- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx
+++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx
@@ -105,6 +105,13 @@ StatusCode G4FaserAlg::initialize()
 
   ATH_CHECK(m_inputConverter.retrieve());
 
+  G4LogicalVolumeStore* logicalVolumeStore = G4LogicalVolumeStore::GetInstance();
+  for (auto* ilv : *logicalVolumeStore ) 
+  {
+    ATH_MSG_ALWAYS("Found logical volume " << ilv->GetName());
+  }
+
+
   ATH_MSG_DEBUG("End of initialize()");
   return StatusCode::SUCCESS;
 }
diff --git a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py
index 91cb87983..fcce333de 100755
--- a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py
+++ b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py
@@ -16,7 +16,7 @@ if __name__ == '__main__':
     from AthenaCommon.Configurable import Configurable
     from Campaigns.Utils import Campaign
     from AthenaConfiguration.Enums import BeamType
-    log.setLevel(DEBUG)
+    log.setLevel(VERBOSE)
     Configurable.configurableRun3Behavior = 1
 #
 # Import and set config flags
@@ -27,6 +27,7 @@ if __name__ == '__main__':
     configFlags.Exec.SkipEvents = 0 # can be overridden from command line with --skipEvents=<number>
     from AthenaConfiguration.Enums import ProductionStep
     configFlags.Common.ProductionStep = ProductionStep.Simulation
+    configFlags.Common.MsgSourceLength = 30
 #
 # All these must be specified to avoid auto-configuration
 #
@@ -205,6 +206,7 @@ if __name__ == '__main__':
 #
 # Dump config
 #
+    cfg.getService("G4GeometryNotifierSvc").OutputLevel=VERBOSE
     from AthenaConfiguration.ComponentFactory import CompFactory
     cfg.addEventAlgo(CompFactory.JobOptsDumperAlg(FileName="G4FaserTestConfig.txt"))
     cfg.getService("StoreGateSvc").Dump = True
diff --git a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py
index d416be9c2..60bce8d2d 100644
--- a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py
+++ b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py
@@ -28,10 +28,10 @@ def G4AtlasSvcCfg(ConfigFlags, name="G4AtlasSvc", **kwargs):
     return G4AtlasSvc(name, **kwargs)
 
 
-def G4GeometryNotifierSvcCfg(ConfigFlags, name="G4GeometryNotifierSvc", **kwargs):
-    kwargs.setdefault("ActivateLVNotifier", True)
-    kwargs.setdefault("ActivatePVNotifier", False)
-    return G4GeometryNotifierSvc(name, **kwargs)
+# def G4GeometryNotifierSvcCfg(ConfigFlags, name="G4GeometryNotifierSvc", **kwargs):
+#     kwargs.setdefault("ActivateLVNotifier", True)
+#     kwargs.setdefault("ActivatePVNotifier", False)
+#     return G4GeometryNotifierSvc(name, **kwargs)
 
 
 def FaserPhysicsListSvcCfg(ConfigFlags, name="FaserPhysicsListSvc", **kwargs):
diff --git a/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py b/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py
index 4920e9222..0d9580e4b 100644
--- a/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py
+++ b/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py
@@ -16,7 +16,7 @@ from G4FaserTools.G4FaserToolsConfigNew import SensitiveDetectorMasterToolCfg
 
 GeoDetectorTool=CompFactory.GeoDetectorTool
 
-BoxEnvelope, MaterialDescriptionTool, VoxelDensityTool, G4AtlasDetectorConstructionTool = CompFactory.getComps("BoxEnvelope", "MaterialDescriptionTool", "VoxelDensityTool", "G4AtlasDetectorConstructionTool",)
+BoxEnvelope, MaterialDescriptionTool, G4AtlasDetectorConstructionTool = CompFactory.getComps("BoxEnvelope", "MaterialDescriptionTool", "G4AtlasDetectorConstructionTool",)
 
 from AthenaCommon.SystemOfUnits import mm
 
@@ -65,7 +65,6 @@ def VetoGeoDetectorToolCfg(flags, name='Veto', **kwargs):
     kwargs.setdefault("DetectorName", "Veto")
     result.setPrivateTools(result.popToolsAndMerge(GeoDetectorToolCfg(flags, name, **kwargs)))
     return result
-
 def VetoNuGeoDetectorToolCfg(flags, name='VetoNu', **kwargs):
     #set up geometry
     from VetoNuGeoModel.VetoNuGeoModelConfig import VetoNuGeometryCfg
@@ -188,21 +187,21 @@ def MaterialDescriptionToolCfg(ConfigFlags, name="MaterialDescriptionTool", **kw
     return result
 
 
-def VoxelDensityToolCfg(ConfigFlags, name="VoxelDensityTool", **kwargs):
-    ## kwargs.setdefault("SomeProperty", aValue)
-    voxelDensitySettings = {}
-    # if ConfigFlags.Detector.GeometryITkPixel:
-    #     voxelDensitySettings["ITkPixelDetector"] = 0.05
-    # if ConfigFlags.Detector.GeometryITkStrip:
-    #     voxelDensitySettings["ITkStrip::Barrel"] = 0.05
-    #     voxelDensitySettings["ITkStrip::ITkStrip_Forward"] = 0.05
-    #     ##The below is only needed temporarily, while we wait for
-    #     ##improved naming to be propagated to all necessary geo tags
-    #     voxelDensitySettings["ITkStrip::SCT_Forward"] = 0.05
-    kwargs.setdefault("VolumeVoxellDensityLevel",voxelDensitySettings)
-    result = ComponentAccumulator()
-    result.setPrivateTools(VoxelDensityTool(name, **kwargs))
-    return result
+# def VoxelDensityToolCfg(ConfigFlags, name="VoxelDensityTool", **kwargs):
+#     ## kwargs.setdefault("SomeProperty", aValue)
+#     voxelDensitySettings = {}
+#     # if ConfigFlags.Detector.GeometryITkPixel:
+#     #     voxelDensitySettings["ITkPixelDetector"] = 0.05
+#     # if ConfigFlags.Detector.GeometryITkStrip:
+#     #     voxelDensitySettings["ITkStrip::Barrel"] = 0.05
+#     #     voxelDensitySettings["ITkStrip::ITkStrip_Forward"] = 0.05
+#     #     ##The below is only needed temporarily, while we wait for
+#     #     ##improved naming to be propagated to all necessary geo tags
+#     #     voxelDensitySettings["ITkStrip::SCT_Forward"] = 0.05
+#     kwargs.setdefault("VolumeVoxellDensityLevel",voxelDensitySettings)
+#     result = ComponentAccumulator()
+#     result.setPrivateTools(VoxelDensityTool(name, **kwargs))
+#     return result
 
 def getFASER_RegionCreatorList(ConfigFlags):
     regionCreatorList = []
@@ -287,7 +286,7 @@ def getGeometryConfigurationTools(ConfigFlags):
     # package containing each tool, so G4FaserTools in this case
     result =ComponentAccumulator()
     geoConfigToolList += [result.popToolsAndMerge(MaterialDescriptionToolCfg(ConfigFlags))]
-    geoConfigToolList += [result.popToolsAndMerge(VoxelDensityToolCfg(ConfigFlags))]
+    # geoConfigToolList += [result.popToolsAndMerge(VoxelDensityToolCfg(ConfigFlags))]
     return result, geoConfigToolList
 
 
-- 
GitLab