lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF 6.5.5
Loading...
Searching...
No Matches
Factories.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_Factories_H
8#define LHAPDF_Factories_H
9
10#include <string>
11
12namespace LHAPDF {
13
14
15 // Forward declarations to avoid circular dependencies
16 class PDF;
17 class Info;
18 class PDFSet;
19 class PDFInfo;
20 class Config;
21 class Interpolator;
22 class Extrapolator;
23 class AlphaS;
24
25
26 /// @defgroup factories Factory functions
27 ///@{
28
29 /// @defgroup factories_pdf Making single PDFs
30 ///@{
31
32 /// Create a new PDF with the given PDF set name and member ID.
33 ///
34 /// Returns a 'new'ed PDF by pointer.
35 /// The caller is responsible for deletion of the created object.
36 PDF* mkPDF(const std::string& setname, size_t member);
37
38 /// Create a new PDF with the given LHAPDF ID code.
39 ///
40 /// Returns a 'new'ed PDF by pointer.
41 /// The caller is responsible for deletion of the created object.
42 PDF* mkPDF(int lhaid);
43
44 /// Create a new PDF with the given PDF set name and member ID as a single string.
45 ///
46 /// The format of the @a setname_nmem string is <setname>/<nmem>
47 /// where <nmem> must be parseable as a positive integer. The /
48 /// character is not permitted in set names due to clashes with
49 /// Unix filesystem path syntax.
50 ///
51 /// If no /<nmem> is given, member number 0 will be used.
52 ///
53 /// Returns a 'new'ed PDF by pointer.
54 /// The caller is responsible for deletion of the created object.
55 PDF* mkPDF(const std::string& setname_nmem);
56
57 ///@}
58
59
60 /// @defgroup factories_pdfs Making whole PDF sets
61 ///@{
62
63 /// Get the PDFSet with the given set name.
64 ///
65 /// Returns a PDFSet by reference. When this function is used for
66 /// access, only one PDFSet object is made per set name... hence the
67 /// 'get' rather than 'mk' function name.
68 ///
69 /// This function is intended particularly for use where it would be
70 /// inefficient to have to repeatedly construct a PDFSet by name. The
71 /// canonical use case is internal: the Info system uses this to ensure that
72 /// cascading of config settings is efficient, and also allows the automatic
73 /// application of set-level changes to all PDF member objects in that set.
74 ///
75 /// @note The LHAPDF system is responsible for deletion of the returned
76 /// object. Do NOT delete it yourself! Hence the return by reference rather
77 /// than pointer.
78 PDFSet& getPDFSet(const std::string& setname);
79
80 /// Get all PDFs in a named set (return by filling the supplied vector).
81 void mkPDFs(const std::string& setname, std::vector<PDF*>& pdfs);
82
83 /// Get all PDFs in a named set (return by a new vector).
84 std::vector<PDF*> mkPDFs(const std::string& setname);
85
86 /// Get all PDFs in a named set (return by filling the supplied vector).
87 ///
88 /// This is a templated version for returning a vector of smart ptrs
89 template <typename PTR>
90 void mkPDFs(const std::string& setname, std::vector<PTR>& pdfs) {
91 std::vector<PDF*> rawptrs;
92 mkPDFs(setname, rawptrs);
93 pdfs.clear();
94 pdfs.reserve(rawptrs.size());
95 // for (const PDF* p : rawptrs) pdfs.push_back(PTR(p)); //< Reinstate when C++11 is guaranteed, without flags
96 for (size_t i = 0; i < rawptrs.size(); ++i) pdfs.push_back(PTR(rawptrs[i]));
97 }
98
99 ///@}
100
101
102 /// @defgroup factories_info Making metadata objects
103 ///@{
104
105 /// Get the global configuration object
106 ///
107 /// The global config is populated by reading from lhapdf.conf if it is found
108 /// in the search paths. It is a singleton, hence the 'get' rather than 'mk'
109 /// function name.
110 ///
111 /// @note The LHAPDF system is responsible for deletion of the returned
112 /// object. Do NOT delete it yourself! Hence the return by reference rather
113 /// than pointer.
114 // Config& getConfig();
116
117 /// Create a new Info object for the given set name and member number.
118 ///
119 /// Returns a 'new'ed Info by pointer.
120 /// The caller is responsible for deletion of the created object.
121 PDFInfo* mkPDFInfo(const std::string& setname, size_t member);
122
123 /// Create a new Info object with the given LHAPDF ID code.
124 ///
125 /// Returns a 'new'ed Info by pointer.
126 /// The caller is responsible for deletion of the created object.
127 PDFInfo* mkPDFInfo(int lhaid);
128
129 /// Create a new Info object for the given set name and member number as a single string.
130 ///
131 /// The format of the @a setname_nmem string is <setname>/<nmem>
132 /// where <nmem> must be parseable as a positive integer. The /
133 /// character is not permitted in set names due to clashes with
134 /// Unix filesystem path syntax.
135 ///
136 /// If no /<nmem> is given, member number 0 will be used.
137 ///
138 /// Returns a 'new'ed Info by pointer.
139 /// The caller is responsible for deletion of the created object.
140 PDFInfo* mkPDFInfo(const std::string& setname_nmem);
141
142 ///@}
143
144
145 /// @defgroup factories_ipolxpol Making grid interpolators/extrapolators
146 ///@{
147
148 /// Interpolator factory
149 ///
150 /// Returns a 'new'ed Interpolator by pointer. Unless passed to a GridPDF,
151 /// the caller is responsible for deletion of the created object.
152 Interpolator* mkInterpolator(const std::string& name);
153
154
155 /// Extrapolator factory
156 ///
157 /// Returns a 'new'ed Extrapolator by pointer. Unless passed to a GridPDF,
158 /// the caller is responsible for deletion of the created object.
159 Extrapolator* mkExtrapolator(const std::string& name);
160
161 ///@}
162
163
164 /// @defgroup factories_alphas Making AlphaS objects
165 ///@{
166
167 /// @brief Make an AlphaS object from an Info object
168 ///
169 /// The type and configuration of the returned AlphaS is chosen based on the
170 /// PDF metadata Info object given as the argument.
171 ///
172 /// Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF,
173 /// the caller is responsible for deletion of the created object.
174 AlphaS* mkAlphaS(const Info& info);
175
176 /// @brief Make an AlphaS object for the specified PDF
177 ///
178 /// The type and configuration of the returned AlphaS is chosen based on the
179 /// named PDFSet's nth member's metadata.
180 ///
181 /// Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF,
182 /// the caller is responsible for deletion of the created object.
183 AlphaS* mkAlphaS(const std::string& setname, size_t member);
184
185 /// @brief Make an AlphaS object for the specified PDF
186 ///
187 /// The type and configuration of the returned AlphaS is chosen based on the
188 /// numbered PDF's metadata.
189 ///
190 /// Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF,
191 /// the caller is responsible for deletion of the created object.
192 AlphaS* mkAlphaS(int lhaid);
193
194 /// Create an AlphaS object for the given set name and member number as a single string
195 ///
196 /// The format of the @a setname_nmem string is <setname>/<nmem>
197 /// where <nmem> must be parseable as a positive integer. The /
198 /// character is not permitted in set names due to clashes with
199 /// Unix filesystem path syntax.
200 ///
201 /// If no /<nmem> is given, the type and configuration of the returned AlphaS
202 /// is chosen based on the named PDFSet's metadata, NOT the info of member
203 /// number 0 as for similar methods. If there is a distinction and you specifically want
204 /// the AlphaS for the central member rather than that specified for the set as a whole,
205 /// make sure to include the "/0"!
206 ///
207 /// Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF,
208 /// the caller is responsible for deletion of the created object.
209 AlphaS* mkAlphaS(const std::string& setname_nmem);
210
211
212 /// @brief Make an AlphaS object of the requested type without a PDF reference
213 ///
214 /// No values are initialised and have to be configured by the caller.
215 ///
216 /// The caller is responsible for deletion of the created object.
217 AlphaS* mkBareAlphaS(const std::string& type);
218
219 ///@}
220
221 ///@}
222
223}
224#endif
Calculator interface for computing alpha_s(Q2) in various ways.
Definition AlphaS.h:24
Class for PDF set metadata and manipulation.
Definition Config.h:16
The general interface for extrapolating beyond grid boundaries.
Definition Extrapolator.h:20
Metadata base class for PDFs, PDF sets, or global configuration.
Definition Info.h:29
The general interface for interpolating between grid points.
Definition Interpolator.h:21
Metadata class for PDF members.
Definition PDFInfo.h:18
Class for PDF-set metadata and manipulation.
Definition PDFSet.h:105
PDF is the general interface for access to parton density information.
Definition PDF.h:40
AlphaS * mkAlphaS(const std::string &setname, size_t member)
Make an AlphaS object for the specified PDF.
AlphaS * mkAlphaS(int lhaid)
Make an AlphaS object for the specified PDF.
AlphaS * mkBareAlphaS(const std::string &type)
Make an AlphaS object of the requested type without a PDF reference.
AlphaS * mkAlphaS(const Info &info)
Make an AlphaS object from an Info object.
AlphaS * mkAlphaS(const std::string &setname_nmem)
PDFInfo * mkPDFInfo(const std::string &setname, size_t member)
Info & getConfig()
PDFInfo * mkPDFInfo(const std::string &setname_nmem)
PDFInfo * mkPDFInfo(int lhaid)
Extrapolator * mkExtrapolator(const std::string &name)
Interpolator * mkInterpolator(const std::string &name)
PDF * mkPDF(const std::string &setname_nmem)
PDF * mkPDF(const std::string &setname, size_t member)
PDF * mkPDF(int lhaid)
void mkPDFs(const std::string &setname, std::vector< PDF * > &pdfs)
Get all PDFs in a named set (return by filling the supplied vector).
PDFSet & getPDFSet(const std::string &setname)
void mkPDFs(const std::string &setname, std::vector< PTR > &pdfs)
Definition Factories.h:90
std::vector< PDF * > mkPDFs(const std::string &setname)
Get all PDFs in a named set (return by a new vector).
Namespace for all LHAPDF functions and classes.
Definition AlphaS.h:14