LHAPDF is hosted by Hepforge, IPPP Durham
LHAPDF  6.1.6
Paths.h
1 // -*- C++ -*-
2 //
3 // This file is part of LHAPDF
4 // Copyright (C) 2012-2016 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 
16 
17 
20  std::vector<std::string> paths();
21 
23  void setPaths(const std::string& pathstr);
25  inline void setPaths(std::vector<string> paths) {
26  setPaths(join(paths, ":"));
27  }
28 
29 
31  inline void pathsPrepend(const std::string& p) {
32  vector<string> ps = paths();
33  ps.insert(ps.begin(), p);
34  ps.pop_back(); //< Discard the auto-added fallback path to the installed data prefix
35  setPaths(ps);
36  }
37 
38 
40  inline void pathsAppend(const std::string& p) {
41  vector<string> ps = paths();
42  ps.pop_back(); //< Discard the auto-added fallback path to the installed data prefix
43  ps.push_back(p);
44  setPaths(ps);
45  }
46 
47 
51  std::string findFile(const std::string& target);
53 
54 
55 
57 
58 
59  inline std::string pdfmempath(const std::string& setname, int member) {
60  const string memname = setname + "_" + to_str_zeropad(member) + ".dat";
61  const string mempath = setname / memname;
62  return mempath;
63  }
64 
65  inline std::string findpdfmempath(const std::string& setname, int member) {
66  return findFile(pdfmempath(setname, member));
67  }
68 
69  inline std::string pdfsetinfopath(const std::string& setname) {
70  const string infoname = setname + ".info";
71  const string setinfo = setname / infoname;
72  return setinfo;
73  }
74 
75  inline std::string findpdfsetinfopath(const std::string& setname) {
77  return findFile(pdfsetinfopath(setname));
78  }
79 
81 
82 
91  const std::vector<std::string>& availablePDFSets();
92 
93 
94 }
95 
96 #endif
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
const std::vector< std::string > & availablePDFSets()
Get the names of all available PDF sets in the search path.
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
void pathsAppend(const std::string &p)
Append to the search paths list.
Definition: Paths.h:40
Namespace for all LHAPDF functions and classes.
Definition: AlphaS.h:14
void pathsPrepend(const std::string &p)
Prepend to the search paths list.
Definition: Paths.h:31
void setPaths(const std::string &pathstr)
Set the search paths list as a colon-separated string.
std::string findFile(const std::string &target)
std::string findpdfsetinfopath(const std::string &setname)
Definition: Paths.h:75
std::vector< std::string > paths()
Get the ordered list of search paths, from $LHAPDF_DATA_PATH and the install location.