LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane. Different wires may be connected to the same readout channel. That is of no relevance for the geometry description. More...
#include "WireGeo.h"
Classes | |
struct | WireGeoCoordinatesTag |
Tag for vectors in the "local" GDML coordinate frame of the plane. More... | |
Public Types | |
using | ID_t = WireID |
using | GeoNodePath_t = std::vector< TGeoNode const * > |
Types for geometry-local reference vectors. | |
These types represents points and displacement vectors in the reference frame defined in the wire geometry "box" from the GDML geometry description. No alias is explicitly defined for the LArSoft global vector types, Remember the | |
using | LocalPoint_t = Point3DBase_t< WireGeoCoordinatesTag > |
Type of points in the local GDML wire plane frame. More... | |
using | LocalVector_t = Vector3DBase_t< WireGeoCoordinatesTag > |
Type of displacement vectors in the local GDML wire plane frame. More... | |
Public Member Functions | |
WireGeo (TGeoNode const &node, TransformationMatrix &&trans) | |
Constructor from a ROOT geometry node and a transformation. More... | |
const TGeoNode * | Node () const |
void | UpdateAfterSorting (WireID const &, bool flip) |
Size and coordinates | |
double | RMax () const |
Returns the outer half-size of the wire [cm]. More... | |
double | HalfL () const |
Returns half the length of the wire [cm]. More... | |
double | RMin () const |
Returns the inner radius of the wire (usually 0) [cm]. More... | |
Point_t | GetPositionFromCenter (double localz) const |
Returns the position (world coordinate) of a point on the wire. More... | |
Point_t | GetPositionFromCenterUnbounded (double localz) const |
Returns the position (world coordinate) of a point on the wire. More... | |
Point_t const & | GetCenter () const |
Returns the world coordinate of the center of the wire [cm]. More... | |
Point_t | GetStart () const |
Returns the world coordinate of one end of the wire [cm]. More... | |
Point_t | GetEnd () const |
Returns the world coordinate of one end of the wire [cm]. More... | |
double | Length () const |
Returns the wire length in centimeters. More... | |
Orientation and angles | |
double | ThetaZ () const |
Returns angle of wire with respect to z axis in the Y-Z plane in radians. More... | |
double | ThetaZ (bool degrees) const |
double | CosThetaZ () const |
Returns trigonometric operations on ThetaZ() More... | |
double | SinThetaZ () const |
Returns trigonometric operations on ThetaZ() More... | |
double | TanThetaZ () const |
Returns trigonometric operations on ThetaZ() More... | |
bool | isHorizontal () const |
Returns if this wire is horizontal (theta_z ~ 0) More... | |
bool | isVertical () const |
Returns if this wire is vertical (theta_z ~ pi/2) More... | |
bool | isParallelTo (WireGeo const &wire) const |
Returns if this wire is parallel to another. More... | |
Vector_t | Direction () const |
Coordinate transformation | |
Local points and displacement vectors are described by the types | |
Point_t | toWorldCoords (LocalPoint_t const &local) const |
Transform point from local wire frame to world frame. More... | |
Vector_t | toWorldCoords (LocalVector_t const &local) const |
Transform direction vector from local to world. More... | |
LocalPoint_t | toLocalCoords (Point_t const &world) const |
Transform point from world frame to local wire frame. More... | |
LocalVector_t | toLocalCoords (Vector_t const &world) const |
Transform direction vector from world to local. More... | |
Geometric properties and algorithms | |
double | ComputeZatY0 () const |
double | DistanceFrom (WireGeo const &wire) const |
Returns 3D distance from the specified wire. More... | |
Point_t | IntersectionWith (WireGeo const &other) const |
Returns the point of this wire that is closest to other wire. More... | |
IntersectionPointAndOffsets< Point_t > | IntersectionAndOffsetsWith (WireGeo const &other) const |
Returns the point of this wire that is closest to other wire. More... | |
Static Public Member Functions | |
static double | WirePitch (WireGeo const &w1, WireGeo const &w2) |
Returns the pitch (distance on y/z plane) between two wires, in cm. More... | |
Private Types | |
using | LocalTransformation_t = LocalTransformationGeo< ROOT::Math::Transform3D, LocalPoint_t, LocalVector_t > |
Private Member Functions | |
double | relLength (double local) const |
Returns the relative length from center to be used when transforming. More... | |
double | capLength (double local) const |
Caps the specified local length coordinate to lay on the wire. More... | |
void | Flip () |
Set to swap the start and end wire. More... | |
Private Attributes | |
const TGeoNode * | fWireNode |
Pointer to the wire node. More... | |
double | fThetaZ |
angle of the wire with respect to the z direction More... | |
double | fHalfL |
half length of the wire More... | |
Point_t | fCenter |
Center of the wire in world coordinates. More... | |
LocalTransformation_t | fTrans |
Wire to world transform. More... | |
bool | flipped |
whether (0, 0, fHalfL) identified end (false) or start (true) More... | |
Printing | |
static constexpr unsigned int | MaxVerbosity = 4 |
Maximum verbosity supported by PrintWireInfo() . More... | |
template<typename Stream > | |
void | PrintWireInfo (Stream &&out, std::string indent="", unsigned int verbosity=1) const |
Prints information about this wire. More... | |
std::string | WireInfo (std::string indent="", unsigned int verbosity=1) const |
Returns a string with all the information of the wire. More... | |
Geometry description of a TPC wire
The wire is a single straight segment on a wire plane. Different wires may be connected to the same readout channel. That is of no relevance for the geometry description.
The wire has a start and an end point. Their definition of them is related to the other wires in the plane and to the TPC itself.
The direction of increasing wire coordinate, defined in the wire plane, is orthogonal to the wire direction and of course points to the direction where the wire number within the plane increases. This direction is indirectly defined when sorting the wires in the plane, which is done by the plane (geo::PlaneGeo). This direction lies by definition on the wire plane. The direction normal to the wire plane is defined by the TPC so that it points inward the TPC rather than outward. Finally, the wire direction is defined so that the triplet of unit vectors direction of the wire , direction of increasing wire number , and normal to the plane is positively defined ( ). The start and the end of the wire are defined so that their difference points in the same direction as .
using geo::WireGeo::GeoNodePath_t = std::vector<TGeoNode const*> |
using geo::WireGeo::ID_t = WireID |
|
private |
geo::WireGeo::WireGeo | ( | TGeoNode const & | node, |
geo::TransformationMatrix && | trans | ||
) |
Constructor from a ROOT geometry node and a transformation.
node | ROOT geometry node |
trans | transformation matrix (local to world) |
The node describes the shape of the wire (the only relevant information is in fact the length), while the transformation described its positioning in the world (both position and orientation).
A pointer to the node and a copy of the transformation matrix are kept in the WireGeo
object.
Definition at line 31 of file WireGeo.cxx.
References util::end(), fCenter, fHalfL, fThetaZ, fWireNode, geo::vect::isfinite(), util::pi(), and toWorldCoords().
|
inlineprivate |
Caps the specified local length coordinate to lay on the wire.
Definition at line 469 of file WireGeo.h.
References Flip(), and HalfL().
Referenced by GetPositionFromCenter().
|
inline |
Returns the z coordinate, in centimetres, at the point where y = 0. Assumes the wire orthogonal to x axis and the wire not parallel to z.
Definition at line 374 of file WireGeo.h.
References DistanceFrom(), fCenter, and TanThetaZ().
|
inline |
Returns trigonometric operations on ThetaZ()
Definition at line 262 of file WireGeo.h.
Referenced by GetPositionFromCenterUnbounded(), geo::ChannelMapStandardAlg::Initialize(), and TanThetaZ().
|
inline |
Returns the wire direction as a norm-one vector.
Vector | type of the vector being returned |
Definition at line 289 of file WireGeo.h.
Referenced by lar_cluster3d::MinSpanTreeAlg::configure(), DistanceFrom(), lar_cluster3d::SnippetHit3DBuilder::DistanceFromPointToHitWire(), geo::PlaneGeo::GetNormalAxis(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_2D(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc2DDocas(), PrintWireInfo(), geo::PlaneGeo::shouldFlipWire(), TanThetaZ(), lar_cluster3d::SnippetHit3DBuilder::WireIDsIntersect(), geo::WiresIntersection(), and geo::WiresIntersectionAndOffsets().
double geo::WireGeo::DistanceFrom | ( | geo::WireGeo const & | wire | ) | const |
Returns 3D distance from the specified wire.
If the specified wire is "ahead" in z respect to this, the distance is returned negative.
Definition at line 96 of file WireGeo.cxx.
References Direction(), GetCenter(), and isParallelTo().
Referenced by ComputeZatY0(), and WirePitch().
|
private |
Set to swap the start and end wire.
Definition at line 128 of file WireGeo.cxx.
References flipped.
Referenced by capLength(), and UpdateAfterSorting().
|
inline |
Returns the world coordinate of the center of the wire [cm].
Definition at line 221 of file WireGeo.h.
Referenced by hit::MagDriftAna::analyze(), trkf::SpacePointAlg::compatible(), lar_pandora::LArPandoraInput::CreatePandoraHits2D(), DistanceFrom(), lar_cluster3d::SnippetHit3DBuilder::DistanceFromPointToHitWire(), trkf::SpacePointAlg::fillComplexSpacePoint(), trkf::SpacePointAlg::fillSpacePoint(), geo::PlaneGeo::GetNormalAxis(), GetPositionFromCenterUnbounded(), cluster::MergeClusterAlg::GlobalWire(), cluster::BlurredClusteringAlg::GlobalWire(), shower::EMShowerAlg::GlobalWire_(), ems::Hit2D::Hit2D(), geo::ChannelMapStandardAlg::Initialize(), recob::tracking::makePlane(), trkf::Track3DKalmanHitAlg::makeSeed(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_2D(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc2DDocas(), geo::PlaneGeo::PlaneCoordinateFrom(), PrintWireInfo(), trkf::SpacePointAlg::separation(), geo::sortWireStandard(), trkf::SurfWireLine::SurfWireLine(), trkf::SurfWireX::SurfWireX(), apa::APAGeometryAlg::ThreeChanPos(), geo::PlaneGeo::UpdateIncreasingWireDir(), lar_cluster3d::SnippetHit3DBuilder::WireIDsIntersect(), geo::WiresIntersection(), and geo::WiresIntersectionAndOffsets().
|
inline |
Returns the world coordinate of one end of the wire [cm].
Definition at line 231 of file WireGeo.h.
Referenced by trkf::SpacePointAlg::compatible(), evd_tool::MicroBooNEDrawer::DrawBadChannels(), evd_tool::ICARUSDrawer::DrawBadChannels(), trkf::SpacePointAlg::fillComplexSpacePoint(), trkf::SpacePointAlg::fillSpacePoint(), GetPositionFromCenterUnbounded(), lar_pandora::PFParticleHitDumper::GetUVW(), geo::details::ActiveAreaCalculator::initializeWireEnds(), trkf::SpacePointAlg::makeSpacePoints(), PrintWireInfo(), trkf::SpacePointAlg::separation(), TanThetaZ(), and geo::GeometryCore::WireEndPoints().
|
inline |
Returns the position (world coordinate) of a point on the wire.
localz | distance of the requested point from the middle of the wire |
The center of the wires corresponds to localz
equal to 0
; negative positions head toward the start of the wire, positive toward the end.
If the localz
position would put the point outside the wire, the returned position is the wire end closest to the requested position.
Definition at line 194 of file WireGeo.h.
References capLength(), and GetPositionFromCenterUnbounded().
|
inline |
Returns the position (world coordinate) of a point on the wire.
localz | distance of the requested point from the middle of the wire |
GetCenter()
, GetStart()
, GetEnd()
, GetPositionFromCenter()
The center of the wires corresponds to localz
equal to 0
; negative positions head toward the start of the wire, positive toward the end.
If the localz
position would put the point outside the wire, the returned position will lie beyond the end of the wire.
Definition at line 213 of file WireGeo.h.
References CosThetaZ(), fCenter, fThetaZ, GetCenter(), GetEnd(), GetStart(), HalfL(), Length(), relLength(), ThetaZ(), and toWorldCoords().
Referenced by GetPositionFromCenter().
|
inline |
Returns the world coordinate of one end of the wire [cm].
Definition at line 226 of file WireGeo.h.
Referenced by evd_tool::MicroBooNEDrawer::DrawBadChannels(), evd_tool::ICARUSDrawer::DrawBadChannels(), GetPositionFromCenterUnbounded(), lar_pandora::PFParticleHitDumper::GetUVW(), geo::details::ActiveAreaCalculator::initializeWireEnds(), trkf::SpacePointAlg::makeSpacePoints(), PrintWireInfo(), TanThetaZ(), and geo::GeometryCore::WireEndPoints().
|
inline |
Returns half the length of the wire [cm].
Definition at line 172 of file WireGeo.h.
Referenced by capLength(), geo::GeometryCore::ChannelsIntersect(), trkf::SpacePointAlg::compatible(), lar_cluster3d::SnippetHit3DBuilder::DistanceFromPointToHitWire(), trkf::SpacePointAlg::fillComplexSpacePoint(), trkf::SpacePointAlg::fillSpacePoint(), GetPositionFromCenterUnbounded(), trkf::SpacePointAlg::makeSpacePoints(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc2DDocas(), trkf::SpacePointAlg::separation(), and lar_cluster3d::SnippetHit3DBuilder::WireIDsIntersect().
|
inline |
Returns the point of this wire that is closest to other
wire.
Point | the type of point returned |
other | the other wire |
point
: the point of this wire closest to other
; offset1
: its offset on this wire [cm]; offset2
: its offset on the other
wire [cm] The point of this wire that is closest to any point of the other
wire is returned. The returned intersection point is the same as for IntersectionWith(other)
. The return value is actually triplet, though, which is most easily unpacked immediately:
The two other elements of the triplets are the distances of the intersection point from the center of this wire (offset
in the example) and from the center of the other
wire (otherOffset
), in centimeters. The sign of the offsets are positive if the intersection points lie on the side pointed by the Direction()
of the respective wires.
To reassign the variables after they have been defined, instead:
Definition at line 435 of file WireGeo.h.
References UpdateAfterSorting(), and geo::WiresIntersectionAndOffsets().
Returns the point of this wire that is closest to other
wire.
other | the other wire |
other
The point of this wire that is closest to any point of the other
wire is returned.
The other
wire is assumed not to be parallel to this one, and when this prerequisite is not met the behaviour is undefined.
Another method, IntersectionAndOffsetsWith()
, also returns the offset of the intersection from the two wire centers.
Definition at line 400 of file WireGeo.h.
References geo::WiresIntersection().
|
inline |
Returns if this wire is horizontal (theta_z ~ 0)
Definition at line 269 of file WireGeo.h.
Referenced by PrintWireInfo(), and TanThetaZ().
|
inline |
Returns if this wire is parallel to another.
Definition at line 279 of file WireGeo.h.
Referenced by DistanceFrom(), and TanThetaZ().
|
inline |
Returns if this wire is vertical (theta_z ~ pi/2)
Definition at line 274 of file WireGeo.h.
Referenced by PrintWireInfo(), and TanThetaZ().
|
inline |
Returns the wire length in centimeters.
Definition at line 236 of file WireGeo.h.
Referenced by GetPositionFromCenterUnbounded(), PrintWireInfo(), and TanThetaZ().
|
inline |
Definition at line 366 of file WireGeo.h.
References fWireNode.
void geo::WireGeo::PrintWireInfo | ( | Stream && | out, |
std::string | indent = "" , |
||
unsigned int | verbosity = 1 |
||
) | const |
Prints information about this wire.
Stream | type of output stream to use |
out | stream to send the information to |
indent | prepend each line with this string |
verbosity | amount of information printed |
Note that the first line out the output is not indented.
The constant MaxVerbosity
is set to the highest supported verbosity level.
Definition at line 486 of file WireGeo.h.
References Direction(), GetCenter(), GetEnd(), GetStart(), isHorizontal(), isVertical(), Length(), and ThetaZ().
Referenced by geo::GeometryCore::Print(), TanThetaZ(), and WireInfo().
|
inlineprivate |
Returns the relative length from center to be used when transforming.
Definition at line 466 of file WireGeo.h.
Referenced by GetPositionFromCenterUnbounded().
double geo::WireGeo::RMax | ( | ) | const |
Returns the outer half-size of the wire [cm].
Definition at line 69 of file WireGeo.cxx.
References fWireNode.
double geo::WireGeo::RMin | ( | ) | const |
Returns the inner radius of the wire (usually 0) [cm].
Definition at line 75 of file WireGeo.cxx.
References fWireNode.
|
inline |
Returns trigonometric operations on ThetaZ()
Definition at line 263 of file WireGeo.h.
References ThetaZ().
Referenced by geo::ChannelMapStandardAlg::Initialize(), and TanThetaZ().
|
inline |
Returns trigonometric operations on ThetaZ()
Definition at line 264 of file WireGeo.h.
References util::abs(), CosThetaZ(), Direction(), e, GetEnd(), GetStart(), art::detail::indent(), isHorizontal(), isParallelTo(), isVertical(), Length(), PrintWireInfo(), SinThetaZ(), ThetaZ(), and WireInfo().
Referenced by ComputeZatY0().
|
inline |
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition at line 248 of file WireGeo.h.
Referenced by trkf::Track3DKalmanSPS::dQdxCalc(), evd::RecoBaseDrawer::DrawTrack2D(), util::GeometryUtilities::GeometryUtilities(), GetPositionFromCenterUnbounded(), recob::tracking::makePlane(), trkf::Track3DKalmanHitAlg::makeSeed(), PrintWireInfo(), SinThetaZ(), trkf::SurfWireLine::SurfWireLine(), trkf::SurfWireX::SurfWireX(), TanThetaZ(), and geo::PlaneGeo::ThetaZ().
double geo::WireGeo::ThetaZ | ( | bool | degrees | ) | const |
Returns angle of wire with respect to z axis in the Y-Z plane
degrees | return the angle in degrees rather than radians |
Definition at line 81 of file WireGeo.cxx.
References fThetaZ, and util::RadiansToDegrees().
|
inline |
Transform point from world frame to local wire frame.
Definition at line 358 of file WireGeo.h.
References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords().
|
inline |
Transform direction vector from world to local.
Definition at line 361 of file WireGeo.h.
References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords().
|
inline |
Transform point from local wire frame to world frame.
Definition at line 352 of file WireGeo.h.
References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toWorldCoords().
Referenced by GetPositionFromCenterUnbounded(), and WireGeo().
|
inline |
Transform direction vector from local to world.
Definition at line 355 of file WireGeo.h.
References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toWorldCoords().
void geo::WireGeo::UpdateAfterSorting | ( | geo::WireID const & | , |
bool | flip | ||
) |
Internal updates after the relative position of the wire is known (currently no-op)
Definition at line 119 of file WireGeo.cxx.
References Flip().
Referenced by IntersectionAndOffsetsWith().
std::string geo::WireGeo::WireInfo | ( | std::string | indent = "" , |
unsigned int | verbosity = 1 |
||
) | const |
Returns a string with all the information of the wire.
PrintWireInfo()
All arguments are equivalent to the ones of PrintWireInfo
.
Definition at line 87 of file WireGeo.cxx.
References PrintWireInfo().
Referenced by TanThetaZ().
Returns the pitch (distance on y/z plane) between two wires, in cm.
Definition at line 449 of file WireGeo.h.
References util::abs(), and DistanceFrom().
Referenced by geo::PlaneGeo::UpdateWirePitch(), and geo::PlaneGeo::UpdateWirePitchSlow().
|
private |
Center of the wire in world coordinates.
Definition at line 461 of file WireGeo.h.
Referenced by ComputeZatY0(), GetPositionFromCenterUnbounded(), and WireGeo().
|
private |
|
private |
|
private |
angle of the wire with respect to the z direction
Definition at line 459 of file WireGeo.h.
Referenced by GetPositionFromCenterUnbounded(), ThetaZ(), and WireGeo().
|
private |
Wire to world transform.
Definition at line 462 of file WireGeo.h.
Referenced by toLocalCoords(), and toWorldCoords().
|
private |
|
static |
Maximum verbosity supported by PrintWireInfo()
.
Definition at line 336 of file WireGeo.h.
Referenced by geo::GeometryCore::Print().