diff --git a/Steer/src/CollisionContextTool.cxx b/Steer/src/CollisionContextTool.cxx index 5287e1ef32799..a6c2b0e62e0ca 100644 --- a/Steer/src/CollisionContextTool.cxx +++ b/Steer/src/CollisionContextTool.cxx @@ -260,8 +260,15 @@ bool copy_collision_context(const std::string& external_path, int this_tf_id, in { namespace fs = std::filesystem; try { - // Construct source file path - fs::path filename = fs::path(external_path) / ("collission_context_" + std::to_string(this_tf_id) + ".root"); + fs::path filename; + if (fs::exists(external_path) && fs::is_regular_file(external_path)) { + std::cout << "external_path is an existing file: " << external_path << "\n"; + // use it directly + filename = fs::path(external_path); + } else { + // Construct source file path + filename = fs::path(external_path) / ("collission_context_" + std::to_string(this_tf_id) + ".root"); + } LOG(info) << "Checking existence of file: " << filename;