Included pitch angle binning in the json file;

minor changes to debug output
This commit is contained in:
2024-10-29 14:55:14 +01:00
parent 5fc227e1b1
commit b1519cb4ca
5 changed files with 48 additions and 5 deletions
+36
View File
@@ -118,4 +118,40 @@ EnergyBinning buildEnergyBinningIncludingRedirection(
}
}
PitchAngleBinning buildPitchAngleBinning(json_t* object) {
std::string pitch_angle_type = json_string(json_object_by_path(object, {"Type"}));
if (pitch_angle_type == "Linear") {
DEBUG_LEVEL_2("Creating pitch angle binning: linear.");
int number_of_bins =
json_int(json_object_by_path(object, {"NumberOfBins"}));
ASSERT_POSITIVE(&number_of_bins, "Number of Bins must be positive");
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
return PitchAngleBinning(number_of_bins);
} else {
ERROR("This pitch angle binning is not implemented.");
return PitchAngleBinning(0);
}
}
PitchAngleBinning buildPitchAngleBinningIncludingRedirection(
Parameter& parameter,
json_path& path_to_binning) {
if (parameter.jsonObjectFromBase(
json_path_append(path_to_binning, {"CreateSameAs"}))) {
DEBUG_LEVEL_2("Creating energy binning: CreateSameAs.");
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
json_path_append(path_to_binning, {"CreateSameAs"})));
std::stringstream path;
for (auto& p : path_to_same) {
path << p << " ";
}
DEBUG_LEVEL_3("From path: " + path.str());
return buildPitchAngleBinningIncludingRedirection(parameter, path_to_same);
} else {
return buildPitchAngleBinning(parameter.jsonObjectFromBase(path_to_binning));
}
}
}; // namespace generator