Commit aa55c2f0 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'setBudgetToZero' into 'master'

Setting the Material budget to zero if not defined

See merge request !253
parents 651f2275 bf946abc
Pipeline #1426578 passed with stages
in 28 minutes and 14 seconds
...@@ -58,7 +58,8 @@ Detector::Detector(const Configuration& config) : m_role(DetectorRole::NONE) { ...@@ -58,7 +58,8 @@ Detector::Detector(const Configuration& config) : m_role(DetectorRole::NONE) {
// Material budget of detector, including support material // Material budget of detector, including support material
if(!config.has("material_budget")) { if(!config.has("material_budget")) {
LOG(WARNING) << "No material budget given for " << m_detectorName << ", assuming zero"; m_materialBudget = 0.0;
LOG(WARNING) << "No material budget given for " << m_detectorName << ", assuming " << m_materialBudget;
} else if(config.get<double>("material_budget") < 0) { } else if(config.get<double>("material_budget") < 0) {
throw InvalidValueError(config, "material_budget", "Material budget has to be positive"); throw InvalidValueError(config, "material_budget", "Material budget has to be positive");
} else { } else {
...@@ -281,10 +282,9 @@ Configuration Detector::getConfiguration() const { ...@@ -281,10 +282,9 @@ Configuration Detector::getConfiguration() const {
config.set("time_resolution", m_timeResolution, {"ns", "us", "ms", "s"}); config.set("time_resolution", m_timeResolution, {"ns", "us", "ms", "s"});
// material budget // material budget
if(m_materialBudget > 0.0) { if(m_materialBudget > std::numeric_limits<double>::epsilon()) {
config.set("material_budget", m_materialBudget); config.set("material_budget", m_materialBudget);
} }
// only if detector is not auxiliary: // only if detector is not auxiliary:
if(!this->isAuxiliary()) { if(!this->isAuxiliary()) {
config.set("number_of_pixels", m_nPixels); config.set("number_of_pixels", m_nPixels);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment