From e8cf4e1fea05b9d3e87648bdd5dbb420b79f2ac5 Mon Sep 17 00:00:00 2001 From: Tadej Novak <tadej.novak@cern.ch> Date: Fri, 23 Oct 2020 13:49:48 +0200 Subject: [PATCH] Make EventBookkeeperTools properly dual use --- Event/EventBookkeeperTools/CMakeLists.txt | 46 +++++++++++++------ .../BookkeeperDumperTool.h | 18 ++++++-- .../EventBookkeeperToolsDict.h | 10 ++++ .../EventBookkeeperTools/selection.xml | 3 ++ .../{src => Root}/BookkeeperDumperTool.cxx | 3 +- .../EventBookkeeperTools_entries.cxx | 3 +- Event/EventBookkeeperTools/util/dump-cbk.cxx | 7 ++- Projects/AnalysisBase/package_filters.txt | 1 + Projects/AthGeneration/package_filters.txt | 2 + 9 files changed, 69 insertions(+), 24 deletions(-) rename Event/EventBookkeeperTools/{src => EventBookkeeperTools}/BookkeeperDumperTool.h (81%) mode change 100755 => 100644 create mode 100644 Event/EventBookkeeperTools/EventBookkeeperTools/EventBookkeeperToolsDict.h create mode 100644 Event/EventBookkeeperTools/EventBookkeeperTools/selection.xml rename Event/EventBookkeeperTools/{src => Root}/BookkeeperDumperTool.cxx (98%) mode change 100755 => 100644 diff --git a/Event/EventBookkeeperTools/CMakeLists.txt b/Event/EventBookkeeperTools/CMakeLists.txt index 0f7d1f44b87..9b676cd1644 100644 --- a/Event/EventBookkeeperTools/CMakeLists.txt +++ b/Event/EventBookkeeperTools/CMakeLists.txt @@ -6,18 +6,32 @@ atlas_subdir( EventBookkeeperTools ) if( XAOD_STANDALONE ) + set( athena_libs ) set( xaod_access_lib xAODRootAccess ) # ... for AthAnalysisBase (Athena calls this POOLRootAccess) else() + set( athena_libs AthenaKernel GaudiKernel ) set( xaod_access_lib POOLRootAccessLib ) endif() # Component(s) in the package: -atlas_add_component( EventBookkeeperTools - src/*.cxx - src/components/*.cxx - LINK_LIBRARIES AsgTools AthenaBaseComps AthenaKernel GaudiKernel - SGTools StoreGateLib EventBookkeeperMetaData EventInfo xAODCutFlow xAODEventInfo ) +atlas_add_library( EventBookkeeperToolsLib + EventBookkeeperTools/*.h Root/*.cxx + PUBLIC_HEADERS EventBookkeeperTools + LINK_LIBRARIES ${athena_libs} AsgDataHandlesLib AsgMessagingLib AsgTools xAODCutFlow xAODEventInfo ) + +atlas_add_dictionary( EventBookkeeperToolsDict + EventBookkeeperTools/EventBookkeeperToolsDict.h + EventBookkeeperTools/selection.xml + LINK_LIBRARIES EventBookkeeperToolsLib ) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( EventBookkeeperTools + src/*.cxx + src/components/*.cxx + LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel EventBookkeeperToolsLib + SGTools StoreGateLib EventBookkeeperMetaData EventInfo ) +endif() atlas_add_executable( dump-cbk util/dump-cbk.cxx @@ -28,17 +42,23 @@ atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) # Tests -atlas_add_test( BookkeeperDumperTool - SCRIPT test/test_BookkeeperDumperTool.py +atlas_add_test( DumpCbkTest + SCRIPT dump-cbk $ASG_TEST_FILE_MC PROPERTIES TIMEOUT 300 POST_EXEC_SCRIPT nopost.sh ) -atlas_add_test( CutflowSvcDummyAlg - SCRIPT athena EventBookkeeperTools/TestCutFlowSvcDummyAlg.py - PROPERTIES TIMEOUT 300 - POST_EXEC_SCRIPT nopost.sh ) -if ( NOT GENERATIONBASE ) - atlas_add_test( CutflowSvcOutput +if( NOT XAOD_STANDALONE ) + atlas_add_test( BookkeeperDumperTool + SCRIPT test/test_BookkeeperDumperTool.py + PROPERTIES TIMEOUT 300 + POST_EXEC_SCRIPT nopost.sh ) + + atlas_add_test( CutFlowSvcDummyAlg + SCRIPT athena EventBookkeeperTools/TestCutFlowSvcDummyAlg.py + PROPERTIES TIMEOUT 300 + POST_EXEC_SCRIPT nopost.sh ) + + atlas_add_test( CutFlowSvcOutput SCRIPT athena EventBookkeeperTools/TestCutFlowSvcOutput.py PROPERTIES TIMEOUT 300 POST_EXEC_SCRIPT nopost.sh ) diff --git a/Event/EventBookkeeperTools/src/BookkeeperDumperTool.h b/Event/EventBookkeeperTools/EventBookkeeperTools/BookkeeperDumperTool.h old mode 100755 new mode 100644 similarity index 81% rename from Event/EventBookkeeperTools/src/BookkeeperDumperTool.h rename to Event/EventBookkeeperTools/EventBookkeeperTools/BookkeeperDumperTool.h index 604d1fcc9d5..c9339ba270e --- a/Event/EventBookkeeperTools/src/BookkeeperDumperTool.h +++ b/Event/EventBookkeeperTools/EventBookkeeperTools/BookkeeperDumperTool.h @@ -17,13 +17,20 @@ */ #include <AsgTools/AsgMetadataTool.h> +#include <AsgTools/PropertyWrapper.h> +#ifndef XAOD_STANDALONE #include <AthenaKernel/IMetaDataTool.h> +#endif -class BookkeeperDumperTool : public asg::AsgMetadataTool, - public virtual IMetaDataTool +class BookkeeperDumperTool : public asg::AsgMetadataTool +#ifndef XAOD_STANDALONE + , public virtual IMetaDataTool +#endif { +#ifndef XAOD_STANDALONE /// Declare the correct constructor for Athena ASG_TOOL_CLASS( BookkeeperDumperTool, IMetaDataTool ) +#endif public: BookkeeperDumperTool(const std::string &name = "BookkeeperDumperTool"); @@ -31,11 +38,14 @@ public: virtual StatusCode initialize() final; virtual StatusCode beginInputFile() final; - virtual StatusCode beginInputFile(const SG::SourceID &) final { return StatusCode::SUCCESS; } virtual StatusCode endInputFile() final { return StatusCode::SUCCESS; } - virtual StatusCode endInputFile(const SG::SourceID &) final { return StatusCode::SUCCESS; } virtual StatusCode metaDataStop() final { return StatusCode::SUCCESS; } +#ifndef XAOD_STANDALONE + virtual StatusCode beginInputFile(const SG::SourceID &) final { return StatusCode::SUCCESS; } + virtual StatusCode endInputFile(const SG::SourceID &) final { return StatusCode::SUCCESS; } +#endif + Gaudi::Property<bool> m_standaloneMode{this, "StandaloneMode", false, "Dump on initialize when running standalone"}; }; diff --git a/Event/EventBookkeeperTools/EventBookkeeperTools/EventBookkeeperToolsDict.h b/Event/EventBookkeeperTools/EventBookkeeperTools/EventBookkeeperToolsDict.h new file mode 100644 index 00000000000..ae7dcecd55d --- /dev/null +++ b/Event/EventBookkeeperTools/EventBookkeeperTools/EventBookkeeperToolsDict.h @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENT_BOOKKEEPER_TOOLS__EVENT_BOOKKEEPER_TOOLS_DICT_H +#define EVENT_BOOKKEEPER_TOOLS__EVENT_BOOKKEEPER_TOOLS_DICT_H + +#include <EventBookkeeperTools/BookkeeperDumperTool.h> + +#endif diff --git a/Event/EventBookkeeperTools/EventBookkeeperTools/selection.xml b/Event/EventBookkeeperTools/EventBookkeeperTools/selection.xml new file mode 100644 index 00000000000..8f65a891c98 --- /dev/null +++ b/Event/EventBookkeeperTools/EventBookkeeperTools/selection.xml @@ -0,0 +1,3 @@ +<lcgdict> + <class name="BookkeeperDumperTool" /> +</lcgdict> diff --git a/Event/EventBookkeeperTools/src/BookkeeperDumperTool.cxx b/Event/EventBookkeeperTools/Root/BookkeeperDumperTool.cxx old mode 100755 new mode 100644 similarity index 98% rename from Event/EventBookkeeperTools/src/BookkeeperDumperTool.cxx rename to Event/EventBookkeeperTools/Root/BookkeeperDumperTool.cxx index ae07d44a89e..e3c7770d6ee --- a/Event/EventBookkeeperTools/src/BookkeeperDumperTool.cxx +++ b/Event/EventBookkeeperTools/Root/BookkeeperDumperTool.cxx @@ -7,10 +7,9 @@ * @brief Implementation of class BookkeeperDumperTool */ -#include "BookkeeperDumperTool.h" - #include <xAODCutFlow/CutBookkeeperContainer.h> +#include <EventBookkeeperTools/BookkeeperDumperTool.h> BookkeeperDumperTool::BookkeeperDumperTool(const std::string &name) diff --git a/Event/EventBookkeeperTools/src/components/EventBookkeeperTools_entries.cxx b/Event/EventBookkeeperTools/src/components/EventBookkeeperTools_entries.cxx index 8629f6a0c37..e9a0d0ab053 100644 --- a/Event/EventBookkeeperTools/src/components/EventBookkeeperTools_entries.cxx +++ b/Event/EventBookkeeperTools/src/components/EventBookkeeperTools_entries.cxx @@ -1,4 +1,5 @@ -#include "../BookkeeperDumperTool.h" +#include <EventBookkeeperTools/BookkeeperDumperTool.h> + #include "../BookkeeperTool.h" #include "../CppFilterTester.h" #include "../CutFlowSvc.h" diff --git a/Event/EventBookkeeperTools/util/dump-cbk.cxx b/Event/EventBookkeeperTools/util/dump-cbk.cxx index 45036386ec4..cb72ff2fbec 100644 --- a/Event/EventBookkeeperTools/util/dump-cbk.cxx +++ b/Event/EventBookkeeperTools/util/dump-cbk.cxx @@ -13,9 +13,8 @@ // ASG #include <AsgMessaging/MessageCheck.h> -#include <AsgTools/ToolHandle.h> +#include <AsgTools/AnaToolHandle.h> #include <AsgTools/AsgMetadataTool.h> -#include <AthAnalysisBaseComps/AthAnalysisHelper.h> ANA_MSG_HEADER(CutFlow) ANA_MSG_SOURCE(CutFlow, "Dump") @@ -65,8 +64,8 @@ int main(int argc, char **argv) event.getEntries(); // Retrieve the tool - ToolHandle<asg::AsgMetadataTool> tool("BookkeeperDumperTool/BookkeeperDumperTool"); - ANA_CHECK(AAH::setProperty(tool, "StandaloneMode", true)); + asg::AnaToolHandle<asg::AsgMetadataTool> tool("BookkeeperDumperTool/BookkeeperDumperTool"); + ANA_CHECK(tool.setProperty("StandaloneMode", true)); ANA_CHECK(tool.retrieve()); // Trigger finalization of all services and tools created by the Gaudi Application diff --git a/Projects/AnalysisBase/package_filters.txt b/Projects/AnalysisBase/package_filters.txt index 6c7c2e836e8..948b6166abe 100644 --- a/Projects/AnalysisBase/package_filters.txt +++ b/Projects/AnalysisBase/package_filters.txt @@ -38,6 +38,7 @@ + DetectorDescription/GeoPrimitives + DetectorDescription/IRegionSelector + DetectorDescription/RoiDescriptor ++ Event/EventBookkeeperTools + Event/EventPrimitives + Event/FourMomUtils - Event/xAOD/.*AthenaPool diff --git a/Projects/AthGeneration/package_filters.txt b/Projects/AthGeneration/package_filters.txt index e4d28888094..2648099c10e 100644 --- a/Projects/AthGeneration/package_filters.txt +++ b/Projects/AthGeneration/package_filters.txt @@ -130,7 +130,9 @@ + Event/xAOD/xAODCoreAthenaPool + Event/xAOD/xAODCoreCnv + Event/xAOD/xAODCutFlow ++ Event/xAOD/xAODCutFlowAthenaPool + Event/xAOD/xAODEventFormat ++ Event/xAOD/xAODEventFormatCnv + Event/xAOD/xAODEventInfo + Event/xAOD/xAODEventInfoAthenaPool + Event/xAOD/xAODEventInfoCnv -- GitLab