Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:47

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <cstddef>
0012 #include <string>
0013 #include <utility>
0014 #include <vector>
0015 
0016 namespace ActsExamples {
0017 
0018 /// Ensure that the given directory exists and is writable.
0019 ///
0020 /// @return Canonical path to the directory.
0021 ///
0022 /// Will create missing directories and throw on any error.
0023 std::string ensureWritableDirectory(const std::string& dir);
0024 
0025 /// Join dir and name into one path with correct handling of empty dirs.
0026 std::string joinPaths(const std::string& dir, const std::string& name);
0027 
0028 /// Construct a file path of the form `[<dir>/]event<XXXXXXXXX>-<name>`.
0029 ///
0030 /// @params dir output directory, current directory if empty
0031 /// @params name basic filename
0032 /// @params event event number
0033 std::string perEventFilepath(const std::string& dir, const std::string& name,
0034                              std::size_t event);
0035 
0036 /// Determine the range of available events in a directory of per-event files.
0037 ///
0038 /// @params dir input directory, current directory if empty
0039 /// @params name base filename
0040 /// @return first and last+1 event number
0041 /// @returns {0, 0} when no matching files could be found
0042 ///
0043 /// Event files must be named `[<dir>/]event<XXXXXXXXX>-<name>` to be considered
0044 std::pair<std::size_t, std::size_t> determineEventFilesRange(
0045     const std::string& dir, const std::string& name);
0046 
0047 }  // namespace ActsExamples