10 namespace pt = boost::property_tree;
12 #include <FairLogger.h> 17 inline std::pair<double, double>
readPair(pt::ptree &tree)
19 if (tree.size() != 2) {
20 throw std::range_error(
"Expected two values e.g min/max not " + std::to_string(tree.size()));
23 auto it = tree.begin();
24 double min = it->second.get_value<
double>();
26 double max = it->second.get_value<
double>();
27 return std::make_pair(min, max);
32 if (tree.size() != 2) {
33 throw std::range_error(
"Expected two values e.g min/max not " + std::to_string(tree.size()));
36 auto it = tree.begin();
37 std::string first = it->second.data();
39 std::string second = it->second.data();
40 return std::make_pair(first, second);
45 if (tree.size() != 3) {
46 throw std::range_error(
"Expected three values e.g x/y/z not " + std::to_string(tree.size()));
49 std::array<double, 3> xyz;
51 for (
auto val : tree) {
52 xyz[index++] = val.second.get_value<
double>();
59 std::vector<double> result;
60 for (
auto val : tree) {
61 result.push_back(val.second.get_value<
double>());
std::pair< double, double > readPair(pt::ptree &tree)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
std::pair< std::string, std::string > readStringPair(pt::ptree &tree)
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
collection of helper methods to load in pairs, triplets or vectors of doubles from JSON files ...
std::array< double, 3 > readTriplet(pt::ptree &tree)
std::vector< double > readVector(pt::ptree &tree)