preprocessor now filters debug output
This commit is contained in:
@@ -10,7 +10,9 @@ namespace generator {
|
||||
|
||||
CylinderBinning buildPositionBinning(json_t* object) {
|
||||
if (json_object_by_path(object, {"CylinderBinning"})) {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating position binning: cylinder binning.");
|
||||
#endif
|
||||
object = json_object_by_path(object, {"CylinderBinning"});
|
||||
|
||||
json_t* radial = json_object_by_path(object, {"Radial"});
|
||||
@@ -36,6 +38,7 @@ CylinderBinning buildPositionBinning(json_t* object) {
|
||||
json_read_length(json_object_by_path(longitudinal, {"MaxLength"}), "m");
|
||||
ASSERT_POSITIVE(&max_length, "Radius must be positive");
|
||||
|
||||
#ifdef debug_level3
|
||||
DEBUG_LEVEL_3("with number of bins radial: " +
|
||||
std::to_string(number_of_bins_radial));
|
||||
DEBUG_LEVEL_3("with number of bins azimuthal: " +
|
||||
@@ -44,6 +47,7 @@ CylinderBinning buildPositionBinning(json_t* object) {
|
||||
std::to_string(number_of_bins_longitudinal));
|
||||
DEBUG_LEVEL_3("with radius: " + std::to_string(max_radius) + " m");
|
||||
DEBUG_LEVEL_3("with height: " + std::to_string(max_length) + " m");
|
||||
#endif
|
||||
|
||||
return CylinderBinning(number_of_bins_radial, max_radius,
|
||||
number_of_bins_azimuthal,
|
||||
@@ -59,14 +63,18 @@ CylinderBinning buildPositionBinningIncludingRedirection(
|
||||
json_path& path_to_binning) {
|
||||
if (parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_binning, {"CreateSameAs"}))) {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating position binning: CreateSameAs.");
|
||||
#endif
|
||||
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 << " ";
|
||||
}
|
||||
#ifdef debug_level3
|
||||
DEBUG_LEVEL_3("From path: " + path.str());
|
||||
#endif
|
||||
return buildPositionBinningIncludingRedirection(parameter, path_to_same);
|
||||
} else {
|
||||
return buildPositionBinning(parameter.jsonObjectFromBase(path_to_binning));
|
||||
@@ -76,7 +84,9 @@ CylinderBinning buildPositionBinningIncludingRedirection(
|
||||
EnergyBinning buildEnergyBinning(json_t* object) {
|
||||
std::string energy_type = json_string(json_object_by_path(object, {"Type"}));
|
||||
if (energy_type == "Logarithmic") {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating energy binning: logarithmic.");
|
||||
#endif
|
||||
int number_of_bins =
|
||||
json_int(json_object_by_path(object, {"NumberOfBins"}));
|
||||
ASSERT_POSITIVE(&number_of_bins, "Number of Bins must be positive");
|
||||
@@ -87,9 +97,11 @@ EnergyBinning buildEnergyBinning(json_t* object) {
|
||||
json_read_energy(json_object_by_path(object, {"MaxEnergy"}), "eV");
|
||||
ASSERT_POSITIVE(&max_energy, "Max Energy must be positive");
|
||||
|
||||
#ifdef debug_level3
|
||||
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
|
||||
DEBUG_LEVEL_3("with min energy: " + std::to_string(min_energy));
|
||||
DEBUG_LEVEL_3("with max energy: " + std::to_string(max_energy));
|
||||
#endif
|
||||
|
||||
return EnergyBinning(min_energy, max_energy, number_of_bins);
|
||||
|
||||
@@ -104,14 +116,22 @@ EnergyBinning buildEnergyBinningIncludingRedirection(
|
||||
json_path& path_to_binning) {
|
||||
if (parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_binning, {"CreateSameAs"}))) {
|
||||
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating energy binning: CreateSameAs.");
|
||||
#endif
|
||||
|
||||
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_binning, {"CreateSameAs"})));
|
||||
|
||||
#ifdef debug_level3
|
||||
std::stringstream path;
|
||||
for (auto& p : path_to_same) {
|
||||
path << p << " ";
|
||||
}
|
||||
DEBUG_LEVEL_3("From path: " + path.str());
|
||||
#endif
|
||||
|
||||
return buildEnergyBinningIncludingRedirection(parameter, path_to_same);
|
||||
} else {
|
||||
return buildEnergyBinning(parameter.jsonObjectFromBase(path_to_binning));
|
||||
@@ -121,12 +141,18 @@ 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") {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating pitch angle binning: linear.");
|
||||
#endif
|
||||
|
||||
int number_of_bins =
|
||||
json_int(json_object_by_path(object, {"NumberOfBins"}));
|
||||
ASSERT_POSITIVE(&number_of_bins, "Number of Bins must be positive");
|
||||
|
||||
#ifdef debug_level3
|
||||
DEBUG_LEVEL_3("with number of bins: " + std::to_string(number_of_bins));
|
||||
#endif
|
||||
|
||||
return PitchAngleBinning(number_of_bins);
|
||||
|
||||
} else {
|
||||
@@ -140,14 +166,21 @@ PitchAngleBinning buildPitchAngleBinningIncludingRedirection(
|
||||
json_path& path_to_binning) {
|
||||
if (parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_binning, {"CreateSameAs"}))) {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Creating energy binning: CreateSameAs.");
|
||||
#endif
|
||||
|
||||
json_path path_to_same = json_path_get(parameter.jsonObjectFromBase(
|
||||
json_path_append(path_to_binning, {"CreateSameAs"})));
|
||||
|
||||
#ifdef debug_level3
|
||||
std::stringstream path;
|
||||
for (auto& p : path_to_same) {
|
||||
path << p << " ";
|
||||
}
|
||||
DEBUG_LEVEL_3("From path: " + path.str());
|
||||
#endif
|
||||
|
||||
return buildPitchAngleBinningIncludingRedirection(parameter, path_to_same);
|
||||
} else {
|
||||
return buildPitchAngleBinning(parameter.jsonObjectFromBase(path_to_binning));
|
||||
|
||||
Reference in New Issue
Block a user