diff --git a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h
index 33c15c1941a6592913bec9cb8a26b5bf03cd3c88..bfd38fbbcbaab2b04949c8ab4f9f0db27157da5d 100644
--- a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h
+++ b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef RATESANALYSIS_RATESANALYSISALG_H
@@ -130,7 +130,7 @@ class RatesAnalysisAlg: public ::AthAnalysisAlgorithm {
    * @brief Register some existing triggers based on wild-card match, e.g. "L1_.*" for all L1.
    * @param pattern Wild-card string to match in trigger name 
    */
-  StatusCode addExisting(const std::string pattern);
+  StatusCode addExisting(const std::string& pattern);
 
   /**
    * Set the pass/fail decision for an item.
diff --git a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h
index 9976e9107fc02e8e786d52f11254699daf990e7f..6eff1b488ef83dc4d432dc7aa829da74d2b22cb0 100644
--- a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h
+++ b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef RATESANALYSIS_RATESHISTOBASE_H
@@ -110,12 +110,9 @@ class RatesHistoBase : public AthMessaging {
   std::unique_ptr<TH1> m_rateVsMu; //!< Histogram of rate as a fn. of the input event's mu
   std::unique_ptr<TH1> m_rateVsTrain; //!< Histogram of rate as a fn. of position in bunch train
   std::unique_ptr<TH1> m_data;  //!< Histogram of raw rates quantites, for when we need to normalise offline (e.g. grid processing)
-  TH1* m_rateVsMuCachedPtr; //!< Cached, non-owning pointer
-  TH1* m_rateVsTrainCachedPtr;  //!< Cached, non-owning pointer
-  TH1* m_dataCachedPtr; //!< Cached, non-owning pointer
-  bool  m_givenRateVsMu; //!< m_rateVsMu has been given to the THistSvc and should not be deleted
-  bool  m_givenRateVsTrain; //!< m_rateVsTrain has been given to the THistSvc and should not be deleted
-  bool  m_givenData; //!< m_data has been given to the THistSvc and should not be deleted
+  TH1* m_rateVsMuCachedPtr{}; //!< Cached, non-owning pointer
+  TH1* m_rateVsTrainCachedPtr{};  //!< Cached, non-owning pointer
+  TH1* m_dataCachedPtr{}; //!< Cached, non-owning pointer
 };
 
 #endif //> !RATESANALYSIS_RATESHISTOBASE_H
diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx
index 1a1f36277aed08fec6b77889545d9e23233f36bb..c92ecf49b7b05c1de988c5353c98556428263f36 100644
--- a/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx
+++ b/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 // RatesAnalysis includes
@@ -31,7 +31,8 @@ RatesAnalysisAlg::RatesAnalysisAlg( const std::string& name, ISvcLocator* pSvcLo
   m_weightedEventCounter(0),
   m_scalingHist(nullptr),
   m_bcidHist(nullptr),
-  m_metadataTree(nullptr)
+  m_metadataTree(nullptr),
+  m_weightingValues()
 {}
 
 RatesAnalysisAlg::~RatesAnalysisAlg() {}
@@ -151,20 +152,21 @@ StatusCode RatesAnalysisAlg::newTrigger(const std::string& name,
   if (m_doTriggerGroups) {
     for (const std::string& group : groups) {
       // Ignore BW and PS groups
-      if (group.find("BW") == 0 || group.find("PS") == 0 || group.find("STREAM:express") == 0) continue;
-      if (m_groups.count(group) == 0) {
-        m_groups.emplace(group, std::make_unique<RatesGroup>(group, msgSvc(), m_doHistograms, m_enableLumiExtrapolation));
+      if (group.starts_with("BW") || group.starts_with("PS") || group.starts_with("STREAM:express")) continue;
+
+      const auto [it, inserted] = m_groups.try_emplace(group, std::make_unique<RatesGroup>(group, msgSvc(), m_doHistograms, m_enableLumiExtrapolation));
+      if (inserted) {
         // As the group is formed from at least one active trigger - it must be active itself (counter example - CPS group of a PS=-1 trigger)
-        m_activeGroups.insert( m_groups.at(group).get() );
+        m_activeGroups.insert( it->second.get() );
       }
-      m_groups.at(group)->addToGroup( newTriggerPtr );
+      it->second->addToGroup( newTriggerPtr );
       // For CPS, we let the trigger know that it is special
       if (isCPS(group)) {
         if (newTriggerPtr->getCPSID() != 0) ATH_MSG_WARNING("Trigger " << name << " can only be in one coherent prescale group.");
         newTriggerPtr->setCPS(group); // This changes the CPSID
         const size_t CPSID = newTriggerPtr->getCPSID();
         // Find the lowest prescale of any member in this CPS group
-        if (m_lowestPrescale.count(CPSID) == 0) m_lowestPrescale[CPSID] = FLT_MAX;
+        m_lowestPrescale.try_emplace(CPSID, FLT_MAX);
         if (prescale < m_lowestPrescale[CPSID]) m_lowestPrescale[CPSID] = prescale;
       }
     }
@@ -191,7 +193,7 @@ StatusCode RatesAnalysisAlg::addAllExisting() {
   return addExisting(".*");
 }
 
-StatusCode RatesAnalysisAlg::addExisting(const std::string pattern) {
+StatusCode RatesAnalysisAlg::addExisting(const std::string& pattern) {
   // Check we have the TDT
   ATH_CHECK(checkGotTDT());
 
diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx
index 96303d0bd3d32ba6a0bf3e3505e96f69b45cef63..24ee936eba6be6965df5cf3699db016215c9237f 100644
--- a/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx
+++ b/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx
@@ -10,8 +10,7 @@
 RatesHistoBase::RatesHistoBase(const std::string& name, IMessageSvc* msgSvc, const bool doHistograms) :
   AthMessaging(msgSvc, name),
   m_name(name),
-  m_doHistograms(doHistograms), m_rateVsMu(nullptr), m_rateVsTrain(nullptr), m_data(nullptr),
-  m_rateVsMuCachedPtr(nullptr), m_rateVsTrainCachedPtr(nullptr), m_dataCachedPtr(nullptr)
+  m_doHistograms(doHistograms)
 {
   if (doHistograms) {
     m_rateVsMu = std::make_unique<TH1D>("",TString(name + ";#mu;Rate / Unit #mu [Hz]"),226,-.5,225.5);
diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesScanTrigger.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesScanTrigger.cxx
index a48f20b24ac89c96e21446bffff4fd8fd51595bd..8a4443b7b6b4a426847bd88cb22aa927f2b938a6 100644
--- a/Trigger/TrigCost/RatesAnalysis/src/RatesScanTrigger.cxx
+++ b/Trigger/TrigCost/RatesAnalysis/src/RatesScanTrigger.cxx
@@ -15,12 +15,10 @@ RatesScanTrigger::RatesScanTrigger( const std::string& name,
                                     const std::string& seedName, const double seedPrescale,
                                     const ExtrapStrat_t extrapolation) :
   RatesTrigger(name, msgSvc, prescale, -1, seedName, seedPrescale, /*base histograms*/false, extrapolation),
-  m_rateScanHist(nullptr), m_rateScanHistCachedPtr(nullptr), m_thresholdPassed(0), m_behaviour(behaviour)
+  m_rateScanHist(std::make_unique<TH1D>("", TString(name + ";Threshold;Rate [Hz]"), thresholdBins, thresholdMin, thresholdMax)),
+  m_rateScanHistCachedPtr(m_rateScanHist.get()), m_thresholdPassed(0), m_behaviour(behaviour)
   {
-    m_rateScanHist = std::make_unique<TH1D>("", TString(name + ";Threshold;Rate [Hz]"), thresholdBins, thresholdMin, thresholdMax);
     m_rateScanHist->Sumw2(true);
-
-    m_rateScanHistCachedPtr = m_rateScanHist.get();
   }
 
 RatesScanTrigger::RatesScanTrigger( const std::string& name, 
diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx
index 93594c5316da179a44c79866df7a7cf92588b965..484ebe07429acfbc26fa179c1d92586ebdc1b159 100644
--- a/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx
+++ b/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "RatesAnalysis/RatesTrigger.h"
@@ -16,6 +16,8 @@ RatesTrigger::RatesTrigger(const std::string& name, IMessageSvc* msgSvc, const d
   m_rateAccumulator2(0.),
   m_rateExpressAccumulator(0.),
   m_rateExpressAccumulator2(0.),
+  m_ratesActive(0.),
+  m_ratesActive2(0.),
   m_CPSID(0),
   m_coherentFactor(0.),
   m_uniqueGroup(nullptr),