lhapdf
is hosted by
Hepforge
,
IPPP Durham
LHAPDF
6.5.5
Loading...
Searching...
No Matches
include
LHAPDF
Paths.h
1
// -*- C++ -*-
2
//
3
// This file is part of LHAPDF
4
// Copyright (C) 2012-2024 The LHAPDF collaboration (see AUTHORS for details)
5
//
6
#
pragma
once
7
#
ifndef
LHAPDF_Paths_H
8
#
define
LHAPDF_Paths_H
9
10
#
include
"LHAPDF/Utils.h"
11
12
namespace
LHAPDF
{
13
14
15
/// @defgroup search Searching for PDF data
16
///@{
17
18
19
/// @name Search path handling functions
20
///@{
21
22
/// @brief Get the ordered list of search paths, from $LHAPDF_DATA_PATH and the install location
23
/// @note The install prefix will be appended *unless* $LHAPDF_DATA_PATH ends with a double colon, i.e. '::'
24
std
::
vector
<
std
::
string
>
paths
();
25
26
/// Set the search paths list as a colon-separated string
27
void
setPaths
(
const
std::string& pathstr);
28
/// Set the search paths list
29
inline
void
setPaths
(
std
::
vector
<
string
>
paths
) {
30
setPaths
(
join
(
paths
,
":"
));
31
}
32
33
34
/// Prepend to the search paths list
35
inline
void
pathsPrepend
(
const
std::string& p) {
36
vector<string> ps = paths();
37
ps.insert(ps.begin(), p);
38
//ps.pop_back(); //< Discard the auto-added fallback path to the installed data prefix
39
setPaths
(ps);
40
}
41
42
43
/// Append to the search paths list
44
inline
void
pathsAppend
(
const
std::string& p) {
45
vector<string> ps = paths();
46
//ps.pop_back(); //< Discard the auto-added fallback path to the installed data prefix
47
ps.push_back(p);
48
setPaths
(ps);
49
}
50
51
52
/// Return the first location in which a file is found
53
///
54
/// If no matching file is found, return an empty path.
55
std
::
string
findFile
(
const
std::string& target);
56
57
/// Return all locations in which a file is found
58
std
::
vector
<
std
::
string
>
findFiles
(
const
std::string& target);
59
60
///@}
61
62
63
/// @name PDF-specific path functions
64
///@{
65
66
/// Get the standard path-end elements expected for a PDF member data-file
67
inline
std
::
string
pdfmempath
(
const
std::string& setname,
int
member) {
68
const
string memname = setname +
"_"
+ to_str_zeropad(member) +
".dat"
;
69
const
string mempath = setname / memname;
70
return
mempath;
71
}
72
73
/// Search for the data-path of a PDF member
74
inline
std
::
string
findpdfmempath
(
const
std::string& setname,
int
member) {
75
return
findFile(pdfmempath(setname, member));
76
}
77
78
/// Get the standard path-end elements expected for a PDF set's info-file
79
inline
std
::
string
pdfsetinfopath
(
const
std::string& setname) {
80
const
string infoname = setname +
".info"
;
81
const
string setinfo = setname / infoname;
82
return
setinfo;
83
}
84
85
/// Search for the info-path of a PDF set
86
inline
std
::
string
findpdfsetinfopath
(
const
std::string& setname) {
87
/// @todo Check that set info and mem=0 file are in same dir?
88
return
findFile(pdfsetinfopath(setname));
89
}
90
91
92
/// @brief Get the names of all available PDF sets in the search path
93
///
94
/// @note Taken from scanning the directories in the search path
95
/// (i.e. LHAPDF_DATA_PATH) for viable PDF sets.
96
///
97
/// @note The result is cached when first called, to avoid repeated filesystem
98
/// walking. It's assumed that new PDFs will not appear on the filesystem
99
/// during a run: please let the authors know if that's not a good assumption!
100
const
std
::
vector
<
std
::
string
>&
availablePDFSets
();
101
102
///@}
103
104
105
}
106
107
#
endif
LHAPDF::availablePDFSets
const std::vector< std::string > & availablePDFSets()
Get the names of all available PDF sets in the search path.
LHAPDF::findpdfmempath
std::string findpdfmempath(const std::string &setname, int member)
Search for the data-path of a PDF member.
Definition
Paths.h:74
LHAPDF::pathsAppend
void pathsAppend(const std::string &p)
Append to the search paths list.
Definition
Paths.h:44
LHAPDF::pdfmempath
std::string pdfmempath(const std::string &setname, int member)
Get the standard path-end elements expected for a PDF member data-file.
Definition
Paths.h:67
LHAPDF::findFiles
std::vector< std::string > findFiles(const std::string &target)
Return all locations in which a file is found.
LHAPDF::findFile
std::string findFile(const std::string &target)
LHAPDF::pathsPrepend
void pathsPrepend(const std::string &p)
Prepend to the search paths list.
Definition
Paths.h:35
LHAPDF::paths
std::vector< std::string > paths()
Get the ordered list of search paths, from $LHAPDF_DATA_PATH and the install location.
LHAPDF::findpdfsetinfopath
std::string findpdfsetinfopath(const std::string &setname)
Search for the info-path of a PDF set.
Definition
Paths.h:86
LHAPDF::setPaths
void setPaths(const std::string &pathstr)
Set the search paths list as a colon-separated string.
LHAPDF::pdfsetinfopath
std::string pdfsetinfopath(const std::string &setname)
Get the standard path-end elements expected for a PDF set's info-file.
Definition
Paths.h:79
LHAPDF::setPaths
void setPaths(std::vector< string > paths)
Set the search paths list.
Definition
Paths.h:29
LHAPDF
Namespace for all LHAPDF functions and classes.
Definition
AlphaS.h:14
Generated on Mon Dec 16 2024 19:04:48 for LHAPDF by
1.12.0