diff --git a/Framework/CMakeLists.txt b/Framework/CMakeLists.txt index 0c0e22e9e85c0..40a33ea80fdfe 100644 --- a/Framework/CMakeLists.txt +++ b/Framework/CMakeLists.txt @@ -17,13 +17,14 @@ add_subdirectory(Core) add_subdirectory(Utils) -add_subdirectory(AnalysisSupport) +add_subdirectory(AnalysisSupport) +add_subdirectory(PhysicsSupport) add_subdirectory(RootAnalysisHelpers) # Build the GUI support only if we have DebugGUI if (TARGET AliceO2::DebugGUI) -add_subdirectory(GUISupport) +add_subdirectory(GUISupport) endif() -add_subdirectory(TestWorkflows) +add_subdirectory(TestWorkflows) diff --git a/Framework/Core/CMakeLists.txt b/Framework/Core/CMakeLists.txt index 648f616bd5aec..f87c531d0687a 100644 --- a/Framework/Core/CMakeLists.txt +++ b/Framework/Core/CMakeLists.txt @@ -145,7 +145,6 @@ o2_add_library(Framework CURL::libcurl FairMQ::FairMQ O2::MathUtils - ROOT::EG ROOT::Tree O2::CCDB O2::FrameworkFoundation diff --git a/Framework/Core/include/Framework/CommonServices.h b/Framework/Core/include/Framework/CommonServices.h index fd6e4aad3da9c..361a4518a6195 100644 --- a/Framework/Core/include/Framework/CommonServices.h +++ b/Framework/Core/include/Framework/CommonServices.h @@ -80,14 +80,13 @@ struct CommonServices { }; struct CommonAnalysisServices { - static ServiceSpec databasePDGSpec(); - template static void addAnalysisService(std::vector& specs) { - if constexpr (std::is_same_v) { - specs.push_back(databasePDGSpec()); - } + std::vector loadableServices = {}; + char const* analysisServices = "O2FrameworkPhysicsSupport:PDGSupport"; + loadableServices = ServiceHelpers::parseServiceSpecString(analysisServices); + ServiceHelpers::loadFromPlugin(loadableServices, specs); } }; diff --git a/Framework/Core/src/CommonServices.cxx b/Framework/Core/src/CommonServices.cxx index cffca44a122dc..dee37c6f03853 100644 --- a/Framework/Core/src/CommonServices.cxx +++ b/Framework/Core/src/CommonServices.cxx @@ -42,8 +42,6 @@ #include "DecongestionService.h" #include "ArrowSupport.h" #include "DPLMonitoringBackend.h" -#include "TDatabasePDG.h" -#include "../../../DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h" #include "Headers/STFHeader.h" #include "Headers/DataHeader.h" @@ -956,18 +954,5 @@ std::vector CommonServices::defaultServices(int numThreads) return specs; } -o2::framework::ServiceSpec CommonAnalysisServices::databasePDGSpec() -{ - return ServiceSpec{ - .name = "database-pdg", - .init = [](ServiceRegistry&, DeviceState&, fair::mq::ProgOptions&) -> ServiceHandle { - auto* ptr = new TDatabasePDG(); - o2::O2DatabasePDG::addALICEParticles(ptr); - return ServiceHandle{TypeIdHelpers::uniqueId(), ptr, ServiceKind::Serial, "database-pdg"}; - }, - .configure = CommonServices::noConfiguration(), - .exit = [](ServiceRegistry&, void* service) { reinterpret_cast(service)->Delete(); }, - .kind = ServiceKind::Serial}; -} } // namespace o2::framework #pragma GCC diagnostic pop diff --git a/Framework/PhysicsSupport/CMakeLists.txt b/Framework/PhysicsSupport/CMakeLists.txt new file mode 100644 index 0000000000000..08a74dd65fc65 --- /dev/null +++ b/Framework/PhysicsSupport/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. +o2_add_library(FrameworkPhysicsSupport + SOURCES src/Plugin.cxx + PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src + PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat) diff --git a/Framework/PhysicsSupport/src/Plugin.cxx b/Framework/PhysicsSupport/src/Plugin.cxx new file mode 100644 index 0000000000000..b36c4ca9d6179 --- /dev/null +++ b/Framework/PhysicsSupport/src/Plugin.cxx @@ -0,0 +1,39 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +#include "Framework/Plugins.h" +#include "Framework/ServiceHandle.h" +#include "Framework/ServiceSpec.h" +#include "Framework/CommonServices.h" +#include "TDatabasePDG.h" +#include "SimulationDataFormat/O2DatabasePDG.h" + +using namespace o2::framework; + +struct PDGSupport : o2::framework::ServicePlugin { + o2::framework::ServiceSpec* create() final + { + return new ServiceSpec{ + .name = "database-pdg", + .init = [](ServiceRegistry&, DeviceState&, fair::mq::ProgOptions&) -> ServiceHandle { + auto* ptr = new TDatabasePDG(); + o2::O2DatabasePDG::addALICEParticles(ptr); + return ServiceHandle{TypeIdHelpers::uniqueId(), ptr, ServiceKind::Serial, "database-pdg"}; + }, + .configure = CommonServices::noConfiguration(), + .exit = [](ServiceRegistry&, void* service) { reinterpret_cast(service)->Delete(); }, + .kind = ServiceKind::Serial}; + } +}; + +DEFINE_DPL_PLUGINS_BEGIN +DEFINE_DPL_PLUGIN_INSTANCE(PDGSupport, CustomService); +DEFINE_DPL_PLUGINS_END diff --git a/cmake/O2AddWorkflow.cmake b/cmake/O2AddWorkflow.cmake index 97a3ad8d80299..6a5fd5ba06efa 100644 --- a/cmake/O2AddWorkflow.cmake +++ b/cmake/O2AddWorkflow.cmake @@ -54,7 +54,7 @@ function(o2_add_dpl_workflow baseTargetName) add_custom_command( TARGET ${targetExeName} POST_BUILD COMMAND ${CMAKE_COMMAND} -E env ASAN_OPTIONS=detect_leaks=0,detect_container_overflow=0,detect_odr_violation=0 "LD_LIBRARY_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$$LD_LIBRARY_PATH" $ -b --dump-workflow --dump-workflow-file ${jsonFile}) - add_dependencies(${targetExeName} O2::FrameworkAnalysisSupport) + add_dependencies(${targetExeName} O2::FrameworkAnalysisSupport O2::FrameworkPhysicsSupport) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${jsonFile}