From 639f23c95036836519c0336bc276f2a265072655 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:13:27 +0000
Subject: [PATCH 001/102] run panels

---
 .../hlt2_reco_rich2_noUT_survey_dd4hep_survey.py     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 314c5a701..7d5b6dc82 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -134,9 +134,13 @@ else:
 
             return files
 
+        # options.input_files = obtain_files_from_many_runs(
+            # base_dir_files, 299618, 299683
+        # )
         options.input_files = obtain_files_from_many_runs(
-            base_dir_files, 299618, 299683
+            base_dir_files, 307065, 307075
         )
+
         # base_dir_files, 298656, 300124)
 
         # base_dir = "/calib/align/LHCb/Rich/0000255353/"
@@ -181,8 +185,10 @@ if UseDD4Hep:
         dd4hep.ConditionsVersion = "master"
 
         # needed for when reconstruction changed to SuperPixels (change was at run 289434)
-        DDDBConf().GeometryVersion = "run3/2024.Q1.2-v00.00"
-        options.geometry_version = "run3/2024.Q1.2-v00.00"
+        # DDDBConf().GeometryVersion = "run3/2024.Q1.2-v00.00"
+        # options.geometry_version = "run3/2024.Q1.2-v00.00"
+        DDDBConf().GeometryVersion = "run3/trunk"
+        options.geometry_version = "run3/trunk"
     else:
         options.conddb_tag = (
             "jonrob/all-pmts-active"  # used for DetDesc MC samples with DD4Hep
-- 
GitLab


From 9b35c7574f03e6efa023a8721bdd4093ad7eb061 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:18:13 +0000
Subject: [PATCH 002/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 7d5b6dc82..e77b2de3d 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -134,12 +134,12 @@ else:
 
             return files
 
-        # options.input_files = obtain_files_from_many_runs(
-            # base_dir_files, 299618, 299683
-        # )
         options.input_files = obtain_files_from_many_runs(
-            base_dir_files, 307065, 307075
+            base_dir_files, 299618, 299683
         )
+        # options.input_files = obtain_files_from_many_runs(
+        #     base_dir_files, 307065, 307075
+        # )
 
         # base_dir_files, 298656, 300124)
 
-- 
GitLab


From c7dc19ca98161d8f0982231098e0f2e389db8368 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:19:53 +0000
Subject: [PATCH 003/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index e77b2de3d..920e1a3da 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -185,10 +185,10 @@ if UseDD4Hep:
         dd4hep.ConditionsVersion = "master"
 
         # needed for when reconstruction changed to SuperPixels (change was at run 289434)
-        # DDDBConf().GeometryVersion = "run3/2024.Q1.2-v00.00"
-        # options.geometry_version = "run3/2024.Q1.2-v00.00"
-        DDDBConf().GeometryVersion = "run3/trunk"
-        options.geometry_version = "run3/trunk"
+        DDDBConf().GeometryVersion = "run3/2024.Q1.2-v00.00"
+        options.geometry_version = "run3/2024.Q1.2-v00.00"
+        # DDDBConf().GeometryVersion = "run3/trunk"
+        # options.geometry_version = "run3/trunk"
     else:
         options.conddb_tag = (
             "jonrob/all-pmts-active"  # used for DetDesc MC samples with DD4Hep
-- 
GitLab


From 1c0afdd9019ab3f09e6ee36d782cfcbb2b7b1418 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:22:46 +0000
Subject: [PATCH 004/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 920e1a3da..7453bdad4 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -18,8 +18,10 @@ import sys
 from GaudiKernel.SystemOfUnits import GeV, MeV, mm, mrad
 from Moore import (
     options,
-    run_reconstruction,
+    # run_reconstruction,
 )
+from RecoConf.config import run_reconstruction
+
 from Panoptes.alignment import (
     standalone_rich_online_align_reco,
     standalone_rich_panel_align_reco,
-- 
GitLab


From f77919e92f45e69bcce8b803e3bdfcf4819906bf Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:25:13 +0000
Subject: [PATCH 005/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 7453bdad4..c1b9fc360 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -76,7 +76,7 @@ options.evt_max = yml_opts["evt_max"]
 options.n_threads = yml_opts["n_threads"]
 # options.n_event_slots = options.n_threads * 3
 options.scheduler_legacy_mode = False
-options.use_iosvc = True
+# options.use_iosvc = True
 
 if useRealData is not True:
     options.set_input_and_conds_from_testfiledb("upgrade_Sept2022_minbias_0fb_md_xdigi")
-- 
GitLab


From def28e0202d36149c9588384cca96942d654da82 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:32:55 +0000
Subject: [PATCH 006/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index c1b9fc360..980f36965 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -18,9 +18,9 @@ import sys
 from GaudiKernel.SystemOfUnits import GeV, MeV, mm, mrad
 from Moore import (
     options,
-    # run_reconstruction,
+    run_reconstruction,
 )
-from RecoConf.config import run_reconstruction
+# from RecoConf.config import run_reconstruction
 
 from Panoptes.alignment import (
     standalone_rich_online_align_reco,
@@ -76,7 +76,7 @@ options.evt_max = yml_opts["evt_max"]
 options.n_threads = yml_opts["n_threads"]
 # options.n_event_slots = options.n_threads * 3
 options.scheduler_legacy_mode = False
-# options.use_iosvc = True
+options.use_iosvc = True
 
 if useRealData is not True:
     options.set_input_and_conds_from_testfiledb("upgrade_Sept2022_minbias_0fb_md_xdigi")
-- 
GitLab


From 03aedc70ea3bc7a588bf9a121ae098d9d83e12ee Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 09:34:06 +0000
Subject: [PATCH 007/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 980f36965..c1b9fc360 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -18,9 +18,9 @@ import sys
 from GaudiKernel.SystemOfUnits import GeV, MeV, mm, mrad
 from Moore import (
     options,
-    run_reconstruction,
+    # run_reconstruction,
 )
-# from RecoConf.config import run_reconstruction
+from RecoConf.config import run_reconstruction
 
 from Panoptes.alignment import (
     standalone_rich_online_align_reco,
@@ -76,7 +76,7 @@ options.evt_max = yml_opts["evt_max"]
 options.n_threads = yml_opts["n_threads"]
 # options.n_event_slots = options.n_threads * 3
 options.scheduler_legacy_mode = False
-options.use_iosvc = True
+# options.use_iosvc = True
 
 if useRealData is not True:
     options.set_input_and_conds_from_testfiledb("upgrade_Sept2022_minbias_0fb_md_xdigi")
-- 
GitLab


From ab68d43f2939d3403a782e6e3d42f097ee77da72 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:24:53 +0000
Subject: [PATCH 008/102] run panels

---
 ...t2_reco_rich2_noUT_survey_dd4hep_survey.py | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index c1b9fc360..84f01b0f0 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -18,9 +18,9 @@ import sys
 from GaudiKernel.SystemOfUnits import GeV, MeV, mm, mrad
 from Moore import (
     options,
-    # run_reconstruction,
+    # run_reconstruction, # 2024 script
 )
-from RecoConf.config import run_reconstruction
+from RecoConf.config import run_reconstruction # 2025 script??
 
 from Panoptes.alignment import (
     standalone_rich_online_align_reco,
@@ -48,6 +48,13 @@ from RecoConf.rich_reconstruction import default_rich_reco_options
 # from Configurables import (
 #      UpdateManagerSvc
 # )
+
+from PyConf.application import (
+    configure,
+    configure_input,
+)
+
+
 """Options for running over data with FT raw bank version 6."""
 from RecoConf.decoders import (
     default_ft_decoding_version,
@@ -76,7 +83,11 @@ options.evt_max = yml_opts["evt_max"]
 options.n_threads = yml_opts["n_threads"]
 # options.n_event_slots = options.n_threads * 3
 options.scheduler_legacy_mode = False
-# options.use_iosvc = True
+# options.use_iosvc = True # 2024 script
+
+# configure input
+config = configure_input(options)
+
 
 if useRealData is not True:
     options.set_input_and_conds_from_testfiledb("upgrade_Sept2022_minbias_0fb_md_xdigi")
@@ -187,10 +198,8 @@ if UseDD4Hep:
         dd4hep.ConditionsVersion = "master"
 
         # needed for when reconstruction changed to SuperPixels (change was at run 289434)
-        DDDBConf().GeometryVersion = "run3/2024.Q1.2-v00.00"
-        options.geometry_version = "run3/2024.Q1.2-v00.00"
-        # DDDBConf().GeometryVersion = "run3/trunk"
-        # options.geometry_version = "run3/trunk"
+        DDDBConf().GeometryVersion = "run3/trunk"
+        options.geometry_version = "run3/trunk"
     else:
         options.conddb_tag = (
             "jonrob/all-pmts-active"  # used for DetDesc MC samples with DD4Hep
-- 
GitLab


From 345bbed56dc662ff87148b5ac78dc87d926d3f4f Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:28:22 +0000
Subject: [PATCH 009/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 84f01b0f0..79b8b6809 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -445,9 +445,9 @@ selDec = HltSelReportsDecoder(
     RawBanks=unpacker.RawBankLocations[1],
 )
 
-app = ApplicationMgr(
-    TopAlg=[unpacker, decDec, selDec], ExtSvc=[configured_ann_svc(name="HltANNSvc")]
-)
+# app = ApplicationMgr(
+#     TopAlg=[unpacker, decDec, selDec], ExtSvc=[configured_ann_svc(name="HltANNSvc")]
+# )
 
 # by default, no additional filtering of the events
 event_filter = []
-- 
GitLab


From 83ff2ac42a6f10903b75b2ff8a2efe6da85b046e Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:29:53 +0000
Subject: [PATCH 010/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 79b8b6809..5a5c208e2 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -85,9 +85,6 @@ options.n_threads = yml_opts["n_threads"]
 options.scheduler_legacy_mode = False
 # options.use_iosvc = True # 2024 script
 
-# configure input
-config = configure_input(options)
-
 
 if useRealData is not True:
     options.set_input_and_conds_from_testfiledb("upgrade_Sept2022_minbias_0fb_md_xdigi")
@@ -227,6 +224,10 @@ else:
     options.conddb_tag = "upgrade/sim-20220612-vc-md100-RICHcustomFTv6"
     options.simulation = True
 
+# configure input
+config = configure_input(options)
+
+
 rich = f"rich{whichRich}"
 radiator = f"Rich{whichRich}Gas"
 
-- 
GitLab


From 38be593f0ed3f6d464fe43f8fc423efdac11a29d Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:35:59 +0000
Subject: [PATCH 011/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index 4426807a4..fc03b274c 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -215,6 +215,7 @@ def standalone_rich_panel_align_reco(
             MaxGhostProbCut=tight_sel["MaxGhostProb"],
         ),
         CKResHistoRange=moni_opts["CKResHistoRange"],
+        RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"],
         TracksLocation=conf["InputTracks"],
         TrackSegmentsLocation=conf["TrackSegments"],
         CherenkovPhotonLocation=conf["CherenkovPhotons"],
-- 
GitLab


From f2107937cd077cfb4f5064e849cc4d545476041b Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:43:52 +0000
Subject: [PATCH 012/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py         |  8 ++++----
 .../hlt2_reco_rich2_noUT_survey_dd4hep_survey.py   | 14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index fc03b274c..6c5a9c7aa 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -163,11 +163,11 @@ def standalone_rich_panel_align_reco(
             light_reco=True, fast_reco=False, use_pr_kf=False
         )
     else:
-        # hlt2_tracks = make_hlt2_tracks_without_UT()
+        hlt2_tracks = make_hlt2_tracks_without_UT()
         # match Hlt/RecoConf/python/RecoConf/standalone.py in Moore
-        hlt2_tracks = make_hlt2_tracks_without_UT(
-            light_reco=True, fast_reco=False, use_pr_kf=True
-        )
+        # hlt2_tracks = make_hlt2_tracks_without_UT(
+            # light_reco=True, fast_reco=False, use_pr_kf=True
+        # )
 
     # The track type we use
     track_version = "v1"
diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 5a5c208e2..7096489b7 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -337,13 +337,13 @@ else:
 # dd4hep.ConditionsOverride = {"/world/BeforeMagnetRegion/VP:alignment_delta": condval}
 # # ####### 2nd July 2024 overlay
 
-# ####### 4th July 2024 overlay
-## NB: these overlays already included in /group/rich/sw/alignment/ConditionsOverlayForPanels/
-# dd4hep.UseConditionsOverlay = True
-# dd4hep.ConditionsOverlayInitPath = '/group/online/alignment/prelim_align_2024/07_01_Run3Map_withUT_0207'
-condval = "!alignment{ position: [0 * mm, 0 * mm, 0 * mm],  rotation: [-0.000511080865103135 * rad, -0.00021828767680766154 * rad, -0.000866016317444813 * rad]}"
-dd4hep.ConditionsOverride = {"/world/BeforeMagnetRegion/VP:alignment_delta": condval}
-# ####### 4th July 2024 overlay
+# # ####### 4th July 2024 overlay
+# ## NB: these overlays already included in /group/rich/sw/alignment/ConditionsOverlayForPanels/
+# # dd4hep.UseConditionsOverlay = True
+# # dd4hep.ConditionsOverlayInitPath = '/group/online/alignment/prelim_align_2024/07_01_Run3Map_withUT_0207'
+# condval = "!alignment{ position: [0 * mm, 0 * mm, 0 * mm],  rotation: [-0.000511080865103135 * rad, -0.00021828767680766154 * rad, -0.000866016317444813 * rad]}"
+# dd4hep.ConditionsOverride = {"/world/BeforeMagnetRegion/VP:alignment_delta": condval}
+# # ####### 4th July 2024 overlay
 
 default_moni_opts = {}
 default_reco_opts = {}
-- 
GitLab


From 3651f2eedc43604d7255a4359975ba72f936be03 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:45:25 +0000
Subject: [PATCH 013/102] run panels

---
 ...t2_reco_rich2_noUT_survey_dd4hep_survey.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 7096489b7..dae91a0f2 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -502,8 +502,23 @@ if useHltDecisions:
     sys.stdout.flush()
 
 
+# with (
+#     standalone_rich_panel_align_reco.bind(
+#         RichGas=radiator,
+#         EventFilter=event_filter if useHltDecisions else [],
+#         noUT=noUT_bool,
+#     ),
+#     alignment_rich_monitoring_options.bind(
+#         radiator=radiator, init_override_opts=align_opts
+#     ),
+#     default_ft_decoding_version.bind(value=6),
+#     default_rich_reco_options.bind(init_override_opts=default_reco_opts),
+#     default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
+# ):
+#     run_reconstruction(options, standalone_rich_panel_align_reco)
+
 with (
-    standalone_rich_panel_align_reco.bind(
+    standalone_rich_online_align_reco.bind(
         RichGas=radiator,
         EventFilter=event_filter if useHltDecisions else [],
         noUT=noUT_bool,
@@ -515,4 +530,4 @@ with (
     default_rich_reco_options.bind(init_override_opts=default_reco_opts),
     default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
 ):
-    run_reconstruction(options, standalone_rich_panel_align_reco)
+    run_reconstruction(options, standalone_rich_online_align_reco)
-- 
GitLab


From 823a7e350183d260f9a49aea6cb931ab31021d61 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 10:46:55 +0000
Subject: [PATCH 014/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index 6c5a9c7aa..1c0699c96 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -329,6 +329,7 @@ def standalone_rich_online_align_reco(
             MaxGhostProbCut=tight_sel["MaxGhostProb"],
         ),
         CKResHistoRange=moni_opts["CKResHistoRange"],
+        RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"],
         TracksLocation=conf["InputTracks"],
         TrackSegmentsLocation=conf["TrackSegments"],
         CherenkovPhotonLocation=conf["CherenkovPhotons"],
-- 
GitLab


From 89633e26d66bb3e30239edec1bec27b9feb3ec2b Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 11:07:31 +0000
Subject: [PATCH 015/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py    |  8 ++--
 ...t2_reco_rich2_noUT_survey_dd4hep_survey.py | 44 ++++++++++++++-----
 2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index 1c0699c96..9b74e33e4 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -163,11 +163,11 @@ def standalone_rich_panel_align_reco(
             light_reco=True, fast_reco=False, use_pr_kf=False
         )
     else:
-        hlt2_tracks = make_hlt2_tracks_without_UT()
+        # hlt2_tracks = make_hlt2_tracks_without_UT()
         # match Hlt/RecoConf/python/RecoConf/standalone.py in Moore
-        # hlt2_tracks = make_hlt2_tracks_without_UT(
-            # light_reco=True, fast_reco=False, use_pr_kf=True
-        # )
+        hlt2_tracks = make_hlt2_tracks_without_UT(
+            light_reco=True, fast_reco=False, use_pr_kf=True
+        )
 
     # The track type we use
     track_version = "v1"
diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index dae91a0f2..f83287b2a 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -517,17 +517,41 @@ if useHltDecisions:
 # ):
 #     run_reconstruction(options, standalone_rich_panel_align_reco)
 
+noUT = True
+if useUT_bool:
+    noUT = False
+    from RecoConf.hlt2_tracking import make_hlt2_tracks as track_maker
+else:
+    from RecoConf.hlt2_tracking import make_hlt2_tracks_without_UT as track_maker
+
+tasks = [
+    "Produce",  #    # fill the production set of histograms
+    #'Monitor',      # add various checking histograms
+    #'MapExlore',    # explore tracks and photons for the HLT1 pre-selection line "map"
+    #'MapConstruct', # construct exploratory data structure for the HLT1 pre-selection line "map"
+    #'Map',          # create data structure to be used in the HLT1 selection line with entire contents
+    #'MapUse',       # use the "map" data structure a la in the HLT1 pre-selection line "map"
+    #'AllFillCount', # add counters for optimization of the RICH2 mirror combinations subset
+    #'AllFillPhi',   # fill 1D phi histos for optimization of the RICH2 mirror combinations subset
+    #'MapPhi',       # create data structure to be used in the HLT1 selection line with contents in quantiles
+    #'MapPhiUse',    # use the "mapPhi" data structure in the HLT1 pre-selection line "mapPhi"
+    #'CheckRestFill',# check filling the rest of RICH2 mirror combinations along with 8 poorest
+    #'SkipFilled',   # check filling all RICH2 mirror combinations with skipping when filled
+]
+
+
 with (
-    standalone_rich_online_align_reco.bind(
-        RichGas=radiator,
-        EventFilter=event_filter if useHltDecisions else [],
-        noUT=noUT_bool,
-    ),
-    alignment_rich_monitoring_options.bind(
-        radiator=radiator, init_override_opts=align_opts
-    ),
-    default_ft_decoding_version.bind(value=6),
+    # PrForwardTrackingVelo.bind(MinP=min_p),
+    # PrMatchNN.bind(MinP=min_p),
+    # PrHybridSeeding.bind(MinP=min_p),
+    track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),
     default_rich_reco_options.bind(init_override_opts=default_reco_opts),
     default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
+    alignment_rich_monitoring_options.bind(
+        radiator="Rich1Gas", init_override_opts=align_opts
+    ),
 ):
-    run_reconstruction(options, standalone_rich_online_align_reco)
+    reconstruction = standalone_rich_panel_align_reco(
+        RichGas="Rich1Gas", MirrorAlignTasks=tasks, EventFilter=event_filter, noUT=noUT
+    )
+    config.update(configure(options, reconstruction.node))
\ No newline at end of file
-- 
GitLab


From 64b38e18834021f55e4810172f8dddc39effa0cc Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 11:08:36 +0000
Subject: [PATCH 016/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index f83287b2a..0f5aefe2e 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -552,6 +552,7 @@ with (
     ),
 ):
     reconstruction = standalone_rich_panel_align_reco(
-        RichGas="Rich1Gas", MirrorAlignTasks=tasks, EventFilter=event_filter, noUT=noUT
+        # RichGas="Rich1Gas", MirrorAlignTasks=tasks, EventFilter=event_filter, noUT=noUT
+        RichGas="Rich1Gas", EventFilter=event_filter, noUT=noUT
     )
     config.update(configure(options, reconstruction.node))
\ No newline at end of file
-- 
GitLab


From f3ba7b001d4e6fc4b0bbdcbc9e34e7bd3446adae Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 11:14:08 +0000
Subject: [PATCH 017/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py    |   2 +-
 ...t2_reco_rich2_noUT_survey_dd4hep_survey.py | 103 +++++++++---------
 2 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index 9b74e33e4..a2af362a6 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -212,7 +212,7 @@ def standalone_rich_panel_align_reco(
             MinPCut=tight_sel["MinP"],
             MinPtCut=tight_sel["MinPt"],
             MaxChi2Cut=tight_sel["MaxChi2"],
-            MaxGhostProbCut=tight_sel["MaxGhostProb"],
+            # MaxGhostProbCut=tight_sel["MaxGhostProb"],
         ),
         CKResHistoRange=moni_opts["CKResHistoRange"],
         RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"],
diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 0f5aefe2e..e1cc6273b 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -502,57 +502,60 @@ if useHltDecisions:
     sys.stdout.flush()
 
 
-# with (
-#     standalone_rich_panel_align_reco.bind(
-#         RichGas=radiator,
-#         EventFilter=event_filter if useHltDecisions else [],
-#         noUT=noUT_bool,
-#     ),
-#     alignment_rich_monitoring_options.bind(
-#         radiator=radiator, init_override_opts=align_opts
-#     ),
-#     default_ft_decoding_version.bind(value=6),
-#     default_rich_reco_options.bind(init_override_opts=default_reco_opts),
-#     default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
-# ):
-#     run_reconstruction(options, standalone_rich_panel_align_reco)
-
-noUT = True
-if useUT_bool:
-    noUT = False
-    from RecoConf.hlt2_tracking import make_hlt2_tracks as track_maker
-else:
-    from RecoConf.hlt2_tracking import make_hlt2_tracks_without_UT as track_maker
-
-tasks = [
-    "Produce",  #    # fill the production set of histograms
-    #'Monitor',      # add various checking histograms
-    #'MapExlore',    # explore tracks and photons for the HLT1 pre-selection line "map"
-    #'MapConstruct', # construct exploratory data structure for the HLT1 pre-selection line "map"
-    #'Map',          # create data structure to be used in the HLT1 selection line with entire contents
-    #'MapUse',       # use the "map" data structure a la in the HLT1 pre-selection line "map"
-    #'AllFillCount', # add counters for optimization of the RICH2 mirror combinations subset
-    #'AllFillPhi',   # fill 1D phi histos for optimization of the RICH2 mirror combinations subset
-    #'MapPhi',       # create data structure to be used in the HLT1 selection line with contents in quantiles
-    #'MapPhiUse',    # use the "mapPhi" data structure in the HLT1 pre-selection line "mapPhi"
-    #'CheckRestFill',# check filling the rest of RICH2 mirror combinations along with 8 poorest
-    #'SkipFilled',   # check filling all RICH2 mirror combinations with skipping when filled
-]
-
-
 with (
-    # PrForwardTrackingVelo.bind(MinP=min_p),
-    # PrMatchNN.bind(MinP=min_p),
-    # PrHybridSeeding.bind(MinP=min_p),
-    track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),
-    default_rich_reco_options.bind(init_override_opts=default_reco_opts),
-    default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
+    standalone_rich_panel_align_reco.bind(
+        RichGas=radiator,
+        EventFilter=event_filter if useHltDecisions else [],
+        noUT=noUT_bool,
+    ),
     alignment_rich_monitoring_options.bind(
-        radiator="Rich1Gas", init_override_opts=align_opts
+        radiator=radiator, init_override_opts=align_opts
     ),
+    default_ft_decoding_version.bind(value=6),
+    default_rich_reco_options.bind(init_override_opts=default_reco_opts),
+    default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
 ):
-    reconstruction = standalone_rich_panel_align_reco(
-        # RichGas="Rich1Gas", MirrorAlignTasks=tasks, EventFilter=event_filter, noUT=noUT
-        RichGas="Rich1Gas", EventFilter=event_filter, noUT=noUT
-    )
-    config.update(configure(options, reconstruction.node))
\ No newline at end of file
+    run_reconstruction(options, standalone_rich_panel_align_reco)
+
+
+    
+
+# noUT = True
+# if useUT_bool:
+#     noUT = False
+#     from RecoConf.hlt2_tracking import make_hlt2_tracks as track_maker
+# else:
+#     from RecoConf.hlt2_tracking import make_hlt2_tracks_without_UT as track_maker
+
+# tasks = [
+#     "Produce",  #    # fill the production set of histograms
+#     #'Monitor',      # add various checking histograms
+#     #'MapExlore',    # explore tracks and photons for the HLT1 pre-selection line "map"
+#     #'MapConstruct', # construct exploratory data structure for the HLT1 pre-selection line "map"
+#     #'Map',          # create data structure to be used in the HLT1 selection line with entire contents
+#     #'MapUse',       # use the "map" data structure a la in the HLT1 pre-selection line "map"
+#     #'AllFillCount', # add counters for optimization of the RICH2 mirror combinations subset
+#     #'AllFillPhi',   # fill 1D phi histos for optimization of the RICH2 mirror combinations subset
+#     #'MapPhi',       # create data structure to be used in the HLT1 selection line with contents in quantiles
+#     #'MapPhiUse',    # use the "mapPhi" data structure in the HLT1 pre-selection line "mapPhi"
+#     #'CheckRestFill',# check filling the rest of RICH2 mirror combinations along with 8 poorest
+#     #'SkipFilled',   # check filling all RICH2 mirror combinations with skipping when filled
+# ]
+
+
+# with (
+#     # PrForwardTrackingVelo.bind(MinP=min_p),
+#     # PrMatchNN.bind(MinP=min_p),
+#     # PrHybridSeeding.bind(MinP=min_p),
+#     track_maker.bind(use_pr_kf=True, light_reco=True, fast_reco=True),
+#     default_rich_reco_options.bind(init_override_opts=default_reco_opts),
+#     default_rich_monitoring_options.bind(init_override_opts=default_moni_opts),
+#     alignment_rich_monitoring_options.bind(
+#         radiator="Rich1Gas", init_override_opts=align_opts
+#     ),
+# ):
+#     reconstruction = standalone_rich_panel_align_reco(
+#         # RichGas="Rich1Gas", MirrorAlignTasks=tasks, EventFilter=event_filter, noUT=noUT
+#         RichGas="Rich1Gas", EventFilter=event_filter, noUT=noUT
+#     )
+#     config.update(configure(options, reconstruction.node))
\ No newline at end of file
-- 
GitLab


From 0ff55182904efab3148a60448c39c484cdb8aeb5 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 11:16:55 +0000
Subject: [PATCH 018/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index a2af362a6..9b74e33e4 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -212,7 +212,7 @@ def standalone_rich_panel_align_reco(
             MinPCut=tight_sel["MinP"],
             MinPtCut=tight_sel["MinPt"],
             MaxChi2Cut=tight_sel["MaxChi2"],
-            # MaxGhostProbCut=tight_sel["MaxGhostProb"],
+            MaxGhostProbCut=tight_sel["MaxGhostProb"],
         ),
         CKResHistoRange=moni_opts["CKResHistoRange"],
         RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"],
-- 
GitLab


From ae4f9785598446a1b071922c95d429d645449841 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 11:22:12 +0000
Subject: [PATCH 019/102] run panels

---
 Rich/Panoptes/python/Panoptes/alignment.py                   | 1 -
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py     | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index 9b74e33e4..fc03b274c 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -329,7 +329,6 @@ def standalone_rich_online_align_reco(
             MaxGhostProbCut=tight_sel["MaxGhostProb"],
         ),
         CKResHistoRange=moni_opts["CKResHistoRange"],
-        RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"],
         TracksLocation=conf["InputTracks"],
         TrackSegmentsLocation=conf["TrackSegments"],
         CherenkovPhotonLocation=conf["CherenkovPhotons"],
diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index e1cc6273b..48bf8910a 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -385,7 +385,8 @@ if whichRich == 2:
 default_moni_opts.update(tighter_minp)
 
 # wider_histo = {'CKResHistoRange': (0.025, 0.005, 0.004)}
-wider_histo = {"CKResHistoRange": (0.025, 0.0055, 0.0055)}
+# wider_histo = {"CKResHistoRange": (0.025, 0.0055, 0.0055)}
+wider_histo = {"CKResHistoRange": 0.025}
 default_moni_opts.update(wider_histo)
 useUT = {"UseUT": useUT_bool}
 default_moni_opts.update(useUT)
@@ -518,7 +519,7 @@ with (
     run_reconstruction(options, standalone_rich_panel_align_reco)
 
 
-    
+
 
 # noUT = True
 # if useUT_bool:
-- 
GitLab


From 0569b131b83d70179059ed0b564b9bcc673df826 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 11:23:38 +0000
Subject: [PATCH 020/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 48bf8910a..6a18c1578 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -385,8 +385,9 @@ if whichRich == 2:
 default_moni_opts.update(tighter_minp)
 
 # wider_histo = {'CKResHistoRange': (0.025, 0.005, 0.004)}
-# wider_histo = {"CKResHistoRange": (0.025, 0.0055, 0.0055)}
-wider_histo = {"CKResHistoRange": 0.025}
+# wider_histo = {"CKResHistoRange": (0.025, 0.0055, 0.0055)} # 2024 script
+wider_histo = {"CKResHistoRange": (0.025, 0.0055)} # Cannot convert '(0.025, 0.0055, 0.0055)' for property 'CKResHistoRange' in class 'Rich::Future::Rec::Moni::SIMDPhotonCherenkovAngles': std::invalid_argument, cannot parse '(0.025, 0.0055, 0.0055)' to std::array<float,2ul>	 StatusCode=FAILURE
+
 default_moni_opts.update(wider_histo)
 useUT = {"UseUT": useUT_bool}
 default_moni_opts.update(useUT)
-- 
GitLab


From bf28b01227730d4a2afc28793376c26b39c327e6 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 12:20:02 +0000
Subject: [PATCH 021/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 6a18c1578..5a7389ed3 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -386,7 +386,8 @@ default_moni_opts.update(tighter_minp)
 
 # wider_histo = {'CKResHistoRange': (0.025, 0.005, 0.004)}
 # wider_histo = {"CKResHistoRange": (0.025, 0.0055, 0.0055)} # 2024 script
-wider_histo = {"CKResHistoRange": (0.025, 0.0055)} # Cannot convert '(0.025, 0.0055, 0.0055)' for property 'CKResHistoRange' in class 'Rich::Future::Rec::Moni::SIMDPhotonCherenkovAngles': std::invalid_argument, cannot parse '(0.025, 0.0055, 0.0055)' to std::array<float,2ul>	 StatusCode=FAILURE
+# wider_histo = {"CKResHistoRange": (0.025, 0.0055)} 
+wider_histo = {"CKResHistoRange": (0.0055, 0.0055)} 
 
 default_moni_opts.update(wider_histo)
 useUT = {"UseUT": useUT_bool}
-- 
GitLab


From 1e8bd8adbc5cb73bd474283a0e6df7bcb27073b5 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 12:23:22 +0000
Subject: [PATCH 022/102] run panels

---
 .../surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
index 5a7389ed3..7e5992b42 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/hlt2_reco_rich2_noUT_survey_dd4hep_survey.py
@@ -144,12 +144,12 @@ else:
 
             return files
 
-        options.input_files = obtain_files_from_many_runs(
-            base_dir_files, 299618, 299683
-        )
         # options.input_files = obtain_files_from_many_runs(
-        #     base_dir_files, 307065, 307075
+            # base_dir_files, 299618, 299683
         # )
+        options.input_files = obtain_files_from_many_runs(
+            base_dir_files, 307065, 307075
+        )
 
         # base_dir_files, 298656, 300124)
 
-- 
GitLab


From b4ec67b920d1f955c2ea9a7c4b5235391c189738 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 14:05:24 +0000
Subject: [PATCH 023/102] run testbench

---
 .../python/RichMirrorAlignmentOnline/Configuration.py  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index f00cc43ac..533fd048d 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -62,10 +62,12 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
-        "WorkDir": "/group/online/AligWork/Rich1/",
-        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
-        "SaveDir": "/group/online/AligWork/MirrorAlignments/",
-        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        "WorkDir": 
+        # "/group/online/AligWork/Rich1/",
+        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        "SaveDir": 
+        # "/group/online/AligWork/MirrorAlignments/",
+        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From f8e3a893ede5a4ffe96bf35a6f3e63a5c01f9ad7 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 14:16:15 +0000
Subject: [PATCH 024/102] mirrors now

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py        | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 101262b48..03a634b04 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -194,8 +194,9 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
         from GaudiKernel.SystemOfUnits import GeV, MeV, mm, mrad
         from Moore import (
             options,
-            run_reconstruction,
+            # run_reconstruction,
         )
+        from RecoConf.config import run_reconstruction
         from Panoptes.alignment import (
             standalone_rich_online_align_reco,
             standalone_rich_panel_align_reco,
@@ -219,6 +220,11 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
         )
         from RecoConf.rich_reconstruction import default_rich_reco_options
 
+        from PyConf.application import (
+            configure,
+            configure_input,
+        )
+
         """Options for running over data with FT raw bank version 6."""
         from RecoConf.decoders import (
             default_ft_decoding_version,
@@ -505,6 +511,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
             options.conddb_tag = "upgrade/sim-20220612-vc-md100-RICHcustomFTv6"
             options.simulation = True
 
+        config = configure_input(options)
+
         param_list = ["p0_x", "p1_x", "p0_y", "p1_y", "p0_z", "p1_z"]
         param_dict = dict.fromkeys(param_list)
 
@@ -644,7 +652,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
             }
         }
         default_moni_opts.update(tighter_minp)
-        wider_histo = {"CKResHistoRange": (0.025, 0.005, 0.004)}
+        # wider_histo = {"CKResHistoRange": (0.025, 0.005, 0.004)}
+        wider_histo = {"CKResHistoRange": (0.005, 0.005)}
         default_moni_opts.update(wider_histo)
         useUT = {"UseUT": useUT_bool}
         default_moni_opts.update(useUT)
-- 
GitLab


From abe9a0f59d0c4e94c8ca8e6f362c35c49d52c904 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 14:18:19 +0000
Subject: [PATCH 025/102] mirrors now

---
 Rich/Panoptes/python/Panoptes/alignment.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/Panoptes/python/Panoptes/alignment.py b/Rich/Panoptes/python/Panoptes/alignment.py
index fc03b274c..9b74e33e4 100644
--- a/Rich/Panoptes/python/Panoptes/alignment.py
+++ b/Rich/Panoptes/python/Panoptes/alignment.py
@@ -329,6 +329,7 @@ def standalone_rich_online_align_reco(
             MaxGhostProbCut=tight_sel["MaxGhostProb"],
         ),
         CKResHistoRange=moni_opts["CKResHistoRange"],
+        RichSIMDPixelSummariesLocation=conf["RichSIMDPixels"],
         TracksLocation=conf["InputTracks"],
         TrackSegmentsLocation=conf["TrackSegments"],
         CherenkovPhotonLocation=conf["CherenkovPhotons"],
-- 
GitLab


From a97d6b94c068c085acefde18afb2f5b93b99bb40 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 14:23:03 +0000
Subject: [PATCH 026/102] mirrors now

---
 .../python/RichMirrorAlignmentOnline/Configuration.py     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 533fd048d..4ef06e850 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -63,11 +63,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        # "/group/online/AligWork/Rich1/",
-        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/Rich1/",
+        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        # "/group/online/AligWork/MirrorAlignments/",
-        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/MirrorAlignments/",
+        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From 1e123a7e882cd9badecf546f692e5bee51fe3817 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 16:48:23 +0000
Subject: [PATCH 027/102] mirrors now

---
 .../python/RichMirrorAlignmentOnline/Configuration.py     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 4ef06e850..533fd048d 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -63,11 +63,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        "/group/online/AligWork/Rich1/",
-        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/Rich1/",
+        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        "/group/online/AligWork/MirrorAlignments/",
-        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/MirrorAlignments/",
+        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From a40cdbdb18fecfd6bcb55dc580541c8c1eb854c6 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 17 Feb 2025 16:53:23 +0000
Subject: [PATCH 028/102] mirrors now

---
 .../python/PyMirrAlignOnline/data_online_Rich1.py               | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index ab391eb02..e257fbc49 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -146,7 +146,7 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     # select_run_numbers = [28985, 28986, 28987]
     # select_run_numbers = "290034"
     # select_run_numbers = [299620,299673,299681]
-    select_run_numbers = [299620]
+    select_run_numbers = [307065, 307066, 307067]
     if not isinstance(select_run_numbers, list):
         select_run_numbers = [select_run_numbers]
     options.input_files = [
-- 
GitLab


From 42154bdbda17fb7fa1465a88486276368931be0f Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 18 Feb 2025 12:19:51 +0000
Subject: [PATCH 029/102] allow overlay

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 31 +++++++++----------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 03a634b04..8edeceece 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -440,32 +440,31 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     shutil.copyfile(fromFile, toFile)
                     sys.stdout.flush()
                 elif useConditionsOverlay:
-                    doCondOverlay = False
-                    if n_it == 0:
-                        dd4hep.UseConditionsOverlay = False
 
-                        # only change conditions on it0 if there is a starting yaml defined
+                    toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+
+                    if n_it == 0:
+                        
                         yamlCondUpdate = alignConf.getProp("startYAMLFile")
                         if yamlCondUpdate != "":
                             fromFile = yamlCondUpdate
-                            doCondOverlay = True
+                        else:
+                            try: os.remove(toFile)
+                            except as e: print(toFile, "already blank")
+                            fromFile = None
 
-                    if n_it >= 1:  # always update conditions for n_it >= 1
+                    elif n_it >= 1:  # always update conditions for n_it >= 1
                         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
-                        doCondOverlay = True
 
-                    if doCondOverlay:
-                        dd4hep.UseConditionsOverlay = True
-                        dd4hep.ConditionsOverlayInitPath = (
-                            "/group/rich/sw/alignment/ConditionsOverlay"
-                        )
-
-                        toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                    dd4hep.UseConditionsOverlay = True
+                    dd4hep.ConditionsOverlayInitPath = (
+                        "/group/rich/sw/alignment/ConditionsOverlay"
+                    )
 
+                    if fromFile is not None:
                         print(f"INFO: Copying {fromFile} to {toFile}")
-
                         shutil.copyfile(fromFile, toFile)
-                        sys.stdout.flush()
+                    sys.stdout.flush()
 
             else:
                 options.conddb_tag = (
-- 
GitLab


From 554961a3ed7362e2ee89bdce33284b812aff46aa Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 18 Feb 2025 12:24:15 +0000
Subject: [PATCH 030/102] allow overlay

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 8edeceece..60f636b91 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -450,7 +450,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                             fromFile = yamlCondUpdate
                         else:
                             try: os.remove(toFile)
-                            except as e: print(toFile, "already blank")
+                            except Exception as e: print(toFile, "already blank")
                             fromFile = None
 
                     elif n_it >= 1:  # always update conditions for n_it >= 1
-- 
GitLab


From f1b07901eb8384a505305a4580e25134296f38da Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 18 Feb 2025 12:58:37 +0000
Subject: [PATCH 031/102] allow overlay

---
 .../python/RichMirrorAlignmentOnline/Configuration.py     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 533fd048d..4ef06e850 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -63,11 +63,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        # "/group/online/AligWork/Rich1/",
-        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/Rich1/",
+        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        # "/group/online/AligWork/MirrorAlignments/",
-        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/MirrorAlignments/",
+        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From b98eb8aa0ed7a0b1c6de24d6fc6aeed0875b546c Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 18 Feb 2025 13:40:22 +0000
Subject: [PATCH 032/102] HACK run numbers

---
 .../PyMirrAlignOnline/data_online_Rich1.py      | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index e257fbc49..9ed4dce30 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -155,6 +155,23 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
         if any(str(run_number) in x for run_number in select_run_numbers)
     ]
 
+
+#### HACKKKK
+base_dir = "/calib/align/LHCb/Rich1/*/"
+dirs = glob.glob(base_dir, recursive=True)
+files = []
+for dir_i in dirs:
+    files += glob.glob(dir_i + "*")
+files_HACK = []
+for file in files:
+    file_id = file.split("/")[-2]
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+        files_HACK.append(file)
+files = files_HACK
+files = sorted(files, reverse=True)
+options.input_files = files
+
+
 print(f"{len(options.input_files)} .mdf files...")
 
 sys.stdout.flush()
-- 
GitLab


From 1c67d3d31abab2661213bcd5a4e13ccc05f096cc Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 18 Feb 2025 13:40:53 +0000
Subject: [PATCH 033/102] HACK run numbers

---
 .../python/PyMirrAlignOnline/data_online_Rich1.py               | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 9ed4dce30..13594dc6a 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -170,7 +170,7 @@ for file in files:
 files = files_HACK
 files = sorted(files, reverse=True)
 options.input_files = files
-
+print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
-- 
GitLab


From c63b78ddbeec14439fd7765c952705b304e7c2e7 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 18 Feb 2025 13:52:15 +0000
Subject: [PATCH 034/102] HACK run numbers

---
 .../python/PyMirrAlignOnline/data_online_Rich1.py             | 3 ++-
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 13594dc6a..71baa680b 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -165,7 +165,8 @@ for dir_i in dirs:
 files_HACK = []
 for file in files:
     file_id = file.split("/")[-2]
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
         files_HACK.append(file)
 files = files_HACK
 files = sorted(files, reverse=True)
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 4ef06e850..b3f2d37dc 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -57,8 +57,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "stackDir": "/group/rich/sw/alignment/stack/",
         "magnFactorsMode": 0,  # 0,
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
-        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
-        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
+        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
-- 
GitLab


From 1ccb5f50f31cc7fb90b0df7c13c8b25125013125 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 19 Feb 2025 09:22:21 +0000
Subject: [PATCH 035/102] reverse hack

---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 71baa680b..4aa071d62 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -156,22 +156,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     ]
 
 
-#### HACKKKK
-base_dir = "/calib/align/LHCb/Rich1/*/"
-dirs = glob.glob(base_dir, recursive=True)
-files = []
-for dir_i in dirs:
-    files += glob.glob(dir_i + "*")
-files_HACK = []
-for file in files:
-    file_id = file.split("/")[-2]
-    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
-        files_HACK.append(file)
-files = files_HACK
-files = sorted(files, reverse=True)
-options.input_files = files
-print("HACKKKK")
+# #### HACKKKK
+# base_dir = "/calib/align/LHCb/Rich1/*/"
+# dirs = glob.glob(base_dir, recursive=True)
+# files = []
+# for dir_i in dirs:
+#     files += glob.glob(dir_i + "*")
+# files_HACK = []
+# for file in files:
+#     file_id = file.split("/")[-2]
+#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
+#         files_HACK.append(file)
+# files = files_HACK
+# files = sorted(files, reverse=True)
+# options.input_files = files
+# print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
-- 
GitLab


From d04f3bf04349a3a8237271a925aa8b4f389e2fe8 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 13:21:09 +0000
Subject: [PATCH 036/102] override geom option

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 23 +++++++++++++
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 .../Configuration.py                          |  2 +-
 3 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 60f636b91..b41d3d25a 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -346,6 +346,29 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                 elif "Collision24" in dataVariant:
                     dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
 
+                if "overrideGeom" in dataVariant:
+                    dd4hep.ConditionsVersion = "master"
+                    dd4hep.ConditionsLocation = (
+                        "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
+                    )
+                    options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
+                    options.dddb_tag = OnlineEnv.DDDBTag
+                    DDDBConf().GeometryVersion = OnlineEnv.DDDBTag
+                    options.geometry_version = OnlineEnv.DDDBTag
+
+                    options.conddb_tag = "master"  # used for real data
+                    options.dddb_tag = "run3/trunk"
+
+                    dd4hep.UseConditionsOverlay = True
+                    dd4hep.ConditionsVersion = "master"
+
+                    # needed for when reconstruction changed to SuperPixels (change was at run 289434)
+                    DDDBConf().GeometryVersion = "run3/trunk"
+                    options.geometry_version = "run3/trunk"
+
+
+                    
+
                 if useCondDBPath:
                     # PN - Here we only want to replace the
                     #      latest Mirrors YAML in the git clone DB
diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 4aa071d62..71baa680b 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -156,22 +156,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     ]
 
 
-# #### HACKKKK
-# base_dir = "/calib/align/LHCb/Rich1/*/"
-# dirs = glob.glob(base_dir, recursive=True)
-# files = []
-# for dir_i in dirs:
-#     files += glob.glob(dir_i + "*")
-# files_HACK = []
-# for file in files:
-#     file_id = file.split("/")[-2]
-#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
-#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
-#         files_HACK.append(file)
-# files = files_HACK
-# files = sorted(files, reverse=True)
-# options.input_files = files
-# print("HACKKKK")
+#### HACKKKK
+base_dir = "/calib/align/LHCb/Rich1/*/"
+dirs = glob.glob(base_dir, recursive=True)
+files = []
+for dir_i in dirs:
+    files += glob.glob(dir_i + "*")
+files_HACK = []
+for file in files:
+    file_id = file.split("/")[-2]
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
+        files_HACK.append(file)
+files = files_HACK
+files = sorted(files, reverse=True)
+options.input_files = files
+print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index b3f2d37dc..a8178e020 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,7 +51,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        "dataVariant": "Collision24",
+        "dataVariant": "Collision24_overrideGeom",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-- 
GitLab


From 32750eb2c5bfba6de6dc6318e1c08ddb15d10250 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 13:28:19 +0000
Subject: [PATCH 037/102] override geom option

---
 .../python/PyMirrAlignOnline/RichAnalyzerControl.py             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py
index 93baf0e90..5a6224956 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py
@@ -141,7 +141,7 @@ class RichAnalyzerControl:
                 myStdErr = open(analyzerStdErrFile, "w")
 
                 self.dataVariant = alignConf.getProp("dataVariant")
-                if self.dataVariant == "Collision24":
+                if self.dataVariant == "Collision24" or self.dataVariant == "Collision24_overrideGeom":
                     if self.whichRich == 1:
                         which_data_online = "data_online_Rich1.py"
                     elif self.whichRich == 2:
-- 
GitLab


From 21e96f897904ba1780318600cb765729c6448ed8 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 14:12:50 +0000
Subject: [PATCH 038/102] override geom option

---
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index a8178e020..8792d2b87 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -89,10 +89,10 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
         "startYAMLFile": "",
-        # "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v10" # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0" # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareYAMLFile": "",
-        # "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v10" # if this is blank, it automatically uses the DB YAML file
+        "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0" # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-- 
GitLab


From f75dc0c756093d58cc7abdc9c2ee579ea43e3cd0 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 14:19:00 +0000
Subject: [PATCH 039/102] override geom option

---
 .../python/RichMirrorAlignmentOnline/Configuration.py       | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 8792d2b87..27d267636 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -88,11 +88,9 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         ### May be changed if you know what you are doing, explanations below
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
-        "startYAMLFile": "",
-        "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0" # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
-        "compareYAMLFile": "",
-        "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0" # if this is blank, it automatically uses the DB YAML file
+        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-- 
GitLab


From c6dad2f56ca5fa3348a12b1aef1cc9e0bc61ad7e Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 16:03:36 +0000
Subject: [PATCH 040/102] override geom option

---
 .../python/RichMirrorAlignmentOnline/Configuration.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 27d267636..b4b9a4687 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -55,7 +55,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 0,  # 0,
+        "magnFactorsMode": 2,  # 0,
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
-- 
GitLab


From 04f79ce879a4f6945c0d1a7c9430d4fb5c4342cb Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 16:22:48 +0000
Subject: [PATCH 041/102] override geom option

---
 .../python/RichMirrorAlignmentOnline/Configuration.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index b4b9a4687..27d267636 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -55,7 +55,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 2,  # 0,
+        "magnFactorsMode": 0,  # 0,
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
-- 
GitLab


From d2faf68ead1203061f41f587a33e1775428a30ac Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 20 Feb 2025 16:25:20 +0000
Subject: [PATCH 042/102] override geom option

---
 .../python/RichMirrorAlignmentOnline/Configuration.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 27d267636..43c6592d4 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -55,7 +55,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 0,  # 0,
+        "magnFactorsMode": 1,  # 0,
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
-- 
GitLab


From 2192b4b50a055ea9f2043526ee6c289fff6f4a06 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Fri, 21 Feb 2025 08:25:46 +0000
Subject: [PATCH 043/102] magfacs

---
 .../python/RichMirrorAlignmentOnline/Configuration.py        | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 43c6592d4..bb1b4b08d 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -55,9 +55,10 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 1,  # 0,
+        "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
-        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
+        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
-- 
GitLab


From a2fa07a7992790ba29da520b51e04e46cdb79c8a Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 08:52:55 +0000
Subject: [PATCH 044/102] start

---
 .../PanelAlignment/surveys/survey_opts.yml             | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/survey_opts.yml b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/survey_opts.yml
index 8f693ca59..399bf383f 100644
--- a/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/survey_opts.yml
+++ b/Rich/RichMirrorAlignmentOnline/files/OfflineScripts/PanelAlignment/surveys/survey_opts.yml
@@ -187,10 +187,10 @@ stack_path: /group/rich/sw/alignment/stack/
 
 
 R1:
-  P0:
+  P0: # top
     perf_trans:
-      x: 0.75
-      y: -4.2
+      x: 0.8999999999999999
+      y: -5.95
       z: 0.0
     perf_rot:
       x: 0.0
@@ -198,8 +198,8 @@ R1:
       z: 0.0
   P1:
     perf_trans:
-      x: -3.6984375000000016
-      y: 8.4015625
+      x: -4.398437500000002
+      y: 6.0515625
       z: 0.0
     perf_rot:
       x: 0.0
-- 
GitLab


From c4ca9fa3b20bbe4003de7c5088c6e8fcb907bc1f Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:21:03 +0000
Subject: [PATCH 045/102] testing

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  |  1 +
 .../PyMirrAlignOnline/data_online_Rich1.py    | 35 ++++++++++---------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index b41d3d25a..c097b022e 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -471,6 +471,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                         yamlCondUpdate = alignConf.getProp("startYAMLFile")
                         if yamlCondUpdate != "":
                             fromFile = yamlCondUpdate
+                            print("START YAML", fromFile)
                         else:
                             try: os.remove(toFile)
                             except Exception as e: print(toFile, "already blank")
diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 71baa680b..4e2edf206 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -146,7 +146,8 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     # select_run_numbers = [28985, 28986, 28987]
     # select_run_numbers = "290034"
     # select_run_numbers = [299620,299673,299681]
-    select_run_numbers = [307065, 307066, 307067]
+    # select_run_numbers = [307065, 307066, 307067]
+    select_run_numbers = [307065]
     if not isinstance(select_run_numbers, list):
         select_run_numbers = [select_run_numbers]
     options.input_files = [
@@ -156,22 +157,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     ]
 
 
-#### HACKKKK
-base_dir = "/calib/align/LHCb/Rich1/*/"
-dirs = glob.glob(base_dir, recursive=True)
-files = []
-for dir_i in dirs:
-    files += glob.glob(dir_i + "*")
-files_HACK = []
-for file in files:
-    file_id = file.split("/")[-2]
-    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
-        files_HACK.append(file)
-files = files_HACK
-files = sorted(files, reverse=True)
-options.input_files = files
-print("HACKKKK")
+# #### HACKKKK
+# base_dir = "/calib/align/LHCb/Rich1/*/"
+# dirs = glob.glob(base_dir, recursive=True)
+# files = []
+# for dir_i in dirs:
+#     files += glob.glob(dir_i + "*")
+# files_HACK = []
+# for file in files:
+#     file_id = file.split("/")[-2]
+#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
+#         files_HACK.append(file)
+# files = files_HACK
+# files = sorted(files, reverse=True)
+# options.input_files = files
+# print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
-- 
GitLab


From 35d5ccdfc210cc03705bf085146dc47dee8c5cc4 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:23:30 +0000
Subject: [PATCH 046/102] testing

---
 .../RichMirrorAlignmentOnline/Configuration.py       | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index bb1b4b08d..396a2e47e 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -57,18 +57,18 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "stackDir": "/group/rich/sw/alignment/stack/",
         "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
-        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
-        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
+        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        "/group/online/AligWork/Rich1/",
-        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/Rich1/",
+        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        "/group/online/AligWork/MirrorAlignments/",
-        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/MirrorAlignments/",
+        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From ce21a3cc1c344829e29c8b67e38c484f46acd34e Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:37:38 +0000
Subject: [PATCH 047/102] testing

---
 .../python/RichMirrorAlignmentOnline/Configuration.py          | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 396a2e47e..1af230fdb 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,7 +51,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        "dataVariant": "Collision24_overrideGeom",
+        # "dataVariant": "Collision24_overrideGeom",
+        "dataVariant": "Collision24",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-- 
GitLab


From 57d0246470c0ba8053db1cec351ac1aebf46db4b Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:39:37 +0000
Subject: [PATCH 048/102] testing

---
 .../python/RichMirrorAlignmentOnline/Configuration.py       | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 1af230fdb..494131760 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -90,9 +90,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         ### May be changed if you know what you are doing, explanations below
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
-        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "startYAMLFile": "",
+        # "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
-        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
+        "compareYAMLFile": "",
+        # "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-- 
GitLab


From 66b8632257bfc6bfe715a0a27353530b966c9348 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:43:12 +0000
Subject: [PATCH 049/102] testing

---
 .../python/PyMirrAlignOnline/Iterator.py                       | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
index b0266abe8..180674628 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
@@ -172,6 +172,7 @@ def run(whichRich, offline=False, runInlineReco=False):
     else:
         lastAlignSuccessLine = "UNKNOWN\n"
 
+    print("testbench: are we here AA")
     ### Now that we have the lastAlignSuccessLine, Reset lastAlignSuccessFile to default
     try:
         lastAlignSuccessFile = open(lastAlignSuccess, "w")
@@ -180,6 +181,7 @@ def run(whichRich, offline=False, runInlineReco=False):
     except:
         print("WARNING: failed open(lastAlignSuccess, 'w')")
 
+    print("testbench: are we here A")
     ## Start logging of hlt02 (the node that the iterator is running on)
     if lastAlignSuccessLine == "YES\n":
         logProcess = subprocess.Popen(
@@ -198,6 +200,7 @@ def run(whichRich, offline=False, runInlineReco=False):
             stdout=subprocess.PIPE,
         )
 
+    print("testbench: are we here B")
     logProcess.stdout.close()
     logProcess.stderr.close()
     sys.stdout.flush()
-- 
GitLab


From 55414c9f8cbb8d3b758517111c4fd00fa6488229 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:44:32 +0000
Subject: [PATCH 050/102] testing

---
 .../python/PyMirrAlignOnline/Iterator.py                         | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
index 180674628..8adb232e9 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
@@ -203,6 +203,7 @@ def run(whichRich, offline=False, runInlineReco=False):
     print("testbench: are we here B")
     logProcess.stdout.close()
     logProcess.stderr.close()
+    print("testbench: are we here C")
     sys.stdout.flush()
     print("INFO: Logger Initializing (8 second pause).")
     sleep(8)  # wait long enough for logger to initialize
-- 
GitLab


From 7c17ff48aac15ad354b69554bef5a88dfa3a0d57 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 09:45:09 +0000
Subject: [PATCH 051/102] testing

---
 .../python/PyMirrAlignOnline/Iterator.py                         | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
index 8adb232e9..fcbadec59 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
@@ -205,6 +205,7 @@ def run(whichRich, offline=False, runInlineReco=False):
     logProcess.stderr.close()
     print("testbench: are we here C")
     sys.stdout.flush()
+    print("testbench: are we here D")
     print("INFO: Logger Initializing (8 second pause).")
     sleep(8)  # wait long enough for logger to initialize
 
-- 
GitLab


From cb023266bfb112fef607f4ce9f9211e500fd62ae Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 10:05:51 +0000
Subject: [PATCH 052/102] testing

---
 .../python/PyMirrAlignOnline/Iterator.py      |  6 +---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 .../Configuration.py                          | 22 ++++++-------
 3 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
index fcbadec59..fa5b4ac89 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py
@@ -181,7 +181,6 @@ def run(whichRich, offline=False, runInlineReco=False):
     except:
         print("WARNING: failed open(lastAlignSuccess, 'w')")
 
-    print("testbench: are we here A")
     ## Start logging of hlt02 (the node that the iterator is running on)
     if lastAlignSuccessLine == "YES\n":
         logProcess = subprocess.Popen(
@@ -200,12 +199,9 @@ def run(whichRich, offline=False, runInlineReco=False):
             stdout=subprocess.PIPE,
         )
 
-    print("testbench: are we here B")
     logProcess.stdout.close()
     logProcess.stderr.close()
-    print("testbench: are we here C")
-    sys.stdout.flush()
-    print("testbench: are we here D")
+    sys.stdout.flush() # hanging in the testbench
     print("INFO: Logger Initializing (8 second pause).")
     sleep(8)  # wait long enough for logger to initialize
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 4e2edf206..51baed605 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -157,22 +157,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     ]
 
 
-# #### HACKKKK
-# base_dir = "/calib/align/LHCb/Rich1/*/"
-# dirs = glob.glob(base_dir, recursive=True)
-# files = []
-# for dir_i in dirs:
-#     files += glob.glob(dir_i + "*")
-# files_HACK = []
-# for file in files:
-#     file_id = file.split("/")[-2]
-#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
-#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
-#         files_HACK.append(file)
-# files = files_HACK
-# files = sorted(files, reverse=True)
-# options.input_files = files
-# print("HACKKKK")
+#### HACKKKK
+base_dir = "/calib/align/LHCb/Rich1/*/"
+dirs = glob.glob(base_dir, recursive=True)
+files = []
+for dir_i in dirs:
+    files += glob.glob(dir_i + "*")
+files_HACK = []
+for file in files:
+    file_id = file.split("/")[-2]
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
+        files_HACK.append(file)
+files = files_HACK
+files = sorted(files, reverse=True)
+options.input_files = files
+print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 494131760..0d47b6711 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,25 +51,25 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        # "dataVariant": "Collision24_overrideGeom",
-        "dataVariant": "Collision24",
+        "dataVariant": "Collision24_overrideGeom",
+        # "dataVariant": "Collision24",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
         "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
-        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
-        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
+        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        # "/group/online/AligWork/Rich1/",
-        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/Rich1/",
+        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        # "/group/online/AligWork/MirrorAlignments/",
-        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/MirrorAlignments/",
+        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
@@ -90,11 +90,9 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         ### May be changed if you know what you are doing, explanations below
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
-        "startYAMLFile": "",
-        # "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
-        "compareYAMLFile": "",
-        # "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
+        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-- 
GitLab


From da7fa875ad59d3e19b4b30d09344e3eb4eed8b6d Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 10:59:13 +0000
Subject: [PATCH 053/102] testing

---
 .../python/PyMirrAlignOnline/data_online_Rich1.py             | 4 ++--
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 51baed605..618694000 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -166,8 +166,8 @@ for dir_i in dirs:
 files_HACK = []
 for file in files:
     file_id = file.split("/")[-2]
-    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 307579:
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707:
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
         files_HACK.append(file)
 files = files_HACK
 files = sorted(files, reverse=True)
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 0d47b6711..f7f135598 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -59,8 +59,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
-        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
-        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
+        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
-- 
GitLab


From caa9bfc77134addd5bafb0796dc8fe4e525f9035 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 11:18:16 +0000
Subject: [PATCH 054/102] testing

---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 62 +++++++++----------
 .../Configuration.py                          |  2 +-
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 618694000..ced6d724b 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -142,37 +142,37 @@ if "online" in getpass.getuser():
     sys.stdout.flush()
     options.input_files = input_files
 
-if select_runs_TESTBENCH and "online" not in getpass.getuser():
-    # select_run_numbers = [28985, 28986, 28987]
-    # select_run_numbers = "290034"
-    # select_run_numbers = [299620,299673,299681]
-    # select_run_numbers = [307065, 307066, 307067]
-    select_run_numbers = [307065]
-    if not isinstance(select_run_numbers, list):
-        select_run_numbers = [select_run_numbers]
-    options.input_files = [
-        x
-        for x in options.input_files
-        if any(str(run_number) in x for run_number in select_run_numbers)
-    ]
-
-
-#### HACKKKK
-base_dir = "/calib/align/LHCb/Rich1/*/"
-dirs = glob.glob(base_dir, recursive=True)
-files = []
-for dir_i in dirs:
-    files += glob.glob(dir_i + "*")
-files_HACK = []
-for file in files:
-    file_id = file.split("/")[-2]
-    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
-        files_HACK.append(file)
-files = files_HACK
-files = sorted(files, reverse=True)
-options.input_files = files
-print("HACKKKK")
+# if select_runs_TESTBENCH and "online" not in getpass.getuser():
+# select_run_numbers = [28985, 28986, 28987]
+# select_run_numbers = "290034"
+# select_run_numbers = [299620,299673,299681]
+# select_run_numbers = [307065, 307066, 307067]
+select_run_numbers = [307065]
+if not isinstance(select_run_numbers, list):
+    select_run_numbers = [select_run_numbers]
+options.input_files = [
+    x
+    for x in options.input_files
+    if any(str(run_number) in x for run_number in select_run_numbers)
+]
+
+
+# #### HACKKKK
+# base_dir = "/calib/align/LHCb/Rich1/*/"
+# dirs = glob.glob(base_dir, recursive=True)
+# files = []
+# for dir_i in dirs:
+#     files += glob.glob(dir_i + "*")
+# files_HACK = []
+# for file in files:
+#     file_id = file.split("/")[-2]
+#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
+#         files_HACK.append(file)
+# files = files_HACK
+# files = sorted(files, reverse=True)
+# options.input_files = files
+# print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index f7f135598..0150a2bad 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -59,7 +59,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
-        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
-- 
GitLab


From 92cf8291841601c29fe48d52fe537bd05d185517 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 11:21:48 +0000
Subject: [PATCH 055/102] testing

---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 62 +++++++++----------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index ced6d724b..618694000 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -142,37 +142,37 @@ if "online" in getpass.getuser():
     sys.stdout.flush()
     options.input_files = input_files
 
-# if select_runs_TESTBENCH and "online" not in getpass.getuser():
-# select_run_numbers = [28985, 28986, 28987]
-# select_run_numbers = "290034"
-# select_run_numbers = [299620,299673,299681]
-# select_run_numbers = [307065, 307066, 307067]
-select_run_numbers = [307065]
-if not isinstance(select_run_numbers, list):
-    select_run_numbers = [select_run_numbers]
-options.input_files = [
-    x
-    for x in options.input_files
-    if any(str(run_number) in x for run_number in select_run_numbers)
-]
-
-
-# #### HACKKKK
-# base_dir = "/calib/align/LHCb/Rich1/*/"
-# dirs = glob.glob(base_dir, recursive=True)
-# files = []
-# for dir_i in dirs:
-#     files += glob.glob(dir_i + "*")
-# files_HACK = []
-# for file in files:
-#     file_id = file.split("/")[-2]
-#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
-#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
-#         files_HACK.append(file)
-# files = files_HACK
-# files = sorted(files, reverse=True)
-# options.input_files = files
-# print("HACKKKK")
+if select_runs_TESTBENCH and "online" not in getpass.getuser():
+    # select_run_numbers = [28985, 28986, 28987]
+    # select_run_numbers = "290034"
+    # select_run_numbers = [299620,299673,299681]
+    # select_run_numbers = [307065, 307066, 307067]
+    select_run_numbers = [307065]
+    if not isinstance(select_run_numbers, list):
+        select_run_numbers = [select_run_numbers]
+    options.input_files = [
+        x
+        for x in options.input_files
+        if any(str(run_number) in x for run_number in select_run_numbers)
+    ]
+
+
+#### HACKKKK
+base_dir = "/calib/align/LHCb/Rich1/*/"
+dirs = glob.glob(base_dir, recursive=True)
+files = []
+for dir_i in dirs:
+    files += glob.glob(dir_i + "*")
+files_HACK = []
+for file in files:
+    file_id = file.split("/")[-2]
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
+        files_HACK.append(file)
+files = files_HACK
+files = sorted(files, reverse=True)
+options.input_files = files
+print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
-- 
GitLab


From f699d1d829f75d49bbc657acb0f48a7731996654 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 12:48:51 +0000
Subject: [PATCH 056/102] testing

---
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 0150a2bad..dd04f9fdd 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -58,9 +58,9 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "stackDir": "/group/rich/sw/alignment/stack/",
         "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
-        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
+        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
-        "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
+        # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
-- 
GitLab


From e90f81507ccf54d57e0d1d7b7ab63b024369e7ec Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 14:50:05 +0000
Subject: [PATCH 057/102] testing

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                  | 2 ++
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index c097b022e..edea1d8d4 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -347,6 +347,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
 
                 if "overrideGeom" in dataVariant:
+                    print("INFO: overrideGeom ON")
                     dd4hep.ConditionsVersion = "master"
                     dd4hep.ConditionsLocation = (
                         "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
@@ -466,6 +467,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                     toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
+                    print('INFO: useConditionsOverlay n_it',n_it)
                     if n_it == 0:
                         
                         yamlCondUpdate = alignConf.getProp("startYAMLFile")
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index dd04f9fdd..27b23caa0 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -90,9 +90,9 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         ### May be changed if you know what you are doing, explanations below
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
-        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/vTest", # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
-        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
+        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/vTest", # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-- 
GitLab


From 86e16c8391d44d34f29613fc14c56966a9c0ee5b Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 16:19:56 +0000
Subject: [PATCH 058/102] testing

---
 .../python/RichMirrorAlignmentOnline/Configuration.py       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 27b23caa0..bbd2e439e 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -56,7 +56,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 0,  # 0, # 2 doesnt exist
+        "magnFactorsMode": 1,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
@@ -90,9 +90,9 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         ### May be changed if you know what you are doing, explanations below
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
-        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/vTest", # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
-        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/vTest", # if this is blank, it automatically uses the DB YAML file
+        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-- 
GitLab


From 0236f0fff70c5d5bea1d4050e0225acc64a740a8 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Mon, 24 Feb 2025 23:11:09 +0000
Subject: [PATCH 059/102] change to mental tilts for test

---
 .../python/RichMirrorAlignmentOnline/Configuration.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index bbd2e439e..2b30b1c17 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -97,7 +97,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "YAMLio": True,
         "useDD4hep": True,
         "minP": 30.0,
-        "coeffCalibTilt": 0.7,
+        "coeffCalibTilt": 7.0,
         "minAverageBinPop": 6.0,
         "phiBinFactor": 3,
         "minFracPhiBinsPopulated": 0.8,
-- 
GitLab


From 5fe6117329cff2f8f3ef1e836d02c9d866a63cbf Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 25 Feb 2025 14:15:09 +0000
Subject: [PATCH 060/102] new tilts

---
 .../python/RichMirrorAlignmentOnline/Configuration.py       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 2b30b1c17..fe81357e9 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -90,14 +90,14 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         ### May be changed if you know what you are doing, explanations below
         "startXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if testing is not True OR this is blank, it automatically uses the DB XML file
         "compareXMLFile": "",  # "/group/rich/sw/alignment/stack/Panoptes/Rich/RichMirrorAlignmentOnline/files/ZeroDB/Rich1_Zeroed.xml" # if this is blank, it automatically uses the DB XML file
-        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if testing is not True OR this is blank, it automatically uses the DB XML file
+        "startYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/vTest", # if testing is not True OR this is blank, it automatically uses the DB XML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if testing is not True OR this is blank, it automatically uses the DB XML file
-        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/v0", # if this is blank, it automatically uses the DB YAML file
+        "compareYAMLFile": "/group/rich/sw/alignment/lhcb-conditions-database-new/Conditions/Rich1/Alignment/Mirrors.yml/.pool/vTest", # if this is blank, it automatically uses the DB YAML file
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
         "minP": 30.0,
-        "coeffCalibTilt": 7.0,
+        "coeffCalibTilt": 0.7,
         "minAverageBinPop": 6.0,
         "phiBinFactor": 3,
         "minFracPhiBinsPopulated": 0.8,
-- 
GitLab


From f945ffe815b7729559f0b6658cbdad9074aa0296 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 25 Feb 2025 23:10:01 +0000
Subject: [PATCH 061/102] try with our old magfacs

---
 .../python/RichMirrorAlignmentOnline/Configuration.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index fe81357e9..27b23caa0 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -56,7 +56,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 1,  # 0, # 2 doesnt exist
+        "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
-- 
GitLab


From c7671688de50cfa804d1958db330936474a02aff Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 09:17:31 +0000
Subject: [PATCH 062/102] for test

---
 Rich/Panoptes/tests/options/2024-data.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index 3d7480b61..a901a2bfd 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -30,8 +30,9 @@ options.evt_max = 1000
 options.print_freq = 100
 
 # If required force use of trunk geom
-if myName and "trunk_geom" in myName:
-    options.geometry_version = "run3/trunk"
+# if myName and "trunk_geom" in myName:
+options.geometry_version = "run3/trunk"
+options.conditions_version = "RICH_alignment_2025"
 
 # Due to issues with hit sorting in FT disable Mat corrections
 # See for more details https://gitlab.cern.ch/lhcb/Panoptes/-/issues/7
-- 
GitLab


From 73c70432ab895fb0716a77dc9aeabaeeae5f73ec Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 10:06:27 +0000
Subject: [PATCH 063/102] trying testbench again

---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 .../Configuration.py                          |  8 ++---
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 618694000..57013820b 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -157,22 +157,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     ]
 
 
-#### HACKKKK
-base_dir = "/calib/align/LHCb/Rich1/*/"
-dirs = glob.glob(base_dir, recursive=True)
-files = []
-for dir_i in dirs:
-    files += glob.glob(dir_i + "*")
-files_HACK = []
-for file in files:
-    file_id = file.split("/")[-2]
-    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
-        files_HACK.append(file)
-files = files_HACK
-files = sorted(files, reverse=True)
-options.input_files = files
-print("HACKKKK")
+# #### HACKKKK
+# base_dir = "/calib/align/LHCb/Rich1/*/"
+# dirs = glob.glob(base_dir, recursive=True)
+# files = []
+# for dir_i in dirs:
+#     files += glob.glob(dir_i + "*")
+# files_HACK = []
+# for file in files:
+#     file_id = file.split("/")[-2]
+#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
+#         files_HACK.append(file)
+# files = files_HACK
+# files = sorted(files, reverse=True)
+# options.input_files = files
+# print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 27b23caa0..df304cec8 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -65,11 +65,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        "/group/online/AligWork/Rich1/",
-        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/Rich1/",
+        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        "/group/online/AligWork/MirrorAlignments/",
-        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/MirrorAlignments/",
+        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From 623d10b1ea2a0c1c5a0579c9d891b08845156902 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 10:31:28 +0000
Subject: [PATCH 064/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index edea1d8d4..ec132ef6c 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -489,6 +489,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                     if fromFile is not None:
                         print(f"INFO: Copying {fromFile} to {toFile}")
+                        print(getpass.getuser())
                         shutil.copyfile(fromFile, toFile)
                     sys.stdout.flush()
 
-- 
GitLab


From 631a4888f92f8c9c1f63e5611ce424aa23cbeff0 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 11:36:27 +0000
Subject: [PATCH 065/102] testbench

---
 Rich/Panoptes/tests/options/2024-data.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index a901a2bfd..9ff552676 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -19,12 +19,17 @@ myName = os.getenv("QMTTEST_NAME")
 # Start with config from TestFileDB
 options.set_input_and_conds_from_testfiledb("rich-decode-2024-panoptes")
 # If in Cambridge, use local PFNs
-jonPath = "/usera/jonesc/NFS/data/RunIII/Hlt2/LHCb/RefIndexCalib/2024/"
-if not myName and os.path.exists(jonPath):
-    options.input_files = [
-        jonPath + "data-{i:04d}.mdf".format(i=i) for i in range(0, 4)
-    ]
-print("Data :-", options.input_files)
+# jonPath = "/usera/jonesc/NFS/data/RunIII/Hlt2/LHCb/RefIndexCalib/2024/"
+# if not myName and os.path.exists(jonPath):
+#     options.input_files = [
+#         jonPath + "data-{i:04d}.mdf".format(i=i) for i in range(0, 4)
+#     ]
+# print("Data :-", options.input_files)
+
+import glob
+path = "/calib/align/LHCb/Rich1/0000307065/"
+files = glob.glob(path)
+options.input_files = files[:4]
 
 options.evt_max = 1000
 options.print_freq = 100
-- 
GitLab


From 7baac5fb661740f4d6d3c45861a082b4f2340556 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 11:38:42 +0000
Subject: [PATCH 066/102] testbench

---
 Rich/Panoptes/tests/options/2024-data.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index 9ff552676..26873dc2a 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -30,7 +30,9 @@ import glob
 path = "/calib/align/LHCb/Rich1/0000307065/"
 files = glob.glob(path)
 options.input_files = files[:4]
-
+print(files)
+print(options.input_files)
+quit()
 options.evt_max = 1000
 options.print_freq = 100
 
-- 
GitLab


From db2aad1af98501c8afcd136a1de6567f1980ef89 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 11:39:26 +0000
Subject: [PATCH 067/102] testbench

---
 Rich/Panoptes/tests/options/2024-data.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index 26873dc2a..a90fb90c3 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -27,10 +27,10 @@ options.set_input_and_conds_from_testfiledb("rich-decode-2024-panoptes")
 # print("Data :-", options.input_files)
 
 import glob
-path = "/calib/align/LHCb/Rich1/0000307065/"
+path = "/calib/align/LHCb/Rich1/0000307065/*.mdf"
 files = glob.glob(path)
 options.input_files = files[:4]
-print(files)
+print(len(files))
 print(options.input_files)
 quit()
 options.evt_max = 1000
-- 
GitLab


From 82b9e9323fe0ea209764f38f5809a1a4c57444be Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 11:39:44 +0000
Subject: [PATCH 068/102] testbench

---
 Rich/Panoptes/tests/options/2024-data.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index a90fb90c3..9647318ea 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -30,9 +30,9 @@ import glob
 path = "/calib/align/LHCb/Rich1/0000307065/*.mdf"
 files = glob.glob(path)
 options.input_files = files[:4]
-print(len(files))
-print(options.input_files)
-quit()
+# print(len(files))
+# print(options.input_files)
+# quit()
 options.evt_max = 1000
 options.print_freq = 100
 
-- 
GitLab


From 4b5f5042d06c2076b46d22b376b9297a4e5057ee Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 12:07:58 +0000
Subject: [PATCH 069/102] testbench

---
 Rich/Panoptes/tests/options/2024-data.py                      | 4 +---
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index 9647318ea..503727fb2 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -30,9 +30,7 @@ import glob
 path = "/calib/align/LHCb/Rich1/0000307065/*.mdf"
 files = glob.glob(path)
 options.input_files = files[:4]
-# print(len(files))
-# print(options.input_files)
-# quit()
+
 options.evt_max = 1000
 options.print_freq = 100
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index df304cec8..656fe6463 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -56,7 +56,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 0,  # 0, # 2 doesnt exist
+        "magnFactorsMode": 1,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
-- 
GitLab


From ab72b33a88cd1a08a4bd69d861d0096cbc3b2dee Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 12:46:17 +0000
Subject: [PATCH 070/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index ec132ef6c..b0a1aecf0 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -469,7 +469,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                     print('INFO: useConditionsOverlay n_it',n_it)
                     if n_it == 0:
-                        
+                        os.remove(toFile)
                         yamlCondUpdate = alignConf.getProp("startYAMLFile")
                         if yamlCondUpdate != "":
                             fromFile = yamlCondUpdate
-- 
GitLab


From f7199ff055670b3a68618106d14253c872a83a4b Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 12:48:34 +0000
Subject: [PATCH 071/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index b0a1aecf0..4eab75fc5 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -487,7 +487,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                         "/group/rich/sw/alignment/ConditionsOverlay"
                     )
 
-                    if fromFile is not None:
+                    if fromFile is not None and n_it != 0::
                         print(f"INFO: Copying {fromFile} to {toFile}")
                         print(getpass.getuser())
                         shutil.copyfile(fromFile, toFile)
-- 
GitLab


From f8fbf706b4dcf07f2f72461b8ac3921963ad1882 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 12:57:13 +0000
Subject: [PATCH 072/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 4eab75fc5..04bd3b987 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -487,7 +487,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                         "/group/rich/sw/alignment/ConditionsOverlay"
                     )
 
-                    if fromFile is not None and n_it != 0::
+                    if fromFile is not None and n_it != 0:
                         print(f"INFO: Copying {fromFile} to {toFile}")
                         print(getpass.getuser())
                         shutil.copyfile(fromFile, toFile)
-- 
GitLab


From dba98a6b1baad6727cc25dd9bb121f17d68756ed Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 13:04:49 +0000
Subject: [PATCH 073/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 04bd3b987..dd143d363 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -469,7 +469,11 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                     print('INFO: useConditionsOverlay n_it',n_it)
                     if n_it == 0:
-                        os.remove(toFile)
+                        
+                        try:
+                            os.remove(toFile)
+                        except Exception: pass
+
                         yamlCondUpdate = alignConf.getProp("startYAMLFile")
                         if yamlCondUpdate != "":
                             fromFile = yamlCondUpdate
-- 
GitLab


From 87953998c98d1e6c208a222ffe1611e6cbf642f0 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 13:42:04 +0000
Subject: [PATCH 074/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 82 +++++++++++++------
 1 file changed, 58 insertions(+), 24 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index dd143d363..04bbb04f6 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -349,9 +349,14 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
                     dd4hep.ConditionsVersion = "master"
-                    dd4hep.ConditionsLocation = (
-                        "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
-                    )
+                    # dd4hep.ConditionsLocation = (
+                    #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
+                    # )
+                    conddb_path = (
+                            " /group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
+                        )
+                    dd4hep.ConditionsLocation = f"file://{conddb_path}"
+
                     options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
                     options.dddb_tag = OnlineEnv.DDDBTag
                     DDDBConf().GeometryVersion = OnlineEnv.DDDBTag
@@ -464,38 +469,67 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     shutil.copyfile(fromFile, toFile)
                     sys.stdout.flush()
                 elif useConditionsOverlay:
-
-                    toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
-
-                    print('INFO: useConditionsOverlay n_it',n_it)
+                    doCondOverlay = False
                     if n_it == 0:
-                        
-                        try:
-                            os.remove(toFile)
-                        except Exception: pass
+                        dd4hep.UseConditionsOverlay = False
 
+                        # only change conditions on it0 if there is a starting yaml defined
                         yamlCondUpdate = alignConf.getProp("startYAMLFile")
                         if yamlCondUpdate != "":
                             fromFile = yamlCondUpdate
-                            print("START YAML", fromFile)
-                        else:
-                            try: os.remove(toFile)
-                            except Exception as e: print(toFile, "already blank")
-                            fromFile = None
+                            doCondOverlay = True
 
-                    elif n_it >= 1:  # always update conditions for n_it >= 1
+                    if n_it >= 1:  # always update conditions for n_it >= 1
                         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                        doCondOverlay = True
 
-                    dd4hep.UseConditionsOverlay = True
-                    dd4hep.ConditionsOverlayInitPath = (
-                        "/group/rich/sw/alignment/ConditionsOverlay"
-                    )
+                    if doCondOverlay:
+                        dd4hep.UseConditionsOverlay = True
+                        dd4hep.ConditionsOverlayInitPath = (
+                            "/group/rich/sw/alignment/ConditionsOverlay"
+                        )
+
+                        toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                    if fromFile is not None and n_it != 0:
                         print(f"INFO: Copying {fromFile} to {toFile}")
-                        print(getpass.getuser())
+
                         shutil.copyfile(fromFile, toFile)
-                    sys.stdout.flush()
+                        sys.stdout.flush()
+
+                # ALEX CHANGES
+                # elif useConditionsOverlay:
+
+                #     toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+
+                #     print('INFO: useConditionsOverlay n_it',n_it)
+                #     if n_it == 0:
+                        
+                #         try:
+                #             os.remove(toFile)
+                #         except Exception: pass
+
+                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                #         if yamlCondUpdate != "":
+                #             fromFile = yamlCondUpdate
+                #             print("START YAML", fromFile)
+                #         else:
+                #             try: os.remove(toFile)
+                #             except Exception as e: print(toFile, "already blank")
+                #             fromFile = None
+
+                #     elif n_it >= 1:  # always update conditions for n_it >= 1
+                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+
+                #     dd4hep.UseConditionsOverlay = True
+                #     dd4hep.ConditionsOverlayInitPath = (
+                #         "/group/rich/sw/alignment/ConditionsOverlay"
+                #     )
+
+                #     if fromFile is not None and n_it != 0:
+                #         print(f"INFO: Copying {fromFile} to {toFile}")
+                #         print(getpass.getuser())
+                #         shutil.copyfile(fromFile, toFile)
+                #     sys.stdout.flush()
 
             else:
                 options.conddb_tag = (
-- 
GitLab


From 096eed121044ef2d36570f003dbbee9cf94eb548 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 13:51:18 +0000
Subject: [PATCH 075/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 04bbb04f6..5a912b91c 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -353,7 +353,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
                     # )
                     conddb_path = (
-                            " /group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
+                            "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
                         )
                     dd4hep.ConditionsLocation = f"file://{conddb_path}"
 
-- 
GitLab


From a7928704cc46b4c279d2aba112a685e61bbb12a8 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 14:06:03 +0000
Subject: [PATCH 076/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 45 ++++++++++---------
 .../Configuration.py                          |  4 +-
 2 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 5a912b91c..6b5cd4e95 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -346,31 +346,34 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                 elif "Collision24" in dataVariant:
                     dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
 
-                if "overrideGeom" in dataVariant:
-                    print("INFO: overrideGeom ON")
-                    dd4hep.ConditionsVersion = "master"
-                    # dd4hep.ConditionsLocation = (
-                    #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
-                    # )
-                    conddb_path = (
-                            "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
-                        )
-                    dd4hep.ConditionsLocation = f"file://{conddb_path}"
+                # if "overrideGeom" in dataVariant:
+                # if "overrideGeom" in dataVariant:
+                print("INFO: overrideGeom ON")
+                dd4hep.ConditionsVersion = "master"
+                # dd4hep.ConditionsLocation = (
+                #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
+                # )
+                conddb_path = (
+                        "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
+                    )
+                dd4hep.ConditionsLocation = f"file://{conddb_path}"
 
-                    options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
-                    options.dddb_tag = OnlineEnv.DDDBTag
-                    DDDBConf().GeometryVersion = OnlineEnv.DDDBTag
-                    options.geometry_version = OnlineEnv.DDDBTag
+                options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
+                options.dddb_tag = OnlineEnv.DDDBTag
+                DDDBConf().GeometryVersion = OnlineEnv.DDDBTag
+                options.geometry_version = OnlineEnv.DDDBTag
 
-                    options.conddb_tag = "master"  # used for real data
-                    options.dddb_tag = "run3/trunk"
+                options.conddb_tag = "master"  # used for real data
+                options.dddb_tag = "run3/trunk"
 
-                    dd4hep.UseConditionsOverlay = True
-                    dd4hep.ConditionsVersion = "master"
+                dd4hep.UseConditionsOverlay = True
+                dd4hep.ConditionsVersion = "master"
 
-                    # needed for when reconstruction changed to SuperPixels (change was at run 289434)
-                    DDDBConf().GeometryVersion = "run3/trunk"
-                    options.geometry_version = "run3/trunk"
+                # needed for when reconstruction changed to SuperPixels (change was at run 289434)
+                DDDBConf().GeometryVersion = "run3/trunk"
+                options.geometry_version = "run3/trunk"
+                # if "overrideGeom" in dataVariant:
+                # if "overrideGeom" in dataVariant:
 
 
                     
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 656fe6463..cf3e38f1f 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,8 +51,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        "dataVariant": "Collision24_overrideGeom",
-        # "dataVariant": "Collision24",
+        # "dataVariant": "Collision24_overrideGeom",
+        "dataVariant": "Collision24",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-- 
GitLab


From 2903d8322a2d2a288e0e1213e15019d10d3285f3 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 14:08:57 +0000
Subject: [PATCH 077/102] testbench

---
 .../python/PyMirrAlignOnline/data_online_Rich1.py                | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 57013820b..c6129b485 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -155,6 +155,7 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
         for x in options.input_files
         if any(str(run_number) in x for run_number in select_run_numbers)
     ]
+    options.input_files = options.input_files[:10]
 
 
 # #### HACKKKK
-- 
GitLab


From ae5508e785c5501b93953ddd98e753cb13efa288 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 14:37:21 +0000
Subject: [PATCH 078/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 47 +++++++++----------
 .../Configuration.py                          |  4 +-
 2 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 6b5cd4e95..f818ea29f 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -346,34 +346,31 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                 elif "Collision24" in dataVariant:
                     dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
 
-                # if "overrideGeom" in dataVariant:
-                # if "overrideGeom" in dataVariant:
-                print("INFO: overrideGeom ON")
-                dd4hep.ConditionsVersion = "master"
-                # dd4hep.ConditionsLocation = (
-                #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
-                # )
-                conddb_path = (
-                        "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
-                    )
-                dd4hep.ConditionsLocation = f"file://{conddb_path}"
+                if "overrideGeom" in dataVariant:
+                    print("INFO: overrideGeom ON")
+                    dd4hep.ConditionsVersion = "master"
+                    # dd4hep.ConditionsLocation = (
+                    #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
+                    # )
+                    conddb_path = (
+                            "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
+                        )
+                    dd4hep.ConditionsLocation = f"file://{conddb_path}"
 
-                options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
-                options.dddb_tag = OnlineEnv.DDDBTag
-                DDDBConf().GeometryVersion = OnlineEnv.DDDBTag
-                options.geometry_version = OnlineEnv.DDDBTag
+                    options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
+                    options.dddb_tag = OnlineEnv.DDDBTag
+                    DDDBConf().GeometryVersion = OnlineEnv.DDDBTag
+                    options.geometry_version = OnlineEnv.DDDBTag
 
-                options.conddb_tag = "master"  # used for real data
-                options.dddb_tag = "run3/trunk"
+                    options.conddb_tag = "master"  # used for real data
+                    options.dddb_tag = "run3/trunk"
 
-                dd4hep.UseConditionsOverlay = True
-                dd4hep.ConditionsVersion = "master"
+                    dd4hep.UseConditionsOverlay = True
+                    dd4hep.ConditionsVersion = "master"
 
-                # needed for when reconstruction changed to SuperPixels (change was at run 289434)
-                DDDBConf().GeometryVersion = "run3/trunk"
-                options.geometry_version = "run3/trunk"
-                # if "overrideGeom" in dataVariant:
-                # if "overrideGeom" in dataVariant:
+                    # needed for when reconstruction changed to SuperPixels (change was at run 289434)
+                    DDDBConf().GeometryVersion = "run3/trunk"
+                    options.geometry_version = "run3/trunk"
 
 
                     
@@ -494,7 +491,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                         toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                        print(f"INFO: Copying {fromFile} to {toFile}")
+                        print(f"INFO: Copying (useConditionsOverlay) (tiltName: {tiltName}) {fromFile} to {toFile}")
 
                         shutil.copyfile(fromFile, toFile)
                         sys.stdout.flush()
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index cf3e38f1f..656fe6463 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,8 +51,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        # "dataVariant": "Collision24_overrideGeom",
-        "dataVariant": "Collision24",
+        "dataVariant": "Collision24_overrideGeom",
+        # "dataVariant": "Collision24",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-- 
GitLab


From 79405f3f65c80993b715ef4fab8a777b0e20fd38 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 14:37:47 +0000
Subject: [PATCH 079/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index f818ea29f..18d963981 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -491,7 +491,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                         toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                        print(f"INFO: Copying (useConditionsOverlay) (tiltName: {tiltName}) {fromFile} to {toFile}")
+                        print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
 
                         shutil.copyfile(fromFile, toFile)
                         sys.stdout.flush()
-- 
GitLab


From a786ae69981c62c61c6ea769f319e6f589874eaa Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 14:51:20 +0000
Subject: [PATCH 080/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py              | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 18d963981..fb7c894a1 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -491,8 +491,14 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                         toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                        print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
+                        if tiltName != "":
+                            # fromFile = 2025-02-26T14-38_rich1_minp30_Collision24_overrideGeom_25000k_Produce_conds_priYn_i0.yml
+                            print(f"TILTING: {tiltName}")
+                            tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{tiltName}.yml')[0]
+                            fromFile = tilt_file
 
+                        print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
+                        
                         shutil.copyfile(fromFile, toFile)
                         sys.stdout.flush()
 
-- 
GitLab


From a90bb45e12cc3f9cfde1d2c16564f90bfb1092df Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 14:54:43 +0000
Subject: [PATCH 081/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index fb7c894a1..3c2db5c64 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -494,7 +494,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                         if tiltName != "":
                             # fromFile = 2025-02-26T14-38_rich1_minp30_Collision24_overrideGeom_25000k_Produce_conds_priYn_i0.yml
                             print(f"TILTING: {tiltName}")
-                            tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{tiltName}.yml')[0]
+                            tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
                             fromFile = tilt_file
 
                         print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
-- 
GitLab


From 8559a10f451e8ccdd965728f5dc637aae920878a Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 15:07:43 +0000
Subject: [PATCH 082/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 107 +++++++++---------
 1 file changed, 54 insertions(+), 53 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 3c2db5c64..e92090dc1 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -468,74 +468,75 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
 
                     shutil.copyfile(fromFile, toFile)
                     sys.stdout.flush()
-                elif useConditionsOverlay:
-                    doCondOverlay = False
-                    if n_it == 0:
-                        dd4hep.UseConditionsOverlay = False
 
-                        # only change conditions on it0 if there is a starting yaml defined
-                        yamlCondUpdate = alignConf.getProp("startYAMLFile")
-                        if yamlCondUpdate != "":
-                            fromFile = yamlCondUpdate
-                            doCondOverlay = True
+                # elif useConditionsOverlay:
+                #     doCondOverlay = False
+                #     if n_it == 0:
+                #         dd4hep.UseConditionsOverlay = False
 
-                    if n_it >= 1:  # always update conditions for n_it >= 1
-                        fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
-                        doCondOverlay = True
+                #         # only change conditions on it0 if there is a starting yaml defined
+                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                #         if yamlCondUpdate != "":
+                #             fromFile = yamlCondUpdate
+                #             doCondOverlay = True
 
-                    if doCondOverlay:
-                        dd4hep.UseConditionsOverlay = True
-                        dd4hep.ConditionsOverlayInitPath = (
-                            "/group/rich/sw/alignment/ConditionsOverlay"
-                        )
+                #     if n_it >= 1:  # always update conditions for n_it >= 1
+                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                #         doCondOverlay = True
+
+                #     if doCondOverlay:
+                #         dd4hep.UseConditionsOverlay = True
+                #         dd4hep.ConditionsOverlayInitPath = (
+                #             "/group/rich/sw/alignment/ConditionsOverlay"
+                #         )
 
-                        toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                #         toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                        if tiltName != "":
-                            # fromFile = 2025-02-26T14-38_rich1_minp30_Collision24_overrideGeom_25000k_Produce_conds_priYn_i0.yml
-                            print(f"TILTING: {tiltName}")
-                            tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
-                            fromFile = tilt_file
+                #         if tiltName != "":
+                #             print(f"TILTING: {tiltName}")
+                #             tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
+                #             fromFile = tilt_file
 
-                        print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
+                #         print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
                         
-                        shutil.copyfile(fromFile, toFile)
-                        sys.stdout.flush()
+                #         shutil.copyfile(fromFile, toFile)
+                #         sys.stdout.flush()
 
                 # ALEX CHANGES
-                # elif useConditionsOverlay:
+                elif useConditionsOverlay:
 
-                #     toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                    toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                #     print('INFO: useConditionsOverlay n_it',n_it)
-                #     if n_it == 0:
-                        
-                #         try:
-                #             os.remove(toFile)
-                #         except Exception: pass
+                    print('INFO: useConditionsOverlay n_it',n_it)
+                    if n_it == 0:
 
-                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
-                #         if yamlCondUpdate != "":
-                #             fromFile = yamlCondUpdate
-                #             print("START YAML", fromFile)
-                #         else:
-                #             try: os.remove(toFile)
-                #             except Exception as e: print(toFile, "already blank")
-                #             fromFile = None
+                        yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                        if yamlCondUpdate != "":
+                            fromFile = yamlCondUpdate
+                            print("START YAML", fromFile)
+                        else: # no overlay
+                            try: os.remove(toFile)
+                            except Exception as e: print(toFile, "already blank")
+                            fromFile = None
 
-                #     elif n_it >= 1:  # always update conditions for n_it >= 1
-                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                    elif n_it >= 1:  # always update conditions for n_it >= 1
+                        fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+
+                    dd4hep.UseConditionsOverlay = True
+                    dd4hep.ConditionsOverlayInitPath = (
+                        "/group/rich/sw/alignment/ConditionsOverlay"
+                    )
 
-                #     dd4hep.UseConditionsOverlay = True
-                #     dd4hep.ConditionsOverlayInitPath = (
-                #         "/group/rich/sw/alignment/ConditionsOverlay"
-                #     )
+                    if tiltName != "":
+                        print(f"TILTING: {tiltName}")
+                        tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
+                        fromFile = tilt_file
 
-                #     if fromFile is not None and n_it != 0:
-                #         print(f"INFO: Copying {fromFile} to {toFile}")
-                #         print(getpass.getuser())
-                #         shutil.copyfile(fromFile, toFile)
-                #     sys.stdout.flush()
+                    if fromFile is not None and n_it != 0:
+                        print(f"INFO: Copying {fromFile} to {toFile}")
+                        print(getpass.getuser())
+                        shutil.copyfile(fromFile, toFile)
+                    sys.stdout.flush()
 
             else:
                 options.conddb_tag = (
-- 
GitLab


From aeb024bbb57564ef5d0b7ba3051dd7823eb49197 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 15:17:50 +0000
Subject: [PATCH 083/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index e92090dc1..6fc41ff24 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -349,13 +349,13 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
                     dd4hep.ConditionsVersion = "master"
-                    # dd4hep.ConditionsLocation = (
-                    #     "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
-                    # )
-                    conddb_path = (
-                            "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
-                        )
-                    dd4hep.ConditionsLocation = f"file://{conddb_path}"
+                    dd4hep.ConditionsLocation = (
+                        "git:/cvmfs/lhcb.cern.ch/lib/lhcb/git-conddb/lhcb-conditions-database.git"
+                    )
+                    # conddb_path = (
+                    #         "/group/rich/sw/alignment/ConditionsNewPanels/lhcb-conditions-database"
+                    #     )
+                    # dd4hep.ConditionsLocation = f"file://{conddb_path}"
 
                     options.conddb_tag = OnlineEnv.CondDBTag  # used for real data
                     options.dddb_tag = OnlineEnv.DDDBTag
@@ -532,7 +532,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                         tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
                         fromFile = tilt_file
 
-                    if fromFile is not None and n_it != 0:
+                    if fromFile is not None:
                         print(f"INFO: Copying {fromFile} to {toFile}")
                         print(getpass.getuser())
                         shutil.copyfile(fromFile, toFile)
-- 
GitLab


From 2c36cf28882f4e40cb61b0f574e4863b8478eec3 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Wed, 26 Feb 2025 15:33:40 +0000
Subject: [PATCH 084/102] testbench

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  |  1 +
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 .../Configuration.py                          |  8 ++---
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 6fc41ff24..d055b8ad6 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -515,6 +515,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                             fromFile = yamlCondUpdate
                             print("START YAML", fromFile)
                         else: # no overlay
+                            print("NO START YAML")
                             try: os.remove(toFile)
                             except Exception as e: print(toFile, "already blank")
                             fromFile = None
diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index c6129b485..1ca3c5f17 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -158,22 +158,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     options.input_files = options.input_files[:10]
 
 
-# #### HACKKKK
-# base_dir = "/calib/align/LHCb/Rich1/*/"
-# dirs = glob.glob(base_dir, recursive=True)
-# files = []
-# for dir_i in dirs:
-#     files += glob.glob(dir_i + "*")
-# files_HACK = []
-# for file in files:
-#     file_id = file.split("/")[-2]
-#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
-#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
-#         files_HACK.append(file)
-# files = files_HACK
-# files = sorted(files, reverse=True)
-# options.input_files = files
-# print("HACKKKK")
+#### HACKKKK
+base_dir = "/calib/align/LHCb/Rich1/*/"
+dirs = glob.glob(base_dir, recursive=True)
+files = []
+for dir_i in dirs:
+    files += glob.glob(dir_i + "*")
+files_HACK = []
+for file in files:
+    file_id = file.split("/")[-2]
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
+        files_HACK.append(file)
+files = files_HACK
+files = sorted(files, reverse=True)
+options.input_files = files
+print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 656fe6463..fe81357e9 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -65,11 +65,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        # "/group/online/AligWork/Rich1/",
-        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/Rich1/",
+        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        # "/group/online/AligWork/MirrorAlignments/",
-        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/MirrorAlignments/",
+        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From 08b70bbb2c21c7c4d6dd0af5032e557ee9ed469f Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 27 Feb 2025 11:31:24 +0000
Subject: [PATCH 085/102] more files

---
 Rich/Panoptes/tests/options/2024-data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index 503727fb2..588696623 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -29,7 +29,7 @@ options.set_input_and_conds_from_testfiledb("rich-decode-2024-panoptes")
 import glob
 path = "/calib/align/LHCb/Rich1/0000307065/*.mdf"
 files = glob.glob(path)
-options.input_files = files[:4]
+# options.input_files = files[:4]
 
 options.evt_max = 1000
 options.print_freq = 100
-- 
GitLab


From bdb8a87df30ecc7bc0e33fc0e543bee2a5d0e7dc Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 27 Feb 2025 11:35:01 +0000
Subject: [PATCH 086/102] more files

---
 Rich/Panoptes/tests/options/2024-data.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py
index 588696623..ccab7f0bb 100644
--- a/Rich/Panoptes/tests/options/2024-data.py
+++ b/Rich/Panoptes/tests/options/2024-data.py
@@ -30,6 +30,7 @@ import glob
 path = "/calib/align/LHCb/Rich1/0000307065/*.mdf"
 files = glob.glob(path)
 # options.input_files = files[:4]
+options.input_files = files
 
 options.evt_max = 1000
 options.print_freq = 100
-- 
GitLab


From 4c7e5744a32aa7fa2e2fbafdf6872f3a07331715 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Thu, 27 Feb 2025 17:57:13 +0000
Subject: [PATCH 087/102] logging head

---
 .../python/PyMirrAlignOnline/RichAnalyzerControl.py             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py
index 5a6224956..7fe083698 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzerControl.py
@@ -149,7 +149,7 @@ class RichAnalyzerControl:
                 else:
                     which_data_online = "data_online.py"
 
-                cmd = f"cd {self.workdir} ; `which gaudirun.py` $RICHMIRRORALIGNMENTONLINEROOT/python/PyMirrAlignOnline/{which_data_online} $RICHMIRRORALIGNMENTONLINEROOT/python/PyMirrAlignOnline/RichAnalyzer.py > {richAnalyzerOutFile} ; cd - "
+                cmd = f"cd {self.workdir} ; `which gaudirun.py` $RICHMIRRORALIGNMENTONLINEROOT/python/PyMirrAlignOnline/{which_data_online} $RICHMIRRORALIGNMENTONLINEROOT/python/PyMirrAlignOnline/RichAnalyzer.py | head -n 500 > {richAnalyzerOutFile} ; cd - " # only keep first 1000 lines, rest is useless anyway
                 print(f"INFO: Starting RichAnalyzer.")
                 print(f"INFO: cmd = {cmd}")
                 sys.stdout.flush()
-- 
GitLab


From 5aad3f8740f4eba082957aab88ac965b9281a162 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Fri, 28 Feb 2025 13:53:26 +0000
Subject: [PATCH 088/102] temporary fix?

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index d055b8ad6..631d85150 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -372,6 +372,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     DDDBConf().GeometryVersion = "run3/trunk"
                     options.geometry_version = "run3/trunk"
 
+                    options.conddb_tag = "RICH_alignment_2025"  # used for real data
+                    options.conditions_version = "RICH_alignment_2025"  # used for real data
 
                     
 
-- 
GitLab


From 64026b1f4af1d980aa0724b820ef49acd8400eb0 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Fri, 28 Feb 2025 13:54:13 +0000
Subject: [PATCH 089/102] temporary fix?

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 631d85150..06d056959 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -372,6 +372,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     DDDBConf().GeometryVersion = "run3/trunk"
                     options.geometry_version = "run3/trunk"
 
+                    # temporary
                     options.conddb_tag = "RICH_alignment_2025"  # used for real data
                     options.conditions_version = "RICH_alignment_2025"  # used for real data
 
-- 
GitLab


From fb2588c411b3edb2c0bf7dc7c34c209df44c1cc2 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Fri, 28 Feb 2025 14:02:25 +0000
Subject: [PATCH 090/102] version

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 06d056959..d15998625 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -375,7 +375,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     # temporary
                     options.conddb_tag = "RICH_alignment_2025"  # used for real data
                     options.conditions_version = "RICH_alignment_2025"  # used for real data
-
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
                     
 
                 if useCondDBPath:
-- 
GitLab


From 33af02318d649cdfbdfb9ddc18f18c76e16a8a7a Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 16:16:10 +0000
Subject: [PATCH 091/102] testing

---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 .../Configuration.py                          | 13 ++++----
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index 1ca3c5f17..c6129b485 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -158,22 +158,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     options.input_files = options.input_files[:10]
 
 
-#### HACKKKK
-base_dir = "/calib/align/LHCb/Rich1/*/"
-dirs = glob.glob(base_dir, recursive=True)
-files = []
-for dir_i in dirs:
-    files += glob.glob(dir_i + "*")
-files_HACK = []
-for file in files:
-    file_id = file.split("/")[-2]
-    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
-    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
-        files_HACK.append(file)
-files = files_HACK
-files = sorted(files, reverse=True)
-options.input_files = files
-print("HACKKKK")
+# #### HACKKKK
+# base_dir = "/calib/align/LHCb/Rich1/*/"
+# dirs = glob.glob(base_dir, recursive=True)
+# files = []
+# for dir_i in dirs:
+#     files += glob.glob(dir_i + "*")
+# files_HACK = []
+# for file in files:
+#     file_id = file.split("/")[-2]
+#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
+#         files_HACK.append(file)
+# files = files_HACK
+# files = sorted(files, reverse=True)
+# options.input_files = files
+# print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index fe81357e9..7b28ade7a 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -56,20 +56,21 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-        "magnFactorsMode": 1,  # 0, # 2 doesnt exist
+        "magnFactorsMode": 0,  # 0, # 2 doesnt exist
         "magnifDir":  # relative to stackDir (i.e. remove /group/rich/sw/alignment/stack/)
         "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2024-03-13T11-26/", # use for sajans detector branch
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
-        "maxIterations": 8,  # 8,
+        # "maxIterations": 8,  # 8,
+        "maxIterations": 1,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        "/group/online/AligWork/Rich1/",
-        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/Rich1/",
+        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        "/group/online/AligWork/MirrorAlignments/",
-        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        # "/group/online/AligWork/MirrorAlignments/",
+        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab


From dcab7d2fa714d5ebef97b1dfe207241dff6a2a9c Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 16:25:24 +0000
Subject: [PATCH 092/102] testing

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 113 +++++++++---------
 .../Configuration.py                          |   7 +-
 2 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index d15998625..4e0750b7b 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -344,7 +344,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                         "alignment2022"  # need alignment2022 for 2022 data
                     )
                 elif "Collision24" in dataVariant:
-                    dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
+                    # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
@@ -472,75 +473,75 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     shutil.copyfile(fromFile, toFile)
                     sys.stdout.flush()
 
-                # elif useConditionsOverlay:
-                #     doCondOverlay = False
-                #     if n_it == 0:
-                #         dd4hep.UseConditionsOverlay = False
+                elif useConditionsOverlay:
+                    doCondOverlay = False
+                    if n_it == 0:
+                        dd4hep.UseConditionsOverlay = False
 
-                #         # only change conditions on it0 if there is a starting yaml defined
-                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
-                #         if yamlCondUpdate != "":
-                #             fromFile = yamlCondUpdate
-                #             doCondOverlay = True
+                        # only change conditions on it0 if there is a starting yaml defined
+                        yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                        if yamlCondUpdate != "":
+                            fromFile = yamlCondUpdate
+                            doCondOverlay = True
 
-                #     if n_it >= 1:  # always update conditions for n_it >= 1
-                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
-                #         doCondOverlay = True
+                    if n_it >= 1:  # always update conditions for n_it >= 1
+                        fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                        doCondOverlay = True
 
-                #     if doCondOverlay:
-                #         dd4hep.UseConditionsOverlay = True
-                #         dd4hep.ConditionsOverlayInitPath = (
-                #             "/group/rich/sw/alignment/ConditionsOverlay"
-                #         )
+                    if doCondOverlay:
+                        dd4hep.UseConditionsOverlay = True
+                        dd4hep.ConditionsOverlayInitPath = (
+                            "/group/rich/sw/alignment/ConditionsOverlay"
+                        )
 
-                #         toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                        toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                #         if tiltName != "":
-                #             print(f"TILTING: {tiltName}")
-                #             tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
-                #             fromFile = tilt_file
+                        if tiltName != "":
+                            print(f"TILTING: {tiltName}")
+                            tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
+                            fromFile = tilt_file
 
-                #         print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
+                        print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
                         
-                #         shutil.copyfile(fromFile, toFile)
-                #         sys.stdout.flush()
+                        shutil.copyfile(fromFile, toFile)
+                        sys.stdout.flush()
 
-                # ALEX CHANGES
-                elif useConditionsOverlay:
+                # # ALEX CHANGES
+                # elif useConditionsOverlay:
 
-                    toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                #     toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                    print('INFO: useConditionsOverlay n_it',n_it)
-                    if n_it == 0:
+                #     print('INFO: useConditionsOverlay n_it',n_it)
+                #     if n_it == 0:
 
-                        yamlCondUpdate = alignConf.getProp("startYAMLFile")
-                        if yamlCondUpdate != "":
-                            fromFile = yamlCondUpdate
-                            print("START YAML", fromFile)
-                        else: # no overlay
-                            print("NO START YAML")
-                            try: os.remove(toFile)
-                            except Exception as e: print(toFile, "already blank")
-                            fromFile = None
-
-                    elif n_it >= 1:  # always update conditions for n_it >= 1
-                        fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                #         if yamlCondUpdate != "":
+                #             fromFile = yamlCondUpdate
+                #             print("START YAML", fromFile)
+                #         else: # no overlay
+                #             print("NO START YAML")
+                #             try: os.remove(toFile)
+                #             except Exception as e: print(toFile, "already blank")
+                #             fromFile = None
+
+                #     elif n_it >= 1:  # always update conditions for n_it >= 1
+                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
 
-                    dd4hep.UseConditionsOverlay = True
-                    dd4hep.ConditionsOverlayInitPath = (
-                        "/group/rich/sw/alignment/ConditionsOverlay"
-                    )
+                #     dd4hep.UseConditionsOverlay = True
+                #     dd4hep.ConditionsOverlayInitPath = (
+                #         "/group/rich/sw/alignment/ConditionsOverlay"
+                #     )
 
-                    if tiltName != "":
-                        print(f"TILTING: {tiltName}")
-                        tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
-                        fromFile = tilt_file
+                #     if tiltName != "":
+                #         print(f"TILTING: {tiltName}")
+                #         tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
+                #         fromFile = tilt_file
 
-                    if fromFile is not None:
-                        print(f"INFO: Copying {fromFile} to {toFile}")
-                        print(getpass.getuser())
-                        shutil.copyfile(fromFile, toFile)
-                    sys.stdout.flush()
+                #     if fromFile is not None:
+                #         print(f"INFO: Copying {fromFile} to {toFile}")
+                #         print(getpass.getuser())
+                #         shutil.copyfile(fromFile, toFile)
+                #     sys.stdout.flush()
 
             else:
                 options.conddb_tag = (
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 7b28ade7a..6c2a6563d 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,8 +51,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        "dataVariant": "Collision24_overrideGeom",
-        # "dataVariant": "Collision24",
+        # "dataVariant": "Collision24_overrideGeom",
+        "dataVariant": "Collision24",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
@@ -62,8 +62,7 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/2025-02-08T21-21/", # 2025 run3/trunk - mental values
         # "Panoptes/Rich/RichMirrorAlignmentOnline/files/MagnifFactors/Rich1/20230514_202521/",
         "richFiles": "/group/online/AligWork/tempAlignmentFiles",  # "/group/rich/AlignmentFiles/",
-        # "maxIterations": 8,  # 8,
-        "maxIterations": 1,  # 8,
+        "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
         # "/group/online/AligWork/Rich1/",
-- 
GitLab


From 41f5c8024ff66f0b81c8d2ed79181a3df44f7db9 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 16:43:06 +0000
Subject: [PATCH 093/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 4e0750b7b..010498c4c 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -345,7 +345,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     )
                 elif "Collision24" in dataVariant:
                     # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
-                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
+                    # dd4hep.ConditionsVersion = "RICH_alignment_2025"
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025_corrupt"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
-- 
GitLab


From 0823fc069b11dbce972459d8bce5e3accafa64f6 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 17:00:21 +0000
Subject: [PATCH 094/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 010498c4c..253ccd666 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -346,7 +346,7 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                 elif "Collision24" in dataVariant:
                     # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
                     # dd4hep.ConditionsVersion = "RICH_alignment_2025"
-                    dd4hep.ConditionsVersion = "RICH_alignment_2025_corrupt"
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
-- 
GitLab


From 23742f61cd8bfa062797d6bf38c65b4040693c0d Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 17:03:17 +0000
Subject: [PATCH 095/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 253ccd666..0bc6cb55c 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -345,8 +345,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     )
                 elif "Collision24" in dataVariant:
                     # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
-                    # dd4hep.ConditionsVersion = "RICH_alignment_2025"
-                    dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
+                    # dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
-- 
GitLab


From c74fdae6edf873b005c2620e23f5d2b4dae03e76 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 17:06:40 +0000
Subject: [PATCH 096/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 0bc6cb55c..253ccd666 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -345,8 +345,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     )
                 elif "Collision24" in dataVariant:
                     # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
-                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
-                    # dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
+                    # dd4hep.ConditionsVersion = "RICH_alignment_2025"
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
-- 
GitLab


From abdda0635586502258da07a3ce7876463741e6dc Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 17:09:34 +0000
Subject: [PATCH 097/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py  | 110 +++++++++---------
 1 file changed, 55 insertions(+), 55 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index 253ccd666..bd18d4920 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -474,75 +474,75 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     shutil.copyfile(fromFile, toFile)
                     sys.stdout.flush()
 
-                elif useConditionsOverlay:
-                    doCondOverlay = False
-                    if n_it == 0:
-                        dd4hep.UseConditionsOverlay = False
+                # elif useConditionsOverlay:
+                #     doCondOverlay = False
+                #     if n_it == 0:
+                #         dd4hep.UseConditionsOverlay = False
 
-                        # only change conditions on it0 if there is a starting yaml defined
-                        yamlCondUpdate = alignConf.getProp("startYAMLFile")
-                        if yamlCondUpdate != "":
-                            fromFile = yamlCondUpdate
-                            doCondOverlay = True
+                #         # only change conditions on it0 if there is a starting yaml defined
+                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                #         if yamlCondUpdate != "":
+                #             fromFile = yamlCondUpdate
+                #             doCondOverlay = True
 
-                    if n_it >= 1:  # always update conditions for n_it >= 1
-                        fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
-                        doCondOverlay = True
+                #     if n_it >= 1:  # always update conditions for n_it >= 1
+                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                #         doCondOverlay = True
 
-                    if doCondOverlay:
-                        dd4hep.UseConditionsOverlay = True
-                        dd4hep.ConditionsOverlayInitPath = (
-                            "/group/rich/sw/alignment/ConditionsOverlay"
-                        )
+                #     if doCondOverlay:
+                #         dd4hep.UseConditionsOverlay = True
+                #         dd4hep.ConditionsOverlayInitPath = (
+                #             "/group/rich/sw/alignment/ConditionsOverlay"
+                #         )
 
-                        toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                #         toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                        if tiltName != "":
-                            print(f"TILTING: {tiltName}")
-                            tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
-                            fromFile = tilt_file
+                #         if tiltName != "":
+                #             print(f"TILTING: {tiltName}")
+                #             tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
+                #             fromFile = tilt_file
 
-                        print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
+                #         print(f"INFO: Copying (useConditionsOverlay) (n_it: {n_it}, tiltName: {tiltName}) {fromFile} to {toFile}")
                         
-                        shutil.copyfile(fromFile, toFile)
-                        sys.stdout.flush()
+                #         shutil.copyfile(fromFile, toFile)
+                #         sys.stdout.flush()
 
-                # # ALEX CHANGES
-                # elif useConditionsOverlay:
+                # ALEX CHANGES
+                elif useConditionsOverlay:
 
-                #     toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
+                    toFile = f"/group/rich/sw/alignment/ConditionsOverlay/Conditions/Rich{whichRich}/Alignment/Mirrors.yml"
 
-                #     print('INFO: useConditionsOverlay n_it',n_it)
-                #     if n_it == 0:
+                    print('INFO: useConditionsOverlay n_it',n_it)
+                    if n_it == 0:
 
-                #         yamlCondUpdate = alignConf.getProp("startYAMLFile")
-                #         if yamlCondUpdate != "":
-                #             fromFile = yamlCondUpdate
-                #             print("START YAML", fromFile)
-                #         else: # no overlay
-                #             print("NO START YAML")
-                #             try: os.remove(toFile)
-                #             except Exception as e: print(toFile, "already blank")
-                #             fromFile = None
-
-                #     elif n_it >= 1:  # always update conditions for n_it >= 1
-                #         fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
+                        yamlCondUpdate = alignConf.getProp("startYAMLFile")
+                        if yamlCondUpdate != "":
+                            fromFile = yamlCondUpdate
+                            print("START YAML", fromFile)
+                        else: # no overlay
+                            print("NO START YAML")
+                            try: os.remove(toFile)
+                            except Exception as e: print(toFile, "already blank")
+                            fromFile = None
+
+                    elif n_it >= 1:  # always update conditions for n_it >= 1
+                        fromFile = f"{workdir}" + f"CondDB_Rich{whichRich}.yml"
 
-                #     dd4hep.UseConditionsOverlay = True
-                #     dd4hep.ConditionsOverlayInitPath = (
-                #         "/group/rich/sw/alignment/ConditionsOverlay"
-                #     )
+                    dd4hep.UseConditionsOverlay = True
+                    dd4hep.ConditionsOverlayInitPath = (
+                        "/group/rich/sw/alignment/ConditionsOverlay"
+                    )
 
-                #     if tiltName != "":
-                #         print(f"TILTING: {tiltName}")
-                #         tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
-                #         fromFile = tilt_file
+                    if tiltName != "":
+                        print(f"TILTING: {tiltName}")
+                        tilt_file = glob.glob(f'{workdir}/*{tiltName}_i{n_it}.yml')[0]
+                        fromFile = tilt_file
 
-                #     if fromFile is not None:
-                #         print(f"INFO: Copying {fromFile} to {toFile}")
-                #         print(getpass.getuser())
-                #         shutil.copyfile(fromFile, toFile)
-                #     sys.stdout.flush()
+                    if fromFile is not None:
+                        print(f"INFO: Copying {fromFile} to {toFile}")
+                        print(getpass.getuser())
+                        shutil.copyfile(fromFile, toFile)
+                    sys.stdout.flush()
 
             else:
                 options.conddb_tag = (
-- 
GitLab


From 4c828b02d6d9d9d6e27d82d0a24d4d3f648597b0 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 17:11:40 +0000
Subject: [PATCH 098/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index bd18d4920..cf15fb265 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -345,8 +345,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     )
                 elif "Collision24" in dataVariant:
                     # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
-                    # dd4hep.ConditionsVersion = "RICH_alignment_2025"
-                    dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
+                    # dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
-- 
GitLab


From 834e981061e232e84f1eb65f9584d8fe69cd580c Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Sun, 2 Mar 2025 17:12:23 +0000
Subject: [PATCH 099/102] corrupt

---
 .../python/PyMirrAlignOnline/RichAnalyzer.py                  | 4 ++--
 .../python/RichMirrorAlignmentOnline/Configuration.py         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
index cf15fb265..bd18d4920 100755
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py
@@ -345,8 +345,8 @@ class hlt2_reco_rich_noUT_panoptes_dd4hep_both:
                     )
                 elif "Collision24" in dataVariant:
                     # dd4hep.ConditionsVersion = OnlineEnv.CondDBTag
-                    dd4hep.ConditionsVersion = "RICH_alignment_2025"
-                    # dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
+                    # dd4hep.ConditionsVersion = "RICH_alignment_2025"
+                    dd4hep.ConditionsVersion = "RICH_alignment_2025_Mar2"
 
                 if "overrideGeom" in dataVariant:
                     print("INFO: overrideGeom ON")
diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 6c2a6563d..df304cec8 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -51,8 +51,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "MinItStart":  # will be automatically forced to be MajItStart multiplied by the length of tiltNames, if magnFactorModes = 0
         0,  # 18
         ### Better not change these, only for very very VERY good reasons
-        # "dataVariant": "Collision24_overrideGeom",
-        "dataVariant": "Collision24",
+        "dataVariant": "Collision24_overrideGeom",
+        # "dataVariant": "Collision24",
         "useHltDecisions": False,
         "useReducedSubset": False,
         "stackDir": "/group/rich/sw/alignment/stack/",
-- 
GitLab


From 04c6fd477407e7f8d40462085f976ad63cafef25 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 11 Mar 2025 11:38:46 +0000
Subject: [PATCH 100/102] mv to 10 GeV

---
 .../python/RichMirrorAlignmentOnline/Configuration.py          | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index df304cec8..31895ed68 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -96,7 +96,8 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         # "/group/rich/sw/alignment/yaml_files/starting_points/v4_altered.yml" # if this is blank, it automatically uses the DB YAML file
         "YAMLio": True,
         "useDD4hep": True,
-        "minP": 30.0,
+        # "minP": 30.0,
+        "minP": 10.0,
         "coeffCalibTilt": 0.7,
         "minAverageBinPop": 6.0,
         "phiBinFactor": 3,
-- 
GitLab


From 400c26be913dfc44bfb8364963ea2f55e71627bf Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 11 Mar 2025 11:40:54 +0000
Subject: [PATCH 101/102] mv to 10 GeV

---
 .../PyMirrAlignOnline/data_online_Rich1.py    | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
index c6129b485..1ca3c5f17 100644
--- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
+++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/data_online_Rich1.py
@@ -158,22 +158,22 @@ if select_runs_TESTBENCH and "online" not in getpass.getuser():
     options.input_files = options.input_files[:10]
 
 
-# #### HACKKKK
-# base_dir = "/calib/align/LHCb/Rich1/*/"
-# dirs = glob.glob(base_dir, recursive=True)
-# files = []
-# for dir_i in dirs:
-#     files += glob.glob(dir_i + "*")
-# files_HACK = []
-# for file in files:
-#     file_id = file.split("/")[-2]
-#     # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
-#     if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
-#         files_HACK.append(file)
-# files = files_HACK
-# files = sorted(files, reverse=True)
-# options.input_files = files
-# print("HACKKKK")
+#### HACKKKK
+base_dir = "/calib/align/LHCb/Rich1/*/"
+dirs = glob.glob(base_dir, recursive=True)
+files = []
+for dir_i in dirs:
+    files += glob.glob(dir_i + "*")
+files_HACK = []
+for file in files:
+    file_id = file.split("/")[-2]
+    # if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306707: # large set
+    if int(file_id[4:]) >= 306402 and int(file_id[4:]) <= 306405:
+        files_HACK.append(file)
+files = files_HACK
+files = sorted(files, reverse=True)
+options.input_files = files
+print("HACKKKK")
 
 print(f"{len(options.input_files)} .mdf files...")
 
-- 
GitLab


From 29ea7480d22b7b59ccb624d8258d918e11c99d72 Mon Sep 17 00:00:00 2001
From: Alexander Mclean Marshall <alex.marshall@cern.ch>
Date: Tue, 11 Mar 2025 11:45:04 +0000
Subject: [PATCH 102/102] mv to 10 GeV

---
 .../python/RichMirrorAlignmentOnline/Configuration.py     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
index 31895ed68..50a33d7f8 100644
--- a/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
+++ b/Rich/RichMirrorAlignmentOnline/python/RichMirrorAlignmentOnline/Configuration.py
@@ -65,11 +65,11 @@ class Rich1MirrAlignOnConf(LHCbConfigurableUser):
         "maxIterations": 8,  # 8,
         "testing": True,  # False,
         "WorkDir": 
-        # "/group/online/AligWork/Rich1/",
-        "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/Rich1/",
+        # "/home/marshall/Bristol_RICH/testbench/Rich1/", # If running in the testbench this path must be changed
         "SaveDir": 
-        # "/group/online/AligWork/MirrorAlignments/",
-        "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
+        "/group/online/AligWork/MirrorAlignments/",
+        # "/home/marshall/Bristol_RICH/testbench/MirrorAlignments/", # If running in the testbench this path must be changed
         "ItNrFile": "/group/online/dataflow/options/LHCbA/Rich1_Alignment_Reference_File.txt",
         "thisCase": "online",
         "tiltNames": [
-- 
GitLab