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 | 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 = geo::Point3DBase_t< WireGeoCoordinatesTag > |
Type of points in the local GDML wire plane frame. More... | |
using | LocalVector_t = geo::Vector3DBase_t< WireGeoCoordinatesTag > |
Type of displacement vectors in the local GDML wire plane frame. More... | |
Public Member Functions | |
WireGeo (TGeoNode const &node, geo::TransformationMatrix &&trans) | |
Constructor from a ROOT geometry node and a transformation. More... | |
const TGeoNode * | Node () const |
void | UpdateAfterSorting (geo::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... | |
void | GetCenter (double *xyz, double localz=0.0) const |
Fills the world coordinate of a point on the wire. More... | |
void | GetStart (double *xyz) const |
void | GetEnd (double *xyz) const |
template<typename Point > | |
Point | GetPositionFromCenter (double localz) const |
Returns the position (world coordinate) of a point on the wire. More... | |
DefaultPoint_t | GetPositionFromCenter (double localz) const |
template<typename Point > | |
Point | GetPositionFromCenterUnbounded (double localz) const |
Returns the position (world coordinate) of a point on the wire. More... | |
DefaultPoint_t | GetPositionFromCenterUnbounded (double localz) const |
template<typename Point > | |
Point | GetCenter () const |
DefaultPoint_t | GetCenter () const |
template<typename Point > | |
Point | GetStart () const |
DefaultPoint_t | GetStart () const |
template<typename Point > | |
Point | GetEnd () const |
DefaultPoint_t | GetEnd () const |
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 |
double | TanThetaZ () const |
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 (geo::WireGeo const &wire) const |
Returns if this wire is parallel to another. More... | |
template<typename Vector > | |
Vector | Direction () const |
DefaultVector_t | Direction () const |
Coordinate transformation | |
Local points and displacement vectors are described by the types | |
void | LocalToWorld (const double *wire, double *world) const |
Transform point from local wire frame to world frame. More... | |
geo::Point_t | toWorldCoords (LocalPoint_t const &local) const |
Transform point from local wire frame to world frame. More... | |
void | LocalToWorldVect (const double *wire, double *world) const |
Transform direction vector from local to world. More... | |
geo::Vector_t | toWorldCoords (LocalVector_t const &local) const |
Transform direction vector from local to world. More... | |
void | WorldToLocal (const double *world, double *wire) const |
Transform point from world frame to local wire frame. More... | |
LocalPoint_t | toLocalCoords (geo::Point_t const &world) const |
Transform point from world frame to local wire frame. More... | |
void | WorldToLocalVect (const double *world, double *wire) const |
Transform direction vector from world to local. More... | |
LocalVector_t | toLocalCoords (geo::Vector_t const &world) const |
Transform direction vector from world to local. More... | |
Geometric properties and algorithms | |
double | ComputeZatY0 () const |
double | DistanceFrom (geo::WireGeo const &wire) const |
Returns 3D distance from the specified wire. More... | |
template<typename Point = DefaultPoint_t> | |
Point | IntersectionWith (geo::WireGeo const &other) const |
Returns the point of this wire that is closest to other wire. More... | |
template<typename Point = DefaultPoint_t> | |
geo::IntersectionPointAndOffsets < Point > | IntersectionAndOffsetsWith (geo::WireGeo const &other) const |
Returns the point of this wire that is closest to other wire. More... | |
Static Public Member Functions | |
static double | WirePitch (geo::WireGeo const &w1, geo::WireGeo const &w2) |
Returns the pitch (distance on y/z plane) between two wires, in cm. More... | |
Private Types | |
using | DefaultVector_t = TVector3 |
using | DefaultPoint_t = TVector3 |
using | LocalTransformation_t = geo::LocalTransformationGeo< ROOT::Math::Transform3D, LocalPoint_t, LocalVector_t > |
Private Member Functions | |
bool | isFlipped () const |
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... | |
double | capRelLength (double local) const |
Stacked capLength() and relLength() . More... | |
void | Flip () |
Set to swap the start and end wire. More... | |
Static Private Member Functions | |
static double | gausSum (double a, double b) |
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... | |
geo::Point_t | fCenter |
Center of the wire in world coordinates. More... | |
LocalTransformation_t | fTrans |
Wire to world transform. More... | |
bool | flipped |
whether start and end are reversed 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 .
|
private |
|
private |
using geo::WireGeo::GeoNodePath_t = std::vector<TGeoNode const*> |
|
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 32 of file WireGeo.cxx.
|
inlineprivate |
Caps the specified local length coordinate to lay on the wire.
Definition at line 498 of file WireGeo.h.
|
inlineprivate |
Stacked capLength()
and relLength()
.
Definition at line 502 of file WireGeo.h.
|
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 399 of file WireGeo.h.
|
inline |
Returns trigonometric operations on ThetaZ()
Definition at line 264 of file WireGeo.h.
Vector geo::WireGeo::Direction | ( | ) | const |
Returns the wire direction as a norm-one vector.
Vector | type of the vector being returned |
Definition at line 587 of file WireGeo.h.
|
inline |
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 113 of file WireGeo.cxx.
|
private |
|
inlinestaticprivate |
void geo::WireGeo::GetCenter | ( | double * | xyz, |
double | localz = 0.0 |
||
) | const |
Fills the world coordinate of a point on the wire.
xyz | _(output)_ the position to be filled, as [ x, y, z ] (in cm) |
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 is the wire end closest to the requested position.
Definition at line 73 of file WireGeo.cxx.
|
inline |
Returns the world coordinate of the center of the wire [cm]
Point | type of the point being returned |
Definition at line 212 of file WireGeo.h.
|
inline |
|
inline |
Fills the world coordinate of one end of the wire
Definition at line 163 of file WireGeo.h.
|
inline |
Returns the world coordinate of one end of the wire [cm]
Point | type of the point being returned |
Definition at line 229 of file WireGeo.h.
|
inline |
|
inline |
Returns the position (world coordinate) of a point on the wire.
Point | type of vector to be returned (current default: TVector3 ) |
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 182 of file WireGeo.h.
|
inline |
Point geo::WireGeo::GetPositionFromCenterUnbounded | ( | double | localz | ) | const |
Returns the position (world coordinate) of a point on the wire.
Point | type of vector to be returned (current default: TVector3 ) |
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 579 of file WireGeo.h.
|
inline |
|
inline |
Fills the world coordinate of one end of the wire
Definition at line 157 of file WireGeo.h.
|
inline |
Returns the world coordinate of one end of the wire [cm]
Point | type of the point being returned |
Definition at line 220 of file WireGeo.h.
|
inline |
|
inline |
geo::IntersectionPointAndOffsets< Point > geo::WireGeo::IntersectionAndOffsetsWith | ( | geo::WireGeo const & | other | ) | const |
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 645 of file WireGeo.h.
Point geo::WireGeo::IntersectionWith | ( | geo::WireGeo const & | other | ) | const |
Returns the point of this wire that is closest to other
wire.
Point | the type of point returned |
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 637 of file WireGeo.h.
|
inlineprivate |
|
inline |
|
inline |
Returns if this wire is parallel to another.
Definition at line 281 of file WireGeo.h.
|
inline |
Returns if this wire is vertical (theta_z ~ pi/2)
Definition at line 276 of file WireGeo.h.
|
inline |
Returns the wire length in centimeters.
Definition at line 236 of file WireGeo.h.
|
inline |
|
inline |
|
inline |
Definition at line 390 of file WireGeo.h.
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 596 of file WireGeo.h.
|
inlineprivate |
double geo::WireGeo::RMax | ( | ) | const |
Returns the outer half-size of the wire [cm].
Definition at line 91 of file WireGeo.cxx.
double geo::WireGeo::RMin | ( | ) | const |
Returns the inner radius of the wire (usually 0) [cm].
Definition at line 95 of file WireGeo.cxx.
|
inline |
Definition at line 265 of file WireGeo.h.
|
inline |
Definition at line 266 of file WireGeo.h.
|
inline |
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition at line 250 of file WireGeo.h.
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 99 of file WireGeo.cxx.
|
inline |
Transform point from world frame to local wire frame.
Definition at line 375 of file WireGeo.h.
|
inline |
Transform direction vector from world to local.
Definition at line 383 of file WireGeo.h.
|
inline |
Transform point from local wire frame to world frame.
Definition at line 359 of file WireGeo.h.
|
inline |
Transform direction vector from local to world.
Definition at line 367 of file WireGeo.h.
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 136 of file WireGeo.cxx.
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 104 of file WireGeo.cxx.
|
inlinestatic |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
Maximum verbosity supported by PrintWireInfo()
.