22 namespace pt = boost::property_tree;
24 #include <FairLogger.h> 29 inline std::pair<double, double>
readPair(pt::ptree &tree)
31 if (tree.size() != 2) {
32 throw std::range_error(
"Expected two values e.g min/max not " + std::to_string(tree.size()));
35 auto it = tree.begin();
36 double min = it->second.get_value<
double>();
38 double max = it->second.get_value<
double>();
39 return std::make_pair(min, max);
44 if (tree.size() != 2) {
45 throw std::range_error(
"Expected two values e.g min/max not " + std::to_string(tree.size()));
48 auto it = tree.begin();
49 std::string first = it->second.data();
51 std::string second = it->second.data();
52 return std::make_pair(first, second);
57 if (tree.size() != 3) {
58 throw std::range_error(
"Expected three values e.g x/y/z not " + std::to_string(tree.size()));
61 std::array<double, 3> xyz;
63 for (
auto val : tree) {
64 xyz[index++] = val.second.get_value<
double>();
71 std::vector<double> result;
72 for (
auto val : tree) {
73 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)