diff --git a/.github/workflows/eicshell.yml b/.github/workflows/eicshell.yml index 3e81639ab..0747c04c5 100644 --- a/.github/workflows/eicshell.yml +++ b/.github/workflows/eicshell.yml @@ -23,7 +23,7 @@ jobs: mkdir -p $GITHUB_WORKSPACE/build cd $GITHUB_WORKSPACE/build cmake .. \ - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/jana_home \ + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE \ -DCMAKE_CXX_STANDARD=20 \ -DUSE_PYTHON=ON \ -DUSE_ROOT=ON \ @@ -45,17 +45,20 @@ jobs: with: platform-release: "jug_xl:nightly" run: | - $GITHUB_WORKSPACE/jana_home/bin/jana \ - -Pjana:plugin_path=$GITHUB_WORKSPACE/jana_home/plugins \ - -Pplugins=JTest \ - -Pjana:nevents=100 + export JANA_HOME=$GITHUB_WORKSPACE + export JANA_PLUGIN_PATH=$JANA_HOME/plugins + export LD_LIBRARY_PATH=$JANA_HOME/lib:$LD_LIBRARY_PATH + $GITHUB_WORKSPACE/bin/jana -Pplugins=JTest -Pjana:nevents=100 - name: Run jana-unit-tests uses: eic/run-cvmfs-osg-eic-shell@main with: platform-release: "jug_xl:nightly" run: | - $GITHUB_WORKSPACE/jana_home/bin/jana-unit-tests + export JANA_HOME=$GITHUB_WORKSPACE + export JANA_PLUGIN_PATH=$JANA_HOME/plugins + export LD_LIBRARY_PATH=$JANA_HOME/lib:$LD_LIBRARY_PATH + $GITHUB_WORKSPACE/bin/jana-unit-tests - name: Run TimesliceExample with simple (physics event) topology uses: eic/run-cvmfs-osg-eic-shell@main @@ -63,8 +66,10 @@ jobs: platform-release: "jug_xl:nightly" run: | echo "--- Running TimesliceExample with simple topology ------------------------------" - $GITHUB_WORKSPACE/jana_home/bin/jana \ - -Pjana:plugin_path=$GITHUB_WORKSPACE/jana_home/plugins \ + export JANA_HOME=$GITHUB_WORKSPACE + export JANA_PLUGIN_PATH=$JANA_HOME/plugins + export LD_LIBRARY_PATH=$JANA_HOME/lib:$LD_LIBRARY_PATH + $GITHUB_WORKSPACE/bin/jana \ -Pplugins=TimesliceExample \ -Pjana:nevents=100 \ events.root @@ -75,7 +80,10 @@ jobs: platform-release: "jug_xl:nightly" run: | echo "--- Running TimesliceExample with simple topology ------------------------------" - $GITHUB_WORKSPACE/jana_home/bin/jana -Pjana:plugin_path=$GITHUB_WORKSPACE/jana_home/plugins -Pplugins=TimesliceExample -Pjana:nevents=100 timeslices.root + export JANA_HOME=$GITHUB_WORKSPACE + export JANA_PLUGIN_PATH=$JANA_HOME/plugins + export LD_LIBRARY_PATH=$JANA_HOME/lib:$LD_LIBRARY_PATH + $GITHUB_WORKSPACE/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=100 timeslices.root - name: Compile EICrecon @@ -84,9 +92,12 @@ jobs: platform-release: "jug_xl:nightly" run: | echo "--- Compiling EICrecon ---" + export JANA_HOME=$GITHUB_WORKSPACE + export LD_LIBRARY_PATH=$JANA_HOME/lib:$LD_LIBRARY_PATH + cd .. git clone https://github.com/eic/EICrecon cd EICrecon - cmake -S . -B build -DJANA_DIR=$GITHUB_WORKSPACE/jana_home/lib/cmake/JANA + cmake -S . -B build -DJANA_DIR=$JANA_HOME/lib/cmake/JANA cmake --build build --target install -- -j8 - name: Generate EICrecon input data @@ -108,5 +119,8 @@ jobs: setup: "/opt/detector/epic-main/bin/thisepic.sh" run: | echo "--- Running EICrecon ---" - eicrecon sim_e_1GeV_20GeV_craterlake.edm4hep.root + export JANA_HOME=$GITHUB_WORKSPACE + export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/../EICrecon/lib:$JANA_HOME/lib:$LD_LIBRARY_PATH + export JANA_PLUGIN_PATH=$GITHUB_WORKSPACE/../EICrecon/lib/EICrecon/plugins + ../EICrecon/bin/eicrecon sim_e_1GeV_20GeV_craterlake.edm4hep.root diff --git a/.gitignore b/.gitignore index ae9369ab0..0b4376270 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ Makefile /bin/ /include/ /lib/ +/plugins/ # Doxygen generated files docs/html/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 34fa3eaf9..5d0d20eac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0074 NEW) # find_package() uses _ROOT implicit hints -project(jana2 VERSION 2.3.0) +project(jana2 VERSION 2.3.1) set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Enable -fPIC for all targets diff --git a/docs/Download.md b/docs/Download.md index 29a640e2a..e74fe2c43 100644 --- a/docs/Download.md +++ b/docs/Download.md @@ -25,6 +25,13 @@ title: JANA: Multi-threaded HENP Event Reconstruction - [See online doxygen documentation](http://www.jlab.org/JANA/jana_doc_latest/index.html) - [Download doxygen documentation](http://www.jlab.org/JANA/jana_doc_latest.tar.gz) +### 2.3.1 +This release fixes a bug which caused the `janadot` plugin to stop producing output. It also drops support for Podio <= 00-17 by replacing the user-provided `PodioTypeMap` with the built-in `PodioT::collection_type`. + +- [See release on GitHub](https://github.com/JeffersonLab/JANA2/releases/tag/v2.3.1) +- [See online doxygen documentation](http://www.jlab.org/JANA/jana_doc_2.3.1/index.html) +- [Download doxygen documentation](http://www.jlab.org/JANA/jana_doc_2.3.1.tar.gz) + ### 2.3.0 - [See release on GitHub](https://github.com/JeffersonLab/JANA2/releases/tag/v2.3.0) - [See online doxygen documentation](http://www.jlab.org/JANA/jana_doc_2.3.0/index.html) diff --git a/src/examples/SubeventExample/CMakeLists.txt b/src/examples/SubeventExample/CMakeLists.txt index 411944187..088ac2927 100644 --- a/src/examples/SubeventExample/CMakeLists.txt +++ b/src/examples/SubeventExample/CMakeLists.txt @@ -8,6 +8,6 @@ add_executable(SubeventExample ${SubeventExample_SOURCES}) target_link_libraries(SubeventExample jana2) set_target_properties(SubeventExample PROPERTIES PREFIX "" OUTPUT_NAME "SubeventExample") -install(TARGETS SubeventExample DESTINATION programs) +install(TARGETS SubeventExample DESTINATION bin) diff --git a/src/libraries/JANA/Engine/JScheduler.cc b/src/libraries/JANA/Engine/JScheduler.cc index a3f4ab269..4c0786df2 100644 --- a/src/libraries/JANA/Engine/JScheduler.cc +++ b/src/libraries/JANA/Engine/JScheduler.cc @@ -131,7 +131,7 @@ void JScheduler::checkin_unprotected(JArrow* assignment, JArrowMetrics::Status l } -JArrow* JScheduler::checkout(int arrow_index) { +JArrow* JScheduler::checkout(size_t arrow_index) { // Note that this lets us check out Inactive arrows, whereas checkout_unprotected() does not. This because we are called by JApplicationInspector // whereas checkout_unprotected is called by JWorker. This is because JArrowProcessingController::request_pause shuts off the topology // instead of shutting off the workers, which in hindsight might have been the wrong choice. diff --git a/src/libraries/JANA/Engine/JScheduler.h b/src/libraries/JANA/Engine/JScheduler.h index ecf9cc3e0..1a2ed22e0 100644 --- a/src/libraries/JANA/Engine/JScheduler.h +++ b/src/libraries/JANA/Engine/JScheduler.h @@ -78,7 +78,7 @@ class JScheduler { /// Lets a Worker, test case, or user request a specific arrow. Returns nullptr if arrow can not be /// checked up because it's no longer active or because it's already at its max parallelism. - JArrow* checkout(int arrow_index); + JArrow* checkout(size_t arrow_index); /// Logger is public so that somebody else can configure it JLogger logger; diff --git a/src/libraries/JANA/JEventSource.h b/src/libraries/JANA/JEventSource.h index 569c7ba13..f4b757d05 100644 --- a/src/libraries/JANA/JEventSource.h +++ b/src/libraries/JANA/JEventSource.h @@ -279,9 +279,7 @@ class JEventSource : public jana::omni::JComponent, public jana::omni::JHasOutpu // Skip these events due to nskip event->SetEventNumber(m_event_count); // Default event number to event count auto previous_origin = event->GetJCallGraphRecorder()->SetInsertDataOrigin( JCallGraphRecorder::ORIGIN_FROM_SOURCE); // (see note at top of JCallGraphRecorder.h) - CallWithJExceptionWrapper("JEventSource::GetEvent", [&](){ - GetEvent(event); - }); + GetEvent(event); event->GetJCallGraphRecorder()->SetInsertDataOrigin( previous_origin ); m_event_count += 1; return Result::FailureTryAgain; // Reject this event and recycle it @@ -298,9 +296,7 @@ class JEventSource : public jana::omni::JComponent, public jana::omni::JHasOutpu event->SetSequential(false); event->GetJCallGraphRecorder()->Reset(); auto previous_origin = event->GetJCallGraphRecorder()->SetInsertDataOrigin( JCallGraphRecorder::ORIGIN_FROM_SOURCE); // (see note at top of JCallGraphRecorder.h) - CallWithJExceptionWrapper("JEventSource::GetEvent", [&](){ - GetEvent(event); - }); + GetEvent(event); for (auto* output : m_outputs) { output->InsertCollection(*event); } @@ -335,6 +331,33 @@ class JEventSource : public jana::omni::JComponent, public jana::omni::JHasOutpu return Result::Success; } } + catch (JException& ex) { + if (ex.function_name.empty()) ex.function_name = "JEventSource::GetEvent"; + if (ex.type_name.empty()) ex.type_name = m_type_name; + if (ex.instance_name.empty()) ex.instance_name = m_prefix; + if (ex.plugin_name.empty()) ex.plugin_name = m_plugin_name; + throw ex; + } + catch (std::exception& e){ + auto ex = JException(e.what()); + ex.exception_type = JTypeInfo::demangle_current_exception_type(); + ex.nested_exception = std::current_exception(); + ex.function_name = "JEventSource::GetEvent"; + ex.type_name = m_type_name; + ex.instance_name = m_prefix; + ex.plugin_name = m_plugin_name; + throw ex; + } + catch (...) { + auto ex = JException("Unknown exception"); + ex.exception_type = JTypeInfo::demangle_current_exception_type(); + ex.nested_exception = std::current_exception(); + ex.function_name = "JEventSource::GetEvent"; + ex.type_name = m_type_name; + ex.instance_name = m_prefix; + ex.plugin_name = m_plugin_name; + throw ex; + } } /// Calls the optional-and-discouraged user-provided FinishEvent virtual method, enforcing diff --git a/src/libraries/JANA/JFactory.cc b/src/libraries/JANA/JFactory.cc index 19c646b9c..1abd2764c 100644 --- a/src/libraries/JANA/JFactory.cc +++ b/src/libraries/JANA/JFactory.cc @@ -41,9 +41,6 @@ void JFactory::Create(const std::shared_ptr& event) { } void JFactory::DoInit() { - if (GetApplication() == nullptr) { - throw JException("JFactory::DoInit(): Null JApplication pointer"); - } if (mStatus == Status::Uninitialized) { CallWithJExceptionWrapper("JFactory::Init", [&](){ Init(); }); mStatus = Status::Unprocessed; diff --git a/src/libraries/JANA/JFactorySet.cc b/src/libraries/JANA/JFactorySet.cc index 2421e6b1d..5d801b18d 100644 --- a/src/libraries/JANA/JFactorySet.cc +++ b/src/libraries/JANA/JFactorySet.cc @@ -105,7 +105,6 @@ bool JFactorySet::Add(JMultifactory *multifactory) { auto helpers = multifactory->GetHelpers(); for (auto fac : helpers->GetAllFactories()) { - fac->SetApplication(multifactory->GetApplication()); Add(fac); } helpers->mIsFactoryOwner = false; diff --git a/src/libraries/JANA/JMultifactory.h b/src/libraries/JANA/JMultifactory.h index df5be8672..6ca466506 100644 --- a/src/libraries/JANA/JMultifactory.h +++ b/src/libraries/JANA/JMultifactory.h @@ -242,14 +242,12 @@ void JMultifactory::SetCollection(std::string tag, std::unique_ptr void JMultifactoryHelper::Process(const std::shared_ptr &event) { - mMultiFactory->SetApplication(this->GetApplication()); mMultiFactory->Execute(event); } #if JANA2_HAVE_PODIO template void JMultifactoryHelperPodio::Process(const std::shared_ptr &event) { - mMultiFactory->SetApplication(this->GetApplication()); mMultiFactory->Execute(event); } #endif // JANA2_HAVE_PODIO diff --git a/src/libraries/JANA/JVersion.h.in b/src/libraries/JANA/JVersion.h.in index 454e3a84c..ac495c47f 100644 --- a/src/libraries/JANA/JVersion.h.in +++ b/src/libraries/JANA/JVersion.h.in @@ -10,6 +10,10 @@ #define JANA2_HAVE_ROOT @JANA2_HAVE_ROOT@ #define JANA2_HAVE_XERCES @JANA2_HAVE_XERCES@ +#define JANA2_COMMIT_HASH "@JVERSION_COMMIT_HASH@" +#define JANA2_COMMIT_DATE "@JVERSION_COMMIT_DATE@" +#define JANA2_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" + struct JVersion { @@ -17,10 +21,6 @@ struct JVersion { static const uint64_t minor = @jana2_VERSION_MINOR@; static const uint64_t patch = @jana2_VERSION_PATCH@; - inline static const std::string last_commit_hash = "@JVERSION_COMMIT_HASH@"; - inline static const std::string last_commit_date = "@JVERSION_COMMIT_DATE@"; - inline static const std::string installdir = "@CMAKE_INSTALL_PREFIX@"; - static const bool is_unknown = @JVERSION_UNKNOWN@; static const bool is_release = @JVERSION_RELEASE@; static const bool is_modified = @JVERSION_MODIFIED@; @@ -29,9 +29,9 @@ struct JVersion { static constexpr uint64_t GetMinorNumber() { return minor; } static constexpr uint64_t GetPatchNumber() { return patch; } - static std::string GetCommitHash() { return last_commit_hash; } - static std::string GetCommitDate() { return last_commit_date; } - static std::string GetInstallDir() { return installdir; } + static std::string GetCommitHash() { return JANA2_COMMIT_HASH; } + static std::string GetCommitDate() { return JANA2_COMMIT_DATE; } + static std::string GetInstallDir() { return JANA2_INSTALL_PREFIX; } static constexpr bool HasPodio() { return JANA2_HAVE_PODIO; } static constexpr bool HasROOT() { return JANA2_HAVE_ROOT; } diff --git a/src/libraries/JANA/Services/JComponentManager.cc b/src/libraries/JANA/Services/JComponentManager.cc index 9499c2c59..fb050eec7 100644 --- a/src/libraries/JANA/Services/JComponentManager.cc +++ b/src/libraries/JANA/Services/JComponentManager.cc @@ -115,13 +115,28 @@ void JComponentManager::initialize_components() { // Factories for (auto* fac : dummy_fac_set.GetAllFactories()) { - fac->DoInit(); + try { + // Run Init() on each factory in order to capture any parameters + // (and eventually services) that are retrieved via GetApplication(). + fac->DoInit(); + } + catch (...) { + // Swallow any exceptions! + // Everything in dummy_fac_set will be destroyed immediately after this. + // The same exception will be thrown from a fresh factory + // set once processing begins, unless the factory is never used. + } fac->Summarize(m_summary); } // Multifactories for (auto* fac : dummy_fac_set.GetAllMultifactories()) { - fac->DoInit(); + try { + fac->DoInit(); + } + catch (...) { + // Swallow any exceptions! See above. + } fac->Summarize(m_summary); } }