lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF 6.5.4
Loading...
Searching...
No Matches
Paths.h
1// -*- C++ -*-
2//
3// This file is part of LHAPDF
4// Copyright (C) 2012-2023 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
12namespace LHAPDF {
13
14
17
18
21
24 std::vector<std::string> paths();
25
27 void setPaths(const std::string& pathstr);
29 inline void setPaths(std::vector<string> paths) {
30 setPaths(join(paths, ":"));
31 }
32
33
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
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
55 std::string findFile(const std::string& target);
56
58 std::vector<std::string> findFiles(const std::string& target);
59
61
62
65
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
74 inline std::string findpdfmempath(const std::string& setname, int member) {
75 return findFile(pdfmempath(setname, member));
76 }
77
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
86 inline std::string findpdfsetinfopath(const std::string& setname) {
88 return findFile(pdfsetinfopath(setname));
89 }
90
91
100 const std::vector<std::string>& availablePDFSets();
101
103
104
105}
106
107#endif
const std::vector< std::string > & availablePDFSets()
Get the names of all available PDF sets in the search path.
std::string findpdfmempath(const std::string &setname, int member)
Find a PDF member-data file path in the search paths.
Definition Paths.h:74
void pathsAppend(const std::string &p)
Append to the search paths list.
Definition Paths.h:44
std::string pdfmempath(const std::string &setname, int member)
Build the form of a PDF member-data file path relative to the search dir.
Definition Paths.h:67
std::vector< std::string > findFiles(const std::string &target)
Return all locations in which a file is found.
std::string findFile(const std::string &target)
void pathsPrepend(const std::string &p)
Prepend to the search paths list.
Definition Paths.h:35
std::vector< std::string > paths()
Get the ordered list of search paths, from $LHAPDF_DATA_PATH and the install location.
std::string findpdfsetinfopath(const std::string &setname)
Find a PDF info file path in the search paths.
Definition Paths.h:86
void setPaths(const std::string &pathstr)
Set the search paths list as a colon-separated string.
std::string pdfsetinfopath(const std::string &setname)
Build the form of a PDF info file path relative to the search dir.
Definition Paths.h:79
std::string to_str_zeropad(int val, size_t nchars=4)
Format an integer val as a zero-padded string of length nchars.
Definition Utils.h:78
std::string join(const std::vector< std::string > &svec, const std::string &sep)
Concatenate strings with separator strings between each element.
Definition Utils.h:85
Namespace for all LHAPDF functions and classes.
Definition AlphaS.h:14