diff --git a/GaudiCommonSvc/CMakeLists.txt b/GaudiCommonSvc/CMakeLists.txt index 128bede6d243c0d56b61177eb35afb7171bc760c..0fc495d0287ccee882584865286bc6c16370b4bc 100644 --- a/GaudiCommonSvc/CMakeLists.txt +++ b/GaudiCommonSvc/CMakeLists.txt @@ -70,8 +70,3 @@ if(GAUDI_USE_AIDA) src/HistogramPersistencySvc/HistogramPersistencySvc.cpp) target_link_libraries(GaudiCommonSvc PRIVATE AIDA::aida GaudiCommonSvcLib) endif() - -if(BUILD_TESTING) - gaudi_add_executable(test_HistoUtils SOURCES tests/src/RootHistogramUtilsUnitTest.cpp - LINK GaudiCommonSvcLib Boost::unit_test_framework TEST) -endif() diff --git a/GaudiCommonSvc/src/HistogramPersistencySvc/RootHistogramSink.cpp b/GaudiCommonSvc/src/HistogramPersistencySvc/RootHistogramSink.cpp index 5fdf5c78e6c9585391e7c6bf18672cce2b929cdb..46b340195a33cb3b3d0669e072f55544567ca99b 100644 --- a/GaudiCommonSvc/src/HistogramPersistencySvc/RootHistogramSink.cpp +++ b/GaudiCommonSvc/src/HistogramPersistencySvc/RootHistogramSink.cpp @@ -1,5 +1,5 @@ /***********************************************************************************\ -* (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations * +* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * * * * This software is distributed under the terms of the Apache version 2 licence, * * copied verbatim in the file "LICENSE". * @@ -9,11 +9,9 @@ * or submit itself to any jurisdiction. * \***********************************************************************************/ -#include "GaudiKernel/Service.h" - -#include <HistogramPersistencySvc/RootHistogramSinkBase.h> -#include <HistogramPersistencySvc/RootHistogramUtils.h> - +#include <Gaudi/Histograming/Sink/Base.h> +#include <Gaudi/Histograming/Sink/Utils.h> +#include <GaudiKernel/Service.h> #include <TH1D.h> #include <TH2D.h> #include <TH3D.h> diff --git a/GaudiCommonSvc/src/HistogramSvc/H1D.cpp b/GaudiCommonSvc/src/HistogramSvc/H1D.cpp index 46479db5e8c306385b89e23514ef29e5cb11ff21..9eda4f6e74d7345e4ca69ac0b6fba10f81c16a88 100644 --- a/GaudiCommonSvc/src/HistogramSvc/H1D.cpp +++ b/GaudiCommonSvc/src/HistogramSvc/H1D.cpp @@ -26,7 +26,7 @@ #include <GaudiKernel/ObjectFactory.h> #include <GaudiKernel/StreamBuffer.h> -#include <HistogramPersistencySvc/RootHistogramUtils.h> +#include <Gaudi/Histograming/Sink/Utils.h> std::pair<DataObject*, AIDA::IHistogram1D*> Gaudi::createH1D( ISvcLocator* svcLocator, const std::string& path, const std::string& title, int nBins, double xlow, diff --git a/GaudiCommonSvc/src/HistogramSvc/H2D.cpp b/GaudiCommonSvc/src/HistogramSvc/H2D.cpp index db25d900de68c3bd2fba4ae5054cf9aba2e65b50..cc562627341abcd65399aa2a782e509440f6663e 100644 --- a/GaudiCommonSvc/src/HistogramSvc/H2D.cpp +++ b/GaudiCommonSvc/src/HistogramSvc/H2D.cpp @@ -30,7 +30,7 @@ #include <TProfile.h> #include <array> -#include <HistogramPersistencySvc/RootHistogramUtils.h> +#include <Gaudi/Histograming/Sink/Utils.h> namespace { using AIDA::IHistogram1D; diff --git a/GaudiCommonSvc/src/HistogramSvc/H3D.cpp b/GaudiCommonSvc/src/HistogramSvc/H3D.cpp index 4d106adfde14fa45d82cb0e67d8943904a4589a2..2d96a8ba42cba549743f744bbcf782daa7ef01c9 100644 --- a/GaudiCommonSvc/src/HistogramSvc/H3D.cpp +++ b/GaudiCommonSvc/src/HistogramSvc/H3D.cpp @@ -27,7 +27,7 @@ #include <GaudiKernel/DataObject.h> #include <GaudiKernel/ObjectFactory.h> -#include <HistogramPersistencySvc/RootHistogramUtils.h> +#include <Gaudi/Histograming/Sink/Utils.h> #include "GaudiPI.h" #include "TH3D.h" diff --git a/GaudiCommonSvc/src/HistogramSvc/P1D.cpp b/GaudiCommonSvc/src/HistogramSvc/P1D.cpp index 966a2ba37b76bd7c0de9b5503f5791c66f2a860f..cd33e3c4c8ecd14c43c0ec954cd644649151f8df 100644 --- a/GaudiCommonSvc/src/HistogramSvc/P1D.cpp +++ b/GaudiCommonSvc/src/HistogramSvc/P1D.cpp @@ -26,7 +26,7 @@ #include <GaudiCommonSvc/P1D.h> #include <GaudiKernel/ObjectFactory.h> -#include <HistogramPersistencySvc/RootHistogramUtils.h> +#include <Gaudi/Histograming/Sink/Utils.h> #include <cmath> diff --git a/GaudiCommonSvc/src/HistogramSvc/P2D.cpp b/GaudiCommonSvc/src/HistogramSvc/P2D.cpp index 708276358dc661cd071087e9424f5eae5ca526aa..78970b60d1e3ea21eb578a6fcbf8b094db3c2be4 100644 --- a/GaudiCommonSvc/src/HistogramSvc/P2D.cpp +++ b/GaudiCommonSvc/src/HistogramSvc/P2D.cpp @@ -26,7 +26,7 @@ #include <GaudiKernel/DataObject.h> #include <GaudiKernel/ObjectFactory.h> -#include <HistogramPersistencySvc/RootHistogramUtils.h> +#include <Gaudi/Histograming/Sink/Utils.h> #include <TH2D.h> #include <TProfile2D.h> diff --git a/GaudiKernel/CMakeLists.txt b/GaudiKernel/CMakeLists.txt index e55a0ed38c0f93fba7a24ffbb05c2b4ede10440a..2d53646fbbcfc500e9707eb85ca960c131c58b39 100644 --- a/GaudiKernel/CMakeLists.txt +++ b/GaudiKernel/CMakeLists.txt @@ -1,5 +1,5 @@ ##################################################################################### -# (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations # +# (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # # # # This software is distributed under the terms of the Apache version 2 licence, # # copied verbatim in the file "LICENSE". # @@ -157,6 +157,7 @@ gaudi_add_library(GaudiKernel cppgsl::cppgsl fmt::fmt nlohmann_json::nlohmann_json + Rangev3::rangev3 ${GAUDI_ATOMIC_LIBS} PRIVATE Python::Python ) @@ -313,6 +314,9 @@ if(BUILD_TESTING) gaudi_add_executable(test_GaudiTimer SOURCES tests/src/test_GaudiTimer.cpp LINK GaudiKernel Boost::unit_test_framework TEST) + gaudi_add_executable(test_HistoUtils SOURCES tests/src/RootHistogramUtilsUnitTest.cpp + LINK GaudiKernel Boost::unit_test_framework ROOT::Hist TEST) + foreach(test_case IN ITEMS 01 02 03 04) add_executable(test_StatusCodeFail_case${test_case} tests/src/test_StatusCode_fail.cxx) target_include_directories(test_StatusCodeFail_case${test_case} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/GaudiCommonSvc/include/HistogramPersistencySvc/RootHistogramSinkBase.h b/GaudiKernel/include/Gaudi/Histograming/Sink/Base.h similarity index 98% rename from GaudiCommonSvc/include/HistogramPersistencySvc/RootHistogramSinkBase.h rename to GaudiKernel/include/Gaudi/Histograming/Sink/Base.h index c1529b7dd18107013d4b0cb83b6448fb1bea768f..a33b8bee0ffbf4c84b176c4e8048b4fb7da58fca 100644 --- a/GaudiCommonSvc/include/HistogramPersistencySvc/RootHistogramSinkBase.h +++ b/GaudiKernel/include/Gaudi/Histograming/Sink/Base.h @@ -1,5 +1,5 @@ /***********************************************************************************\ -* (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations * +* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * * * * This software is distributed under the terms of the Apache version 2 licence, * * copied verbatim in the file "LICENSE". * @@ -11,13 +11,10 @@ #include <Gaudi/BaseSink.h> #include <Gaudi/MonitoringHub.h> - #include <TFile.h> - -#include <nlohmann/json.hpp> - #include <filesystem> #include <map> +#include <nlohmann/json.hpp> #include <string> #include <vector> diff --git a/GaudiCommonSvc/include/HistogramPersistencySvc/RootHistogramUtils.h b/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h similarity index 99% rename from GaudiCommonSvc/include/HistogramPersistencySvc/RootHistogramUtils.h rename to GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h index 781955201a27f1bc9667a282472087c44957e3d8..c090d156a5a95bbe5b21a56c272ca3a42fba7fef 100644 --- a/GaudiCommonSvc/include/HistogramPersistencySvc/RootHistogramUtils.h +++ b/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h @@ -1,5 +1,5 @@ /***********************************************************************************\ -* (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations * +* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * * * * This software is distributed under the terms of the Apache version 2 licence, * * copied verbatim in the file "LICENSE". * @@ -10,10 +10,7 @@ \***********************************************************************************/ #pragma once -#include "GaudiKernel/GaudiException.h" - -#include <functional> - +#include <GaudiKernel/GaudiException.h> #include <TDirectory.h> #include <TFile.h> #include <TH1.h> @@ -22,11 +19,17 @@ #include <TH3D.h> #include <TProfile.h> #include <TProfile2D.h> - +#include <algorithm> +#include <functional> +#include <gsl/span> +#include <nlohmann/json.hpp> #include <range/v3/numeric/accumulate.hpp> #include <range/v3/range/conversion.hpp> #include <range/v3/view/split_when.hpp> #include <range/v3/view/transform.hpp> +#include <string> +#include <vector> + // upstream has renamed namespace ranges::view -> ranges::views #if RANGE_V3_VERSION < 900 namespace ranges::views { @@ -34,14 +37,6 @@ namespace ranges::views { } #endif -#include <gsl/span> -#include <nlohmann/json.hpp> - -#include <algorithm> -#include <functional> -#include <string> -#include <vector> - namespace Gaudi::Histograming::Sink { /** diff --git a/GaudiCommonSvc/tests/src/RootHistogramUtilsUnitTest.cpp b/GaudiKernel/tests/src/RootHistogramUtilsUnitTest.cpp similarity index 98% rename from GaudiCommonSvc/tests/src/RootHistogramUtilsUnitTest.cpp rename to GaudiKernel/tests/src/RootHistogramUtilsUnitTest.cpp index e0086b1127f3f251307b744ab08f93f53cff8277..e48f9eec5db8977111178541f7b47bb6e72a542e 100644 --- a/GaudiCommonSvc/tests/src/RootHistogramUtilsUnitTest.cpp +++ b/GaudiKernel/tests/src/RootHistogramUtilsUnitTest.cpp @@ -1,5 +1,5 @@ /***********************************************************************************\ -* (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations * +* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations * * * * This software is distributed under the terms of the Apache version 2 licence, * * copied verbatim in the file "LICENSE". * @@ -9,9 +9,9 @@ * or submit itself to any jurisdiction. * \***********************************************************************************/ #define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE test_CounterHistos +#define BOOST_TEST_MODULE test_HistoUtils -#include <HistogramPersistencySvc/RootHistogramUtils.h> +#include <Gaudi/Histograming/Sink/Utils.h> #include <boost/test/unit_test.hpp>