From 711618473199686e01608a5203755aa99014327f Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> Date: Wed, 27 May 2020 10:42:01 +0200 Subject: [PATCH] Introduced the xAODPrimitives.xAODIso python module. It is meant to help python code get access to all the enumerations in the xAOD::Iso C++ namespace. At the same time moved the ROOT6_NamespaceAutoloadHook struct into a more hidden place, as C++ clients don't need to be exposed to it. --- Event/xAOD/xAODPrimitives/CMakeLists.txt | 3 +++ Event/xAOD/xAODPrimitives/python/__init__.py | 1 + Event/xAOD/xAODPrimitives/python/xAODIso.py | 8 ++++++++ .../xAODPrimitives/xAODPrimitives/IsolationType.h | 7 +------ .../xAODPrimitives/xAODPrimitives/selection.xml | 4 ++-- .../xAODPrimitives/xAODPrimitivesDict.h | 14 +++++++++----- 6 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 Event/xAOD/xAODPrimitives/python/__init__.py create mode 100644 Event/xAOD/xAODPrimitives/python/xAODIso.py diff --git a/Event/xAOD/xAODPrimitives/CMakeLists.txt b/Event/xAOD/xAODPrimitives/CMakeLists.txt index 6389e0bf700..5563fec425b 100644 --- a/Event/xAOD/xAODPrimitives/CMakeLists.txt +++ b/Event/xAOD/xAODPrimitives/CMakeLists.txt @@ -18,3 +18,6 @@ atlas_add_dictionary( xAODPrimitivesDict atlas_add_test( ut_xAOD_primitives_enums_test SOURCES test/ut_xAOD_primitives_enums_test.cxx LINK_LIBRARIES xAODPrimitives ) + +# Install files from the package. +atlas_install_python_modules( python/*.py ) diff --git a/Event/xAOD/xAODPrimitives/python/__init__.py b/Event/xAOD/xAODPrimitives/python/__init__.py new file mode 100644 index 00000000000..f2f0fc1b7b4 --- /dev/null +++ b/Event/xAOD/xAODPrimitives/python/__init__.py @@ -0,0 +1 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration diff --git a/Event/xAOD/xAODPrimitives/python/xAODIso.py b/Event/xAOD/xAODPrimitives/python/xAODIso.py new file mode 100644 index 00000000000..058689be10c --- /dev/null +++ b/Event/xAOD/xAODPrimitives/python/xAODIso.py @@ -0,0 +1,8 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Make sure that the dictionary is loaded. +import ROOT +ROOT.xAOD.Iso.ROOT6_NamespaceAutoloadHook() + +# Declare the xAODIso type. +xAODIso = ROOT.xAOD.Iso diff --git a/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h b/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h index b09a61ea58e..6b3268d68c8 100644 --- a/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h +++ b/Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationType.h @@ -1,10 +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 */ - -// $Id: IsolationType.h 718726 2016-01-20 12:10:22Z dzhang $ #ifndef XAODPRIMITIVES_ISOLATIONTYPE_H #define XAODPRIMITIVES_ISOLATIONTYPE_H @@ -100,8 +97,6 @@ namespace xAOD { default: return "[Unknown IsolationType]"; } } - - struct ROOT6_NamespaceAutoloadHook{}; } // namespace Iso diff --git a/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml b/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml index 0e252c2b6be..a93cb86a100 100644 --- a/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml +++ b/Event/xAOD/xAODPrimitives/xAODPrimitives/selection.xml @@ -1,8 +1,8 @@ -<!-- $Id: selection.xml 615648 2014-09-08 16:35:14Z schaffer $ --> +<!-- Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <!-- Enums --> <enum pattern="xAOD::Iso::*" /> - <class name="xAOD::Iso::ROOT6_NamespaceAutoloadHook" /> + <struct name="xAOD::Iso::ROOT6_NamespaceAutoloadHook" /> </lcgdict> diff --git a/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h b/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h index 0196a3b88c3..29cb59e333d 100644 --- a/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h +++ b/Event/xAOD/xAODPrimitives/xAODPrimitives/xAODPrimitivesDict.h @@ -1,17 +1,21 @@ // 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 */ - -// $Id: xAODPrimitivesDict.h 636772 2014-12-18 15:33:07Z mnowak $ #ifndef XAODPRIMITIVES_XAODPRIMITIVESDICT_H #define XAODPRIMITIVES_XAODPRIMITIVESDICT_H +// Local include(s). #include "xAODPrimitives/IsolationType.h" #include "xAODPrimitives/IsolationCorrection.h" #include "xAODPrimitives/IsolationFlavour.h" #include "xAODPrimitives/IsolationConeSize.h" -#endif // XAODPRIMITIVES_XAODPRIMITIVESDICT_H +namespace xAOD { + namespace Iso { + /// Struct helping with auto-loading this dictionary + struct ROOT6_NamespaceAutoloadHook {}; + } // namespace Iso +} // namespace xAOD +#endif // XAODPRIMITIVES_XAODPRIMITIVESDICT_H -- GitLab