Skip to content

Commit

Permalink
Add warning and better protection if user does not give a 'cathode' v…
Browse files Browse the repository at this point in the history
…alue for an xregion.
  • Loading branch information
brettviren committed Nov 26, 2024
1 parent b3f028d commit db7468d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gen/src/AnodePlane.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,18 @@ void Gen::AnodePlane::configure(const WireCell::Configuration& cfg)
const double response_x = jface["response"].asDouble();
const double anode_x = get(jface, "anode", response_x);
// const double cathode_x = jface["cathode"].asDouble();
double cathode_xref;
double cathode_xref = response_x; // illegal/insensitive
if (jface["cathode"].isNumeric()) {
cathode_xref = jface["cathode"].asDouble();
}
if (jface["cathode"].isMember("x")) {
else if (jface["cathode"].isMember("x")) {
auto xvec = get<std::vector<double>>(jface["cathode"], "x");
const auto [vmin, vmax] = std::minmax_element(xvec.begin(), xvec.end());
cathode_xref = *vmin < response_x ? *vmin : *vmax;
}
else {
log->warn("No 'cathode' location defined for xregion, making short drift for face {} anode {}", iface, m_ident);
}
const double cathode_x = cathode_xref;

log->debug("X planes: \"cathode\"@ {}m, \"response\"@{}m, \"anode\"@{}m", cathode_x / units::m,
Expand Down

0 comments on commit db7468d

Please sign in to comment.