From 9a78cffe6df630a78d69da7a7dbdef941bf60e0c Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Mon, 22 Jun 2020 11:48:14 -0400
Subject: [PATCH] TrigCostRootAnalysis: Fix clang 10 warning.

Avoid spurious object copy in range for.
---
 .../TrigCostRootAnalysis/Root/MonitorRates.cxx |  8 ++++----
 .../Root/MonitorRatesUpgrade.cxx               | 18 +++++++++---------
 .../Root/TrigConfInterface.cxx                 |  6 +++---
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRates.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRates.cxx
index 8e5d7a0b387..f58dd715e56 100644
--- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRates.cxx
+++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRates.cxx
@@ -1,7 +1,7 @@
 // Dear emacs, this is -*- c++ -*-
 
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // -------------------------------------------------------------
@@ -161,8 +161,8 @@ namespace TrigCostRootAnalysis {
       }
     }
 
-    for (const auto chainItem : m_chainItemsHLT) chainItem.second->classifyLumiAndRandom();
-    for (const auto chainItem : m_chainItemsL1) chainItem.second->classifyLumiAndRandom();
+    for (const auto& chainItem : m_chainItemsHLT) chainItem.second->classifyLumiAndRandom();
+    for (const auto& chainItem : m_chainItemsL1) chainItem.second->classifyLumiAndRandom();
 
     if (Config::config().getVecSize(kListOfNoLumiWeightChains) > 0) {
       Info("MonitorRates::populateChainItemMaps",
@@ -186,7 +186,7 @@ namespace TrigCostRootAnalysis {
     }
 
     // Get the common factor of all the CPS groups
-    for (const auto cpsGroup : m_cpsGroups) cpsGroup.second->calculateCPSFactor();
+    for (const auto& cpsGroup : m_cpsGroups) cpsGroup.second->calculateCPSFactor();
   }
 
   /**
diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRatesUpgrade.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRatesUpgrade.cxx
index 6d0533b0095..c5214673f25 100644
--- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRatesUpgrade.cxx
+++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/MonitorRatesUpgrade.cxx
@@ -1,7 +1,7 @@
 // Dear emacs, this is -*- c++ -*-
 
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // -------------------------------------------------------------
@@ -305,9 +305,9 @@ namespace TrigCostRootAnalysis {
     }
 
 
-    for (const auto chainItem : m_chainItemsL1) chainItem.second->classifyLumiAndRandom();
+    for (const auto& chainItem : m_chainItemsL1) chainItem.second->classifyLumiAndRandom();
     //Should not be needed, do different lumi scaling here
-    for (const auto chainItem : m_chainItemsL2) chainItem.second->classifyLumiAndRandom();
+    for (const auto& chainItem : m_chainItemsL2) chainItem.second->classifyLumiAndRandom();
   }
 
   /**
@@ -389,7 +389,7 @@ namespace TrigCostRootAnalysis {
     // }
 
 
-    for (const auto item : m_upgradeChains) {
+    for (const auto& item : m_upgradeChains) {
       if (item.m_level != 1) continue; // not doing HLT here
 
       const std::string chainName = item.m_name;
@@ -450,7 +450,7 @@ namespace TrigCostRootAnalysis {
    * L2 are like L1, but with another hardware layer added
    */
   void MonitorRatesUpgrade::createL2Counters(CounterMap_t* counterMap) {
-    for (const auto item : m_upgradeChains) {
+    for (const auto& item : m_upgradeChains) {
       if (item.m_level != 1) continue; // Note should be 1, L2 stored in L1 info
 
       std::string chainName = item.m_l2name;
@@ -738,8 +738,8 @@ namespace TrigCostRootAnalysis {
     // m_eventsToMix -= (Int_t)m_eventsToMix; // Remove whole integer events mixed. Leave fractional part to accumulate
     // for next event.
 
-    for (const auto chainItem : m_chainItemsL1) chainItem.second->beginEvent(m_thisEventPtr);
-    for (const auto chainItem : m_chainItemsL2) chainItem.second->beginEvent(m_thisEventPtr);
+    for (const auto& chainItem : m_chainItemsL1) chainItem.second->beginEvent(m_thisEventPtr);
+    for (const auto& chainItem : m_chainItemsL2) chainItem.second->beginEvent(m_thisEventPtr);
 
     //Now loop over the counter collections;
     for (CounterMapSetIt_t cmsIt = m_collectionsToProcess.begin(); cmsIt != m_collectionsToProcess.end(); ++cmsIt) {
@@ -759,8 +759,8 @@ namespace TrigCostRootAnalysis {
       endEvent(0);
     }
 
-    for (const auto chainItem : m_chainItemsL1) chainItem.second->endEvent();
-    for (const auto chainItem : m_chainItemsL2) chainItem.second->endEvent();
+    for (const auto& chainItem : m_chainItemsL1) chainItem.second->endEvent();
+    for (const auto& chainItem : m_chainItemsL2) chainItem.second->endEvent();
 
     delete thisEventPtr;
     thisEventPtr = nullptr;
diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/TrigConfInterface.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/TrigConfInterface.cxx
index 37a2b019751..e9d767c0948 100644
--- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/TrigConfInterface.cxx
+++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/TrigConfInterface.cxx
@@ -1,7 +1,7 @@
 // Dear emacs, this is -*- c++ -*-
 
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // -------------------------------------------------------------
@@ -147,10 +147,10 @@ namespace TrigCostRootAnalysis {
    * Look at which LB each keyset was being used in
    */
   void TrigConfInterface::populateLBPerKeysetStrings() {
-    for (const auto keyset : m_seenKeys) {
+    for (const auto& keyset : m_seenKeys) {
       // Set of my LB
       std::set<UInt_t> myLB;
-      for (const auto it : m_lumiToKeyMap) {
+      for (const auto& it : m_lumiToKeyMap) {
         if (it.second == keyset) {
           myLB.insert(it.first);
         }
-- 
GitLab