From 78b4c5d520e128a83680f34296af4a0c46abe624 Mon Sep 17 00:00:00 2001 From: Simon Gardner Date: Fri, 20 Dec 2024 08:20:23 +0000 Subject: [PATCH] Allow xrootd files as inputs to eicrecon (#1690) ### Briefly, what does this PR introduce? Currently eicrecon has two checks for files existing, neither of which allow the file to be on a remote xrootd server. This PR adapts JEventSourcePODIO.cc so that the first check allows for remote files and (currently) removes the second check. ### What kind of change does this PR introduce? - [x] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? tbd ### Does this PR change default behavior? Allows remote files to be passed directly to eicrecon --------- Co-authored-by: Dmitry Kalinkin --- src/services/io/podio/JEventSourcePODIO.cc | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/services/io/podio/JEventSourcePODIO.cc b/src/services/io/podio/JEventSourcePODIO.cc index faf3f4ba3..ee4351a6f 100644 --- a/src/services/io/podio/JEventSourcePODIO.cc +++ b/src/services/io/podio/JEventSourcePODIO.cc @@ -14,16 +14,12 @@ #include #include #include -#include #include -#include #include #include #include #include -#include #include -#include #include #include #include @@ -131,17 +127,6 @@ void JEventSourcePODIO::Open() { // Open primary events file try { - // Verify file exists - if( ! std::filesystem::exists(GetResourceName()) ){ - // Here we go against the standard practice of throwing an error and print - // the message and exit immediately. This is because we want the last message - // on the screen to be that the file doesn't exist. - auto mess = fmt::format(fmt::emphasis::bold | fg(fmt::color::red),"ERROR: "); - mess += fmt::format(fmt::emphasis::bold, "file: {} does not exist!", GetResourceName()); - std::cerr << std::endl << std::endl << mess << std::endl << std::endl; - std::_Exit(EXIT_FAILURE); - } - m_reader.openFile( GetResourceName() ); auto version = m_reader.currentFileVersion(); @@ -267,7 +252,7 @@ double JEventSourceGeneratorT::CheckOpenable(std::string reso // PODIO FrameReader segfaults on legacy input files, so we use ROOT to validate beforehand. Of course, // we can't validate if ROOT can't read the file. - std::unique_ptr file = std::make_unique(resource_name.c_str()); + std::unique_ptr file = std::unique_ptr{TFile::Open(resource_name.c_str())}; if (!file || file->IsZombie()) return 0.0; // We test the format the same way that PODIO's python API does. See python/podio/reading.py