lhapdf
is hosted by
Hepforge
,
IPPP Durham
LHAPDF
6.5.4
Loading...
Searching...
No Matches
/tests/testinfo.cc
// Example program for testing the info system
#include "LHAPDF/Info.h"
#include "LHAPDF/Config.h"
#include "LHAPDF/PDFInfo.h"
#include "LHAPDF/PDFSet.h"
#include "LHAPDF/Factories.h"
#include <iostream>
#ifdef HAVE_MPI
#include <mpi.h>
#endif
using namespace
std;
int
main(
int
argc,
char
* argv[]) {
#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
#endif
LHAPDF::Info
& cfg =
LHAPDF::getConfig
();
// cout << "UndefFlavorAction: " << cfg.get_entry("UndefFlavorAction") << endl;
cout <<
"Verbosity: "
<< cfg.
get_entry
(
"Verbosity"
) << endl;
cfg.
set_entry
(
"Verbosity"
, 5);
const
LHAPDF::Info
& cfg2 =
LHAPDF::getConfig
();
cout <<
"New Verbosity from second Config: "
<< cfg2.
get_entry
(
"Verbosity"
) << endl;
const
LHAPDF::PDFSet
set(
"CT10nlo"
);
cout <<
"SetDesc: "
<< set.get_entry(
"SetDesc"
) << endl;
cout <<
"Verbosity from set: "
<< set.get_entry(
"Verbosity"
) << endl;
const
LHAPDF::PDFInfo
info(
"CT10nlo"
, 2);
if
(info.
has_key
(
"PdfDesc"
)) cout <<
"PdfDesc: "
<< info.
get_entry
(
"PdfDesc"
) << endl;
cout <<
"PdfType: "
<< info.
get_entry
(
"PdfType"
) << endl;
cout <<
"Verbosity from PDF: "
<< info.
get_entry
(
"Verbosity"
) << endl;
vector<int> pids = info.
get_entry_as
< vector<int> >(
"Flavors"
);
cout <<
"PIDs (1): "
;
for
(
int
f : pids) { cout << f <<
" "
; } cout << endl;
cout <<
"PIDs (2): "
<<
LHAPDF::to_str
(pids) << endl;
// Now test loading of all central PDFs
for
(
const
string
& name :
LHAPDF::availablePDFSets
()) {
cout <<
"Testing PDFInfo for "
<< name << endl;
LHAPDF::PDFInfo
* i =
LHAPDF::mkPDFInfo
(name, 0);
i->
has_key
(
"Foo"
);
// < Force loading of all info levels
delete
i;
}
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return
0;
}
LHAPDF::Info
Metadata base class for PDFs, PDF sets, or global configuration.
Definition
Info.h:29
LHAPDF::Info::get_entry
virtual const std::string & get_entry(const std::string &key) const
Definition
Info.h:119
LHAPDF::Info::set_entry
void set_entry(const std::string &key, const T &val)
Set a keyed value entry.
Definition
Info.h:158
LHAPDF::Info::get_entry_as
T get_entry_as(const std::string &key) const
Definition
Info.h:139
LHAPDF::PDFInfo
Metadata class for PDF members.
Definition
PDFInfo.h:18
LHAPDF::PDFInfo::get_entry
const std::string & get_entry(const std::string &key) const
Retrieve a metadata string by key name.
LHAPDF::PDFInfo::has_key
bool has_key(const std::string &key) const
Can this Info object return a value for the given key? (it may be defined non-locally)
LHAPDF::PDFSet
Class for PDF-set metadata and manipulation.
Definition
PDFSet.h:105
LHAPDF::mkPDFInfo
PDFInfo * mkPDFInfo(const std::string &setname, size_t member)
LHAPDF::getConfig
Info & getConfig()
LHAPDF::availablePDFSets
const std::vector< std::string > & availablePDFSets()
Get the names of all available PDF sets in the search path.
LHAPDF::to_str
std::string to_str(const T &val)
Make a string representation of val.
Definition
Utils.h:61
Generated on Thu Sep 26 2024 15:19:26 for LHAPDF by
1.12.0