diff --git a/rugnux/RugnuxFirstPassRescues.cpp b/rugnux/RugnuxFirstPassRescues.cpp index 1b868ee85..edb7661f6 100644 --- a/rugnux/RugnuxFirstPassRescues.cpp +++ b/rugnux/RugnuxFirstPassRescues.cpp @@ -1196,6 +1196,11 @@ auto Rugnux::FirstPassRun::Pass1Fallback(FirstPass best) -> FirstPass { const auto &l = pass1_lattice.lattice; pass1_lattice.lattice = CrystalLattice(l.Vec0() * f, l.Vec1() * f, l.Vec2() * f); } + // And the detector it is integrated at is this pass's, not pass 1's: the result is adopted whole + // (ForceResult), geometry included, so carrying pass 1's would integrate a cell scaled to the + // post-refined distance at the distance and beam the post-refinement has just moved off. + pass1_lattice.geom.BeamX_pxl(rx.experiment_.GetBeamX_pxl()).BeamY_pxl(rx.experiment_.GetBeamY_pxl()) + .DetectorDistance_mm(d_use); const CrystalLattice pass1_primitive = pass1_lattice.lattice .ToPrimitive(pass1_lattice.search_result.centering).NiggliReduce(); const double pass1_vol = std::abs(pass1_primitive.CalcVolume()); @@ -1231,7 +1236,11 @@ auto Rugnux::FirstPassRun::Pass1Fallback(FirstPass best) -> FirstPass { late_validation.size(), pass1_late, late_validation.size()), early, pass1_more); } - if (best.score < floor || pass1_more) { + // The floor is a question about the lattice, not about this geometry: where the re-index found pass + // 1's lattice again and indexes as many frames with it, pass 1 had no more evidence for it than this + // pass has, and the re-index is the one refined at the geometry the pass integrates at. + const bool same_and_as_good = same_lattice && best.score >= pass1_score; + if ((best.score < floor && !same_and_as_good) || pass1_more) { const auto &pc = pass1_lattice.search_result.conventional.GetUnitCell(); const auto &bc = best.result->search_result.conventional.GetUnitCell(); logger.Warning("Two-pass: the refined-geometry re-index indexes {}/{} validation frames "