Performs the wire intersection test at a single point.
2554 const unsigned int NPlanes =
TPC.Nplanes();
2560 std::vector<double> WirePitch(NPlanes);
2563 WireCoordDirs(NPlanes);
2564 std::vector<geo::WireID> WireIDs;
2565 WireIDs.reserve(NPlanes);
2566 std::vector<double> WireDistances(NPlanes);
2567 for (
unsigned int iPlane = 0; iPlane < NPlanes; ++iPlane) {
2573 WireIDs.emplace_back(plane.
ID(), (
unsigned int) std::round(WireDistance));
2574 WireDistances[iPlane]
2575 = (WireDistance - std::round(WireDistance)) * WirePitch[iPlane];
2577 MF_LOG_DEBUG(
"GeometryTest") <<
"Nearest wire to " << point
2578 <<
" on plane " << std::string(plane.
ID())
2579 <<
" (pitch: " << WirePitch[iPlane]
2580 <<
", coord.dir.=" << WireCoordDirs[iPlane]
2581 <<
") is " << WireIDs[iPlane] <<
" (position: " << WireDistance <<
")";
2588 for (
unsigned int iPlane1 = 0; iPlane1 < NPlanes; ++iPlane1) {
2594 for (
unsigned int iPlane2 = iPlane1 + 1; iPlane2 < NPlanes; ++iPlane2) {
2601 MF_LOG_ERROR(
"GeometryTest") <<
"Wires " << w1 <<
" and " << w2
2602 <<
" should intersect around " << point <<
" of TPC " <<
TPC.ID()
2603 <<
", but they seem not to intersect at all!";
2614 MF_LOG_ERROR(
"GeometryTest") <<
"Legacy check: wires " << w1 <<
" and "
2615 << w2 <<
" should intersect around " << point <<
" of TPC "
2616 <<
TPC.ID() <<
", but they seem not to intersect at all!";
2620 if (coordIs.nonEqual(widIntersect.
y, xingPoint.Y())
2621 || coordIs.nonEqual(widIntersect.
z, xingPoint.Z()))
2623 MF_LOG_ERROR(
"GeometryTest") <<
"Legacy check: wires " << w1 <<
" and "
2624 << w2 <<
" should intersect around " << point <<
" of TPC "
2625 <<
TPC.ID() <<
", but legacy code says (?, "
2626 << widIntersect.
y <<
", " << widIntersect.
z <<
")!";
2635 MF_LOG_ERROR(
"GeometryTest") <<
"Wires " << w2 <<
" and " << w1
2636 <<
" (reversed test) should intersect around " << point
2637 <<
" of TPC " <<
TPC.ID()
2638 <<
", but they seem not to intersect at all!";
2642 if (vectorIs.nonEqual(xingPointInv, xingPoint2)) {
2643 MF_LOG_ERROR(
"GeometryTest")
2644 <<
"WireIDsIntersect() gives different intersections for "
2645 << w1 <<
" and " << w2
2646 <<
": " << xingPoint2 <<
" (direct+shift) and " << xingPointInv
2659 const double d1 = WireDistances[iPlane1], d2 = WireDistances[iPlane2],
2660 cosAlpha =
dot(WireCoordDirs[iPlane1], WireCoordDirs[iPlane2]);
2661 const double expected_d = std::sqrt(
2662 (cet::square(d1) + cet::square(d2) - 2.0 * d1 * d2 * cosAlpha) / (1 - cet::square(cosAlpha))
2666 MF_LOG_DEBUG(
"GeometryTest")
2667 <<
" - wires " << w1 <<
" and " << w2 <<
" intersect at " << xingPoint
2668 <<
", " << d <<
" cm far from starting point (expected: "
2669 << expected_d <<
")";
2674 (std::max(WirePitch[iPlane1], WirePitch[iPlane2]) * 1
e-3);
2675 if (wireCoordIs.nonEqual(d, expected_d)) {
2676 MF_LOG_ERROR(
"GeometryTest")
2677 <<
"wires " << w1 <<
" and " << w2 <<
" intersect at " << xingPoint
2679 << d <<
" cm far from starting point: too far from the expected "
2680 << expected_d <<
" cm!";
2690 if (vectorIs.nonEqual(objXingPoint, xingPoint)) {
2691 MF_LOG_ERROR(
"GeometryTest")
2692 <<
"geo::WiresIntersection() gives wrong intersection for "
2693 << w1 <<
" and " << w2
2694 <<
": " << objXingPoint <<
" vs. " << xingPoint <<
" (expected)";
2702 if (vectorIs.nonEqual(objXingPoint, xingPoint)) {
2703 MF_LOG_ERROR(
"GeometryTest")
2704 <<
"geo::WireGeo[" << w1
2705 <<
"]::IntersectionWith() gives wrong intersection with " << w2
2706 <<
": " << objXingPoint <<
" vs. " << xingPoint <<
" (expected)";
2712 if (vectorIs.nonEqual(objXingPoint, xingPointInv)) {
2713 MF_LOG_ERROR(
"GeometryTest")
2714 <<
"geo::WireGeo[" << w2
2715 <<
"]::IntersectionWith() gives wrong intersection with " << w1
2716 <<
": " << objXingPoint <<
" vs. " << xingPoint <<
" (expected)";
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
double z
z position of intersection
constexpr auto dot(Vector const &a, Vector const &b)
Return cross product of two vectors.
WireGeo const & Wire(unsigned int iwire) const
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Vector GetIncreasingWireDirection() const
Returns the direction of increasing wires.
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
geo::Point_t WiresIntersection(geo::WireGeo const &wireA, geo::WireGeo const &wireB)
Returns the point of wireA that is closest to wireB.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Point IntersectionWith(geo::WireGeo const &other) const
Returns the point of this wire that is closest to other wire.
auto makeVector3DComparison(RealType threshold)
Creates a Vector3DComparison from a RealComparisons object.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
WireCoordProjection_t VectorProjection(geo::Vector_t const &v) const
double y
y position of intersection
geo::PlaneID const & ID() const
Returns the identifier of this plane.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
geo::GeometryCore const * geom
pointer to geometry service provider
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
static std::array< double, 3 > GetIncreasingWireDirection(const geo::PlaneGeo &plane)
Returns the direction on plane orthogonal to wires where wire number increases.