LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::WireGeo Class Reference

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, geo::Point_t and geo::Vector_t.

Remember the LocalPoint_t and LocalVector_t vectors from different instances of geo::WireGeo have the same type but are not compatible.

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 geo::WireGeo::LocalPoint_t and geo::WireGeo::LocalVector_t, respectively.

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_tIntersectionAndOffsetsWith (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...
 

Detailed Description

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 $ \hat{l} $, direction of increasing wire number $ \hat{w} $, and normal to the plane $ \hat{n} $ is positively defined ( $ \hat{l} \times \hat{w} \cdot \hat{n} = +1 $). The start $ \vec{a}_{w} $ and the end of the wire $ \vec{b}_{w} $ are defined so that their difference $ \vec{b}_{w} - \vec{a}_{w} $ points in the same direction as $ \hat{l} $.

Definition at line 114 of file WireGeo.h.

Member Typedef Documentation

using geo::WireGeo::GeoNodePath_t = std::vector<TGeoNode const*>

Definition at line 117 of file WireGeo.h.

Definition at line 116 of file WireGeo.h.

Type of points in the local GDML wire plane frame.

Definition at line 139 of file WireGeo.h.

Definition at line 456 of file WireGeo.h.

Type of displacement vectors in the local GDML wire plane frame.

Definition at line 142 of file WireGeo.h.

Constructor & Destructor Documentation

geo::WireGeo::WireGeo ( TGeoNode const &  node,
geo::TransformationMatrix &&  trans 
)

Constructor from a ROOT geometry node and a transformation.

Parameters
nodeROOT geometry node
transtransformation 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().

32  : fWireNode(&node), fTrans(std::move(trans)), flipped(false)
33  {
34  fHalfL = ((TGeoTube*)fWireNode->GetVolume()->GetShape())->GetDZ();
35 
36  // uncomment the following to check the paths to the wires
37  // std::string p(base);
38  // for(int i = 0; i <= depth; ++i){
39  // p += "/";
40  // p += path[i]->GetName();
41  // }
42  // std::cout << p.c_str() << std::endl;
43 
44  // determine the orientation of the wire
45  auto lp = geo::origin<LocalPoint_t>();
46  fCenter = toWorldCoords(lp);
47 
48  lp.SetZ(fHalfL);
49  auto end = toWorldCoords(lp);
50 
51  fThetaZ = std::acos(std::clamp((end.Z() - fCenter.Z()) / fHalfL, -1.0, +1.0));
52 
53  // check to see if it runs "forward" or "backwards" in z
54  // check is made looking at the y position of the end point
55  // relative to the center point because you want to know if
56  // the end point is above or below the center of the wire in
57  // the yz plane
58  if (end.Y() < fCenter.Y()) fThetaZ *= -1.;
59 
60  //This ensures we are looking at the angle between 0 and Pi
61  //as if the wire runs at one angle it also runs at that angle +-Pi
62  if (fThetaZ < 0) fThetaZ += util::pi();
63 
64  assert(std::isfinite(fThetaZ));
65 
66  } // geo::WireGeo::WireGeo()
double fThetaZ
angle of the wire with respect to the z direction
Definition: WireGeo.h:459
Point_t fCenter
Center of the wire in world coordinates.
Definition: WireGeo.h:461
double fHalfL
half length of the wire
Definition: WireGeo.h:460
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
bool isfinite(Vector const &v)
Returns whether all components of the vector are finite.
LocalTransformation_t fTrans
Wire to world transform.
Definition: WireGeo.h:462
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local wire frame to world frame.
Definition: WireGeo.h:352
const TGeoNode * fWireNode
Pointer to the wire node.
Definition: WireGeo.h:458
bool flipped
whether (0, 0, fHalfL) identified end (false) or start (true)
Definition: WireGeo.h:463

Member Function Documentation

double geo::WireGeo::capLength ( double  local) const
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().

469 { return std::min(+HalfL(), std::max(-HalfL(), local)); }
double HalfL() const
Returns half the length of the wire [cm].
Definition: WireGeo.h:172
double geo::WireGeo::ComputeZatY0 ( ) const
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().

374 { return fCenter.Z() - fCenter.Y() / TanThetaZ(); }
Point_t fCenter
Center of the wire in world coordinates.
Definition: WireGeo.h:461
double TanThetaZ() const
Returns trigonometric operations on ThetaZ()
Definition: WireGeo.h:264
double geo::WireGeo::CosThetaZ ( ) const
inline

Returns trigonometric operations on ThetaZ()

Definition at line 262 of file WireGeo.h.

Referenced by GetPositionFromCenterUnbounded(), geo::ChannelMapStandardAlg::Initialize(), and TanThetaZ().

262 { return std::cos(ThetaZ()); }
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:248
Vector_t geo::WireGeo::Direction ( ) const
inline

Returns the wire direction as a norm-one vector.

Template Parameters
Vectortype 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().

290  {
291  // maybe (GetCenter() - GetStart()) / HalfL() would be faster;
292  return (GetEnd() - GetStart()) / Length();
293  }
double Length() const
Returns the wire length in centimeters.
Definition: WireGeo.h:236
Point_t GetStart() const
Returns the world coordinate of one end of the wire [cm].
Definition: WireGeo.h:226
Point_t GetEnd() const
Returns the world coordinate of one end of the wire [cm].
Definition: WireGeo.h:231
double geo::WireGeo::DistanceFrom ( geo::WireGeo const &  wire) const

Returns 3D distance from the specified wire.

Returns
the signed distance in centimetres (0 if wires are not parallel)

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().

97  {
98  //
99  // The algorithm assumes that picking any point on the wire will do,
100  // that is, that the wires are parallel.
101  //
102 
103  if (!isParallelTo(wire)) return 0;
104 
105  // a vector connecting to the other wire
106  auto const toWire = wire.GetCenter() - GetCenter();
107 
108  // the distance is that vector, times the sine of the angle with the wire
109  // direction; we get that in a generic way with a cross product.
110  // We don't even care about the sign here
111  // (if we did, we would do a dot-product with the normal to the plane,
112  // and we should get a positive distance if the other wire has larger wire
113  // coordinate than this one).
114  return toWire.Cross(Direction()).R();
115 
116  } // WireGeo::DistanceFrom()
bool isParallelTo(WireGeo const &wire) const
Returns if this wire is parallel to another.
Definition: WireGeo.h:279
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
Definition: WireGeo.h:221
Vector_t Direction() const
Definition: WireGeo.h:289
void geo::WireGeo::Flip ( )
private

Set to swap the start and end wire.

Definition at line 128 of file WireGeo.cxx.

References flipped.

Referenced by capLength(), and UpdateAfterSorting().

129  {
130  // we don't need to do much to flip so far:
131  // - ThetaZ() is defined in [0, pi], invariant to flipping
132  // - we don't change the transformation matrices, that we want to be
133  // untouched and coherent with the original geometry source
134  // - center is invariant for flipping
135  // - start and end are computed on the fly (taking flipping into account)
136  // - ... and we chose to leave half length unsigned and independent
137 
138  // change the flipping bit
139  flipped = !flipped;
140 
141  } // WireGeo::Flip()
bool flipped
whether (0, 0, fHalfL) identified end (false) or start (true)
Definition: WireGeo.h:463
Point_t geo::WireGeo::GetEnd ( ) const
inline
Point_t geo::WireGeo::GetPositionFromCenter ( double  localz) const
inline

Returns the position (world coordinate) of a point on the wire.

Parameters
localzdistance of the requested point from the middle of the wire
Returns
the position of the requested point (in cm)
See also
GetCenter(), GetStart(), GetEnd(), GetPositionFromCenterUnbounded()

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().

195  {
197  }
Point_t GetPositionFromCenterUnbounded(double localz) const
Returns the position (world coordinate) of a point on the wire.
Definition: WireGeo.h:213
double capLength(double local) const
Caps the specified local length coordinate to lay on the wire.
Definition: WireGeo.h:469
Point_t geo::WireGeo::GetPositionFromCenterUnbounded ( double  localz) const
inline

Returns the position (world coordinate) of a point on the wire.

Parameters
localzdistance of the requested point from the middle of the wire
Returns
the position of the requested point (in cm)
See also
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().

214  {
215  return toWorldCoords(LocalPoint_t{0.0, 0.0, relLength(localz)});
216  }
double relLength(double local) const
Returns the relative length from center to be used when transforming.
Definition: WireGeo.h:466
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local wire frame to world frame.
Definition: WireGeo.h:352
Point3DBase_t< WireGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
Definition: WireGeo.h:139
Point_t geo::WireGeo::GetStart ( ) const
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().

Point_t GetPositionFromCenterUnbounded(double localz) const
Returns the position (world coordinate) of a point on the wire.
Definition: WireGeo.h:213
double HalfL() const
Returns half the length of the wire [cm].
Definition: WireGeo.h:172
IntersectionPointAndOffsets<Point_t> geo::WireGeo::IntersectionAndOffsetsWith ( WireGeo const &  other) const
inline

Returns the point of this wire that is closest to other wire.

Template Parameters
Pointthe type of point returned
Parameters
otherthe other wire
Returns
a data structure with three fields: point: the point of this wire closest to other; offset1: its offset on this wire [cm]; offset2: its offset on the other wire [cm]
See also
IntersectionWith()

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:

auto [point, offset, otherOffset]
= wire.IntersectionAndOffsetsWith(otherWire);

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:

std::tie(point, otherOffset, offset)
= otherWire.IntersectionAndOffsetsWith(wire);

Definition at line 435 of file WireGeo.h.

References UpdateAfterSorting(), and geo::WiresIntersectionAndOffsets().

436  {
437  auto const [point, ofsA, ofsB] = WiresIntersectionAndOffsets(*this, other);
438  return {point, ofsA, ofsB};
439  }
IntersectionPointAndOffsets< Point_t > WiresIntersectionAndOffsets(WireGeo const &wireA, WireGeo const &wireB)
Returns the point of wireA that is closest to wireB.
Definition: WireGeo.h:518
Point_t geo::WireGeo::IntersectionWith ( WireGeo const &  other) const
inline

Returns the point of this wire that is closest to other wire.

Parameters
otherthe other wire
Returns
the point of this wire closest to other
See also
IntersectionAndOffsetsWith()

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().

400 { return WiresIntersection(*this, other); }
Point_t WiresIntersection(WireGeo const &wireA, WireGeo const &wireB)
Returns the point of wireA that is closest to wireB.
Definition: WireGeo.h:528
bool geo::WireGeo::isHorizontal ( ) const
inline

Returns if this wire is horizontal (theta_z ~ 0)

Definition at line 269 of file WireGeo.h.

Referenced by PrintWireInfo(), and TanThetaZ().

269 { return std::abs(SinThetaZ()) < 1e-5; }
double SinThetaZ() const
Returns trigonometric operations on ThetaZ()
Definition: WireGeo.h:263
constexpr auto abs(T v)
Returns the absolute value of the argument.
Float_t e
Definition: plot.C:35
bool geo::WireGeo::isParallelTo ( WireGeo const &  wire) const
inline

Returns if this wire is parallel to another.

Definition at line 279 of file WireGeo.h.

Referenced by DistanceFrom(), and TanThetaZ().

280  {
281  return // parallel if the dot product of the directions is about +/- 1
282  std::abs(std::abs(Direction().Dot(wire.Direction())) - 1.) < 1e-5;
283  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
Vector_t Direction() const
Definition: WireGeo.h:289
Float_t e
Definition: plot.C:35
bool geo::WireGeo::isVertical ( ) const
inline

Returns if this wire is vertical (theta_z ~ pi/2)

Definition at line 274 of file WireGeo.h.

Referenced by PrintWireInfo(), and TanThetaZ().

274 { return std::abs(CosThetaZ()) < 1e-5; }
constexpr auto abs(T v)
Returns the absolute value of the argument.
double CosThetaZ() const
Returns trigonometric operations on ThetaZ()
Definition: WireGeo.h:262
Float_t e
Definition: plot.C:35
double geo::WireGeo::Length ( ) const
inline

Returns the wire length in centimeters.

Definition at line 236 of file WireGeo.h.

Referenced by GetPositionFromCenterUnbounded(), PrintWireInfo(), and TanThetaZ().

236 { return 2. * HalfL(); }
double HalfL() const
Returns half the length of the wire [cm].
Definition: WireGeo.h:172
const TGeoNode* geo::WireGeo::Node ( ) const
inline

Definition at line 366 of file WireGeo.h.

References fWireNode.

366 { return fWireNode; }
const TGeoNode * fWireNode
Pointer to the wire node.
Definition: WireGeo.h:458
template<typename Stream >
void geo::WireGeo::PrintWireInfo ( Stream &&  out,
std::string  indent = "",
unsigned int  verbosity = 1 
) const

Prints information about this wire.

Template Parameters
Streamtype of output stream to use
Parameters
outstream to send the information to
indentprepend each line with this string
verbosityamount of information printed

Note that the first line out the output is not indented.

Verbosity levels

  • 0: only start and end
  • 1 _(default)_: also length
  • 2: also angle with z axis
  • 3: also center
  • 4: also direction

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().

490 {
491  //----------------------------------------------------------------------------
492  out << "wire from " << GetStart() << " to " << GetEnd();
493 
494  if (verbosity-- <= 0) return; // 0
495 
496  //----------------------------------------------------------------------------
497  out << " (" << Length() << " cm long)";
498 
499  if (verbosity-- <= 0) return; // 1
500 
501  //----------------------------------------------------------------------------
502  out << ", theta(z)=" << ThetaZ() << " rad";
503 
504  if (verbosity-- <= 0) return; // 2
505 
506  //----------------------------------------------------------------------------
507  out << "\n" << indent << " center at " << GetCenter() << " cm";
508 
509  if (verbosity-- <= 0) return; // 3
510 
511  //----------------------------------------------------------------------------
512  out << ", direction: " << Direction();
513  if (isHorizontal()) out << " (horizontal)";
514  if (isVertical()) out << " (vertical)";
515 }
bool isVertical() const
Returns if this wire is vertical (theta_z ~ pi/2)
Definition: WireGeo.h:274
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
Definition: WireGeo.h:221
double Length() const
Returns the wire length in centimeters.
Definition: WireGeo.h:236
Point_t GetStart() const
Returns the world coordinate of one end of the wire [cm].
Definition: WireGeo.h:226
Point_t GetEnd() const
Returns the world coordinate of one end of the wire [cm].
Definition: WireGeo.h:231
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:248
bool isHorizontal() const
Returns if this wire is horizontal (theta_z ~ 0)
Definition: WireGeo.h:269
Vector_t Direction() const
Definition: WireGeo.h:289
std::string indent(std::size_t const i)
double geo::WireGeo::relLength ( double  local) const
inlineprivate

Returns the relative length from center to be used when transforming.

Definition at line 466 of file WireGeo.h.

Referenced by GetPositionFromCenterUnbounded().

466 { return flipped ? -local : local; }
bool flipped
whether (0, 0, fHalfL) identified end (false) or start (true)
Definition: WireGeo.h:463
double geo::WireGeo::RMax ( ) const

Returns the outer half-size of the wire [cm].

Definition at line 69 of file WireGeo.cxx.

References fWireNode.

70  {
71  return ((TGeoTube*)fWireNode->GetVolume()->GetShape())->GetRmax();
72  }
const TGeoNode * fWireNode
Pointer to the wire node.
Definition: WireGeo.h:458
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.

76  {
77  return ((TGeoTube*)fWireNode->GetVolume()->GetShape())->GetRmin();
78  }
const TGeoNode * fWireNode
Pointer to the wire node.
Definition: WireGeo.h:458
double geo::WireGeo::SinThetaZ ( ) const
inline

Returns trigonometric operations on ThetaZ()

Definition at line 263 of file WireGeo.h.

References ThetaZ().

Referenced by geo::ChannelMapStandardAlg::Initialize(), and TanThetaZ().

263 { return std::sin(ThetaZ()); }
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:248
double geo::WireGeo::TanThetaZ ( ) const
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().

264 { return std::tan(ThetaZ()); }
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:248
double geo::WireGeo::ThetaZ ( ) const
inline
double geo::WireGeo::ThetaZ ( bool  degrees) const

Returns angle of wire with respect to z axis in the Y-Z plane

Parameters
degreesreturn the angle in degrees rather than radians
Returns
wire angle

Definition at line 81 of file WireGeo.cxx.

References fThetaZ, and util::RadiansToDegrees().

82  {
83  return degrees ? util::RadiansToDegrees(fThetaZ) : fThetaZ;
84  }
double fThetaZ
angle of the wire with respect to the z direction
Definition: WireGeo.h:459
constexpr T RadiansToDegrees(T angle)
Converts the argument angle from radians into degrees ( )
LocalPoint_t geo::WireGeo::toLocalCoords ( Point_t const &  world) const
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().

358 { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Wire to world transform.
Definition: WireGeo.h:462
LocalVector_t geo::WireGeo::toLocalCoords ( Vector_t const &  world) const
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().

361 { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Wire to world transform.
Definition: WireGeo.h:462
Point_t geo::WireGeo::toWorldCoords ( LocalPoint_t const &  local) const
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().

352 { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
Wire to world transform.
Definition: WireGeo.h:462
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
Vector_t geo::WireGeo::toWorldCoords ( LocalVector_t const &  local) const
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().

355 { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
Wire to world transform.
Definition: WireGeo.h:462
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
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().

120  {
121 
122  // flip, if asked
123  if (flip) Flip();
124 
125  } // WireGeo::UpdateAfterSorting()
void Flip()
Set to swap the start and end wire.
Definition: WireGeo.cxx:128
std::string geo::WireGeo::WireInfo ( std::string  indent = "",
unsigned int  verbosity = 1 
) const

Returns a string with all the information of the wire.

See also
PrintWireInfo()

All arguments are equivalent to the ones of PrintWireInfo.

Definition at line 87 of file WireGeo.cxx.

References PrintWireInfo().

Referenced by TanThetaZ().

89  {
90  std::ostringstream sstr;
91  PrintWireInfo(sstr, indent, verbosity);
92  return sstr.str();
93  } // WireGeo::WireInfo()
void PrintWireInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this wire.
Definition: WireGeo.h:486
std::string indent(std::size_t const i)
static double geo::WireGeo::WirePitch ( WireGeo const &  w1,
WireGeo const &  w2 
)
inlinestatic

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().

450  {
451  return std::abs(w2.DistanceFrom(w1));
452  }
constexpr auto abs(T v)
Returns the absolute value of the argument.

Member Data Documentation

Point_t geo::WireGeo::fCenter
private

Center of the wire in world coordinates.

Definition at line 461 of file WireGeo.h.

Referenced by ComputeZatY0(), GetPositionFromCenterUnbounded(), and WireGeo().

double geo::WireGeo::fHalfL
private

half length of the wire

Definition at line 460 of file WireGeo.h.

Referenced by WireGeo().

bool geo::WireGeo::flipped
private

whether (0, 0, fHalfL) identified end (false) or start (true)

Definition at line 463 of file WireGeo.h.

Referenced by Flip().

double geo::WireGeo::fThetaZ
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().

LocalTransformation_t geo::WireGeo::fTrans
private

Wire to world transform.

Definition at line 462 of file WireGeo.h.

Referenced by toLocalCoords(), and toWorldCoords().

const TGeoNode* geo::WireGeo::fWireNode
private

Pointer to the wire node.

Definition at line 458 of file WireGeo.h.

Referenced by Node(), RMax(), RMin(), and WireGeo().

constexpr unsigned int geo::WireGeo::MaxVerbosity = 4
static

Maximum verbosity supported by PrintWireInfo().

Definition at line 336 of file WireGeo.h.

Referenced by geo::GeometryCore::Print().


The documentation for this class was generated from the following files: