From aa0b71cefeb94ad468ff5635082d0380bf7525a3 Mon Sep 17 00:00:00 2001
From: Teng Jian Khoo <teng.jian.khoo@cern.ch>
Date: Thu, 10 Dec 2020 18:12:54 +0100
Subject: [PATCH] Add compilation guards to hide ShallowCopyDecorDeps in
 AnalysisBase

---
 Reconstruction/Jet/JetRec/CMakeLists.txt     | 4 ++--
 Reconstruction/Jet/JetRec/JetRec/JetCopier.h | 7 +++++++
 Reconstruction/Jet/JetRec/Root/JetCopier.cxx | 8 ++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Reconstruction/Jet/JetRec/CMakeLists.txt b/Reconstruction/Jet/JetRec/CMakeLists.txt
index a720dda77143..767c7545bc18 100644
--- a/Reconstruction/Jet/JetRec/CMakeLists.txt
+++ b/Reconstruction/Jet/JetRec/CMakeLists.txt
@@ -8,7 +8,7 @@ set( extra_libs )
 if( NOT GENERATIONBASE )
    list( APPEND extra_libs xAODPFlow )
    if( NOT XAOD_STANDALONE )
-      list( APPEND extra_libs AthenaMonitoringKernelLib )
+      list( APPEND extra_libs AthenaMonitoringKernelLib StoreGateLib )
    endif()
 endif()
 
@@ -24,7 +24,7 @@ atlas_add_library( JetRecLib
   JetRec/*.h Root/*.h Root/*.cxx
   PUBLIC_HEADERS JetRec
   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${FASTJETCONTRIB_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-  LINK_LIBRARIES ${Boost_LIBRARIES} ${FASTJET_LIBRARIES} ${FASTJETCONTRIB_LIBRARIES} ${ROOT_LIBRARIES} AsgDataHandlesLib AsgTools AthLinks EventShapeInterface JetEDM JetInterface xAODBase xAODCaloEvent xAODCore xAODEventInfo xAODJet xAODMuon StoreGateLib ${extra_libs}
+  LINK_LIBRARIES ${Boost_LIBRARIES} ${FASTJET_LIBRARIES} ${FASTJETCONTRIB_LIBRARIES} ${ROOT_LIBRARIES} AsgDataHandlesLib AsgTools AthLinks EventShapeInterface JetEDM JetInterface xAODBase xAODCaloEvent xAODCore xAODEventInfo xAODJet xAODMuon ${extra_libs}
   PRIVATE_LINK_LIBRARIES CxxUtils xAODTracking )
 
 if( NOT XAOD_STANDALONE )
diff --git a/Reconstruction/Jet/JetRec/JetRec/JetCopier.h b/Reconstruction/Jet/JetRec/JetRec/JetCopier.h
index 44d89de74634..8d1b6d2c9870 100644
--- a/Reconstruction/Jet/JetRec/JetRec/JetCopier.h
+++ b/Reconstruction/Jet/JetRec/JetRec/JetCopier.h
@@ -23,7 +23,12 @@
 #include "JetInterface/IJetProvider.h"
 #include "xAODJet/JetContainer.h"
 #include "xAODCore/ShallowAuxContainer.h"
+
+// This class doesn't (yet) exist for AnalysisBase, so in that release
+// we will simply have to rerun modifiers if we need them.
+#ifndef XAOD_ANALYSIS
 #include "StoreGate/ShallowCopyDecorDeps.h"
+#endif
 
 class JetCopier
   : public asg::AsgTool,
@@ -55,8 +60,10 @@ class JetCopier
     Gaudi::Property<bool> m_shallowCopy {this, "ShallowCopy", true, "True for shallow copy, false for deep copy"};
     Gaudi::Property<bool> m_shallowIO {this, "ShallowIO", false, "True for storing only modified data"};
 
+#ifndef XAOD_ANALYSIS
     SG::ShallowCopyDecorDeps<xAOD::JetContainer> m_decorDeps { this, "DecorDeps", {},
           "List of decorations to propagate through the shallow copy." };
+#endif
 };
 
 #endif
diff --git a/Reconstruction/Jet/JetRec/Root/JetCopier.cxx b/Reconstruction/Jet/JetRec/Root/JetCopier.cxx
index e802ed2eee63..e92ce06177e0 100644
--- a/Reconstruction/Jet/JetRec/Root/JetCopier.cxx
+++ b/Reconstruction/Jet/JetRec/Root/JetCopier.cxx
@@ -38,7 +38,11 @@ StatusCode JetCopier::initialize() {
 
 // Setup helper to propagate decorations from original to copy
 StatusCode JetCopier::initWithOutput(const SG::WriteHandleKey<xAOD::JetContainer>& outputJets) {
+#ifndef XAOD_ANALYSIS
   return m_decorDeps.initialize(m_inputJets, outputJets) ;
+#else
+  return StatusCode::SUCCESS;
+#endif
 }
 
 
@@ -52,12 +56,16 @@ StatusCode JetCopier::getAndRecordJets(SG::WriteHandle<xAOD::JetContainer>& jetH
   if(m_shallowCopy){
     std::unique_ptr<xAOD::ShallowAuxContainer> auxCont_derived(static_cast<xAOD::ShallowAuxContainer*>(auxCont.release()));
     ATH_CHECK( jetHandle.record(std::move(jets), std::move(auxCont_derived)) );
+#ifndef XAOD_ANALYSIS
     ATH_CHECK( m_decorDeps.linkDecors (m_inputJets) );
+#endif
   }
   else{
     std::unique_ptr<xAOD::JetAuxContainer> auxCont_derived(static_cast<xAOD::JetAuxContainer*>(auxCont.release()));
     ATH_CHECK( jetHandle.record(std::move(jets), std::move(auxCont_derived)) );
+#ifndef XAOD_ANALYSIS
     ATH_CHECK( m_decorDeps.linkDecors (m_inputJets) );
+#endif
   }
   return StatusCode::SUCCESS;
 }
-- 
GitLab