9 #ifndef LARCOREALG_GEOMETRY_WIREGEO_H
10 #define LARCOREALG_GEOMETRY_WIREGEO_H
20 #include "Math/GenVector/Transform3D.h"
25 #include <type_traits>
151 void GetCenter(
double* xyz,
double localz=0.0)
const;
181 template <
typename Po
int>
183 {
return GetPositionFromCenterUnbounded<Point>(
capLength(localz)); }
185 {
return GetPositionFromCenter<DefaultPoint_t>(localz); }
202 template <
typename Po
int>
205 {
return GetPositionFromCenterUnbounded<DefaultPoint_t>(localz); }
211 template <
typename Po
int>
219 template <
typename Po
int>
221 {
return GetPositionFromCenterUnbounded<Point>(-
HalfL()); }
228 template <
typename Po
int>
230 {
return GetPositionFromCenterUnbounded<Point>(+
HalfL()); }
259 double ThetaZ(
bool degrees)
const;
291 template <
typename Vector>
325 template <
typename Stream>
327 (
Stream&& out, std::string indent =
"",
unsigned int verbosity = 1)
const;
335 std::string
WireInfo(std::string indent =
"",
unsigned int verbosity = 1)
const;
427 template <
typename Po
int = DefaultPo
int_t>
463 template <
typename Po
int = DefaultPo
int_t>
499 {
return std::min(+
HalfL(), std::max(-
HalfL(), local)); }
509 static double gausSum(
double a,
double b) {
return std::sqrt(a*a + b*b); }
513 static_assert(std::is_move_assignable_v<geo::WireGeo>);
514 static_assert(std::is_move_constructible_v<geo::WireGeo>);
578 template <
typename Po
int>
580 return geo::vect::convertTo<Point>
586 template <
typename Vector>
590 return geo::vect::convertTo<Vector>(GetEnd<geo::Point_t>() - GetStart<geo::Point_t>()) * (1.0 /
Length());
595 template <
typename Stream>
599 unsigned int verbosity
603 out <<
"wire from " << GetStart<geo::Point_t>()
604 <<
" to " << GetEnd<geo::Point_t>();
606 if (verbosity-- <= 0)
return;
609 out <<
" (" <<
Length() <<
" cm long)";
611 if (verbosity-- <= 0)
return;
614 out <<
", theta(z)=" << ThetaZ() <<
" rad";
616 if (verbosity-- <= 0)
return;
619 out <<
"\n" << indent
620 <<
" center at " << GetCenter<geo::Point_t>() <<
" cm";
622 if (verbosity-- <= 0)
return;
625 out <<
", direction: " << Direction<geo::Vector_t>();
626 if (isHorizontal()) out <<
" (horizontal)";
627 if (isVertical()) out <<
" (vertical)";
636 template <
typename Point >
643 template <
typename Point >
648 return { geo::vect::convertTo<Point>(point), ofsA, ofsB };
681 #endif // LARCOREALG_GEOMETRY_WIREGEO_H
bool isVertical() const
Returns if this wire is vertical (theta_z ~ pi/2)
void Flip()
Set to swap the start and end wire.
void GetStart(double *xyz) const
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.
float Length(const PFPStruct &pfp)
void PrintWireInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this wire.
double fThetaZ
angle of the wire with respect to the z direction
geo::Point_t fCenter
Center of the wire in world coordinates.
double DistanceFrom(geo::WireGeo const &wire) const
Returns 3D distance from the specified wire.
double Length() const
Returns the wire length in centimeters.
const TGeoNode * Node() const
DefaultPoint_t GetEnd() const
static double WirePitch(geo::WireGeo const &w1, geo::WireGeo const &w2)
Returns the pitch (distance on y/z plane) between two wires, in cm.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local wire frame to world frame.
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
DefaultVector_t Direction() const
double fHalfL
half length of the wire
geo::Point_t WiresIntersection(geo::WireGeo const &wireA, geo::WireGeo const &wireB)
Returns the point of wireA that is closest to wireB.
std::string WireInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with all the information of the wire.
DefaultPoint_t GetCenter() const
void LocalToWorldVect(const double *wire, double *world) const
Transform direction vector from local to world.
IntersectionPointAndOffsets< Point > LineClosestPointAndOffsetsWithUnitVectors(Point const &startA, UnitVector const &dirA, Point const &startB, UnitVector const &dirB)
Returns the point of a line that is closest to a second line.
Point GetPositionFromCenter(double localz) const
Returns the position (world coordinate) of a point on the wire.
void UpdateAfterSorting(geo::WireID const &, bool flip)
void LocalToWorld(const double *wire, double *world) const
Transform point from local wire frame to world frame.
Point IntersectionWith(geo::WireGeo const &other) const
Returns the point of this wire that is closest to other wire.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
bool isHorizontal() const
Returns if this wire is horizontal (theta_z ~ 0)
geo::Vector3DBase_t< WireGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML wire plane frame.
double RMax() const
Returns the outer half-size of the wire [cm].
static double gausSum(double a, double b)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Utility for intersection of two 3D lines.
Utilities to extend the interface of geometry vectors.
DefaultPoint_t GetStart() const
double capRelLength(double local) const
Stacked capLength() and relLength().
Point LineClosestPointWithUnitVectors(Point const &startA, UnitVector const &dirA, Point const &startB, UnitVector const &dirB)
Returns the point of a line that is closest to a second line.
LocalVector_t toLocalCoords(geo::Vector_t const &world) const
Transform direction vector from world to local.
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local wire frame.
void WorldToLocalVect(const double *world, double *wire) const
Transform direction vector from world to local.
double HalfL() const
Returns half the length of the wire [cm].
Point GetPositionFromCenterUnbounded(double localz) const
Returns the position (world coordinate) of a point on the wire.
double relLength(double local) const
Returns the relative length from center to be used when transforming.
std::vector< TGeoNode const * > GeoNodePath_t
geo::IntersectionPointAndOffsets< Point > IntersectionAndOffsetsWith(geo::WireGeo const &other) const
Returns the point of this wire that is closest to other wire.
void GetEnd(double *xyz) const
LocalTransformation_t fTrans
Wire to world transform.
DefaultPoint_t GetPositionFromCenter(double localz) const
double capLength(double local) const
Caps the specified local length coordinate to lay on the wire.
WireGeo(TGeoNode const &node, geo::TransformationMatrix &&trans)
Constructor from a ROOT geometry node and a transformation.
geo::Point3DBase_t< WireGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
Data structure for return values of LineClosestPointAndOffsets().
Tag for vectors in the "local" GDML coordinate frame of the plane.
geo::Vector_t toWorldCoords(LocalVector_t const &local) const
Transform direction vector from local to world.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintWireInfo().
GenPoint3DBase_t< double, C > Point3DBase_t
Type of 3D point with representation in double precision.
GenVector3DBase_t< double, C > Vector3DBase_t
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
double CosThetaZ() const
Returns trigonometric operations on ThetaZ()
double ComputeZatY0() const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
DefaultPoint_t GetPositionFromCenterUnbounded(double localz) const
geo::LocalTransformationGeo< ROOT::Math::Transform3D, LocalPoint_t, LocalVector_t > LocalTransformation_t
bool isParallelTo(geo::WireGeo const &wire) const
Returns if this wire is parallel to another.
double RMin() const
Returns the inner radius of the wire (usually 0) [cm].
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
const TGeoNode * fWireNode
Pointer to the wire node.
bool flipped
whether start and end are reversed
geo::IntersectionPointAndOffsets< geo::Point_t > WiresIntersectionAndOffsets(geo::WireGeo const &wireA, geo::WireGeo const &wireB)
Returns the point of wireA that is closest to wireB.
void WorldToLocal(const double *world, double *wire) const
Transform point from world frame to local wire frame.