From e61fdce8ef897ff1bb43abca1d7309dde69c8124 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 20:18:31 +0200
Subject: [PATCH 01/13] Move EventInfoGlobalAlg in central config

---
 EasyjetHub/python/algs/cpalgs_config.py              |  5 +++++
 .../python/algs/event_info_global_alg_config.py      | 12 ++++++++++++
 bbVVAnalysis/python/bbVV_config.py                   |  7 -------
 bbbbAnalysis/python/config/boosted.py                |  7 -------
 bbbbAnalysis/python/config/resolved.py               |  7 -------
 bbllAnalysis/python/bbll_config.py                   |  7 -------
 bbttAnalysis/python/bbtt_config.py                   |  7 -------
 bbyyAnalysis/python/bbyy_config.py                   |  7 -------
 ttHHAnalysis/python/ttHH_config.py                   |  7 -------
 9 files changed, 17 insertions(+), 49 deletions(-)
 create mode 100644 EasyjetHub/python/algs/event_info_global_alg_config.py

diff --git a/EasyjetHub/python/algs/cpalgs_config.py b/EasyjetHub/python/algs/cpalgs_config.py
index 0347530c0..d24265746 100644
--- a/EasyjetHub/python/algs/cpalgs_config.py
+++ b/EasyjetHub/python/algs/cpalgs_config.py
@@ -29,6 +29,7 @@ from EasyjetHub.steering.utils.log_helper import log
 from EasyjetHub.steering.utils.systematics_helper import consolidate_systematics_regex
 
 from EasyjetHub.algs.event_counter_config import event_counter_cfg
+from EasyjetHub.algs.event_info_global_alg_config import event_info_global_alg_cfg
 
 # Map object types to sequence configurators
 analysis_seqs = {
@@ -49,6 +50,10 @@ def cpalgs_cfg(flags):
     if not flags.Analysis.suppress_metadata_json:
         cfg.merge(event_counter_cfg("n_input"))
 
+    # Comput global EventInfo decoration, in particular data-taking year
+    # Needed for MC20a = 2015+2016
+    cfg.merge(event_info_global_alg_cfg(flags))
+
     # Create SystematicsSvc explicitly:
     sysSvc = CompFactory.CP.SystematicsSvc("SystematicsSvc")
     cfg.addService(sysSvc)
diff --git a/EasyjetHub/python/algs/event_info_global_alg_config.py b/EasyjetHub/python/algs/event_info_global_alg_config.py
new file mode 100644
index 000000000..462d84eeb
--- /dev/null
+++ b/EasyjetHub/python/algs/event_info_global_alg_config.py
@@ -0,0 +1,12 @@
+from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+from AthenaConfiguration.ComponentFactory import CompFactory
+
+
+def event_info_global_alg_cfg(flags, **kwargs):
+    ca = ComponentAccumulator()
+
+    kwargs.setdefault("isMC", flags.Input.isMC)
+    kwargs.setdefault("Years", flags.Analysis.Years)
+
+    ca.addEventAlgo(CompFactory.Easyjet.EventInfoGlobalAlg(**kwargs))
+    return ca
diff --git a/bbVVAnalysis/python/bbVV_config.py b/bbVVAnalysis/python/bbVV_config.py
index 90e1f2793..cd28c68dd 100644
--- a/bbVVAnalysis/python/bbVV_config.py
+++ b/bbVVAnalysis/python/bbVV_config.py
@@ -166,13 +166,6 @@ def bbVV_cfg(flags, smalljetkey, largejetkey, muonkey, electronkey):
         )
     )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     return cfg
 
 
diff --git a/bbbbAnalysis/python/config/boosted.py b/bbbbAnalysis/python/config/boosted.py
index c5109dc53..44b80ed3d 100644
--- a/bbbbAnalysis/python/config/boosted.py
+++ b/bbbbAnalysis/python/config/boosted.py
@@ -87,13 +87,6 @@ def boosted_cfg(flags, largejetkey):
             )
         )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     return cfg
 
 
diff --git a/bbbbAnalysis/python/config/resolved.py b/bbbbAnalysis/python/config/resolved.py
index 8b226b2b5..fdfdcd1e5 100644
--- a/bbbbAnalysis/python/config/resolved.py
+++ b/bbbbAnalysis/python/config/resolved.py
@@ -52,13 +52,6 @@ def resolved_cfg(flags, smalljetkey):
             )
         )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     return cfg
 
 
diff --git a/bbllAnalysis/python/bbll_config.py b/bbllAnalysis/python/bbll_config.py
index f6a86af6e..eb5cb2a49 100644
--- a/bbllAnalysis/python/bbll_config.py
+++ b/bbllAnalysis/python/bbll_config.py
@@ -109,13 +109,6 @@ def bbll_cfg(flags, smalljetkey, muonkey, electronkey,
         )
     )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     return cfg
 
 
diff --git a/bbttAnalysis/python/bbtt_config.py b/bbttAnalysis/python/bbtt_config.py
index a52f7ef23..5a9c666f1 100644
--- a/bbttAnalysis/python/bbtt_config.py
+++ b/bbttAnalysis/python/bbtt_config.py
@@ -166,13 +166,6 @@ def bbtt_cfg(
         )
     )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     return cfg
 
 
diff --git a/bbyyAnalysis/python/bbyy_config.py b/bbyyAnalysis/python/bbyy_config.py
index 524ef7146..98f132a8e 100644
--- a/bbyyAnalysis/python/bbyy_config.py
+++ b/bbyyAnalysis/python/bbyy_config.py
@@ -110,13 +110,6 @@ def bbyy_cfg(flags, smalljetkey, photonkey, muonkey, electronkey,
         )
     )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     if flags.Analysis.do_resonant_PNN:
         float_SH_var = [var for var in float_variables if "SH_" in var]
         cfg.addEventAlgo(
diff --git a/ttHHAnalysis/python/ttHH_config.py b/ttHHAnalysis/python/ttHH_config.py
index a6f5b31e4..1ed856a11 100644
--- a/ttHHAnalysis/python/ttHH_config.py
+++ b/ttHHAnalysis/python/ttHH_config.py
@@ -120,13 +120,6 @@ def ttHH_cfg(flags, smalljetkey, muonkey, electronkey,
         )
     )
 
-    cfg.addEventAlgo(
-        CompFactory.Easyjet.EventInfoGlobalAlg(
-            isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
-        )
-    )
-
     return cfg
 
 
-- 
GitLab


From 648b4d564ba62517918ef51b356a51f1ea7b7b8c Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 20:21:18 +0200
Subject: [PATCH 02/13] Expend EventInfoGlobalAlg decorations

---
 EasyjetHub/src/EventInfoGlobalAlg.cxx | 53 +++++++++++++++++++--------
 EasyjetHub/src/EventInfoGlobalAlg.h   | 40 ++++++++------------
 2 files changed, 53 insertions(+), 40 deletions(-)

diff --git a/EasyjetHub/src/EventInfoGlobalAlg.cxx b/EasyjetHub/src/EventInfoGlobalAlg.cxx
index 6a23a3444..3eb4d3583 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.cxx
+++ b/EasyjetHub/src/EventInfoGlobalAlg.cxx
@@ -3,36 +3,57 @@
 namespace Easyjet
 {
 
-EventInfoGlobalAlg::EventInfoGlobalAlg(const std::string &name,
+  EventInfoGlobalAlg::EventInfoGlobalAlg(const std::string &name,
                                        ISvcLocator *pSvcLocator)
       : AthHistogramAlgorithm(name, pSvcLocator) { }
 
-StatusCode EventInfoGlobalAlg::initialize() {
+  StatusCode EventInfoGlobalAlg::initialize() {
 
     ATH_CHECK(m_EventInfoKey.initialize());
-    ATH_CHECK(m_YearsDecorKey.initialize());
     ATH_CHECK(m_runNumberKey.initialize());
     ATH_CHECK(m_rdmRunNumberKey.initialize());
 
+    m_yearDecorKey = "EventInfo.dataTakingYear";
+    ATH_CHECK(m_yearDecorKey.initialize());
+
+    for(const auto& period : m_runPeriods){
+      m_runPeriodsDecor_keys.emplace_back("EventInfo.is"+std::get<0>(period));
+      ATH_CHECK(m_runPeriodsDecor_keys.back().initialize());
+    }
+
     return StatusCode::SUCCESS;
-}
+  }
 
-StatusCode EventInfoGlobalAlg::execute() {
+  StatusCode EventInfoGlobalAlg::execute() {
 
     SG::ReadHandle<xAOD::EventInfo> eventInfo(m_EventInfoKey);
     ATH_CHECK(eventInfo.isValid());
-  // Save Year of Data taking per event
-    SG::WriteDecorHandle<xAOD::EventInfo, unsigned int> m_YearsDecorHandle(m_YearsDecorKey);
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_runNumberHandle(m_runNumberKey);
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_rdmRunNumberHandle(m_rdmRunNumberKey);
-
-    unsigned int rdmNumber = m_isMC ? m_rdmRunNumberHandle(*eventInfo) : m_runNumberHandle(*eventInfo);
-
-    if (getDataTakingYear(m_years,rdmNumber)==0)
-      return StatusCode::FAILURE;
 
-    m_YearsDecorHandle(*eventInfo) = getDataTakingYear(m_years,rdmNumber);
+    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> runNumberHandle(m_runNumberKey);
+    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> rdmRunNumberHandle(m_rdmRunNumberKey);
+    unsigned int runNumber = m_isMC ? rdmRunNumberHandle(*eventInfo) : runNumberHandle(*eventInfo);
+
+    // Save Year of Data taking per event
+    SG::WriteDecorHandle<xAOD::EventInfo, unsigned int> yearDecorHandle(m_yearDecorKey);
+
+    int year = 0;
+    if (m_years.size() == 1) year = m_years[0];
+    // Get single run year per event in case of MC20a which corresponds
+    // to 2015+2016
+    else if (m_years.size() == 2) {
+      if (266904 <= runNumber && runNumber <= 284484)
+        year = 2015;
+      else if (296939 <= runNumber && runNumber <= 311481)
+        year = 2016;
+    }
+    yearDecorHandle(*eventInfo) = year;
+
+    for(unsigned int i=0; i<m_runPeriods.size(); i++){
+      SG::WriteDecorHandle<xAOD::EventInfo, char> handle(m_runPeriodsDecor_keys[i]);
+      handle(*eventInfo) = std::get<1>(m_runPeriods[i]) <= runNumber &&
+        runNumber <= std::get<2>(m_runPeriods[i]);
+    }
 
     return StatusCode::SUCCESS;
+  }
 }
-}
\ No newline at end of file
diff --git a/EasyjetHub/src/EventInfoGlobalAlg.h b/EasyjetHub/src/EventInfoGlobalAlg.h
index 6762a24bb..d137fa01f 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.h
+++ b/EasyjetHub/src/EventInfoGlobalAlg.h
@@ -25,28 +25,6 @@ public:
     StatusCode execute() override;
     /// We use default finalize() -- this is for cleanup, and we don't do any
 
-    // Get year of data taking
-    inline unsigned int getDataTakingYear(std::vector<unsigned int> years, unsigned int rNumber ) {
-
-        if (years.size() == 1)
-            return years.at(0);
-        //Get single run year per event in case of MC20a which corresponds to 2015+2016
-        else if (years.size() == 2) {
-            if (266904 <= rNumber && rNumber <= 284484)
-                return 2015;
-            else if (296939 <= rNumber && rNumber <= 311481)
-                return 2016;
-            else { 
-              ATH_MSG_ERROR("Wrong (or unkown) combination of year and (Random)runNumber");
-              return 0;
-            }
-
-        }
-        else
-          ATH_MSG_ERROR("Wrong (or unkown) combination of year and (Random)runNumber");
-
-        return 0;
-    }
 
 private:
 
@@ -58,8 +36,22 @@ private:
         this, "runNumberDecorKey", "EventInfo.runNumber", "Run number"};
     SG::ReadDecorHandleKey<xAOD::EventInfo> m_rdmRunNumberKey{
         this, "RandomRunNumberDecorKey", "EventInfo.RandomRunNumber", "Random run number"};
-    SG::WriteDecorHandleKey<xAOD::EventInfo> m_YearsDecorKey{
-        this, "YearDecorKey", "EventInfo.dataTakingYear", "Data taking year"};
+
+    SG::WriteDecorHandleKey<xAOD::EventInfo> m_yearDecorKey;
+
+    // References:
+    // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php
+    std::vector<std::tuple<std::string, unsigned int, unsigned int>>
+      m_runPeriods = {
+      {"2016_periodA", 296939, 300287},
+      {"2016_periodB_D3", 300345, 302872},
+      {"2017_periodB5_D8", 326834, 328393},
+      {"2022_75bunches", 427882, 428070},
+      {"2023_75bunches", 450360, 450893},
+      {"2023_400bunches", 450894, 451093},
+    };
+
+    std::vector<SG::WriteDecorHandleKey<xAOD::EventInfo>> m_runPeriodsDecor_keys;
 
     Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
-- 
GitLab


From 0da97ee6447eb2544c48be5bc9927fb0a344fbea Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 20:21:33 +0200
Subject: [PATCH 03/13] Use event info decoration in TauDecoratorAlg

---
 .../python/output/ttree/tau_decor_config.py   |  1 -
 EasyjetHub/src/TauDecoratorAlg.cxx            | 78 ++++++++++---------
 EasyjetHub/src/TauDecoratorAlg.h              | 17 ++--
 3 files changed, 50 insertions(+), 46 deletions(-)

diff --git a/EasyjetHub/python/output/ttree/tau_decor_config.py b/EasyjetHub/python/output/ttree/tau_decor_config.py
index 4b9351a09..0162aa9f8 100644
--- a/EasyjetHub/python/output/ttree/tau_decor_config.py
+++ b/EasyjetHub/python/output/ttree/tau_decor_config.py
@@ -21,7 +21,6 @@ def tau_decor_cfg(flags, **kwargs):
         CompFactory.Easyjet.TauDecoratorAlg(
             f"TauDecor_{taucoll}",
             isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
             tauIDWP=flags.Analysis.Tau.ID,
             doAntiTauDecor=flags.Analysis.do_bbtt_analysis,
             muonsIn=muoncoll,
diff --git a/EasyjetHub/src/TauDecoratorAlg.cxx b/EasyjetHub/src/TauDecoratorAlg.cxx
index 4604a7cde..4b753b7ac 100644
--- a/EasyjetHub/src/TauDecoratorAlg.cxx
+++ b/EasyjetHub/src/TauDecoratorAlg.cxx
@@ -22,8 +22,17 @@ namespace Easyjet
   StatusCode TauDecoratorAlg ::initialize()
   {
     ATH_CHECK (m_eventInfoKey.initialize());
-    ATH_CHECK (m_runNumberKey.initialize());
-    ATH_CHECK (m_rdmRunNumberKey.initialize());
+
+    m_yearKey = "EventInfo.dataTakingYear";
+    ATH_CHECK(m_yearKey.initialize());
+
+    m_is2016_periodA_key = "EventInfo.is2016_periodA";
+    m_is2016_periodB_D3_key = "EventInfo.is2016_periodB_D3";
+    m_is2022_75bunches_key = "EventInfo.is2022_75bunches";
+
+    ATH_CHECK(m_is2016_periodA_key.initialize());
+    ATH_CHECK(m_is2016_periodB_D3_key.initialize());
+    ATH_CHECK(m_is2022_75bunches_key.initialize());
 
     ATH_CHECK (m_tausInKey.initialize());
 
@@ -88,8 +97,6 @@ namespace Easyjet
     SG::ReadHandle<xAOD::TauJetContainer> tausIn(m_tausInKey,ctx);
     ATH_CHECK (tausIn.isValid());
 
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_runNumberHandle(m_runNumberKey);
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_rdmRunNumberHandle(m_rdmRunNumberKey);
     SG::WriteDecorHandle<xAOD::TauJetContainer, int> nProngDecorHandle(m_nProngDecorKey);
     SG::WriteDecorHandle<xAOD::TauJetContainer, int> decayModeDecorHandle(m_decayModeDecorKey);
     SG::WriteDecorHandle<xAOD::TauJetContainer, char> idTauDecorHandle(m_IDTauDecorKey);
@@ -136,10 +143,19 @@ namespace Easyjet
       SG::ReadDecorHandle<xAOD::EventInfo, bool> isSTT(m_passSTTDecorKey);
       SG::ReadDecorHandle<xAOD::EventInfo, bool> isDTT(m_passDTTDecorKey);
 
-      std::unordered_map<Easyjet::TriggerChannel,       std::unordered_map<Easyjet::Var, float>> ptThresholds;
-      unsigned int rdmNumber = m_isMC ? m_rdmRunNumberHandle(*eventInfo) : m_runNumberHandle(*eventInfo);
-      int year = 0;
-      setRunNumberQuantities(rdmNumber, year, ptThresholds);
+      SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> year(m_yearKey);
+
+      SG::ReadDecorHandle<xAOD::EventInfo, char> is2016_periodA(m_is2016_periodA_key);
+      SG::ReadDecorHandle<xAOD::EventInfo, char> is2016_periodB_D3(m_is2016_periodB_D3_key);
+      SG::ReadDecorHandle<xAOD::EventInfo, char> is2022_75bunches(m_is2022_75bunches_key);
+
+      std::unordered_map<Easyjet::TriggerChannel,
+			 std::unordered_map<Easyjet::Var, float>> ptThresholds;
+      setRunNumberQuantities(year(*eventInfo),
+			     is2016_periodA(*eventInfo),
+			     is2016_periodB_D3(*eventInfo),
+			     is2022_75bunches(*eventInfo),
+			     ptThresholds);
 
       int nIDMatchedTauSTT = 0;
       bool passTauPtSTTThreshold = false;
@@ -201,44 +217,30 @@ namespace Easyjet
     return StatusCode::SUCCESS;
   }
   
-  void TauDecoratorAlg::setRunNumberQuantities(unsigned int runNumber, int& year, std::unordered_map<Easyjet::TriggerChannel, std::unordered_map<Easyjet::Var, float>>& ptThresholds) const{
+  void TauDecoratorAlg::setRunNumberQuantities
+  (unsigned int year,
+   bool is2016_periodA, bool is2016_periodB_D3,
+   bool is2022_75bunches,
+   std::unordered_map<Easyjet::TriggerChannel, std::unordered_map<Easyjet::Var, float>>& ptThresholds) const{
 
     // References:
-    // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php
     // https://twiki.cern.ch/twiki/bin/view/Atlas/LowestUnprescaled
-
-    year = 0;
-    if (m_years.size() == 1) year = m_years[0];
-    else if(m_years.size() == 2){
-      if(266904 <= runNumber && runNumber <= 284484) year = 2015;
-      else if(296939 <= runNumber && runNumber <= 311481) year = 2016;
-    }
   
     // Single-lepton triggers
-    if(year==2015)
-      ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::ele] = 25. * Athena::Units::GeV;
-    // 2022 75 bunches
-    else if(427882 <= runNumber && runNumber < 428071)
-      ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::ele] = 18. * Athena::Units::GeV;
-    else
-      ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::ele] = 27. * Athena::Units::GeV;
-
-    if(year==2015)
-      ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::mu] = 21. * Athena::Units::GeV;
-    else if(year>=2016 && year<=2018)
-      ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::mu] = 27. * Athena::Units::GeV;
-    else
-      ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::mu] = 25. * Athena::Units::GeV;
+    float min_ele = 27. * Athena::Units::GeV;
+    if(year==2015) min_ele = 25. * Athena::Units::GeV;
+    else if(is2022_75bunches) min_ele = 18. * Athena::Units::GeV;
+    ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::ele] = min_ele;
+
+    float min_mu = 25. * Athena::Units::GeV;
+    if(year==2015) min_mu = 21. * Athena::Units::GeV;
+    else if(year>=2016 && year<=2018) min_mu = 27. * Athena::Units::GeV;
+    ptThresholds[Easyjet::TriggerChannel::SLT][Easyjet::Var::mu] = min_mu;
 
     // Single tau triggers
     float min_tau_STT = 180. * Athena::Units::GeV;
-    // 2015 + 2016 period A
-    if(year==2015 || (296939 <= runNumber && runNumber <= 300287))
-      min_tau_STT = 100. * Athena::Units::GeV;
-    // 2016 period B-D3
-    else if(300345 <= runNumber && runNumber <= 302872)
-      min_tau_STT = 140. * Athena::Units::GeV;
-
+    if(year==2015 || is2016_periodA) min_tau_STT = 100. * Athena::Units::GeV;
+    else if(is2016_periodB_D3) min_tau_STT = 140. * Athena::Units::GeV;
     ptThresholds[Easyjet::TriggerChannel::STT][Easyjet::Var::leadingtau] = min_tau_STT;
   }
 
diff --git a/EasyjetHub/src/TauDecoratorAlg.h b/EasyjetHub/src/TauDecoratorAlg.h
index 5096ba610..72ab15da0 100644
--- a/EasyjetHub/src/TauDecoratorAlg.h
+++ b/EasyjetHub/src/TauDecoratorAlg.h
@@ -59,13 +59,12 @@ private:
       { this, "event", "EventInfo", "EventInfo to read" };
     Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
-    Gaudi::Property<std::vector<unsigned int>> m_years
-      { this, "Years", false, "which years are running" };
 
-    SG::ReadDecorHandleKey<xAOD::EventInfo> m_runNumberKey{
-      this, "runNumberDecorKey", "EventInfo.runNumber", "Run number"};
-    SG::ReadDecorHandleKey<xAOD::EventInfo> m_rdmRunNumberKey{
-      this, "RandomRunNumberDecorKey", "EventInfo.RandomRunNumber", "Random run number"};
+    SG::ReadDecorHandleKey<xAOD::EventInfo> m_yearKey;
+
+    SG::ReadDecorHandleKey<xAOD::EventInfo> m_is2016_periodA_key;
+    SG::ReadDecorHandleKey<xAOD::EventInfo> m_is2016_periodB_D3_key;
+    SG::ReadDecorHandleKey<xAOD::EventInfo> m_is2022_75bunches_key;
 
     // Muons
     SG::ReadHandleKey<xAOD::MuonContainer> m_muonsInKey{
@@ -150,7 +149,11 @@ private:
     };
     SG::ReadDecorHandleKey<xAOD::TauJetContainer> m_triggerMatchDTTKey;
 
-    void setRunNumberQuantities(unsigned int runNumber, int& year,  std::unordered_map<Easyjet::TriggerChannel, std::unordered_map<Easyjet::Var, float>>& ptThresholdMap) const;
+    void setRunNumberQuantities
+    (unsigned int year,
+     bool is2016_periodA, bool is2016_periodB_D3,
+     bool is2022_75bunches,
+     std::unordered_map<Easyjet::TriggerChannel, std::unordered_map<Easyjet::Var, float>>& ptThresholdMap) const;
   };
 }
 
-- 
GitLab


From 9f8ec25bf2dd799d4585c06066750a78dec162b7 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 20:21:48 +0200
Subject: [PATCH 04/13] Use event info decoration in HHbbllSelectorAlg

---
 bbllAnalysis/src/HHbbllSelectorAlg.cxx | 114 +++++++++++--------------
 bbllAnalysis/src/HHbbllSelectorAlg.h   |  63 +++++++-------
 2 files changed, 84 insertions(+), 93 deletions(-)

diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.cxx b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
index 9393f713b..b43ae3388 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.cxx
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.cxx
@@ -41,9 +41,13 @@ namespace HHBBLL
     ATH_CHECK (m_metHandle.initialize(m_systematicsList));
     ATH_CHECK (m_eventHandle.initialize(m_systematicsList));    
 
-    ATH_CHECK (m_runNumber.initialize(m_systematicsList, m_eventHandle));
-    ATH_CHECK (m_rdmRunNumber.initialize(m_systematicsList, m_eventHandle));
+    ATH_CHECK(m_year.initialize(m_systematicsList, m_eventHandle));
 
+    ATH_CHECK(m_is17_periodB5_B8.initialize(m_systematicsList, m_eventHandle));
+    ATH_CHECK(m_is22_75bunches.initialize(m_systematicsList, m_eventHandle));
+    ATH_CHECK(m_is23_75bunches.initialize(m_systematicsList, m_eventHandle));
+    ATH_CHECK(m_is23_400bunches.initialize(m_systematicsList, m_eventHandle));
+    
     ATH_CHECK (m_matchingTool.retrieve());
 
     for (auto& [key, value] : m_boolnames) {
@@ -179,16 +183,7 @@ namespace HHBBLL
       m_bools.at(HHBBLL::DILEPTON_MASS_SR2) = false;
       m_bools.at(HHBBLL::DIBJET_MASS_SR2) = false;
 
-      unsigned int runNumber = m_isMC ? m_rdmRunNumber.get(*event, sys) :
-      m_runNumber.get(*event, sys);
-
-      int year = 0;
-      std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap;
-      for(unsigned int i=0; i<=HHBBLL::Count; i++){
-        runBoolMap[static_cast<HHBBLL::RunBooleans>(i)] = false;
-      }
-
-      setRunNumberQuantities(runNumber, year, runBoolMap);
+      setThresholds(event, sys);
 
       // Leptons
       const xAOD::Electron* ele0 = nullptr;
@@ -212,7 +207,7 @@ namespace HHBBLL
         mu0 = muons->at(0);
       }
 
-      evaluateTriggerCuts(year, runBoolMap, event, ele0, ele1, mu0, mu1, m_bbllCuts, sys);
+      evaluateTriggerCuts(event, ele0, ele1, mu0, mu1, m_bbllCuts, sys);
       evaluateLeptonCuts(*electrons, *muons, m_bbllCuts);
       evaluateJetCuts(*bjets, *nonbjets, m_bbllCuts);
       evaluateBJetLeptonCuts(*bjets, *electrons, *muons);
@@ -294,30 +289,36 @@ namespace HHBBLL
     return StatusCode::SUCCESS;
   }
 
-  void HHbbllSelectorAlg::evaluateTriggerCuts(int year, std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap, const xAOD::EventInfo *event, const xAOD::Electron* ele0,  
-                          const xAOD::Electron* ele1, const xAOD::Muon* mu0, const xAOD::Muon* mu1, CutManager& bbllCuts, const CP::SystematicSet& sys) {
+  void HHbbllSelectorAlg::evaluateTriggerCuts
+  (const xAOD::EventInfo *event,
+   const xAOD::Electron* ele0, const xAOD::Electron* ele1,
+   const xAOD::Muon* mu0, const xAOD::Muon* mu1,
+   CutManager& bbllCuts, const CP::SystematicSet& sys) {
 
     if (!bbllCuts.exists("PASS_TRIGGER"))
         return;
 
-    if (ele0 || mu0) evaluateSingleLeptonTrigger(year, runBoolMap, event, ele0, mu0, sys);
-    if (ele1 || mu1) evaluateSingleLeptonTrigger(year, runBoolMap, event, ele1, mu1, sys);
-    if ((ele0 && ele1) || (mu0 && mu1)) evaluateDiLeptonTrigger(year, runBoolMap, event, ele0, ele1, mu0, mu1, sys);
-    if (ele0 && mu0) evaluateAsymmetricLeptonTrigger(year, event, ele0, mu0, sys);
+    if (ele0 || mu0) evaluateSingleLeptonTrigger(event, ele0, mu0, sys);
+    if (ele1 || mu1) evaluateSingleLeptonTrigger(event, ele1, mu1, sys);
+    if ((ele0 && ele1) || (mu0 && mu1)) evaluateDiLeptonTrigger(event, ele0, ele1, mu0, mu1, sys);
+    if (ele0 && mu0) evaluateAsymmetricLeptonTrigger(event, ele0, mu0, sys);
 
-    bool pass_trigger_ASLT = m_bools.at(HHBBLL::pass_trigger_ASLT1_em) || m_bools.at(HHBBLL::pass_trigger_ASLT1_me) ||
-    m_bools.at(HHBBLL::pass_trigger_ASLT2);
+    bool pass_trigger_ASLT = m_bools.at(HHBBLL::pass_trigger_ASLT1_em) ||
+      m_bools.at(HHBBLL::pass_trigger_ASLT1_me) ||
+      m_bools.at(HHBBLL::pass_trigger_ASLT2);
 
     if (m_bools.at(HHBBLL::pass_trigger_SLT) || m_bools.at(HHBBLL::pass_trigger_DLT) || pass_trigger_ASLT) m_bools.at(HHBBLL::PASS_TRIGGER) = true;
   }
 
-  void HHbbllSelectorAlg::evaluateSingleLeptonTrigger(
-      int year, std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap, const xAOD::EventInfo *event,
-      const xAOD::Electron *ele, const xAOD::Muon *mu, const CP::SystematicSet& sys)
+  void HHbbllSelectorAlg::evaluateSingleLeptonTrigger
+  (const xAOD::EventInfo *event,
+   const xAOD::Electron *ele, const xAOD::Muon *mu,
+   const CP::SystematicSet& sys)
   {
     // Check single electron triggers
     std::vector<std::string> single_ele_paths;
 
+    int year = m_year.get(*event, sys);
     if(year==2015){
       single_ele_paths = {
         "HLT_e24_lhmedium_L1EM20VH", "HLT_e60_lhmedium",
@@ -330,7 +331,7 @@ namespace HHBBLL
         "HLT_e140_lhloose_nod0"
       };
     }
-    else if(runBoolMap.at(HHBBLL::is22_75bunches)){
+    else if(m_is22_75bunches.get(*event, sys)){
       single_ele_paths = {
         "HLT_e17_lhvloose_L1EM15VHI", "HLT_e20_lhvloose_L1EM15VH",
         "HLT_e250_etcut_L1EM22VHI"
@@ -342,7 +343,7 @@ namespace HHBBLL
         "HLT_e140_lhloose_L1EM22VHI", "HLT_e300_etcut_L1EM22VHI"
       };
     }
-    else if(runBoolMap.at(HHBBLL::is23_75bunches)){
+    else if(m_is23_75bunches.get(*event, sys)){
       single_ele_paths = {
         "HLT_e26_lhtight_ivarloose_L1EM22VHI", "HLT_e60_lhmedium_L1EM22VHI",
         "HLT_e140_lhloose_L1EM22VHI", "HLT_e140_lhloose_noringer_L1EM22VHI",
@@ -379,9 +380,9 @@ namespace HHBBLL
       single_mu_paths = {"HLT_mu26_ivarmedium", "HLT_mu50"};
     }
     else if(2022<=year && year<=2023 &&
-	    !runBoolMap.at(HHBBLL::is22_75bunches) &&
-	    !runBoolMap.at(HHBBLL::is23_75bunches) &&
-	    !runBoolMap.at(HHBBLL::is23_400bunches)){
+	    !m_is22_75bunches.get(*event, sys) &&
+	    !m_is23_75bunches.get(*event, sys) &&
+	    !m_is23_400bunches.get(*event, sys)){
       single_mu_paths = {
         "HLT_mu24_ivarmedium_L1MU14FCH", "HLT_mu50_L1MU14FCH",
         "HLT_mu60_0eta105_msonly_L1MU14FCH", "HLT_mu60_L1MU14FCH",
@@ -404,20 +405,22 @@ namespace HHBBLL
     m_bools.at(HHBBLL::pass_trigger_SLT) |= (trigPassed_SET || trigPassed_SMT);
   }
 
-  void HHbbllSelectorAlg::evaluateDiLeptonTrigger(
-      int year, std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap, const xAOD::EventInfo *event,
-      const xAOD::Electron *ele0, const xAOD::Electron *ele1, const xAOD::Muon *mu0,
-      const xAOD::Muon *mu1, const CP::SystematicSet& sys)
+  void HHbbllSelectorAlg::evaluateDiLeptonTrigger
+  (const xAOD::EventInfo *event,
+   const xAOD::Electron *ele0, const xAOD::Electron *ele1,
+   const xAOD::Muon *mu0, const xAOD::Muon *mu1,
+   const CP::SystematicSet& sys)
   {
     std::vector<std::string> di_ele_paths;
-    
+
+    int year = m_year.get(*event, sys);
     if(year==2015){
       di_ele_paths = {"HLT_2e12_lhloose_L12EM10VH"};
     }
     else if(year==2016){
       di_ele_paths = {"HLT_2e17_lhvloose_nod0"};
     }
-    else if (runBoolMap.at(HHBBLL::is17PeriodB5_B8)){
+    else if(m_is17_periodB5_B8.get(*event, sys)){
       di_ele_paths = {
         "HLT_2e24_lhvloose_nod0", "HLT_e24_lhvloose_nod0_2e12_lhvloose_nod0_L1EM20VH_3EM10VH"
       };
@@ -483,9 +486,13 @@ namespace HHBBLL
     m_bools.at(HHBBLL::pass_trigger_DLT) = (trigPassed_DET || trigPassed_DMT);
   }
 
-  void HHbbllSelectorAlg::evaluateAsymmetricLeptonTrigger(
-      int year, const xAOD::EventInfo *event, const xAOD::Electron *ele, const xAOD::Muon *mu, const CP::SystematicSet& sys)
+  void HHbbllSelectorAlg::evaluateAsymmetricLeptonTrigger
+  (const xAOD::EventInfo *event,
+   const xAOD::Electron *ele, const xAOD::Muon *mu,
+   const CP::SystematicSet& sys)
   {
+    int year = m_year.get(*event, sys);
+
     bool trigPassed_ASLT1_em = false;
     bool trigPassed_ASLT1_me = false;
     bool trigPassed_ASLT2 = false;
@@ -685,37 +692,16 @@ namespace HHBBLL
     m_bools.at(HHBBLL::Pass_ll) = ((TWO_ISO_ELECTRONS || TWO_ISO_MUONS || TWO_ISO_ELECMUs) && EXACTLY_TWO_B_JETS);
   }  
 
-  void HHbbllSelectorAlg::setRunNumberQuantities
-  (unsigned int runNumber, int& year,
-   std::unordered_map<HHBBLL::RunBooleans, bool>& runBoolMap) {
-    // References:
-    // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php
-    // https://twiki.cern.ch/twiki/bin/view/Atlas/LowestUnprescaled
-
-    runBoolMap.at(HHBBLL::is15) =
-      266904 <= runNumber && runNumber <= 284484;
-    runBoolMap.at(HHBBLL::is16) =
-      296939 <= runNumber && runNumber <= 311481;
-    runBoolMap.at(HHBBLL::is17PeriodB5_B8) =
-      326834 <= runNumber && runNumber <= 328393;
-    runBoolMap.at(HHBBLL::is22_75bunches) =
-      427882 <= runNumber && runNumber < 428071;
-    runBoolMap.at(HHBBLL::is23_75bunches) =
-      450360 <= runNumber && runNumber < 450894;
-    runBoolMap.at(HHBBLL::is23_400bunches) =
-      450894 <= runNumber && runNumber < 451094;
-
-    if(m_years.size()==1) year = m_years[0];
-    else{
-      if(runBoolMap.at(HHBBLL::is15)) year = 2015;
-      else if(runBoolMap.at(HHBBLL::is16)) year = 2016;
-    }
+  void HHbbllSelectorAlg::setThresholds(const xAOD::EventInfo* event,
+					const CP::SystematicSet& sys) {
+    
+    int year = m_year.get(*event, sys);
 
     // Single-lepton triggers
     if(year==2015)
       m_pt_threshold[HHBBLL::SLT][HHBBLL::ele] = 25. * Athena::Units::GeV;
     // 2022 75 bunches
-    else if(runBoolMap.at(HHBBLL::is22_75bunches))
+    else if(m_is22_75bunches.get(*event, sys))
       m_pt_threshold[HHBBLL::SLT][HHBBLL::ele] = 18. * Athena::Units::GeV;
     else
       m_pt_threshold[HHBBLL::SLT][HHBBLL::ele] = 27. * Athena::Units::GeV;
@@ -735,7 +721,7 @@ namespace HHBBLL
     }
     // prescaled periods B5-B8
     // https://twiki.cern.ch/twiki/bin/view/Atlas/TrigEgammaRecommendedTriggers2017
-    else if(runBoolMap.at(HHBBLL::is17PeriodB5_B8)) {
+    else if(m_is17_periodB5_B8.get(*event, sys)) {
       m_pt_threshold[HHBBLL::DLT][HHBBLL::leadingele] = 25. * Athena::Units::GeV;
       m_pt_threshold[HHBBLL::DLT][HHBBLL::subleadingele] = 25. * Athena::Units::GeV;
     } else {
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.h b/bbllAnalysis/src/HHbbllSelectorAlg.h
index 58c58dbb2..54c1d6c10 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.h
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 // Always protect against multiple includes!
@@ -29,18 +29,6 @@
 
 namespace HHBBLL
 {
-
-    enum RunBooleans
-  {
-    is15,
-    is16,
-    is17PeriodB5_B8,
-    is22_75bunches,
-    is23_75bunches,
-    is23_400bunches,
-    Count
-  };
-
   enum TriggerChannel
   {
     SLT,
@@ -141,12 +129,18 @@ namespace HHBBLL
       CP::SysReadHandle<xAOD::MissingETContainer>
       m_metHandle{ this, "met", "AnalysisMET",   "MET container to read" };
 
-      CP::SysReadDecorHandle<unsigned int>
-      m_runNumber {this, "runNumber", "runNumber", "Runnumber"};
-
-      CP::SysReadDecorHandle<unsigned int>
-      m_rdmRunNumber {this, "randomRunNumber", "RandomRunNumber", "Random run number for MC"};
-
+      CP::SysReadDecorHandle<unsigned int> m_year
+	{this, "year", "dataTakingYear", ""};
+
+      CP::SysReadDecorHandle<char> m_is17_periodB5_B8
+	{this, "is17_periodB5_B8", "is17_periodB5_B8", ""};
+      CP::SysReadDecorHandle<char> m_is22_75bunches
+	{this, "is22_75bunches", "is22_75bunches", ""};
+      CP::SysReadDecorHandle<char> m_is23_75bunches
+	{this, "is23_75bunches", "is23_75bunches", ""};
+      CP::SysReadDecorHandle<char> m_is23_400bunches
+	{this, "is23_400bunches", "is23_400bunches", ""};
+      
       CP::SysFilterReporterParams m_filterParams {this, "HHbbll selection"};
 
       std::vector<std::string> m_passTriggers;
@@ -203,22 +197,33 @@ namespace HHBBLL
 
       std::unordered_map<HHBBLL::TriggerChannel, std::unordered_map<HHBBLL::Var, float>> m_pt_threshold;
 
-      void evaluateTriggerCuts(int year, std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap, const xAOD::EventInfo* event, const xAOD::Electron* ele0,  
-                          const xAOD::Electron* ele1, const xAOD::Muon* mu0, const xAOD::Muon* mu1, CutManager& bbllCuts, const CP::SystematicSet& sys);
-      void evaluateSingleLeptonTrigger(int year, std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap, const xAOD::EventInfo* event, 
-                          const xAOD::Electron* ele, const xAOD::Muon* mu, const CP::SystematicSet& sys);
-      void evaluateDiLeptonTrigger(int year, std::unordered_map<HHBBLL::RunBooleans, bool> runBoolMap, const xAOD::EventInfo* event,
-                          const xAOD::Electron* ele0, const xAOD::Electron* ele1, const xAOD::Muon* mu0, const xAOD::Muon* mu1, const CP::SystematicSet& sys);
-      void evaluateAsymmetricLeptonTrigger(int year, const xAOD::EventInfo* event, const xAOD::Electron* ele, const xAOD::Muon* mu, const CP::SystematicSet& sys);
+      void evaluateTriggerCuts
+	(const xAOD::EventInfo* event,
+	 const xAOD::Electron* ele0, const xAOD::Electron* ele1,
+	 const xAOD::Muon* mu0, const xAOD::Muon* mu1,
+	 CutManager& bbllCuts, const CP::SystematicSet& sys);
+      void evaluateSingleLeptonTrigger
+	(const xAOD::EventInfo* event, 
+	 const xAOD::Electron* ele, const xAOD::Muon* mu,
+	 const CP::SystematicSet& sys);
+      void evaluateDiLeptonTrigger
+	(const xAOD::EventInfo* event,
+	 const xAOD::Electron* ele0, const xAOD::Electron* ele1,
+	 const xAOD::Muon* mu0, const xAOD::Muon* mu1,
+	 const CP::SystematicSet& sys);
+      void evaluateAsymmetricLeptonTrigger
+	(const xAOD::EventInfo* event,
+	 const xAOD::Electron* ele, const xAOD::Muon* mu,
+	 const CP::SystematicSet& sys);
+
       void evaluateLeptonCuts(const xAOD::ElectronContainer& electrons,
                           const xAOD::MuonContainer& muons, CutManager& bbllCuts);
       void evaluateJetCuts(const ConstDataVector<xAOD::JetContainer>& bjets,
                           const ConstDataVector<xAOD::JetContainer>& nonbjets, CutManager& bbllCuts);
       void evaluateBJetLeptonCuts(const ConstDataVector<xAOD::JetContainer>& bjets,
                           const xAOD::ElectronContainer& electrons, const xAOD::MuonContainer& muons);
-      void setRunNumberQuantities
-      (unsigned int runNumber, int& year,
-       std::unordered_map<HHBBLL::RunBooleans, bool>& runBoolMap);
+      void setThresholds(const xAOD::EventInfo* event,
+			 const CP::SystematicSet& sys);
   };
 
 }
-- 
GitLab


From 66dd9f427e64023ef0edb1e05782ecf32ebccc8a Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 20:29:13 +0200
Subject: [PATCH 05/13] Move alg down in config

---
 EasyjetHub/python/algs/cpalgs_config.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/EasyjetHub/python/algs/cpalgs_config.py b/EasyjetHub/python/algs/cpalgs_config.py
index d24265746..46eb4670f 100644
--- a/EasyjetHub/python/algs/cpalgs_config.py
+++ b/EasyjetHub/python/algs/cpalgs_config.py
@@ -50,10 +50,6 @@ def cpalgs_cfg(flags):
     if not flags.Analysis.suppress_metadata_json:
         cfg.merge(event_counter_cfg("n_input"))
 
-    # Comput global EventInfo decoration, in particular data-taking year
-    # Needed for MC20a = 2015+2016
-    cfg.merge(event_info_global_alg_cfg(flags))
-
     # Create SystematicsSvc explicitly:
     sysSvc = CompFactory.CP.SystematicsSvc("SystematicsSvc")
     cfg.addService(sysSvc)
@@ -103,6 +99,11 @@ def cpalgs_cfg(flags):
     cfg.merge(weightConfigAccumulator.CA)
 
     # Extra decoration algorithms
+    
+    # Comput global EventInfo decoration, in particular data-taking year
+    # Needed for MC20a = 2015+2016
+    cfg.merge(event_info_global_alg_cfg(flags))
+    
     if flags.Analysis.do_small_R_jets:
         # Schedule the alg to decorate btag info onto jets
         # rather than accessing from xAOD::BTagging
-- 
GitLab


From 5a4cd98fff0de11935bd734ef1a91a8904582e57 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 22:36:44 +0200
Subject: [PATCH 06/13] Fixes

---
 EasyjetHub/python/algs/cpalgs_config.py | 4 ++--
 bbllAnalysis/src/HHbbllSelectorAlg.h    | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/EasyjetHub/python/algs/cpalgs_config.py b/EasyjetHub/python/algs/cpalgs_config.py
index 46eb4670f..991cc7ad7 100644
--- a/EasyjetHub/python/algs/cpalgs_config.py
+++ b/EasyjetHub/python/algs/cpalgs_config.py
@@ -99,11 +99,11 @@ def cpalgs_cfg(flags):
     cfg.merge(weightConfigAccumulator.CA)
 
     # Extra decoration algorithms
-    
+
     # Comput global EventInfo decoration, in particular data-taking year
     # Needed for MC20a = 2015+2016
     cfg.merge(event_info_global_alg_cfg(flags))
-    
+
     if flags.Analysis.do_small_R_jets:
         # Schedule the alg to decorate btag info onto jets
         # rather than accessing from xAOD::BTagging
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.h b/bbllAnalysis/src/HHbbllSelectorAlg.h
index 54c1d6c10..bb9108969 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.h
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.h
@@ -133,13 +133,13 @@ namespace HHBBLL
 	{this, "year", "dataTakingYear", ""};
 
       CP::SysReadDecorHandle<char> m_is17_periodB5_B8
-	{this, "is17_periodB5_B8", "is17_periodB5_B8", ""};
+	{this, "is2017_periodB5_B8", "is2017_periodB5_B8", ""};
       CP::SysReadDecorHandle<char> m_is22_75bunches
-	{this, "is22_75bunches", "is22_75bunches", ""};
+	{this, "is2022_75bunches", "is2022_75bunches", ""};
       CP::SysReadDecorHandle<char> m_is23_75bunches
-	{this, "is23_75bunches", "is23_75bunches", ""};
+	{this, "is2023_75bunches", "is2023_75bunches", ""};
       CP::SysReadDecorHandle<char> m_is23_400bunches
-	{this, "is23_400bunches", "is23_400bunches", ""};
+	{this, "is2023_400bunches", "is2023_400bunches", ""};
       
       CP::SysFilterReporterParams m_filterParams {this, "HHbbll selection"};
 
-- 
GitLab


From a905c73393869f26ecfdc63d3e7e6f4e9520ea22 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Wed, 17 Apr 2024 22:54:04 +0200
Subject: [PATCH 07/13] Fix

---
 EasyjetHub/src/EventInfoGlobalAlg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EasyjetHub/src/EventInfoGlobalAlg.h b/EasyjetHub/src/EventInfoGlobalAlg.h
index d137fa01f..cb344effd 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.h
+++ b/EasyjetHub/src/EventInfoGlobalAlg.h
@@ -45,7 +45,7 @@ private:
       m_runPeriods = {
       {"2016_periodA", 296939, 300287},
       {"2016_periodB_D3", 300345, 302872},
-      {"2017_periodB5_D8", 326834, 328393},
+      {"2017_periodB5_B8", 326834, 328393},
       {"2022_75bunches", 427882, 428070},
       {"2023_75bunches", 450360, 450893},
       {"2023_400bunches", 450894, 451093},
-- 
GitLab


From 271f7dd3a2169cd3cbe7b95b71738c2300a84236 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Thu, 18 Apr 2024 00:12:54 +0200
Subject: [PATCH 08/13] Updated bbtt algs

---
 EasyjetHub/src/EventInfoGlobalAlg.cxx         |   9 +-
 EasyjetHub/src/EventInfoGlobalAlg.h           |   9 +
 EasyjetHub/src/TauDecoratorAlg.cxx            |   6 +-
 bbllAnalysis/python/bbll_config.py            |   1 -
 bbllAnalysis/src/HHbbllSelectorAlg.h          |  11 +-
 bbttAnalysis/python/TriggerDecoratorConfig.py |   1 -
 bbttAnalysis/python/bbtt_config.py            |   1 -
 bbttAnalysis/src/HHbbttSelectorAlg.cxx        |  51 ++---
 bbttAnalysis/src/HHbbttSelectorAlg.h          |  20 +-
 bbttAnalysis/src/TriggerDecoratorAlg.cxx      | 205 +++++++-----------
 bbttAnalysis/src/TriggerDecoratorAlg.h        |  62 +++---
 11 files changed, 167 insertions(+), 209 deletions(-)

diff --git a/EasyjetHub/src/EventInfoGlobalAlg.cxx b/EasyjetHub/src/EventInfoGlobalAlg.cxx
index 3eb4d3583..8e2dfa6ab 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.cxx
+++ b/EasyjetHub/src/EventInfoGlobalAlg.cxx
@@ -21,6 +21,9 @@ namespace Easyjet
       ATH_CHECK(m_runPeriodsDecor_keys.back().initialize());
     }
 
+    m_L1TopoDisabledDecorKey = "EventInfo.l1TopoDisabled";
+    ATH_CHECK(m_L1TopoDisabledDecorKey.initialize());
+
     return StatusCode::SUCCESS;
   }
 
@@ -49,11 +52,15 @@ namespace Easyjet
     yearDecorHandle(*eventInfo) = year;
 
     for(unsigned int i=0; i<m_runPeriods.size(); i++){
-      SG::WriteDecorHandle<xAOD::EventInfo, char> handle(m_runPeriodsDecor_keys[i]);
+      SG::WriteDecorHandle<xAOD::EventInfo, bool> handle(m_runPeriodsDecor_keys[i]);
       handle(*eventInfo) = std::get<1>(m_runPeriods[i]) <= runNumber &&
         runNumber <= std::get<2>(m_runPeriods[i]);
     }
 
+    SG::WriteDecorHandle<xAOD::EventInfo, bool> l1TopoDisabled(m_L1TopoDisabledDecorKey);
+    l1TopoDisabled(*eventInfo) =
+      (runNumber == 336506) || (runNumber == 336548) || (runNumber == 336567);
+
     return StatusCode::SUCCESS;
   }
 }
diff --git a/EasyjetHub/src/EventInfoGlobalAlg.h b/EasyjetHub/src/EventInfoGlobalAlg.h
index cb344effd..90282a5a4 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.h
+++ b/EasyjetHub/src/EventInfoGlobalAlg.h
@@ -45,14 +45,23 @@ private:
       m_runPeriods = {
       {"2016_periodA", 296939, 300287},
       {"2016_periodB_D3", 300345, 302872},
+      {"2016_periodD4_end", 302919, 311481},
+      {"2017_periodB1_B4", 325713, 326695},
+      {"2017_periodB5_B7", 326834, 327490},
       {"2017_periodB5_B8", 326834, 328393},
+      {"2017_periodB8_end", 327582, 341649},
+      {"2018_periodB_end", 348885, 364485},
+      {"2018_periodK_end", 355529, 364485},
       {"2022_75bunches", 427882, 428070},
       {"2023_75bunches", 450360, 450893},
       {"2023_400bunches", 450894, 451093},
+      {"2023_first_2400bunches", 451896, 456749}
     };
 
     std::vector<SG::WriteDecorHandleKey<xAOD::EventInfo>> m_runPeriodsDecor_keys;
 
+    SG::WriteDecorHandleKey<xAOD::EventInfo> m_L1TopoDisabledDecorKey;
+
     Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
     Gaudi::Property<std::vector<unsigned int>> m_years
diff --git a/EasyjetHub/src/TauDecoratorAlg.cxx b/EasyjetHub/src/TauDecoratorAlg.cxx
index 4b753b7ac..44ef9ceca 100644
--- a/EasyjetHub/src/TauDecoratorAlg.cxx
+++ b/EasyjetHub/src/TauDecoratorAlg.cxx
@@ -145,9 +145,9 @@ namespace Easyjet
 
       SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> year(m_yearKey);
 
-      SG::ReadDecorHandle<xAOD::EventInfo, char> is2016_periodA(m_is2016_periodA_key);
-      SG::ReadDecorHandle<xAOD::EventInfo, char> is2016_periodB_D3(m_is2016_periodB_D3_key);
-      SG::ReadDecorHandle<xAOD::EventInfo, char> is2022_75bunches(m_is2022_75bunches_key);
+      SG::ReadDecorHandle<xAOD::EventInfo, bool> is2016_periodA(m_is2016_periodA_key);
+      SG::ReadDecorHandle<xAOD::EventInfo, bool> is2016_periodB_D3(m_is2016_periodB_D3_key);
+      SG::ReadDecorHandle<xAOD::EventInfo, bool> is2022_75bunches(m_is2022_75bunches_key);
 
       std::unordered_map<Easyjet::TriggerChannel,
 			 std::unordered_map<Easyjet::Var, float>> ptThresholds;
diff --git a/bbllAnalysis/python/bbll_config.py b/bbllAnalysis/python/bbll_config.py
index eb5cb2a49..ee386b2a8 100644
--- a/bbllAnalysis/python/bbll_config.py
+++ b/bbllAnalysis/python/bbll_config.py
@@ -72,7 +72,6 @@ def bbll_cfg(flags, smalljetkey, muonkey, electronkey,
             saveCutFlow=flags.Analysis.save_bbll_cutflow,
             passTriggers=flags.Analysis.TriggerChains,
             isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
             triggerLists=trigger_branches,
             trigMatchingTool=cfg.popToolsAndMerge(TriggerMatchingToolCfg(flags)),
             bypass=(flags.Analysis.bypass if hasattr(flags.Analysis, 'bypass')
diff --git a/bbllAnalysis/src/HHbbllSelectorAlg.h b/bbllAnalysis/src/HHbbllSelectorAlg.h
index bb9108969..1752e3d3e 100644
--- a/bbllAnalysis/src/HHbbllSelectorAlg.h
+++ b/bbllAnalysis/src/HHbbllSelectorAlg.h
@@ -102,9 +102,6 @@ namespace HHBBLL
       Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
 
-      Gaudi::Property<std::vector<int>> m_years
-      { this, "Years", false, "which years are running" };
-
       Gaudi::Property<bool> m_bypass
       { this, "bypass", false, "Run selector algorithm in pass-through mode" };
 
@@ -132,13 +129,13 @@ namespace HHBBLL
       CP::SysReadDecorHandle<unsigned int> m_year
 	{this, "year", "dataTakingYear", ""};
 
-      CP::SysReadDecorHandle<char> m_is17_periodB5_B8
+      CP::SysReadDecorHandle<bool> m_is17_periodB5_B8
 	{this, "is2017_periodB5_B8", "is2017_periodB5_B8", ""};
-      CP::SysReadDecorHandle<char> m_is22_75bunches
+      CP::SysReadDecorHandle<bool> m_is22_75bunches
 	{this, "is2022_75bunches", "is2022_75bunches", ""};
-      CP::SysReadDecorHandle<char> m_is23_75bunches
+      CP::SysReadDecorHandle<bool> m_is23_75bunches
 	{this, "is2023_75bunches", "is2023_75bunches", ""};
-      CP::SysReadDecorHandle<char> m_is23_400bunches
+      CP::SysReadDecorHandle<bool> m_is23_400bunches
 	{this, "is2023_400bunches", "is2023_400bunches", ""};
       
       CP::SysFilterReporterParams m_filterParams {this, "HHbbll selection"};
diff --git a/bbttAnalysis/python/TriggerDecoratorConfig.py b/bbttAnalysis/python/TriggerDecoratorConfig.py
index ec401b7b2..077472b92 100644
--- a/bbttAnalysis/python/TriggerDecoratorConfig.py
+++ b/bbttAnalysis/python/TriggerDecoratorConfig.py
@@ -21,7 +21,6 @@ def HHbbttTriggerDecoratorCfg(flags):
         CompFactory.HHBBTT.TriggerDecoratorAlg(
             "HHbbttTriggerDecoratorAlg",
             isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
             muons=flags.Analysis.container_names.input.muons,
             electrons=flags.Analysis.container_names.input.electrons,
             taus=flags.Analysis.container_names.input.taus,
diff --git a/bbttAnalysis/python/bbtt_config.py b/bbttAnalysis/python/bbtt_config.py
index 5a9c666f1..25ff5275a 100644
--- a/bbttAnalysis/python/bbtt_config.py
+++ b/bbttAnalysis/python/bbtt_config.py
@@ -87,7 +87,6 @@ def bbtt_cfg(
             isMC=flags.Input.isMC,
             doAntiIDRegions=flags.Analysis.do_antiID_regions,
             useTriggerSelections=flags.Analysis.do_trigger_offline_filtering,
-            Years=flags.Analysis.Years,
             bypass=flags.Analysis.bypass,
             saveCutFlow=flags.Analysis.save_bbtt_cutflow,
             cutList=(
diff --git a/bbttAnalysis/src/HHbbttSelectorAlg.cxx b/bbttAnalysis/src/HHbbttSelectorAlg.cxx
index ddf132a40..450a7353d 100644
--- a/bbttAnalysis/src/HHbbttSelectorAlg.cxx
+++ b/bbttAnalysis/src/HHbbttSelectorAlg.cxx
@@ -37,12 +37,13 @@ namespace HHBBTT
       ATH_CHECK (m_isBtag.initialize(m_systematicsList, m_jetHandle));
     }
 
-    ATH_CHECK (m_runNumber.initialize(m_systematicsList, m_eventHandle));
-    ATH_CHECK (m_rdmRunNumber.initialize(m_systematicsList, m_eventHandle));
     ATH_CHECK (m_generatorWeight.initialize(m_systematicsList, m_eventHandle));
 
+    ATH_CHECK(m_year.initialize(m_systematicsList, m_eventHandle));
 
-
+    ATH_CHECK(m_is2016_periodA.initialize(m_systematicsList, m_eventHandle));
+    ATH_CHECK(m_is2016_periodB_D3.initialize(m_systematicsList, m_eventHandle));
+    ATH_CHECK(m_is2022_75bunches.initialize(m_systematicsList, m_eventHandle));
     
     // Intialise booleans with value false. Also initialise syst-aware output decorators
     for (auto& [key, value] : m_boolnames) {
@@ -175,12 +176,10 @@ namespace HHBBTT
     m_pt_threshold[HHBBTT::STT][HHBBTT::subleadingtau] = 25. * Athena::Units::GeV;
 
     // Di-tau triggers
-    //DTT cuts setted in setRunNumberQuantities
     m_pt_threshold[HHBBTT::DTT_2016][HHBBTT::leadingjet] = 80. * Athena::Units::GeV;
     m_pt_threshold[HHBBTT::DTT_4J12][HHBBTT::leadingjet] = 45. * Athena::Units::GeV;
     m_pt_threshold[HHBBTT::DTT_4J12][HHBBTT::subleadingjet] = 45. * Athena::Units::GeV;
 
-
     ATH_CHECK (initialiseCutflow());
     return StatusCode::SUCCESS;
   }
@@ -220,11 +219,7 @@ namespace HHBBTT
       const xAOD::EventInfo *event = nullptr;
       ANA_CHECK (m_eventHandle.retrieve (event, sys));
 
-      // Set run number dependent quantities for nominal systematics
-      if(sys.name()==""){
-        unsigned int rdmNumber = m_isMC ? m_rdmRunNumber.get(*event, sys) : m_runNumber.get(*event,sys);
-        setRunNumberQuantities(rdmNumber);
-      }
+      setThresholds(event, sys);
 
       const xAOD::JetContainer *jets = nullptr;
       ANA_CHECK (m_jetHandle.retrieve (jets, sys));
@@ -550,8 +545,9 @@ namespace HHBBTT
           }
         }
         // DTT
-        if(!m_bools.at(HHBBTT::pass_STT) && tau_ptcut_DTT){ 
-          if(2015<=m_year && m_year<=2016){
+        if(!m_bools.at(HHBBTT::pass_STT) && tau_ptcut_DTT){
+          int year = m_year.get(*event, sys);
+          if(2015<=year && year<=2016){
             if(jet_ptcut_DTT_2016){
               m_bools.at(HHBBTT::pass_baseline_DTT_2016) = true;
               if (m_bools.at(HHBBTT::pass_trigger_DTT_2016)) {
@@ -977,49 +973,38 @@ namespace HHBBTT
   }
 
 
-  void HHbbttSelectorAlg::setRunNumberQuantities(unsigned int runNumber){
-    // References:
-    // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php
-    // https://twiki.cern.ch/twiki/bin/view/Atlas/LowestUnprescaled
+  void HHbbttSelectorAlg::setThresholds(const xAOD::EventInfo* event,
+					const CP::SystematicSet& sys){
 
-    m_year = 0;
-    if(m_years.size()==1) m_year = m_years[0];
-    else{
-      if(266904 <= runNumber && runNumber <= 284484) m_year = 2015;
-      else if(296939 <= runNumber && runNumber <= 311481) m_year = 2016;
-    }
+    int year = m_year.get(*event, sys);
 
     // Single-lepton triggers
-    if(m_year==2015)
+    if(year==2015)
       m_pt_threshold[HHBBTT::SLT][HHBBTT::ele] = 25. * Athena::Units::GeV;
-    // 2022 75 bunches
-    else if(427882 <= runNumber && runNumber < 428071)
+    else if(m_is2022_75bunches.get(*event, sys))
       m_pt_threshold[HHBBTT::SLT][HHBBTT::ele] = 18. * Athena::Units::GeV;
     else
       m_pt_threshold[HHBBTT::SLT][HHBBTT::ele] = 27. * Athena::Units::GeV;
 
-    if(m_year==2015)
+    if(year==2015)
       m_pt_threshold[HHBBTT::SLT][HHBBTT::mu] = 21. * Athena::Units::GeV;
-    else if(2016<=m_year && m_year<=2018)
+    else if(2016<=year && year<=2018)
       m_pt_threshold[HHBBTT::SLT][HHBBTT::mu] = 27. * Athena::Units::GeV;
     else
       m_pt_threshold[HHBBTT::SLT][HHBBTT::mu] = 25. * Athena::Units::GeV;
 
     // Single tau triggers
     float min_tau_STT = 180. * Athena::Units::GeV;
-    // 2015 + 2016 period A
-    if(m_year==2015 || (296939 <= runNumber && runNumber <= 300287))
+    if(year==2015 || m_is2016_periodA.get(*event, sys))
       min_tau_STT = 100. * Athena::Units::GeV;
-    // 2016 period B-D3
-    else if(300345 <= runNumber && runNumber <= 302872)
+    else if(m_is2016_periodB_D3.get(*event, sys))
       min_tau_STT = 140. * Athena::Units::GeV;
-
     m_pt_threshold[HHBBTT::STT][HHBBTT::leadingtau] = min_tau_STT;
 
     m_pt_threshold[HHBBTT::DTT][HHBBTT::leadingtau] = 40. * Athena::Units::GeV;
     m_pt_threshold[HHBBTT::DTT][HHBBTT::subleadingtau] = 30. * Athena::Units::GeV;
     m_pt_threshold[HHBBTT::DTT_L1Topo][HHBBTT::leadingjet] = 80. * Athena::Units::GeV;
-    if(m_year >= 2022){
+    if(year >= 2022){
       m_pt_threshold[HHBBTT::DTT][HHBBTT::leadingtau] = 20. * Athena::Units::GeV;
       m_pt_threshold[HHBBTT::DTT][HHBBTT::subleadingtau] = 20. * Athena::Units::GeV;
       m_pt_threshold[HHBBTT::DTT_L1Topo][HHBBTT::leadingjet] = 20. * Athena::Units::GeV;
diff --git a/bbttAnalysis/src/HHbbttSelectorAlg.h b/bbttAnalysis/src/HHbbttSelectorAlg.h
index 282808d53..497c61c2a 100644
--- a/bbttAnalysis/src/HHbbttSelectorAlg.h
+++ b/bbttAnalysis/src/HHbbttSelectorAlg.h
@@ -124,11 +124,6 @@ private:
       { this, "useTriggerSelections", true, "Apply trigger-related selections" };
     Gaudi::Property<bool> m_doAntiIDRegions
       { this, "doAntiIDRegions", false, "Select anti-ID taus for fake estimates" };
-
-
-    Gaudi::Property<std::vector<int>> m_years
-      { this, "Years", false, "which years are running" };
-    int m_year;
     
     Gaudi::Property<bool> m_bypass
       { this, "bypass", false, "Run selector algorithm in pass-through mode" };
@@ -165,11 +160,15 @@ private:
     CP::SysReadDecorHandle<char> 
     m_isBtag {this, "bTagWPDecorName", "", "Name of input dectorator for b-tagging"};
 
-    CP::SysReadDecorHandle<unsigned int>
-    m_runNumber {this, "runNumber", "runNumber", "Runnumber"};
+    CP::SysReadDecorHandle<unsigned int> m_year
+      {this, "year", "dataTakingYear", ""};
 
-    CP::SysReadDecorHandle<unsigned int>
-    m_rdmRunNumber {this, "randomRunNumber", "RandomRunNumber", "Random run number for MC"};
+    CP::SysReadDecorHandle<bool> m_is2016_periodA
+      {this, "is2016_periodA", "is2016_periodA", ""};
+    CP::SysReadDecorHandle<bool> m_is2016_periodB_D3
+      {this, "is2016_periodB_D3", "is2016_periodB_D3", ""};
+    CP::SysReadDecorHandle<bool> m_is2022_75bunches
+      {this, "is2022_75bunches", "is2022_75bunches", ""};
 
     Gaudi::Property<std::string> m_eleWPName
       { this, "eleWP", "","Electron ID + Iso working point" };
@@ -317,7 +316,8 @@ private:
        const tauTrigMatchReadDecoMap& tau_trigMatchDecos,
        const xAOD::Jet* jet0, const xAOD::Jet* jet1);
 
-    void setRunNumberQuantities(unsigned int runNumber);
+    void setThresholds(const xAOD::EventInfo* event,
+		       const CP::SystematicSet& sys);
 
   };
 }
diff --git a/bbttAnalysis/src/TriggerDecoratorAlg.cxx b/bbttAnalysis/src/TriggerDecoratorAlg.cxx
index 79bf85801..8bfa66f76 100644
--- a/bbttAnalysis/src/TriggerDecoratorAlg.cxx
+++ b/bbttAnalysis/src/TriggerDecoratorAlg.cxx
@@ -14,8 +14,16 @@ namespace HHBBTT
   StatusCode TriggerDecoratorAlg ::initialize()
   {
     ATH_CHECK (m_eventInfoKey.initialize());
-    ATH_CHECK(m_runNumberKey.initialize());
-    ATH_CHECK(m_rdmRunNumberKey.initialize());
+
+    m_yearKey = "EventInfo.dataTakingYear";
+    ATH_CHECK(m_yearKey.initialize());
+
+    for(const auto& [runBool, name] : m_runBooleans) {
+      SG::ReadDecorHandleKey<xAOD::EventInfo> deco;
+      deco = "EventInfo." + name;
+      m_runBooleans_key.emplace(runBool, deco);
+      ATH_CHECK(m_runBooleans_key.at(runBool).initialize());
+    }
 
     ATH_CHECK (m_muonsKey.initialize());
     ATH_CHECK (m_elesKey.initialize());
@@ -93,11 +101,6 @@ namespace HHBBTT
     SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey,ctx);
     ATH_CHECK (eventInfo.isValid());
 
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_runNumberHandle
-      (m_runNumberKey);
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_rdmRunNumberHandle
-      (m_rdmRunNumberKey);
-
     SG::ReadHandle<xAOD::MuonContainer> muons(m_muonsKey,ctx);
     ATH_CHECK (muons.isValid());
 
@@ -107,6 +110,11 @@ namespace HHBBTT
     SG::ReadHandle<xAOD::TauJetContainer> taus(m_tausKey,ctx);
     ATH_CHECK (taus.isValid());
 
+    runBoolReadDecoMap runBoolDecos;
+    for (const auto& [runBool, key] : m_runBooleans_key){
+      runBoolDecos.emplace(runBool, key);
+    }
+
     trigReadDecoMap triggerdecos;
     for (const auto& [name, key] : m_triggerdecoKeys){
       triggerdecos.emplace(name, key);
@@ -142,95 +150,40 @@ namespace HHBBTT
       }
     }
 
-    unsigned int runNumber = m_isMC ? m_rdmRunNumberHandle(*eventInfo) :
-      m_runNumberHandle(*eventInfo);
-
-    int year = 0;
-    std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap;
-    for(unsigned int i=0; i<=HHBBTT::Count; i++){
-      runBoolMap[static_cast<HHBBTT::RunBooleans>(i)] = false;
-    }
-
-    setRunNumberQuantities(runNumber, year, runBoolMap);
+    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> year(m_yearKey);
 
-    checkSingleMuTriggers(year, runBoolMap,
-			  eventInfo.cptr(), triggerdecos, pass_decos,
+    checkSingleMuTriggers(year(*eventInfo), eventInfo.cptr(),
+			  runBoolDecos, triggerdecos, pass_decos,
 			  muons.cptr(), mu_trigMatchDecos);
 
-    checkSingleEleTriggers(year, runBoolMap,
-			   eventInfo.cptr(), triggerdecos, pass_decos,
+    checkSingleEleTriggers(year(*eventInfo), eventInfo.cptr(),
+			   runBoolDecos, triggerdecos, pass_decos,
 			   electrons.cptr(), ele_trigMatchDecos);
 
-    checkMuTauTriggers(year, runBoolMap,
-		       eventInfo.cptr(), triggerdecos, pass_decos,
+    checkMuTauTriggers(year(*eventInfo), eventInfo.cptr(),
+		       runBoolDecos, triggerdecos, pass_decos,
 		       muons.cptr(), mu_trigMatchDecos,
 		       taus.cptr(), tau_trigMatchDecos);
 
-    checkEleTauTriggers(year, runBoolMap,
-			eventInfo.cptr(), triggerdecos, pass_decos,
+    checkEleTauTriggers(year(*eventInfo), eventInfo.cptr(),
+			runBoolDecos, triggerdecos, pass_decos,
 			electrons.cptr(), ele_trigMatchDecos,
 			taus.cptr(), tau_trigMatchDecos);
 
-    checkSingleTauTriggers(year, runBoolMap,
-			   eventInfo.cptr(), triggerdecos, pass_decos,
+    checkSingleTauTriggers(year(*eventInfo), eventInfo.cptr(),
+			   runBoolDecos, triggerdecos, pass_decos,
 			   taus.cptr(), tau_trigMatchDecos);
 
-    checkDiTauTriggers(year, runBoolMap,
-		       eventInfo.cptr(), triggerdecos, pass_decos,
+    checkDiTauTriggers(year(*eventInfo), eventInfo.cptr(),
+		       runBoolDecos, triggerdecos, pass_decos,
 		       taus.cptr(), tau_trigMatchDecos);
     
     return StatusCode::SUCCESS;
   }
 
-
-  void TriggerDecoratorAlg::setRunNumberQuantities
-  (unsigned int runNumber, int& year,
-   std::unordered_map<HHBBTT::RunBooleans, bool>& runBoolMap) const{
-    // References:
-    // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php
-    // https://twiki.cern.ch/twiki/bin/view/Atlas/LowestUnprescaled
-
-    year = 0;
-    if(m_years.size()==1) year = m_years[0];
-    else{
-      if(266904 <= runNumber && runNumber <= 284484) year = 2015;
-      else if(296939 <= runNumber && runNumber <= 311481) year = 2016;
-    }
-    
-    runBoolMap.at(HHBBTT::is16PeriodA) =
-      296939 <= runNumber && runNumber <= 300287;
-    runBoolMap.at(HHBBTT::is16PeriodB_D3) =
-      300345 <= runNumber && runNumber <= 302872;
-    runBoolMap.at(HHBBTT::is16PeriodD4_end) =
-      302919 <= runNumber && runNumber <= 311481;
-    runBoolMap.at(HHBBTT::is17PeriodB1_B4) =
-      325713 <= runNumber && runNumber <= 326695;
-    runBoolMap.at(HHBBTT::is17PeriodB5_B7) =
-      326834 <= runNumber && runNumber <= 327490;
-    runBoolMap.at(HHBBTT::is17PeriodB8_end) =
-      327582 <= runNumber && runNumber <= 341649;
-    runBoolMap.at(HHBBTT::is18PeriodB_end) =
-      348885 <= runNumber && runNumber <= 364485;
-    runBoolMap.at(HHBBTT::is18PeriodK_end) =
-      355529 <= runNumber && runNumber <= 364485;
-    runBoolMap.at(HHBBTT::is22_75bunches) =
-      427882 <= runNumber && runNumber < 428071;
-    runBoolMap.at(HHBBTT::is23_75bunches) =
-      450360 <= runNumber && runNumber < 450894;
-    runBoolMap.at(HHBBTT::is23_400bunches) =
-      450894 <= runNumber && runNumber < 451094;
-    runBoolMap.at(HHBBTT::is23_first_2400bunches) =
-      451896 <= runNumber;
-
-    runBoolMap.at(HHBBTT::l1topo_disabled) =
-      (runNumber == 336506) || (runNumber == 336548) || (runNumber == 336567);
-
-    return;
-  }
-
   void TriggerDecoratorAlg::checkSingleMuTriggers
-  (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-   const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+  (int year, const xAOD::EventInfo* eventInfo,
+   const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
    passWriteDecoMap& pass_decos,
    const xAOD::MuonContainer* muons,
    muTrigMatchWriteDecoMap& mu_trigMatchDecos) const{
@@ -244,9 +197,9 @@ namespace HHBBTT
       single_mu_paths = {"HLT_mu26_ivarmedium", "HLT_mu50"};
     }
     else if(2022<=year && year<=2023 &&
-	    !runBoolMap.at(HHBBTT::is22_75bunches) &&
-	    !runBoolMap.at(HHBBTT::is23_75bunches) &&
-	    !runBoolMap.at(HHBBTT::is23_400bunches)){
+	    !runBoolDecos.at(HHBBTT::is22_75bunches)(*eventInfo) &&
+	    !runBoolDecos.at(HHBBTT::is23_75bunches)(*eventInfo) &&
+	    !runBoolDecos.at(HHBBTT::is23_400bunches)(*eventInfo)){
       single_mu_paths = {
 	"HLT_mu24_ivarmedium_L1MU14FCH", "HLT_mu50_L1MU14FCH",
 	"HLT_mu60_0eta105_msonly_L1MU14FCH", "HLT_mu60_L1MU14FCH",
@@ -272,8 +225,8 @@ namespace HHBBTT
   }
 
   void TriggerDecoratorAlg::checkSingleEleTriggers
-  (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-   const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+  (int year, const xAOD::EventInfo* eventInfo,
+   const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
    passWriteDecoMap& pass_decos,
    const xAOD::ElectronContainer* electrons,
    eleTrigMatchWriteDecoMap& ele_trigMatchDecos) const{
@@ -292,7 +245,7 @@ namespace HHBBTT
 	"HLT_e140_lhloose_nod0"
       };
     }
-    else if(runBoolMap.at(HHBBTT::is22_75bunches)){
+    else if(runBoolDecos.at(HHBBTT::is22_75bunches)(*eventInfo)){
       single_ele_paths = {
 	"HLT_e17_lhvloose_L1EM15VHI", "HLT_e20_lhvloose_L1EM15VH",
 	"HLT_e250_etcut_L1EM22VHI"
@@ -304,7 +257,7 @@ namespace HHBBTT
 	"HLT_e140_lhloose_L1EM22VHI", "HLT_e300_etcut_L1EM22VHI"
       };
     }
-    else if(runBoolMap.at(HHBBTT::is23_75bunches)){
+    else if(runBoolDecos.at(HHBBTT::is23_75bunches)(*eventInfo)){
       single_ele_paths = {
 	"HLT_e26_lhtight_ivarloose_L1EM22VHI", "HLT_e60_lhmedium_L1EM22VHI",
 	"HLT_e140_lhloose_L1EM22VHI", "HLT_e140_lhloose_noringer_L1EM22VHI",
@@ -337,8 +290,8 @@ namespace HHBBTT
   }
 
   void TriggerDecoratorAlg::checkMuTauTriggers
-  (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-   const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+  (int year, const xAOD::EventInfo* eventInfo,
+   const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
    passWriteDecoMap& pass_decos,
    const xAOD::MuonContainer* muons,
    muTrigMatchWriteDecoMap& mu_trigMatchDecos,
@@ -349,23 +302,23 @@ namespace HHBBTT
     std::vector<std::string> mu_tau_paths_low;
     std::vector<std::string> mu_tau_paths_high;
 
-    if(year==2015 || runBoolMap.at(HHBBTT::is16PeriodA)){
+    if(year==2015 || runBoolDecos.at(HHBBTT::is16PeriodA)(*eventInfo)){
       mu_tau_paths_2016 = {"HLT_mu14_tau25_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is16PeriodB_D3) ||
-	    runBoolMap.at(HHBBTT::is16PeriodD4_end)){
+    else if(runBoolDecos.at(HHBBTT::is16PeriodB_D3)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is16PeriodD4_end)(*eventInfo)){
       mu_tau_paths_2016 = {"HLT_mu14_ivarloose_tau25_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is17PeriodB1_B4) ||
-	    runBoolMap.at(HHBBTT::is17PeriodB5_B7) ||
-	    runBoolMap.at(HHBBTT::is17PeriodB8_end)){
+    else if(runBoolDecos.at(HHBBTT::is17PeriodB1_B4)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is17PeriodB5_B7)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is17PeriodB8_end)(*eventInfo)){
       mu_tau_paths_low = {"HLT_mu14_ivarloose_tau25_medium1_tracktwo_L1MU10_TAU12IM_3J12"};
       mu_tau_paths_high = {"HLT_mu14_ivarloose_tau35_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is18PeriodB_end)){
+    else if(runBoolDecos.at(HHBBTT::is18PeriodB_end)(*eventInfo)){
       mu_tau_paths_low = {"HLT_mu14_ivarloose_tau25_medium1_tracktwoEF_L1MU10_TAU12IM_3J12"};
       mu_tau_paths_high = {"HLT_mu14_ivarloose_tau35_medium1_tracktwoEF"};
-      if(runBoolMap.at(HHBBTT::is18PeriodK_end)){
+      if(runBoolDecos.at(HHBBTT::is18PeriodK_end)(*eventInfo)){
         mu_tau_paths_low.push_back("HLT_mu14_ivarloose_tau25_mediumRNN_tracktwoMVA_L1MU10_TAU12IM_3J12");
         mu_tau_paths_high.push_back("HLT_mu14_ivarloose_tau35_mediumRNN_tracktwoMVA");
       }
@@ -410,8 +363,8 @@ namespace HHBBTT
   }
 
   void TriggerDecoratorAlg::checkEleTauTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::ElectronContainer* electrons,
        eleTrigMatchWriteDecoMap& ele_trigMatchDecos,
@@ -421,23 +374,23 @@ namespace HHBBTT
     std::vector<std::string> ele_tau_paths;
     std::vector<std::string> ele_tau_paths_4J12;
  
-    if(year==2015 || runBoolMap.at(HHBBTT::is16PeriodA)){
+    if(year==2015 || runBoolDecos.at(HHBBTT::is16PeriodA)(*eventInfo)){
       ele_tau_paths = {"HLT_e17_lhmedium_nod0_tau25_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is16PeriodB_D3) ||
-	    runBoolMap.at(HHBBTT::is16PeriodD4_end)){
+    else if(runBoolDecos.at(HHBBTT::is16PeriodB_D3)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is16PeriodD4_end)(*eventInfo)){
       ele_tau_paths = {"HLT_e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is17PeriodB1_B4) ||
-	    runBoolMap.at(HHBBTT::is17PeriodB5_B7) ||
-	    runBoolMap.at(HHBBTT::is17PeriodB8_end)){
+    else if(runBoolDecos.at(HHBBTT::is17PeriodB1_B4)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is17PeriodB5_B7)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is17PeriodB8_end)(*eventInfo)){
       ele_tau_paths = {"HLT_e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwo"};
       ele_tau_paths_4J12 = {"HLT_e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwo_L1EM15VHI_2TAU12IM_4J12"};
     }
-    else if(runBoolMap.at(HHBBTT::is18PeriodB_end)){
+    else if(runBoolDecos.at(HHBBTT::is18PeriodB_end)(*eventInfo)){
       ele_tau_paths = {"HLT_e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwoEF"};
       ele_tau_paths_4J12 = {"HLT_e17_lhmedium_nod0_ivarloose_tau25_medium1_tracktwoEF_L1EM15VHI_2TAU12IM_4J12"};
-      if(runBoolMap.at(HHBBTT::is18PeriodK_end)){
+      if(runBoolDecos.at(HHBBTT::is18PeriodK_end)(*eventInfo)){
         ele_tau_paths.push_back("HLT_e17_lhmedium_nod0_ivarloose_tau25_mediumRNN_tracktwoMVA");
         ele_tau_paths_4J12.push_back("HLT_e17_lhmedium_nod0_ivarloose_tau25_mediumRNN_tracktwoMVA_L1EM15VHI_2TAU12IM_4J12");
       }
@@ -485,31 +438,31 @@ namespace HHBBTT
 
 
   void TriggerDecoratorAlg::checkSingleTauTriggers
-  (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-   const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+  (int year, const xAOD::EventInfo* eventInfo,
+   const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
    passWriteDecoMap& pass_decos,
    const xAOD::TauJetContainer* taus,
    tauTrigMatchWriteDecoMap& tau_trigMatchDecos) const {
 
     std::vector<std::string> single_tau_paths;
 
-    if(year==2015 || runBoolMap.at(HHBBTT::is16PeriodA)){
+    if(year==2015 || runBoolDecos.at(HHBBTT::is16PeriodA)(*eventInfo)){
       single_tau_paths = {"HLT_tau80_medium1_tracktwo_L1TAU60"};
     }
-    else if(runBoolMap.at(HHBBTT::is16PeriodB_D3)){
+    else if(runBoolDecos.at(HHBBTT::is16PeriodB_D3)(*eventInfo)){
       single_tau_paths = {"HLT_tau125_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is16PeriodD4_end) ||
-	    runBoolMap.at(HHBBTT::is17PeriodB1_B4)){
+    else if(runBoolDecos.at(HHBBTT::is16PeriodD4_end)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is17PeriodB1_B4)(*eventInfo)){
       single_tau_paths = {"HLT_tau160_medium1_tracktwo"};
     }
-    else if(runBoolMap.at(HHBBTT::is17PeriodB5_B7) ||
-	    runBoolMap.at(HHBBTT::is17PeriodB8_end)){
+    else if(runBoolDecos.at(HHBBTT::is17PeriodB5_B7)(*eventInfo) ||
+	    runBoolDecos.at(HHBBTT::is17PeriodB8_end)(*eventInfo)){
       single_tau_paths = {"HLT_tau160_medium1_tracktwo_L1TAU100"};
     }
     else if(year==2018){
       single_tau_paths = {"HLT_tau160_medium1_tracktwoEF_L1TAU100"};
-      if(runBoolMap.at(HHBBTT::is18PeriodK_end)){
+      if(runBoolDecos.at(HHBBTT::is18PeriodK_end)(*eventInfo)){
         single_tau_paths.push_back("HLT_tau160_mediumRNN_tracktwoMVA_L1TAU100");
       }
     }
@@ -518,7 +471,7 @@ namespace HHBBTT
     }
     else if(year==2023){
       single_tau_paths = {"HLT_tau160_mediumRNN_tracktwoMVA_L1eTAU100"};
-      if(runBoolMap.at(HHBBTT::is23_first_2400bunches)){
+      if(runBoolDecos.at(HHBBTT::is23_first_2400bunches)(*eventInfo)){
         single_tau_paths = {"HLT_tau160_mediumRNN_tracktwoMVA_L1eTAU140"};
       }
     }
@@ -543,8 +496,8 @@ namespace HHBBTT
 
 
   void TriggerDecoratorAlg::checkDiTauTriggers
-  (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-   const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+  (int year, const xAOD::EventInfo* eventInfo,
+   const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
    passWriteDecoMap& pass_decos,
    const xAOD::TauJetContainer* taus,
    tauTrigMatchWriteDecoMap& tau_trigMatchDecos) const {
@@ -557,12 +510,12 @@ namespace HHBBTT
       ditau_paths_2016 = {"HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo_L1TAU20IM_2TAU12IM"};
     }
     else if(2016<=year && year<=2017){
-      if(runBoolMap.at(HHBBTT::is16PeriodA) ||
-	 runBoolMap.at(HHBBTT::is16PeriodB_D3) ||
-	 runBoolMap.at(HHBBTT::is16PeriodD4_end)){
+      if(runBoolDecos.at(HHBBTT::is16PeriodA)(*eventInfo) ||
+	 runBoolDecos.at(HHBBTT::is16PeriodB_D3)(*eventInfo) ||
+	 runBoolDecos.at(HHBBTT::is16PeriodD4_end)(*eventInfo)){
 	ditau_paths_2016 = {"HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo"};
       }
-      else if(runBoolMap.at(HHBBTT::l1topo_disabled)){
+      else if(runBoolDecos.at(HHBBTT::l1topo_disabled)(*eventInfo)){
 	ditau_paths_2016 = {"HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo"};
       }
 
@@ -570,13 +523,13 @@ namespace HHBBTT
         ditau_paths_4J12 = {"HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo_L1TAU20IM_2TAU12IM_4J12"};
       }
 
-      if(runBoolMap.at(HHBBTT::is17PeriodB1_B4)){
+      if(runBoolDecos.at(HHBBTT::is17PeriodB1_B4)(*eventInfo)){
 	// For Period B1 to B4 in 2017, should use this trigger but go to L1Topo selection
         ditau_paths_L1Topo = {"HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo"};
       }
-      else if(!runBoolMap.at(HHBBTT::l1topo_disabled) &&
-	      (runBoolMap.at(HHBBTT::is17PeriodB5_B7) ||
-	       runBoolMap.at(HHBBTT::is17PeriodB8_end))){
+      else if(!runBoolDecos.at(HHBBTT::l1topo_disabled)(*eventInfo) &&
+	      (runBoolDecos.at(HHBBTT::is17PeriodB5_B7)(*eventInfo) ||
+	       runBoolDecos.at(HHBBTT::is17PeriodB8_end)(*eventInfo))){
         ditau_paths_L1Topo = {"HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo_L1DR_TAU20ITAU12I_J25"};
       }
     }
@@ -584,7 +537,7 @@ namespace HHBBTT
     else if(year==2018){
       ditau_paths_L1Topo = {"HLT_tau35_medium1_tracktwoEF_tau25_medium1_tracktwoEF_L1DR_TAU20ITAU12I_J25"};
       ditau_paths_4J12 = {"HLT_tau35_medium1_tracktwoEF_tau25_medium1_tracktwoEF_L1TAU20IM_2TAU12IM_4J12p0ETA23"};
-      if(runBoolMap.at(HHBBTT::is18PeriodK_end)){
+      if(runBoolDecos.at(HHBBTT::is18PeriodK_end)(*eventInfo)){
         ditau_paths_L1Topo.push_back("HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_L1DR_TAU20ITAU12I_J25");
         ditau_paths_4J12.push_back("HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_L1TAU20IM_2TAU12IM_4J12p0ETA23");
       }
@@ -593,7 +546,7 @@ namespace HHBBTT
     else if(year>=2022){
       ditau_paths_L1Topo = {"HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB30_L1DR_TAU20ITAU12I_J25"};
       ditau_paths_4J12 = {"HLT_tau35_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25"};
-      if (runBoolMap.at(HHBBTT::is23_first_2400bunches)){
+      if (runBoolDecos.at(HHBBTT::is23_first_2400bunches)(*eventInfo)){
         ditau_paths_L1Topo = {"HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB30_L1DR_TAU20ITAU12I_J25"};
         ditau_paths_4J12 = {"HLT_tau30_mediumRNN_tracktwoMVA_tau20_mediumRNN_tracktwoMVA_03dRAB_L1TAU20IM_2TAU12IM_4J12p0ETA25"};
       }
diff --git a/bbttAnalysis/src/TriggerDecoratorAlg.h b/bbttAnalysis/src/TriggerDecoratorAlg.h
index ad819cfce..4c15f62f6 100644
--- a/bbttAnalysis/src/TriggerDecoratorAlg.h
+++ b/bbttAnalysis/src/TriggerDecoratorAlg.h
@@ -30,7 +30,7 @@
 
 namespace HHBBTT
 {
-  
+
   enum RunBooleans
   {
     is16PeriodA,
@@ -45,9 +45,9 @@ namespace HHBBTT
     is23_75bunches,
     is23_400bunches,
     is23_first_2400bunches,
-    l1topo_disabled,
-    Count
+    l1topo_disabled
   };
+
   
   class TriggerDecoratorAlg final : public AthReentrantAlgorithm
   {
@@ -60,7 +60,7 @@ namespace HHBBTT
 
   private:
 
-    std::unordered_map<HHBBTT::TriggerChannel, std::string> m_triggerChannels =
+    const std::unordered_map<HHBBTT::TriggerChannel, std::string> m_triggerChannels =
       {
 	{HHBBTT::SLT, "SLT"},
 	{HHBBTT::LTT, "LTT"},
@@ -79,15 +79,28 @@ namespace HHBBTT
     SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey
       { this, "event", "EventInfo", "EventInfo to read" };
 
-    SG::ReadDecorHandleKey<xAOD::EventInfo> m_runNumberKey{
-      this, "runNumberDecorKey", "EventInfo.runNumber", "Run number"};
-    SG::ReadDecorHandleKey<xAOD::EventInfo> m_rdmRunNumberKey{
-      this, "RandomRunNumberDecorKey", "EventInfo.RandomRunNumber", "Random run number"};
+    SG::ReadDecorHandleKey<xAOD::EventInfo> m_yearKey;
+
+    const std::unordered_map<HHBBTT::RunBooleans, std::string> m_runBooleans =
+      {
+	{HHBBTT::is16PeriodA, "is2016_periodA"},
+	{HHBBTT::is16PeriodB_D3, "is2016_periodB_D3"},
+	{HHBBTT::is16PeriodD4_end, "is2016_periodD4_end"},
+	{HHBBTT::is17PeriodB1_B4, "is2017_periodB1_B4"},
+	{HHBBTT::is17PeriodB5_B7, "is2017_periodB5_B7"},
+	{HHBBTT::is17PeriodB8_end, "is2017_periodB8_end"},
+	{HHBBTT::is18PeriodB_end, "is2017_periodB_end"},
+	{HHBBTT::is18PeriodK_end, "is2017_periodK_end"},
+	{HHBBTT::is22_75bunches, "is2022_75bunches"},
+	{HHBBTT::is23_75bunches, "is2023_75bunches"},
+	{HHBBTT::is23_400bunches, "is2023_400bunches"},
+	{HHBBTT::is23_first_2400bunches, "is2023_first_2400bunches"},
+	{HHBBTT::l1topo_disabled, "l1TopoDisabled"},
+      };
+    std::map<HHBBTT::RunBooleans, SG::ReadDecorHandleKey<xAOD::EventInfo>> m_runBooleans_key;
 
     Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
-    Gaudi::Property<std::vector<int>> m_years
-      { this, "Years", false, "which years are running" };
 
     SG::ReadHandleKey<xAOD::MuonContainer> m_muonsKey
       { this, "muons", "", "Muon container" };
@@ -118,11 +131,8 @@ namespace HHBBTT
 
     Gaudi::Property<bool> m_useDiTauTrigMatch
       { this, "diTauTrigMatch", true, "Run di-tau trigger matching" };
-    
-    void setRunNumberQuantities
-      (unsigned int runNumber, int& year,
-       std::unordered_map<HHBBTT::RunBooleans, bool>& runBoolMap) const;
 
+    typedef std::unordered_map<HHBBTT::RunBooleans, SG::ReadDecorHandle<xAOD::EventInfo, bool> > runBoolReadDecoMap;
     typedef std::unordered_map<std::string, SG::ReadDecorHandle<xAOD::EventInfo, bool> > trigReadDecoMap;
     typedef std::unordered_map<HHBBTT::TriggerChannel, SG::WriteDecorHandle<xAOD::EventInfo, bool> > passWriteDecoMap;
     typedef std::unordered_map<HHBBTT::TriggerChannel, SG::WriteDecorHandle<xAOD::MuonContainer, bool> > muTrigMatchWriteDecoMap;
@@ -130,22 +140,22 @@ namespace HHBBTT
     typedef std::unordered_map<HHBBTT::TriggerChannel, SG::WriteDecorHandle<xAOD::TauJetContainer, bool> > tauTrigMatchWriteDecoMap;
     
     void checkSingleMuTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::MuonContainer* muons,
        muTrigMatchWriteDecoMap& mu_trigMatchDecos) const;
 
     void checkSingleEleTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::ElectronContainer* electrons,
        eleTrigMatchWriteDecoMap& ele_trigMatchDecos) const;
 
     void checkMuTauTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::MuonContainer* muons,
        muTrigMatchWriteDecoMap& mu_trigMatchDecos,
@@ -153,8 +163,8 @@ namespace HHBBTT
        tauTrigMatchWriteDecoMap& tau_trigMatchDecos) const;
 
     void checkEleTauTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::ElectronContainer* electrons,
        eleTrigMatchWriteDecoMap& ele_trigMatchDecos,
@@ -162,15 +172,15 @@ namespace HHBBTT
        tauTrigMatchWriteDecoMap& tau_trigMatchDecos) const;
 
     void checkSingleTauTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::TauJetContainer* taus,
        tauTrigMatchWriteDecoMap& tau_trigMatchDecos) const;
 
     void checkDiTauTriggers
-      (int year, std::unordered_map<HHBBTT::RunBooleans, bool> runBoolMap,
-       const xAOD::EventInfo* eventInfo, const trigReadDecoMap& triggerdecos,
+      (int year, const xAOD::EventInfo* eventInfo,
+       const runBoolReadDecoMap& runBoolDecos, const trigReadDecoMap& triggerdecos,
        passWriteDecoMap& pass_decos,
        const xAOD::TauJetContainer* taus,
        tauTrigMatchWriteDecoMap& tau_trigMatchDecos) const;
-- 
GitLab


From cbbc8ebfd481a282d4983bb7e64101d2bcffbf43 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Thu, 18 Apr 2024 00:24:53 +0200
Subject: [PATCH 09/13] Updated lltt alg

---
 bbttAnalysis/src/TriggerDecoratorAlg.h |  4 +-
 llttAnalysis/python/lltt_config.py     |  1 -
 llttAnalysis/src/HllttSelectorAlg.cxx  | 59 ++++++++++++--------------
 llttAnalysis/src/HllttSelectorAlg.h    | 16 ++-----
 4 files changed, 31 insertions(+), 49 deletions(-)

diff --git a/bbttAnalysis/src/TriggerDecoratorAlg.h b/bbttAnalysis/src/TriggerDecoratorAlg.h
index 4c15f62f6..3dfa21a90 100644
--- a/bbttAnalysis/src/TriggerDecoratorAlg.h
+++ b/bbttAnalysis/src/TriggerDecoratorAlg.h
@@ -89,8 +89,8 @@ namespace HHBBTT
 	{HHBBTT::is17PeriodB1_B4, "is2017_periodB1_B4"},
 	{HHBBTT::is17PeriodB5_B7, "is2017_periodB5_B7"},
 	{HHBBTT::is17PeriodB8_end, "is2017_periodB8_end"},
-	{HHBBTT::is18PeriodB_end, "is2017_periodB_end"},
-	{HHBBTT::is18PeriodK_end, "is2017_periodK_end"},
+	{HHBBTT::is18PeriodB_end, "is2018_periodB_end"},
+	{HHBBTT::is18PeriodK_end, "is2018_periodK_end"},
 	{HHBBTT::is22_75bunches, "is2022_75bunches"},
 	{HHBBTT::is23_75bunches, "is2023_75bunches"},
 	{HHBBTT::is23_400bunches, "is2023_400bunches"},
diff --git a/llttAnalysis/python/lltt_config.py b/llttAnalysis/python/lltt_config.py
index 7429d9205..89a5775b0 100644
--- a/llttAnalysis/python/lltt_config.py
+++ b/llttAnalysis/python/lltt_config.py
@@ -87,7 +87,6 @@ def lltt_cfg(
             triggerLists=trigger_branches,
             channel=flags.Analysis.channel,
             isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
             bypass=flags.Analysis.bypass,
         )
     )
diff --git a/llttAnalysis/src/HllttSelectorAlg.cxx b/llttAnalysis/src/HllttSelectorAlg.cxx
index 4827d7cff..69d99a09e 100644
--- a/llttAnalysis/src/HllttSelectorAlg.cxx
+++ b/llttAnalysis/src/HllttSelectorAlg.cxx
@@ -10,6 +10,7 @@
 #include <SystematicsHandles/SysFilterReporter.h>
 #include <SystematicsHandles/SysFilterReporterCombiner.h>
 #include <AthContainers/ConstDataVector.h>
+#include <AthenaKernel/Units.h>
 
 namespace HLLTT
 {
@@ -38,8 +39,6 @@ namespace HLLTT
       ATH_CHECK (m_isBtag.initialize(m_systematicsList, m_jetHandle));
     }
 
-    ATH_CHECK (m_runNumber.initialize(m_systematicsList, m_eventHandle));
-
     // Intialise syst-aware output decorators
     for (const std::string &var : m_Bvarnames){
       CP::SysWriteDecorHandle<bool> whandle{var+"_%SYS%", this};
@@ -81,14 +80,6 @@ namespace HLLTT
       }
     }
 
-    //finding which years are set in the config
-    is15 = std::find(m_years.begin(), m_years.end(), 2015) != m_years.end();
-    is16 = std::find(m_years.begin(), m_years.end(), 2016) != m_years.end();
-    is17 = std::find(m_years.begin(), m_years.end(), 2017) != m_years.end();
-    is18 = std::find(m_years.begin(), m_years.end(), 2018) != m_years.end();
-    is22 = std::find(m_years.begin(), m_years.end(), 2022) != m_years.end();
-    is23 = std::find(m_years.begin(), m_years.end(), 2023) != m_years.end();
-
     return StatusCode::SUCCESS;
   }
 
@@ -207,7 +198,7 @@ namespace HLLTT
       {
         bool passTauWP = m_tauWPDecorHandle.get(*tau, sys);
         m_selected_tau.set(*tau, false, sys);
-        if (passTauWP && tau->pt() > 20000)
+        if (passTauWP && tau->pt() > 20. * Athena::Units::GeV)
         {
           if (std::abs(tau->eta()) < 2.5) {
             m_selected_tau.set(*tau, true, sys);
@@ -313,9 +304,8 @@ namespace HLLTT
   }
 
 
-  void HllttSelectorAlg ::applySLTTriggerSelection(
-						     const xAOD::EventInfo *event,
-						     const CP::SystematicSet &sys)
+  void HllttSelectorAlg ::applySLTTriggerSelection(const xAOD::EventInfo *event,
+						   const CP::SystematicSet &sys)
   {
     bool trigPassed_SET = false;
     bool trigPassed_SMT = false;
@@ -324,29 +314,31 @@ namespace HLLTT
     std::vector<std::string> single_ele_paths;
     std::vector<std::string> single_mu_paths;
 
+    int year = m_year.get(*event, sys);
+
     // SLT
-    if(is15){
-      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 25000;
-      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 21000;
+    if(year==2015){
+      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 25. * Athena::Units::GeV;
+      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 21. * Athena::Units::GeV;
       single_ele_paths = {"trigPassed_HLT_e24_lhmedium_L1EM20VH", "trigPassed_HLT_e60_lhmedium", "trigPassed_HLT_e120_lhloose"};
       single_mu_paths = {"trigPassed_HLT_mu20_iloose_L1MU15", "trigPassed_HLT_mu50"};
     }
-    else if(is16 || is17 || is18){
-      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 27000;
-      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 27000;
+    else if(2016<=year && year<=2018){
+      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 27. * Athena::Units::GeV;
+      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 27. * Athena::Units::GeV;
       single_ele_paths = {"trigPassed_HLT_e26_lhtight_nod0_ivarloose", "trigPassed_HLT_e60_lhmedium_nod0", "trigPassed_HLT_e140_lhloose_nod0"};
       single_mu_paths = {"trigPassed_HLT_mu26_ivarmedium", "trigPassed_HLT_mu50"};
     }
-    else if (is22) {
-      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 27000;
-      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 27000;
+    else if(year==2022) {
+      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 27. * Athena::Units::GeV;
+      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 27. * Athena::Units::GeV;
       single_ele_paths = {"trigPassed_HLT_e26_lhtight_ivarloose_L1EM22VHI", "trigPassed_HLT_e60_lhmedium_L1EM22VHI", "trigPassed_HLT_e140_lhloose_L1EM22VHI"
       };
       single_mu_paths = {"trigPassed_HLT_mu24_ivarmedium_L1MU14FCH", "trigPassed_HLT_mu50_L1MU14FCH"};
     }
-    else if (is23) {
-      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 27000;
-      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 27000;
+    else if(year==2023) {
+      m_pt_threshold[HLLTT::SLT][HLLTT::ele] = 27. * Athena::Units::GeV;
+      m_pt_threshold[HLLTT::SLT][HLLTT::mu] = 27. * Athena::Units::GeV;
       single_ele_paths = {"trigPassed_HLT_e26_lhtight_ivarloose_L1eEM26M", "trigPassed_HLT_e60_lhmedium_L1eEM26M", "trigPassed_HLT_e140_lhloose_L1eEM26M"};
       single_mu_paths = {"trigPassed_HLT_mu24_ivarmedium_L1MU14FCH", "trigPassed_HLT_mu50_L1MU14FCH"};
     }
@@ -373,20 +365,21 @@ namespace HLLTT
     trigPassed_DLT = false;
 
     std::vector<std::string> dilep_paths;
-
+    int year = m_year.get(*event, sys);
+    
     // SLT
-    m_pt_threshold[HLLTT::DLT][HLLTT::leadinglep] = 20000;
-    m_pt_threshold[HLLTT::DLT][HLLTT::subleadinglep] = 7000;
-    if(is15){
+    m_pt_threshold[HLLTT::DLT][HLLTT::leadinglep] = 20. * Athena::Units::GeV;
+    m_pt_threshold[HLLTT::DLT][HLLTT::subleadinglep] = 7. * Athena::Units::GeV;
+    if(year==2015){
       dilep_paths = {"trigPassed_HLT_2e12_lhvloose_L12EM10VH","trigPassed_HLT_mu18_mu8noL1","trigPassed_HLT_e17_lhloose_mu14"};
     }
-    else if(is16 || is17 || is18){
+    else if(2016<=year && year<=2018){
       dilep_paths = {"trigPassed_HLT_2e17_lhvloose_nod0_L12EM15VHI","trigPassed_HLT_mu22_mu8noL1","trigPassed_HLT_e17_lhloose_nod0_mu14"};
     }
-    else if (is22) {
+    else if(year==2022){
       dilep_paths = {"trigPassed_HLT_2e17_lhvloose_L12EM15VHI","trigPassed_HLT_mu22_mu8noL1_L1MU14FCH","trigPassed_HLT_e17_lhloose_mu14_L1EM15VH_MU8F"};
     }
-    else if (is23) {
+    else if(year==2023){
       dilep_paths = {"trigPassed_HLT_2e17_lhvloose_L12eEM18M","trigPassed_HLT_mu22_mu8noL1_L1MU14FCH","trigPassed_HLT_e17_lhloose_mu14_L1EM15VH_MU8F"};
     }
 
diff --git a/llttAnalysis/src/HllttSelectorAlg.h b/llttAnalysis/src/HllttSelectorAlg.h
index 9c10198bc..e0dc25a02 100644
--- a/llttAnalysis/src/HllttSelectorAlg.h
+++ b/llttAnalysis/src/HllttSelectorAlg.h
@@ -69,9 +69,6 @@ private:
 
     Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
-
-    Gaudi::Property<std::vector<int>> m_years
-      { this, "Years", false, "which years are running" };
     
     Gaudi::Property<bool> m_bypass
       { this, "bypass", false, "Run selector algorithm in pass-through mode" };
@@ -97,6 +94,9 @@ private:
     CP::SysReadHandle<xAOD::EventInfo>
     m_eventHandle{ this, "event", "EventInfo",   "EventInfo container to read" };
 
+    CP::SysReadDecorHandle<unsigned int> m_year
+      {this, "year", "dataTakingYear", ""};
+
     Gaudi::Property<std::string> m_tauWPName
       { this, "tauWP", "", "Tau ID working point" };
     CP::SysReadDecorHandle<char> m_tauWPDecorHandle{"", this};
@@ -106,9 +106,6 @@ private:
     CP::SysReadDecorHandle<char> 
     m_isBtag {this, "bTagWPDecorName", "", "Name of input dectorator for b-tagging"};
 
-    CP::SysReadDecorHandle<unsigned int>
-    m_runNumber {this, "runNumber", "runNumber", "Runnumber"};
-
     std::unordered_map<std::string, CP::SysReadDecorHandle<bool> > m_triggerdecos;
 
     Gaudi::Property<std::string> m_eleWPName
@@ -155,13 +152,6 @@ private:
 
     std::unordered_map<HLLTT::TriggerChannel, std::unordered_map<HLLTT::Var, float>> m_pt_threshold;
 
-    bool is15;
-    bool is16;
-    bool is17;
-    bool is18;
-    bool is22;
-    bool is23;
-
     void applyTriggerSelection(const xAOD::EventInfo* event, const CP::SystematicSet& sys);
     void applySLTTriggerSelection(const xAOD::EventInfo* event, const CP::SystematicSet& sys);
     void applyDiLepTriggerSelection(const xAOD::EventInfo* event, const CP::SystematicSet& sys);
-- 
GitLab


From 98b6c0782e7d6388dbe31fd9a0080a1156594928 Mon Sep 17 00:00:00 2001
From: tstreble <thomas.strebler@cern.ch>
Date: Thu, 18 Apr 2024 00:36:59 +0200
Subject: [PATCH 10/13] Updated ttHH alg

---
 llttAnalysis/src/HllttSelectorAlg.cxx    |  2 ++
 ttHHAnalysis/python/ttHH_config.py       |  1 -
 ttHHAnalysis/src/TriggerDecoratorAlg.cxx | 26 +++++++-----------------
 ttHHAnalysis/src/TriggerDecoratorAlg.h   |  8 +-------
 4 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/llttAnalysis/src/HllttSelectorAlg.cxx b/llttAnalysis/src/HllttSelectorAlg.cxx
index 69d99a09e..16e489557 100644
--- a/llttAnalysis/src/HllttSelectorAlg.cxx
+++ b/llttAnalysis/src/HllttSelectorAlg.cxx
@@ -39,6 +39,8 @@ namespace HLLTT
       ATH_CHECK (m_isBtag.initialize(m_systematicsList, m_jetHandle));
     }
 
+    ATH_CHECK(m_year.initialize(m_systematicsList, m_eventHandle));
+    
     // Intialise syst-aware output decorators
     for (const std::string &var : m_Bvarnames){
       CP::SysWriteDecorHandle<bool> whandle{var+"_%SYS%", this};
diff --git a/ttHHAnalysis/python/ttHH_config.py b/ttHHAnalysis/python/ttHH_config.py
index 1ed856a11..f620961d8 100644
--- a/ttHHAnalysis/python/ttHH_config.py
+++ b/ttHHAnalysis/python/ttHH_config.py
@@ -81,7 +81,6 @@ def ttHH_cfg(flags, smalljetkey, muonkey, electronkey,
         CompFactory.ttHH.TriggerDecoratorAlg(
             "ttHHTriggerDecoratorAlg",
             isMC=flags.Input.isMC,
-            Years=flags.Analysis.Years,
             triggerLists=flags.Analysis.TriggerChains,
         )
     )
diff --git a/ttHHAnalysis/src/TriggerDecoratorAlg.cxx b/ttHHAnalysis/src/TriggerDecoratorAlg.cxx
index f8c975b39..940ad82f0 100644
--- a/ttHHAnalysis/src/TriggerDecoratorAlg.cxx
+++ b/ttHHAnalysis/src/TriggerDecoratorAlg.cxx
@@ -17,8 +17,9 @@ namespace ttHH
   StatusCode TriggerDecoratorAlg::initialize()
   {
     ATH_CHECK(m_eventInfoKey.initialize());
-    ATH_CHECK(m_runNumberKey.initialize());
-    ATH_CHECK(m_rdmRunNumberKey.initialize());
+
+    m_yearKey = "EventInfo.dataTakingYear";
+    ATH_CHECK(m_yearKey.initialize());
 
     // make trigger decorators
     for (const auto& trig : m_triggers){
@@ -50,11 +51,6 @@ namespace ttHH
     SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey,ctx);
     ATH_CHECK (eventInfo.isValid());
 
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_runNumberHandle
-      (m_runNumberKey);
-    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> m_rdmRunNumberHandle
-      (m_rdmRunNumberKey);
-
     trigReadDecoMap triggerdecos;
     for (const auto& [name, key] : m_triggerdecoKeys){
       triggerdecos.emplace(name, key);
@@ -66,19 +62,11 @@ namespace ttHH
       pass_decos.at(channel)(*eventInfo) = false;
     }
 
-    unsigned int runNumber = m_isMC ? m_rdmRunNumberHandle(*eventInfo) :
-    m_runNumberHandle(*eventInfo);
-
-    int year = 0;
-    if(m_years.size()==1) year = m_years[0];
-    else{
-      if(266904 <= runNumber && runNumber <= 284484) year = 2015;
-      else if(296939 <= runNumber && runNumber <= 311481) year = 2016;
-    }
+    SG::ReadDecorHandle<xAOD::EventInfo, unsigned int> year(m_yearKey);
 
-    std::vector<std::string> singLepTrigPaths = m_triggerMap.at(year).at(ttHH::SINGLEP);
-    std::vector<std::string> diLepTrigPaths = m_triggerMap.at(year).at(ttHH::DILEP);
-    std::vector<std::string> bjetTrigPaths = m_triggerMap.at(year).at(ttHH::BJET);
+    std::vector<std::string> singLepTrigPaths = m_triggerMap.at(year(*eventInfo)).at(ttHH::SINGLEP);
+    std::vector<std::string> diLepTrigPaths = m_triggerMap.at(year(*eventInfo)).at(ttHH::DILEP);
+    std::vector<std::string> bjetTrigPaths = m_triggerMap.at(year(*eventInfo)).at(ttHH::BJET);
 
     if (!singLepTrigPaths.empty()) evaluateTriggerCuts(eventInfo.cptr(), singLepTrigPaths, triggerdecos, pass_decos, ttHH::SINGLEP);
     if (!diLepTrigPaths.empty()) evaluateTriggerCuts(eventInfo.cptr(), diLepTrigPaths, triggerdecos, pass_decos, ttHH::DILEP);
diff --git a/ttHHAnalysis/src/TriggerDecoratorAlg.h b/ttHHAnalysis/src/TriggerDecoratorAlg.h
index a9fa389a3..a3fc31a56 100644
--- a/ttHHAnalysis/src/TriggerDecoratorAlg.h
+++ b/ttHHAnalysis/src/TriggerDecoratorAlg.h
@@ -50,17 +50,11 @@ namespace ttHH
     SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey
       { this, "event", "EventInfo", "EventInfo to read" };
 
-    SG::ReadDecorHandleKey<xAOD::EventInfo> m_runNumberKey{
-      this, "runNumberDecorKey", "EventInfo.runNumber", "Run number"};
-    SG::ReadDecorHandleKey<xAOD::EventInfo> m_rdmRunNumberKey{
-      this, "RandomRunNumberDecorKey", "EventInfo.RandomRunNumber", "Random run number"};
+    SG::ReadDecorHandleKey<xAOD::EventInfo> m_yearKey;
 
     Gaudi::Property<bool> m_isMC
       { this, "isMC", false, "Is this simulation?" };
 
-    Gaudi::Property<std::vector<int>> m_years
-      { this, "Years", false, "which years are running" };
-
     Gaudi::Property<std::vector<std::string>> m_triggers
       { this, "triggerLists", {}, "Name list of trigger" };
     std::unordered_map<std::string, SG::ReadDecorHandleKey<xAOD::EventInfo> >
-- 
GitLab


From 7ec35b3e09ee1f201bad1c77840e854ec5bcb8b9 Mon Sep 17 00:00:00 2001
From: Louis D'Eramo <louis.d'eramo@cern.ch>
Date: Fri, 19 Apr 2024 17:59:00 +0200
Subject: [PATCH 11/13] Apply 2 suggestion(s) to 1 file(s)

---
 EasyjetHub/src/EventInfoGlobalAlg.cxx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/EasyjetHub/src/EventInfoGlobalAlg.cxx b/EasyjetHub/src/EventInfoGlobalAlg.cxx
index 8e2dfa6ab..039547f20 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.cxx
+++ b/EasyjetHub/src/EventInfoGlobalAlg.cxx
@@ -48,7 +48,10 @@ namespace Easyjet
         year = 2015;
       else if (296939 <= runNumber && runNumber <= 311481)
         year = 2016;
-    }
+      else 
+         ATH_MSG_ERROR("Wrong (or unknown) combination of year and (Random)runNumber");
+    } else {
+      ATH_MSG_ERROR("Wrong (or unknown) combination of year and (Random)runNumber");
     yearDecorHandle(*eventInfo) = year;
 
     for(unsigned int i=0; i<m_runPeriods.size(); i++){
-- 
GitLab


From fd3c2afd08395b41f2a5a3773d0a0fb46c2a3827 Mon Sep 17 00:00:00 2001
From: Thomas Strebler <thomas.strebler@cern.ch>
Date: Fri, 19 Apr 2024 18:00:02 +0200
Subject: [PATCH 12/13] Apply 1 suggestion(s) to 1 file(s)

---
 EasyjetHub/src/EventInfoGlobalAlg.cxx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/EasyjetHub/src/EventInfoGlobalAlg.cxx b/EasyjetHub/src/EventInfoGlobalAlg.cxx
index 039547f20..246c1732f 100644
--- a/EasyjetHub/src/EventInfoGlobalAlg.cxx
+++ b/EasyjetHub/src/EventInfoGlobalAlg.cxx
@@ -52,6 +52,7 @@ namespace Easyjet
          ATH_MSG_ERROR("Wrong (or unknown) combination of year and (Random)runNumber");
     } else {
       ATH_MSG_ERROR("Wrong (or unknown) combination of year and (Random)runNumber");
+    }
     yearDecorHandle(*eventInfo) = year;
 
     for(unsigned int i=0; i<m_runPeriods.size(); i++){
-- 
GitLab


From 630205db612868d81a8786f5f866b4e6f827c63e Mon Sep 17 00:00:00 2001
From: Thomas Strebler <thomas.strebler@cern.ch>
Date: Fri, 19 Apr 2024 18:11:53 +0200
Subject: [PATCH 13/13] Apply 3 suggestion(s) to 2 file(s)

---
 EasyjetHub/src/TauDecoratorAlg.cxx | 4 ++--
 EasyjetHub/src/TauDecoratorAlg.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/EasyjetHub/src/TauDecoratorAlg.cxx b/EasyjetHub/src/TauDecoratorAlg.cxx
index 44ef9ceca..be4ca4a42 100644
--- a/EasyjetHub/src/TauDecoratorAlg.cxx
+++ b/EasyjetHub/src/TauDecoratorAlg.cxx
@@ -151,7 +151,7 @@ namespace Easyjet
 
       std::unordered_map<Easyjet::TriggerChannel,
 			 std::unordered_map<Easyjet::Var, float>> ptThresholds;
-      setRunNumberQuantities(year(*eventInfo),
+      setThresholds(year(*eventInfo),
 			     is2016_periodA(*eventInfo),
 			     is2016_periodB_D3(*eventInfo),
 			     is2022_75bunches(*eventInfo),
@@ -217,7 +217,7 @@ namespace Easyjet
     return StatusCode::SUCCESS;
   }
   
-  void TauDecoratorAlg::setRunNumberQuantities
+  void TauDecoratorAlg::setThresholds
   (unsigned int year,
    bool is2016_periodA, bool is2016_periodB_D3,
    bool is2022_75bunches,
diff --git a/EasyjetHub/src/TauDecoratorAlg.h b/EasyjetHub/src/TauDecoratorAlg.h
index 72ab15da0..678db1817 100644
--- a/EasyjetHub/src/TauDecoratorAlg.h
+++ b/EasyjetHub/src/TauDecoratorAlg.h
@@ -149,7 +149,7 @@ private:
     };
     SG::ReadDecorHandleKey<xAOD::TauJetContainer> m_triggerMatchDTTKey;
 
-    void setRunNumberQuantities
+    void setThresholds
     (unsigned int year,
      bool is2016_periodA, bool is2016_periodB_D3,
      bool is2022_75bunches,
-- 
GitLab