From dae9ed5456d0f1eab8ba6ac62fa5032e5fe47cf4 Mon Sep 17 00:00:00 2001
From: FASER Reco <faserrec@lxplus958.cern.ch>
Date: Fri, 7 Jun 2024 08:56:55 +0200
Subject: [PATCH] Get reco working without ACTS

---
 .../CaloRecAlgs/python/CaloRecAlgsConfig.py   |  2 +-
 .../Reconstruction/scripts/faser_reco.py      | 13 ++++++++---
 Event/FaserEventPlugins/CMakeLists.txt        |  2 +-
 Event/FaserEventStorage/CMakeLists.txt        | 22 ++++++-------------
 .../FaserSCT_ConfigurationConditionsTool.cxx  |  2 +-
 .../src/FaserSCT_SiliconConditionsTool.cxx    |  8 ++++---
 .../WaveRecAlgs/python/WaveRecAlgsConfig.py   |  3 ++-
 package_filters.txt                           |  6 ++---
 8 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py b/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py
index b17c125e0..7204d63c7 100644
--- a/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py
+++ b/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py
@@ -40,7 +40,7 @@ def CalorimeterReconstructionOutputCfg(flags, **kwargs):
         "xAOD::CalorimeterHitContainer#*"
         , "xAOD::CalorimeterHitAuxContainer#*"
     ]
-    acc.merge(OutputStreamCfg(flags, "xAOD", ItemList))
+    acc.merge(OutputStreamCfg(flags, "xAOD", ItemList, disableEventTag=True))
     # ostream = acc.getEventAlgo("OutputStreamRDO")
     # ostream.TakeItemsFromInput = True # Don't know what this does
     return acc
diff --git a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py
index 2527c427e..0235dfa4f 100755
--- a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py
+++ b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py
@@ -44,6 +44,8 @@ parser.add_argument("--testBeam", action='store_true',
                     help="Set geometry for 2021 test beam")
 parser.add_argument("--isOverlay", action='store_true', 
                     help="Set overlaid data input")
+parser.add_argument("--noTracking", action='store_true',
+                    help="Turn off tracking (for R24 debugging)")
 
 args = parser.parse_args()
 
@@ -130,8 +132,8 @@ useCKF = True
 useCal = False
 useLHC = False
 
-# Enable ACTS material corrections, this crashes testbeam geometries
-configFlags.TrackingGeometry.MaterialSource = "/cvmfs/faser.cern.ch/repo/sw/database/DBRelease/current/acts/material-maps.json"
+if args.noTracking:
+    useCKF = False
 
 # TI12 Cosmics geometry
 if runtype == "TI12Data":
@@ -184,6 +186,10 @@ if len(args.cond):
     configFlags.IOVDb.GlobalTag = args.cond
     print(f"Override global tag configFlags.IOVDb.GlobalTag = {args.config}") 
 
+if useCKF:
+    # Enable ACTS material corrections, this crashes testbeam geometries
+    configFlags.TrackingGeometry.MaterialSource = "/cvmfs/faser.cern.ch/repo/sw/database/DBRelease/current/acts/material-maps.json"
+
 # Must use original input string here, as pathlib mangles double // in path names
 configFlags.Input.Files = [ args.file_path ]
 
@@ -334,8 +340,9 @@ if not args.isOverlay:
     acc.merge(CalorimeterReconstructionOutputCfg(configFlags))
 
 # Check what we have
+from OutputStreamAthenaPool.OutputStreamConfig import outputStreamName
 print( "Writing out xAOD objects:" )
-print( acc.getEventAlgo("OutputStreamxAOD").ItemList )
+print( acc.getEventAlgo(outputStreamName("xAOD")).ItemList )
 
 # Hack to avoid problem with our use of MC databases when isMC = False
 if not args.isMC:
diff --git a/Event/FaserEventPlugins/CMakeLists.txt b/Event/FaserEventPlugins/CMakeLists.txt
index 377c12e15..f14e85623 100644
--- a/Event/FaserEventPlugins/CMakeLists.txt
+++ b/Event/FaserEventPlugins/CMakeLists.txt
@@ -3,7 +3,7 @@
 ################################################################################
 
 # Declare the package name:
-atlas_subdir( FaserEventsPlugins )
+atlas_subdir( FaserEventPlugins )
 
 # External dependencies:
 find_package( tdaq-common COMPONENTS ers EventStorage )
diff --git a/Event/FaserEventStorage/CMakeLists.txt b/Event/FaserEventStorage/CMakeLists.txt
index f55d90c6e..59afc8f53 100644
--- a/Event/FaserEventStorage/CMakeLists.txt
+++ b/Event/FaserEventStorage/CMakeLists.txt
@@ -6,23 +6,15 @@
 atlas_subdir( FaserEventStorage )
 
 # External dependencies:
+# Apparently not needed...
+# find_package( FaserEventPlugins COMPONENTS fReadXRootD fReadPlain fReadDavix )
 find_package( tdaq-common COMPONENTS ers EventStorage )
 find_package( Boost COMPONENTS system )
 
 atlas_add_library( FaserEventStorageLib
-    FaserEventStorage/*.h src/*.h src/*.cxx
-    PUBLIC_HEADERS FaserEventStorage
-    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
-    LINK_LIBRARIES ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} EventFormats )
+  FaserEventStorage/*.h
+  src/*.h src/*.cxx
+  PUBLIC_HEADERS FaserEventStorage
+  INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
+  LINK_LIBRARIES ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} EventFormats )
 
-
-
-# atlas_add_library(fReadPlain 
-#      src/fReadPlain.h src/fReadPlain.cxx 
-#      NO_PUBLIC_HEADERS
-#      PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
-#      PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} -rdynamic)
-
-# Install files from the package:
-#atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
-#atlas_install_joboptions( share/*.py )
diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConfigurationConditionsTool.cxx b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConfigurationConditionsTool.cxx
index 1c6b2a8ae..e8be8a4f5 100644
--- a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConfigurationConditionsTool.cxx
+++ b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConfigurationConditionsTool.cxx
@@ -23,7 +23,7 @@ StatusCode FaserSCT_ConfigurationConditionsTool::initialize() {
 
   // Read Cond Handle Key
   ATH_CHECK(m_condKey.initialize());
-  // ATH_CHECK(m_SCTDetEleCollKey.initialize());
+  ATH_CHECK(m_SCTDetEleCollKey.initialize());
 
   return StatusCode::SUCCESS;
 }
diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_SiliconConditionsTool.cxx b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_SiliconConditionsTool.cxx
index ab3673947..60ec2d0f2 100644
--- a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_SiliconConditionsTool.cxx
+++ b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_SiliconConditionsTool.cxx
@@ -32,14 +32,16 @@ StatusCode FaserSCT_SiliconConditionsTool::initialize() {
     } else {
       ATH_MSG_INFO("GeoModel requests to use Conditions DB.");
     }
-  } 
+  }
+
+  ATH_CHECK(m_condKeyHV.initialize((not m_useGeoModel) and m_useDB));
+  ATH_CHECK(m_condKeyTemp.initialize((not m_useGeoModel) and m_useDB));
+
   if (not m_useGeoModel) {
     ATH_MSG_INFO("Will use temperature and voltages from this service (not from GeoModel).");
    
     // Get from Conditions database. Register callback, etc.
     if (m_useDB) {
-      ATH_CHECK(m_condKeyHV.initialize());
-      ATH_CHECK(m_condKeyTemp.initialize());
       ATH_CHECK(detStore()->retrieve(m_sct_id, "FaserSCT_ID"));
 
       ATH_MSG_INFO("SCTDCSSvc retrieved");
diff --git a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py
index 8600247ed..b1b586585 100644
--- a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py
+++ b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py
@@ -95,7 +95,8 @@ def WaveformReconstructionOutputCfg(flags, **kwargs):
         , "xAOD::WaveformClock#*"
         , "xAOD::WaveformClockAuxInfo#*"
     ]
-    acc.merge(OutputStreamCfg(flags, "xAOD", ItemList))
+    print(flags)
+    acc.merge(OutputStreamCfg(flags, "xAOD", ItemList, disableEventTag=True))
     # ostream = acc.getEventAlgo("OutputStreamRDO")
     # ostream.TakeItemsFromInput = True # Don't know what this does
     return acc
diff --git a/package_filters.txt b/package_filters.txt
index 7835fa427..176347eba 100644
--- a/package_filters.txt
+++ b/package_filters.txt
@@ -16,6 +16,7 @@
 +Control/CalypsoExample/GenEventExample
 +Control/CalypsoExample/GeoModelTest
 +Control/CalypsoExample/RDOReadExample
++Control/CalypsoExample/Reconstruction
 +Control/CalypsoExample/SimHitExample
 +Control/CalypsoExample/TrackerDataAccessExample
 +Control/CalypsoExample/TriggerDataAccessExample
@@ -37,10 +38,7 @@
 +DetectorDescription/GeoModel/GeoModelSvc
 +DetectorDescription/IdDictDetDescrCnv
 #-DetectorDescription/.*
-+Event/FaserByteStreamCnvSvcBase
-+Event/FaserByteStreamCnvSvc
-+Event/FaserEventStorage
--Event/.*
++Event/.*
 +FaserGeometryCommon/.*
 +Generators/.*
 +LHCData/LHCDataAlgs
-- 
GitLab