Juggler
Juggling algorithms and event processing using gaudi framework
Paths.hpp
Go to the documentation of this file.
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 #include <string>
12 #include <utility>
13 #include <vector>
14 
15 namespace Jug {
16 
17 /// Ensure that the given directory exists and is writable.
18 ///
19 /// @return Canonical path to the directory.
20 ///
21 /// Will create missing directories and throw on any error.
22 std::string ensureWritableDirectory(const std::string& dir);
23 
24 /// Join dir and name into one path with correct handling of empty dirs.
25 std::string joinPaths(const std::string& dir, const std::string& name);
26 
27 /// Construct a file path of the form `[<dir>/]event<XXXXXXXXX>-<name>`.
28 ///
29 /// @params dir output directory, current directory if empty
30 /// @params name basic filename
31 /// @params event event number
32 std::string perEventFilepath(const std::string& dir, const std::string& name,
33  size_t event);
34 
35 /// Determine the range of available events in a directory of per-event files.
36 ///
37 /// @params dir input directory, current directory if empty
38 /// @params name base filename
39 /// @return first and last+1 event number
40 /// @returns {0, 0} when no matching files could be found
41 ///
42 /// Event files must be named `[<dir>/]event<XXXXXXXXX>-<name>` to be considered
43 std::pair<size_t, size_t> determineEventFilesRange(const std::string& dir,
44  const std::string& name);
45 
46 } // namespace FW
Jug::joinPaths
std::string joinPaths(const std::string &dir, const std::string &name)
Join dir and name into one path with correct handling of empty dirs.
Definition: Paths.cpp:34
Jug::perEventFilepath
std::string perEventFilepath(const std::string &dir, const std::string &name, size_t event)
Definition: Paths.cpp:43
Jug
Definition: DD4hepBField.h:22
Jug::determineEventFilesRange
std::pair< size_t, size_t > determineEventFilesRange(const std::string &dir, const std::string &name)
Definition: Paths.cpp:57
Jug::ensureWritableDirectory
std::string ensureWritableDirectory(const std::string &dir)
Definition: Paths.cpp:21