From a435b2ff5757359c572c89f33498aed3a6eb4c9a Mon Sep 17 00:00:00 2001
From: Dan Guest <dguest@cern.ch>
Date: Mon, 27 Jul 2020 13:31:18 +0200
Subject: [PATCH] Use unique_ptr<T> rather than T in write handle vector

---
 .../python/FtagRun3DerivationConfig.py                    | 4 +++-
 .../BTagging/BTagging/BTagHighLevelAugmenterAlg.h         | 6 +++++-
 .../JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx | 8 ++++----
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py
index f8c51c52203..de597894057 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py
@@ -3,11 +3,12 @@
 from AthenaCommon.CFElements import findAllAlgorithms
 from AthenaCommon.AthenaCommonFlags import jobproperties as jps
 
+from GaudiKernel.Configurable import WARNING
 
 
 
 
-def FtagJetCollection(jetcol, seq):
+def FtagJetCollection(jetcol, seq, OutputLevel=WARNING):
     
 
     jetcol_name_without_Jets = jetcol.replace('Jets','')
@@ -99,6 +100,7 @@ def FtagJetCollection(jetcol, seq):
     options['JetLinkName'] = options['BTaggingCollectionName'] + '.jetLink'
     options['BTagTrackToJetAssociatorName'] = 'BTagTrackToJetAssociator'
     options['name'] = ( 'BTagging_'+jetcol_name_without_Jets+ '_Augment').lower()
+    options['OutputLevel'] = OutputLevel
 
     acc.addEventAlgo(Analysis__BTagHighLevelAugmenterAlg(**options))
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h
index a9abf708adc..1b1d75a873a 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagHighLevelAugmenterAlg.h
@@ -41,7 +41,11 @@ namespace Analysis {
 
     // Decorator keys will be created at run-time to conform to the
     // correct container name.
-    std::vector<SG::WriteDecorHandleKey<xAOD::BTaggingContainer>> m_write_handles;
+    std::vector<
+      std::unique_ptr<
+        SG::WriteDecorHandleKey<xAOD::BTaggingContainer>
+        >
+      > m_write_handles;
   };
 }
 #endif
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx
index b8fd5622087..7f51c85f144 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagHighLevelAugmenterAlg.cxx
@@ -40,11 +40,11 @@ namespace Analysis {
     for (const std::string& key: m_aug->getDecoratorKeys()) {
       std::string full_key = m_BTagCollectionName.key() + "." + key;
       ATH_MSG_DEBUG("Adding " << full_key);
-      SG::WriteDecorHandleKey<xAOD::BTaggingContainer> handle{
-        this, key, full_key, ""};
-      m_write_handles.push_back(handle);
+      m_write_handles.emplace_back(
+        std::make_unique<SG::WriteDecorHandleKey<xAOD::BTaggingContainer>>(
+          this, key, full_key, ""));
       ATH_MSG_DEBUG("Initializing " << full_key);
-      ATH_CHECK(m_write_handles.back().initialize());
+      ATH_CHECK(m_write_handles.back()->initialize());
     }
     return StatusCode::SUCCESS;
   }
-- 
GitLab