From 41ab81c75455f69b3f68bd675353bac0461225d2 Mon Sep 17 00:00:00 2001
From: FaserMC <fasermc@cern.ch>
Date: Mon, 29 Aug 2022 04:54:44 +0200
Subject: [PATCH] Use VetoNu settings for TB counters

---
 .../ScintDigiAlgs/python/ScintDigiAlgsConfig.py    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py b/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py
index b8b025ae..407ab913 100644
--- a/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py
+++ b/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py
@@ -36,12 +36,15 @@ def ScintWaveformDigitizationCfg(flags):
     if not flags.Input.isMC:
         return acc
 
-    if "TB" not in flags.GeoModel.FaserVersion:
+    if "TB" in flags.GeoModel.FaserVersion:
+        acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto"))
+        acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower"))
+    else:
         acc.merge(ScintWaveformDigiCfg(flags, "TriggerWaveformDigiAlg", "Trigger"))
+        acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto"))
         acc.merge(ScintWaveformDigiCfg(flags, "VetoNuWaveformDigiAlg", "VetoNu"))
+        acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower"))
 
-    acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto"))
-    acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower"))
     acc.merge(ScintWaveformDigitizationOutputCfg(flags))
     acc.merge(WaveformCableMappingCfg(flags))
     return acc
@@ -58,6 +61,11 @@ def ScintWaveformDigiCfg(flags, name="ScintWaveformDigiAlg", source="", **kwargs
     kwargs.setdefault("WaveformContainerKey", source+"Waveforms")
 
     digiAlg = CompFactory.ScintWaveformDigiAlg(name, **kwargs)
+
+    if "TB" in flags.GeoModel.FaserVersion and source == "Veto":
+        # The testbeam counters were actually VetoNu, so use those parameters 
+        source = "VetoNu"
+
     digiAlg.CB_alpha = dict_CB_param[source]["CB_alpha"]
     digiAlg.CB_n = dict_CB_param[source]["CB_n"]
     digiAlg.CB_mean = dict_CB_param[source]["CB_mean"]
-- 
GitLab