const R3Point R3Box:: ClosestPoint(const R3Point& point) const { // Return closest point in box R3Point closest(point); if (closest.X() < XMin()) closest[RN_X] = XMin(); else if (closest.X() > XMax()) closest[RN_X] = XMax(); if (closest.Y() < YMin()) closest[RN_Y] = YMin(); else if (closest.Y() > YMax()) closest[RN_Y] = YMax(); if (closest.Z() < ZMin()) closest[RN_Z] = ZMin(); else if (closest.Z() > ZMax()) closest[RN_Z] = ZMax(); return closest; }
bool Box::Contains( Box const& other ) const { return ( XMin() <= other.XMin() && XMax() >= other.XMax() && YMin() <= other.YMin() && YMax() >= other.YMax() ); }
Jet MuXboostedBTagging::Result(std::vector<Lepton> const &muons, Jet const &jet, Jet &core) const { INFO0; // Keep track of the smallest x for any muon auto min_x = std::numeric_limits<double>::max(); // Large enough, simple significand // Iterate through each muon, add it to the core, and calculate the resulting boost invariant auto p4_neutrino_correction = Jet {}; for (auto const &muon : muons) { // Add back the muon and the neutrino core += 2 * muon; // Set a hard ceiling on subjet mass, for poor reconstruction auto dot = muon.Spatial().Dot(core.Spatial()); auto min = std::min(core.Mass(), MaxSubJetMass()); if (dot == 0_eV * eV || min == 0_eV) continue; auto cross = muon.Spatial().Cross(core.Spatial()).Mag(); auto x_core = static_cast<double>(core.Energy() * cross / dot / min); CHECK(x_core >= 0, x_core); if (x_core < 0) return jet; // Add the neutrino to original jet IFF the muon passes the boosted test if (x_core <= XMax()) p4_neutrino_correction += muon; min_x = std::min(min_x, x_core); } auto result = jet + p4_neutrino_correction; CHECK(result.Pt() > 0_eV, result.Pt()); CHECK(!(result.Pt() != result.Pt()), result.Pt()) CHECK(!(core.Pt() != core.Pt()), core.Pt()) CHECK(!(min_x != min_x), min_x) if (result.Pt() <= 0_eV) return jet; result.SetInfo(jet.Info()); result.Info().SetMuBTag(min_x, core.Pt() / result.Pt()); return result; }
void Box::Merge( Box const& other ) { if( other.Empty() ) return; if( Empty() ) { *this = other; return; } int l = std::min(x, other.x ); int t = std::min(y, other.y ); int r = std::max( XMax(), other.XMax() ); int b = std::max( YMax(), other.YMax() ); x = l; y = t; w = (r-l)+1; h = (b-t)+1; }