LArSoft  v08_41_00
Liquid Argon Software toolkit - http://larsoft.org/
geo::PlaneGeo Class Reference

Geometry information for a single wire plane.The plane is represented in the geometry by a solid which contains wires. Currently, only box solids are well supported. The box which is representation of the plane has some thickness, and it should not be assumed that the wires are in the median section of it, that is, the center of the box may not lie on the plane defined by the wires. More...

#include "PlaneGeo.h"

Classes

struct  PlaneGeoCoordinatesTag
 Tag for vectors in the "local" GDML coordinate frame of the plane. More...
 
struct  RectSpecs
 
struct  WidthDepthReferenceTag
 Tag for plane frame base vectors. More...
 
struct  WireCoordinateReferenceTag
 Tag for wire base vectors. More...
 

Public Types

using WireCollection_t = std::vector< geo::WireGeo >
 
using GeoNodePath_t = std::vector< TGeoNode const * >
 
using ElementIteratorBox = WireCollection_t const &
 Type returned by IterateElements(). More...
 
using Rect = lar::util::simple_geo::Rectangle< double >
 Type for description of rectangles. More...
 
Types for geometry-local reference vectors.

These types represents points and displacement vectors in the reference frame defined in the plane 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::PlaneGeo have the same type but are not compatible.

using LocalPoint_t = geo::Point3DBase_t< PlaneGeoCoordinatesTag >
 Type of points in the local GDML wire plane frame. More...
 
using LocalVector_t = geo::Vector3DBase_t< PlaneGeoCoordinatesTag >
 Type of displacement vectors in the local GDML wire plane frame. More...
 
Types for vectors in the wire coordinate frame.
using WireCoordProjection_t = ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WireCoordinateReferenceTag >
 Type for projections in the wire base representation. More...
 
using WireDecomposer_t = geo::Decomposer< geo::Vector_t, geo::Point_t, WireCoordProjection_t >
 Type used for plane decompositions on wire base. More...
 
using WireDecomposedVector_t = WireDecomposer_t::DecomposedVector_t
 Type describing a 3D point or vector decomposed on a plane on wire base. More...
 
Types for vectors in the width/depth coordinate frame.
using WidthDepthProjection_t = ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag >
 
using WidthDepthDisplacement_t = ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag >
 Type for vector projections in the plane frame base representation. More...
 
using WidthDepthDecomposer_t = geo::Decomposer< geo::Vector_t, geo::Point_t, WidthDepthProjection_t >
 Type used for plane decompositions on plane frame (width/depth). More...
 
using WDDecomposedVector_t = WidthDepthDecomposer_t::DecomposedVector_t
 

Public Member Functions

 PlaneGeo (TGeoNode const &node, geo::TransformationMatrix &&trans, WireCollection_t &&wires)
 Construct a representation of a single plane of the detector. More...
 
double Width () const
 Return the width of the plane. More...
 
double Depth () const
 Return the depth of the plane. More...
 
geo::BoxBoundedGeo BoundingBox () const
 
WireGeo const & Wire (unsigned int iwire) const
 
geo::WirePtr WirePtr (unsigned int iwire) const
 Returns the wire number iwire from this plane. More...
 
const WireGeoFirstWire () const
 Return the first wire in the plane. More...
 
const WireGeoMiddleWire () const
 Return the middle wire in the plane. More...
 
const WireGeoLastWire () const
 Return the last wire in the plane. More...
 
geo::WireGeo const & NearestWire (geo::Point_t const &pos) const
 Returns the wire closest to the specified position. More...
 
geo::WireID ClosestWireID (geo::WireID::WireID_t wireNo) const
 Returns the closest valid wire ID to the specified wire. More...
 
geo::WireID ClosestWireID (geo::WireID const &wireid) const
 Returns the closest valid wire ID to the specified wire. More...
 
Rect const & ActiveArea () const
 Returns an area covered by the wires in the plane. More...
 
lar::util::simple_geo::Volume Coverage () const
 Returns a volume including all the wires in the plane. More...
 
template<typename Stream >
void PrintPlaneInfo (Stream &&out, std::string indent="", unsigned int verbosity=1) const
 Prints information about this plane. More...
 
std::string PlaneInfo (std::string indent="", unsigned int verbosity=1) const
 Returns a string with plane information. More...
 
template<typename Point >
double WireCoordinate (Point const &point) const
 Returns the coordinate of the point on the plane, in wire units. More...
 
WidthDepthProjection_t DeltaFromPlane (WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
 Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the plane. More...
 
WidthDepthProjection_t DeltaFromPlane (WidthDepthProjection_t const &proj, double margin=0.0) const
 Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the area of plane. More...
 
WidthDepthProjection_t DeltaFromActivePlane (WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
 Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the active area of plane. More...
 
WidthDepthProjection_t DeltaFromActivePlane (WidthDepthProjection_t const &proj, double margin=0.0) const
 Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the active area of plane. More...
 
WidthDepthProjection_t MoveProjectionToPlane (WidthDepthProjection_t const &proj) const
 Returns the projection, moved onto the plane if necessary. More...
 
void SortWires (geo::GeoObjectSorter const &sorter)
 Apply sorting to WireGeo objects. More...
 
void UpdateAfterSorting (geo::PlaneID planeid, geo::BoxBoundedGeo const &TPCbox)
 Performs all needed updates after the TPC has sorted the planes. More...
 
Plane properties
View_t View () const
 Which coordinate does this plane measure. More...
 
Orient_t Orientation () const
 What is the orientation of the plane. More...
 
double ThetaZ () const
 Angle of the wires from positive z axis; $ \theta_{z} \in [ 0, \pi ]$. More...
 
double PhiZ () const
 Angle from positive z axis of the wire coordinate axis, in radians. More...
 
double SinPhiZ () const
 Sine of PhiZ() More...
 
double CosPhiZ () const
 Cosine of PhiZ() More...
 
geo::PlaneID const & ID () const
 Returns the identifier of this plane. More...
 
Plane size and coordinates
template<typename Vector >
Vector WidthDir () const
 Return the direction of plane width. More...
 
DefaultVector_t WidthDir () const
 Return the direction of plane width. More...
 
template<typename Vector >
Vector DepthDir () const
 Return the direction of plane depth. More...
 
DefaultVector_t DepthDir () const
 Return the direction of plane depth. More...
 
Wire access
unsigned int Nwires () const
 Number of wires in this plane. More...
 
unsigned int NElements () const
 Number of wires in this plane. More...
 
bool HasWire (unsigned int iwire) const
 Returns whether a wire with index iwire is present in this plane. More...
 
bool HasElement (unsigned int iwire) const
 Returns whether a wire with index iwire is present in this plane. More...
 
bool HasWire (geo::WireID const &wireid) const
 Returns whether the wire in wireid is present in this plane. More...
 
bool HasElement (geo::WireID const &wireid) const
 Returns whether the wire in wireid is present in this plane. More...
 
WireGeo const & Wire (WireID const &wireid) const
 Returns the wire in wireid from this plane. More...
 
WireGeo const & GetElement (WireID const &wireid) const
 Returns the wire in wireid from this plane. More...
 
geo::WirePtr WirePtr (WireID const &wireid) const
 Returns the wire in wireid from this plane. More...
 
geo::WirePtr GetElementPtr (WireID const &wireid) const
 Returns the wire in wireid from this plane. More...
 
ElementIteratorBox IterateElements () const
 Allows range-for iteration on all wires in this plane. More...
 
ElementIteratorBox IterateWires () const
 Allows range-for iteration on all wires in this plane. More...
 
Plane geometry properties
double WirePitch () const
 Return the wire pitch (in centimeters). It is assumed constant. More...
 
bool WireIDincreasesWithZ () const
 Returns whether the higher z wires have higher wire ID. More...
 
template<typename Vector >
Vector GetNormalDirection () const
 Returns the direction normal to the plane. More...
 
DefaultVector_t GetNormalDirection () const
 Return the wire pitch (in centimeters). It is assumed constant. More...
 
template<typename Vector >
Vector GetIncreasingWireDirection () const
 Returns the direction of increasing wires. More...
 
DefaultVector_t GetIncreasingWireDirection () const
 Returns the direction of increasing wires. More...
 
template<typename Point >
Point GetCenter () const
 Returns the centre of the wire plane in world coordinates [cm]. More...
 
DefaultPoint_t GetCenter () const
 Returns the centre of the wire plane in world coordinates [cm]. More...
 
template<typename Point >
Point GetBoxCenter () const
 Returns the centre of the box representing the plane. More...
 
DefaultPoint_t GetBoxCenter () const
 Returns the centre of the box representing the plane. More...
 
template<typename Vector >
Vector GetWireDirection () const
 Returns the direction of the wires. More...
 
DefaultVector_t GetWireDirection () const
 Returns the direction of the wires. More...
 
geo::WireID NearestWireID (geo::Point_t const &pos) const
 Returns the ID of wire closest to the specified position. More...
 
geo::WireID NearestWireID (TVector3 const &pos) const
 Returns the ID of wire closest to the specified position. More...
 
double DistanceFromPlane (geo::Point_t const &point) const
 Returns the distance of the specified point from the wire plane. More...
 
double DistanceFromPlane (TVector3 const &point) const
 Returns the distance of the specified point from the wire plane. More...
 
void DriftPoint (geo::Point_t &position, double distance) const
 Shifts the position of an electron drifted by a distance. More...
 
void DriftPoint (TVector3 &position, double distance) const
 Shifts the position of an electron drifted by a distance. More...
 
void DriftPoint (geo::Point_t &position) const
 Shifts the position along drift direction to fall on the plane. More...
 
void DriftPoint (TVector3 &position) const
 Shifts the position along drift direction to fall on the plane. More...
 
double InterWireProjectedDistance (WireCoordProjection_t const &projDir) const
 Returns the distance between wires along the specified direction. More...
 
double InterWireDistance (geo::Vector_t const &dir) const
 Returns the distance between wires along the specified direction. More...
 
double InterWireDistance (TVector3 const &dir) const
 Returns the distance between wires along the specified direction. More...
 
template<typename Vector >
std::enable_if_t< geo::vect::dimension< Vector >)==3U, double > InterWireProjectedDistance (Vector const &dir) const
 Returns the distance between wires along the specified direction. More...
 
Projections on wire length/wire coordinate direction base

These methods deal with projection of points and vectors on the plane, using a geometric reference base which is dependent on the wire direction. This is useful for plane reconstruction.

double PlaneCoordinateFrom (geo::Point_t const &point, geo::WireGeo const &refWire) const
 Returns the coordinate of point on the plane respect to a wire. More...
 
double PlaneCoordinateFrom (TVector3 const &point, geo::WireGeo const &refWire) const
 Returns the coordinate of point on the plane respect to a wire. More...
 
double PlaneCoordinate (geo::Point_t const &point) const
 Returns the coordinate of the point on the plane. More...
 
double PlaneCoordinate (TVector3 const &point) const
 Returns the coordinate of the point on the plane. More...
 
WireDecomposedVector_t DecomposePoint (geo::Point_t const &point) const
 Decomposes a 3D point in two components. More...
 
WireDecomposedVector_t DecomposePoint (TVector3 const &point) const
 Decomposes a 3D point in two components. More...
 
template<typename Point >
Point ProjectionReferencePoint () const
 Returns the reference point used by PointProjection(). More...
 
DefaultPoint_t ProjectionReferencePoint () const
 Returns the reference point used by PointProjection(). More...
 
WireCoordProjection_t Projection (geo::Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
WireCoordProjection_t PointProjection (geo::Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
WireCoordProjection_t PointProjection (TVector3 const &point) const
 Returns the projection of the specified point on the plane. More...
 
WireCoordProjection_t Projection (geo::Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
WireCoordProjection_t VectorProjection (geo::Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
WireCoordProjection_t VectorProjection (TVector3 const &v) const
 Returns the projection of the specified vector on the plane. More...
 
template<typename Vector >
Vector ComposeVector (WireDecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
DefaultVector_t ComposeVector (WireDecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
template<typename Vector >
Vector ComposeVector (double distance, WireCoordProjection_t const &proj) const
 Returns the 3D vector from composition of projection and distance. More...
 
DefaultVector_t ComposeVector (double distance, WireCoordProjection_t const &proj) const
 Returns the 3D vector from composition of projection and distance. More...
 
template<typename Point >
Point ComposePoint (WireDecomposedVector_t const &decomp) const
 Returns the 3D point from composition of projection and distance. More...
 
DefaultPoint_t ComposePoint (WireDecomposedVector_t const &decomp) const
 Returns the 3D point from composition of projection and distance. More...
 
template<typename Point >
Point ComposePoint (double distance, WireCoordProjection_t const &proj) const
 Returns the 3D point from composition of projection and distance. More...
 
DefaultPoint_t ComposePoint (double distance, WireCoordProjection_t const &proj) const
 Returns the 3D point from composition of projection and distance. More...
 
Projection on width/depth plane

These methods deal with projection of points and vectors on the plane, using a geometric reference base which is not dependent on the wire direction. This is more useful when comparing with the TPC or other planes.

WDDecomposedVector_t DecomposePointWidthDepth (geo::Point_t const &point) const
 Decomposes a 3D point in two components. More...
 
WDDecomposedVector_t DecomposePointWidthDepth (TVector3 const &point) const
 Decomposes a 3D point in two components. More...
 
WidthDepthProjection_t PointWidthDepthProjection (geo::Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
WidthDepthProjection_t PointWidthDepthProjection (TVector3 const &point) const
 Returns the projection of the specified point on the plane. More...
 
WidthDepthProjection_t VectorWidthDepthProjection (geo::Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
WidthDepthProjection_t VectorWidthDepthProjection (TVector3 const &v) const
 Returns the projection of the specified vector on the plane. More...
 
bool isProjectionOnPlane (geo::Point_t const &point) const
 Returns if the projection of specified point is within the plane. More...
 
bool isProjectionOnPlane (TVector3 const &point) const
 Returns if the projection of specified point is within the plane. More...
 
geo::Point_t MovePointOverPlane (geo::Point_t const &point) const
 Returns the point, moved so that its projection is over the plane. More...
 
TVector3 MovePointOverPlane (TVector3 const &point) const
 Returns the point, moved so that its projection is over the plane. More...
 
template<typename Point >
Point ComposePoint (WDDecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
DefaultPoint_t ComposePoint (WDDecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
template<typename Point >
Point ComposePoint (double distance, WidthDepthProjection_t const &proj) const
 Returns the 3D point from composition of projection and distance. More...
 
DefaultPoint_t ComposePoint (double distance, WidthDepthProjection_t const &proj) const
 Returns the 3D point from composition of projection and distance. More...
 
Coordinate transformation

Local points and displacement vectors are described by the types geo::PlaneGeo::LocalPoint_t and geo::PlaneGeo::LocalVector_t, respectively.

void LocalToWorld (const double *plane, double *world) const
 Transform point from local plane frame to world frame. More...
 
TVector3 LocalToWorld (const TVector3 &local) const
 Transform point from local plane frame to world frame. More...
 
geo::Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local plane frame to world frame. More...
 
void LocalToWorldVect (const double *plane, double *world) const
 Transform direction vector from local to world. More...
 
TVector3 LocalToWorldVect (const TVector3 &local) 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 *plane) const
 Transform point from world frame to local plane frame. More...
 
TVector3 WorldToLocal (TVector3 const &world) const
 Transform point from world frame to local plane frame. More...
 
LocalPoint_t toLocalCoords (geo::Point_t const &world) const
 Transform point from world frame to local plane frame. More...
 
void WorldToLocalVect (const double *world, double *plane) const
 Transform direction vector from world to local. More...
 
TVector3 WorldToLocalVect (TVector3 const &world) 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...
 
Setters
void SetView (geo::View_t view)
 Set the signal view (for TPCGeo). More...
 

Static Public Member Functions

static std::string ViewName (geo::View_t view)
 Returns the name of the specified view. More...
 
static std::string OrientationName (geo::Orient_t orientation)
 Returns the name of the specified orientation. More...
 

Static Public Attributes

static constexpr unsigned int MaxVerbosity = 6
 Maximum value for print verbosity. 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

void DetectGeometryDirections ()
 Sets the geometry directions. More...
 
geo::Vector_t GetNormalAxis () const
 Returns a direction normal to the plane (pointing is not defined). More...
 
void UpdatePlaneNormal (geo::BoxBoundedGeo const &TPCbox)
 Updates the cached normal to plane versor; needs the TPC box coordinates. More...
 
void UpdateWidthDepthDir ()
 Updates the cached depth and width direction. More...
 
void UpdateIncreasingWireDir ()
 Updates the cached direction to increasing wires. More...
 
void UpdateWireDir ()
 Updates the cached direction to wire. More...
 
void UpdateOrientation ()
 Updates plane orientation. More...
 
void UpdateWirePitch ()
 Updates the stored wire pitch. More...
 
void UpdateWirePlaneCenter ()
 Updates the stored wire plane center. More...
 
void UpdatePhiZ ()
 Updates the stored $ \phi_{z} $. More...
 
void UpdateView ()
 Updates the stored view. More...
 
void UpdateWirePitchSlow ()
 Updates the stored wire pitch with a slower, more robust algorithm. More...
 
void UpdateDecompWireOrigin ()
 Updates the position of the wire coordinate decomposition. More...
 
void UpdateActiveArea ()
 Updates the internally used active area. More...
 
bool shouldFlipWire (geo::WireGeo const &wire) const
 Whether the specified wire should have start and end swapped. More...
 

Static Private Member Functions

template<typename T >
static T boundedValue (T v, T min, T max)
 Returns min if v < min, max if v > max, v otherwise. More...
 

Private Attributes

LocalTransformation_t fTrans
 Plane to world transform. More...
 
TGeoVolume const * fVolume
 Plane volume description. More...
 
View_t fView
 Does this plane measure U, V, or W? More...
 
Orient_t fOrientation
 Is the plane vertical or horizontal? More...
 
WireCollection_t fWire
 List of wires in this plane. More...
 
double fWirePitch
 Pitch of wires in this plane. More...
 
double fSinPhiZ
 Sine of $ \phi_{z} $. More...
 
double fCosPhiZ
 Cosine of $ \phi_{z} $. More...
 
geo::Vector_t fNormal
 
WireDecomposer_t fDecompWire
 
WidthDepthDecomposer_t fDecompFrame
 
RectSpecs fFrameSize
 
Rect fActiveArea
 Area covered by wires in frame base. More...
 
geo::Point_t fCenter
 Center of the plane, lying on the wire plane. More...
 
geo::PlaneID fID
 ID of this plane. More...
 

Friends

struct details::ActiveAreaCalculator
 

Detailed Description

Geometry information for a single wire plane.

The plane is represented in the geometry by a solid which contains wires. Currently, only box solids are well supported. The box which is representation of the plane has some thickness, and it should not be assumed that the wires are in the median section of it, that is, the center of the box may not lie on the plane defined by the wires.

The plane defines two local reference frames. The first, depending on wire directions and therefore called "wire base", is defined by the normal to the plane (pointing toward the center of the TPC), the direction of the wires, and the direction that the wires measure. This is a positive orthogonal base. Note that for this base to be correctly defined, the Geometry service has to provide external information (for example, where the center of the TPC is).

The second, depending only on the shape of the plane and called "frame base", is defined by the normal (the same as for the previous one), and two orthogonal axes, "width" and "depth", aligned with the sides of the plane. If the plane has not the shape of a box, this reference frame is not available. This coordinate system is also positive defined. These components are all measured in centimeters.

Definition at line 82 of file PlaneGeo.h.

Member Typedef Documentation

using geo::PlaneGeo::DefaultPoint_t = TVector3
private

Definition at line 85 of file PlaneGeo.h.

using geo::PlaneGeo::DefaultVector_t = TVector3
private

Definition at line 84 of file PlaneGeo.h.

Type returned by IterateElements().

Definition at line 93 of file PlaneGeo.h.

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

Definition at line 90 of file PlaneGeo.h.

Type of points in the local GDML wire plane frame.

Definition at line 115 of file PlaneGeo.h.

Definition at line 1466 of file PlaneGeo.h.

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

Definition at line 118 of file PlaneGeo.h.

Type for description of rectangles.

Definition at line 169 of file PlaneGeo.h.

Type describing a 3D point or vector decomposed on a plane with plane frame base (width and depth).

Definition at line 163 of file PlaneGeo.h.

Type used for plane decompositions on plane frame (width/depth).

Definition at line 159 of file PlaneGeo.h.

using geo::PlaneGeo::WidthDepthDisplacement_t = ROOT::Math::DisplacementVector2D <ROOT::Math::Cartesian2D<double>, WidthDepthReferenceTag>

Type for vector projections in the plane frame base representation.

Definition at line 155 of file PlaneGeo.h.

using geo::PlaneGeo::WidthDepthProjection_t = ROOT::Math::DisplacementVector2D <ROOT::Math::Cartesian2D<double>, WidthDepthReferenceTag>

Type for projections in the plane frame base representation.

Todo:
the following should be a PositionVector2D

Definition at line 151 of file PlaneGeo.h.

Definition at line 89 of file PlaneGeo.h.

using geo::PlaneGeo::WireCoordProjection_t = ROOT::Math::DisplacementVector2D <ROOT::Math::Cartesian2D<double>, WireCoordinateReferenceTag>

Type for projections in the wire base representation.

Definition at line 130 of file PlaneGeo.h.

Type describing a 3D point or vector decomposed on a plane on wire base.

Definition at line 137 of file PlaneGeo.h.

Type used for plane decompositions on wire base.

Definition at line 134 of file PlaneGeo.h.

Constructor & Destructor Documentation

geo::PlaneGeo::PlaneGeo ( TGeoNode const &  node,
geo::TransformationMatrix &&  trans,
WireCollection_t &&  wires 
)

Construct a representation of a single plane of the detector.

Definition at line 442 of file PlaneGeo.cxx.

References DetectGeometryDirections(), fVolume, and UpdateWirePitchSlow().

447  : fTrans(std::move(trans))
448  , fVolume(node.GetVolume())
451  , fWire(std::move(wires))
452  , fWirePitch(0.)
453  , fSinPhiZ(0.)
454  , fCosPhiZ(0.)
455  , fDecompWire()
456  , fDecompFrame()
457  , fCenter()
458  {
459 
460  if (!fVolume) {
461  throw cet::exception("PlaneGeo")
462  << "Plane geometry node " << node.IsA()->GetName()
463  << "[" << node.GetName() << ", #" << node.GetNumber()
464  << "] has no volume!\n";
465  }
466 
467  // view is now set at TPC level with SetView
468 
471 
472  } // PlaneGeo::PlaneGeo()
geo::Point_t fCenter
Center of the plane, lying on the wire plane.
Definition: PlaneGeo.h:1500
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1483
Unknown view.
Definition: geo_types.h:132
View_t fView
Does this plane measure U, V, or W?
Definition: PlaneGeo.h:1480
void DetectGeometryDirections()
Sets the geometry directions.
Definition: PlaneGeo.cxx:798
TGeoVolume const * fVolume
Plane volume description.
Definition: PlaneGeo.h:1479
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
Planes that are in the vertical plane (e.g. ArgoNeuT).
Definition: geo_types.h:137
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
double fSinPhiZ
Sine of .
Definition: PlaneGeo.h:1484
void UpdateWirePitchSlow()
Updates the stored wire pitch with a slower, more robust algorithm.
Definition: PlaneGeo.cxx:1145
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
double fCosPhiZ
Cosine of .
Definition: PlaneGeo.h:1485
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
Orient_t fOrientation
Is the plane vertical or horizontal?
Definition: PlaneGeo.h:1481
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Function Documentation

Rect const& geo::PlaneGeo::ActiveArea ( ) const
inline

Returns an area covered by the wires in the plane.

The returned value is conceptually akin of a projection of Coverage() volume. Yet, the precise definition of the area is not specified, therefore this area should not be uses for physics.

The current implementation is documented in details::ActiveAreaCalculator.

Definition at line 758 of file PlaneGeo.h.

References art::detail::indent().

758 { return fActiveArea; }
Rect fActiveArea
Area covered by wires in frame base.
Definition: PlaneGeo.h:1498
template<typename T >
static T geo::PlaneGeo::boundedValue ( v,
min,
max 
)
inlinestaticprivate

Returns min if v < min, max if v > max, v otherwise.

Definition at line 1508 of file PlaneGeo.h.

References ClosestWireID(), max, and min.

1509  { return std::min(max, std::max(min, v)); }
Int_t max
Definition: plot.C:27
Int_t min
Definition: plot.C:26
geo::BoxBoundedGeo geo::PlaneGeo::BoundingBox ( ) const

Returns the world coordinates of the box containing the plane.

See also
GetBoxCenter()

Definition at line 476 of file PlaneGeo.cxx.

References geo::BoxBoundedGeo::ExtendToInclude(), fVolume, geo::BoxBoundedGeo::SetBoundaries(), and toWorldCoords().

476  {
477 
478  //
479  // The algorithm is not very refined...
480  //
481 
482  TGeoBBox const* pShape = dynamic_cast<TGeoBBox const*>(fVolume->GetShape());
483  if (!pShape) {
484  throw cet::exception("PlaneGeo")
485  << "BoundingBox(): volume " << fVolume->IsA()->GetName()
486  << "['" << fVolume->GetName() << "'] has a shape which is a "
487  << pShape->IsA()->GetName()
488  << ", not a TGeoBBox!";
489  }
490 
491  geo::BoxBoundedGeo box;
492  unsigned int points = 0;
493  for (double dx: { -(pShape->GetDX()), +(pShape->GetDX()) }) {
494  for (double dy: { -(pShape->GetDY()), +(pShape->GetDY()) }) {
495  for (double dz: { -(pShape->GetDZ()), +(pShape->GetDZ()) }) {
496 
497  auto const p = toWorldCoords(LocalPoint_t{ dx, dy, dz });
498 
499  if (points++ == 0)
500  box.SetBoundaries(p, p);
501  else
502  box.ExtendToInclude(p);
503 
504  } // for z
505  } // for y
506  } // for x
507  return box;
508 
509  } // PlaneGeo::BoundingBox()
TGeoVolume const * fVolume
Plane volume description.
Definition: PlaneGeo.h:1479
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1351
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
void SetBoundaries(Coord_t x_min, Coord_t x_max, Coord_t y_min, Coord_t y_max, Coord_t z_min, Coord_t z_max)
Sets the boundaries in world coordinates as specified.
void ExtendToInclude(Coord_t x, Coord_t y, Coord_t z)
Extends the current box to also include the specified point.
geo::Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
Definition: PlaneGeo.h:115
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::WireID geo::PlaneGeo::ClosestWireID ( geo::WireID::WireID_t  wireNo) const
inline

Returns the closest valid wire ID to the specified wire.

Parameters
wireNonumber of the wire on this plane
Returns
complete wire ID of the closest wire on this plane

If the wire number described a wire present on this plane, its complete wire ID is returned, valid. Otherwise, a valid wire ID is returned which points to the existing wire closest to the specified wire number: the first wire if the wire number is negative, or the last wire if the wire number is larger than the actual wires.

Note that the argument geo::WireID::WireID_t type is an integral type, and if a floating point value is specified for it, it's subject to truncation.

Definition at line 1520 of file PlaneGeo.h.

Referenced by boundedValue(), and NearestWire().

1521 {
1522  return { ID(), boundedValue<geo::WireID::WireID_t>(wireNo, 0, Nwires()) };
1523 }
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
geo::WireID geo::PlaneGeo::ClosestWireID ( geo::WireID const &  wireid) const
inline

Returns the closest valid wire ID to the specified wire.

Parameters
wireidthe wire ID (must be on this plane)
Returns
complete wire ID of the closest wire, invalid if not this plane
See also
ClosestWireID(geo::WireID::WireID_t)

If wireid is not on this plane, it is returned but marked as invalid. Otherwise, the returned ID is the same as in ClosestWireID(geo::WireID::WireID_t).

Definition at line 1525 of file PlaneGeo.h.

References geo::PlaneID::asPlaneID(), geo::CryostatID::markInvalid(), and geo::WireID::Wire.

1526 {
1527  if (wireid.asPlaneID() != ID()) {
1528  geo::WireID invalid{ wireid };
1529  invalid.markInvalid();
1530  return invalid;
1531  }
1532  return ClosestWireID(wireid.Wire);
1533 } // geo::PlaneGeo::ClosestWireID()
void markInvalid()
Sets the ID as invalid.
Definition: geo_types.h:236
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
geo::WireID ClosestWireID(geo::WireID::WireID_t wireNo) const
Returns the closest valid wire ID to the specified wire.
Definition: PlaneGeo.h:1520
template<typename Point >
Point geo::PlaneGeo::ComposePoint ( WireDecomposedVector_t const &  decomp) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointthe type of point to return (current default: TVector3)
Parameters
decompdecomposed point
Returns
the 3D point from composition of projection and distance
See also
DecomposePoint(), ComposePoint(double, WireCoordProjection_t const&)

See ComposePoint(double, WireCoordProjection_t const&) for details.

Definition at line 1024 of file PlaneGeo.h.

Referenced by geo::TPCGeo::ComposePoint(), and larg4::LArVoxelReadout::RecoverOffPlaneDeposit().

1025  { return geo::vect::convertTo<Point>(fDecompWire.ComposePoint(decomp)); }
Point_t ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: Decomposer.h:611
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultPoint_t geo::PlaneGeo::ComposePoint ( WireDecomposedVector_t const &  decomp) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointthe type of point to return (current default: TVector3)
Parameters
decompdecomposed point
Returns
the 3D point from composition of projection and distance
See also
DecomposePoint(), ComposePoint(double, WireCoordProjection_t const&)

See ComposePoint(double, WireCoordProjection_t const&) for details.

Definition at line 1026 of file PlaneGeo.h.

1027  { return ComposePoint<DefaultPoint_t>(decomp); }
template<typename Point >
Point geo::PlaneGeo::ComposePoint ( double  distance,
WireCoordProjection_t const &  proj 
) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointthe type of point to return (current default: TVector3)
Parameters
distancedistance of the target point from the wire plane
projprojection of the target point on the wire plane
Returns
the 3D point from composition of projection and distance
See also
DecomposePoint()

The returned point is the reference point of the frame system (that is, the plane center), translated by two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via PointProjection() gives the input projection

The choice of the projection reference point embodies the same convention used in PointProjection() and DecomposePoint(). In fact, the strict definition of the result of this method is a 3D point whose decomposition on the plane frame base matches the method arguments.

Definition at line 1054 of file PlaneGeo.h.

1055  { return geo::vect::convertTo<Point>(fDecompWire.ComposePoint(distance, proj)); }
Point_t ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: Decomposer.h:611
Float_t proj
Definition: plot.C:34
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultPoint_t geo::PlaneGeo::ComposePoint ( double  distance,
WireCoordProjection_t const &  proj 
) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointthe type of point to return (current default: TVector3)
Parameters
distancedistance of the target point from the wire plane
projprojection of the target point on the wire plane
Returns
the 3D point from composition of projection and distance
See also
DecomposePoint()

The returned point is the reference point of the frame system (that is, the plane center), translated by two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via PointProjection() gives the input projection

The choice of the projection reference point embodies the same convention used in PointProjection() and DecomposePoint(). In fact, the strict definition of the result of this method is a 3D point whose decomposition on the plane frame base matches the method arguments.

Definition at line 1057 of file PlaneGeo.h.

References proj.

1058  { return ComposePoint<DefaultPoint_t>(distance, proj); }
Float_t proj
Definition: plot.C:34
template<typename Point >
Point geo::PlaneGeo::ComposePoint ( WDDecomposedVector_t const &  decomp) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Pointtype of point to be produced (current default is TVector3)
Parameters
decompdecomposed point
Returns
the 3D vector from composition of projection and distance
See also
DecomposePointWidthDepth(), ComposePointWidthDepth(double, DecomposedVector_t::Projection_t const&)

See ComposePointWidthDepth(double, DecomposedVector_t::Projection_t const&) for details.

Definition at line 1294 of file PlaneGeo.h.

1295  { return geo::vect::convertTo<Point>(fDecompFrame.ComposePoint(decomp)); }
Point_t ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: Decomposer.h:611
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
DefaultPoint_t geo::PlaneGeo::ComposePoint ( WDDecomposedVector_t const &  decomp) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Pointtype of point to be produced (current default is TVector3)
Parameters
decompdecomposed point
Returns
the 3D vector from composition of projection and distance
See also
DecomposePointWidthDepth(), ComposePointWidthDepth(double, DecomposedVector_t::Projection_t const&)

See ComposePointWidthDepth(double, DecomposedVector_t::Projection_t const&) for details.

Definition at line 1296 of file PlaneGeo.h.

1297  { return ComposePoint<DefaultPoint_t>(decomp); }
template<typename Point >
Point geo::PlaneGeo::ComposePoint ( double  distance,
WidthDepthProjection_t const &  proj 
) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointtype of point to be produced (current default is TVector3)
Parameters
distancedistance of the target point from the wire plane
projprojection of the target point on the wire plane
Returns
the 3D vector from composition of projection and distance
See also
DecomposePointWidthDepth()

The returned vector is the sum of two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via PointWidthDepthProjection() gives the input projection

Given the arbitrary definition of the projection reference, it is assumed that the same convention is used as in PointWidthDepthProjection() and DecomposePointWidthDepth().

Definition at line 1322 of file PlaneGeo.h.

1323  { return geo::vect::convertTo<Point>(fDecompFrame.ComposePoint(distance, proj)); }
Point_t ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: Decomposer.h:611
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
Float_t proj
Definition: plot.C:34
DefaultPoint_t geo::PlaneGeo::ComposePoint ( double  distance,
WidthDepthProjection_t const &  proj 
) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointtype of point to be produced (current default is TVector3)
Parameters
distancedistance of the target point from the wire plane
projprojection of the target point on the wire plane
Returns
the 3D vector from composition of projection and distance
See also
DecomposePointWidthDepth()

The returned vector is the sum of two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via PointWidthDepthProjection() gives the input projection

Given the arbitrary definition of the projection reference, it is assumed that the same convention is used as in PointWidthDepthProjection() and DecomposePointWidthDepth().

Definition at line 1325 of file PlaneGeo.h.

References proj.

1326  { return ComposePoint<DefaultPoint_t>(distance, proj); }
Float_t proj
Definition: plot.C:34
template<typename Vector >
Vector geo::PlaneGeo::ComposeVector ( WireDecomposedVector_t const &  decomp) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Parameters
decompdecomposed vector
Returns
the 3D vector from composition of projection and distance
See also
DecomposePoint(), ComposeVector(double, WireCoordProjection_t const&), ComposePoint(WireDecomposedVector_t const&)

See ComposeVector(double, WireCoordProjection_t const&) for details.

Definition at line 982 of file PlaneGeo.h.

983  { return geo::vect::convertTo<Vector>(fDecompWire.ComposeVector(decomp)); }
Vector_t ComposeVector(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: Decomposer.h:648
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultVector_t geo::PlaneGeo::ComposeVector ( WireDecomposedVector_t const &  decomp) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Parameters
decompdecomposed vector
Returns
the 3D vector from composition of projection and distance
See also
DecomposePoint(), ComposeVector(double, WireCoordProjection_t const&), ComposePoint(WireDecomposedVector_t const&)

See ComposeVector(double, WireCoordProjection_t const&) for details.

Definition at line 984 of file PlaneGeo.h.

985  { return ComposeVector<DefaultVector_t>(decomp); }
template<typename Vector >
Vector geo::PlaneGeo::ComposeVector ( double  distance,
WireCoordProjection_t const &  proj 
) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Parameters
distancecomponent of target vector orthogonal to the wire plane
projprojection of the target vector on the wire plane
Returns
the 3D vector from composition of projection and distance
See also
DecomposePoint()

The returned vector is the sum of two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via VectorProjection() gives the input projection

Definition at line 1005 of file PlaneGeo.h.

1006  { return geo::vect::convertTo<Vector>(fDecompWire.ComposeVector(distance, proj)); }
Vector_t ComposeVector(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: Decomposer.h:648
Float_t proj
Definition: plot.C:34
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultVector_t geo::PlaneGeo::ComposeVector ( double  distance,
WireCoordProjection_t const &  proj 
) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Parameters
distancecomponent of target vector orthogonal to the wire plane
projprojection of the target vector on the wire plane
Returns
the 3D vector from composition of projection and distance
See also
DecomposePoint()

The returned vector is the sum of two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via VectorProjection() gives the input projection

Definition at line 1008 of file PlaneGeo.h.

References proj.

1009  { return ComposeVector<DefaultVector_t>(distance, proj); }
Float_t proj
Definition: plot.C:34
double geo::PlaneGeo::CosPhiZ ( ) const
inline

Cosine of PhiZ()

Definition at line 200 of file PlaneGeo.h.

200 { return fCosPhiZ; }
double fCosPhiZ
Cosine of .
Definition: PlaneGeo.h:1485
lar::util::simple_geo::Volume geo::PlaneGeo::Coverage ( ) const

Returns a volume including all the wires in the plane.

Definition at line 542 of file PlaneGeo.cxx.

References B, FirstWire(), geo::WireGeo::GetEnd(), geo::WireGeo::GetStart(), LastWire(), and PlaneInfo().

542  {
543 
544  // add both coordinates of first and last wire
545  std::array<double, 3> A, B;
546 
547  FirstWire().GetStart(A.data());
548  LastWire().GetEnd(B.data());
549 
550  return { A.data(), B.data() };
551  } // PlaneGeo::Coverage()
void GetStart(double *xyz) const
Definition: WireGeo.h:144
Int_t B
Definition: plot.C:25
const WireGeo & FirstWire() const
Return the first wire in the plane.
Definition: PlaneGeo.h:344
void GetEnd(double *xyz) const
Definition: WireGeo.h:148
const WireGeo & LastWire() const
Return the last wire in the plane.
Definition: PlaneGeo.h:350
WireDecomposedVector_t geo::PlaneGeo::DecomposePoint ( geo::Point_t const &  point) const
inline

Decomposes a 3D point in two components.

Parameters
pointthe point to be decomposed
Returns
the two components of point, on the plane and orthogonal to it

The point is decomposed in:

  1. a component orthogonal to the plane, expressed as a signed real number
  2. a component lying on the plane, expressed as a 2D vector

The distance is obtained as by DistanceFromPlane(). The projection on the plane is obtained following the same convention as PointProjection().

Definition at line 901 of file PlaneGeo.h.

902  { return fDecompWire.DecomposePoint(point); }
DecomposedVector_t DecomposePoint(Point_t const &point) const
Decomposes a 3D point in two components.
Definition: Decomposer.h:517
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
WireDecomposedVector_t geo::PlaneGeo::DecomposePoint ( TVector3 const &  point) const
inline

Decomposes a 3D point in two components.

Parameters
pointthe point to be decomposed
Returns
the two components of point, on the plane and orthogonal to it

The point is decomposed in:

  1. a component orthogonal to the plane, expressed as a signed real number
  2. a component lying on the plane, expressed as a 2D vector

The distance is obtained as by DistanceFromPlane(). The projection on the plane is obtained following the same convention as PointProjection().

Definition at line 903 of file PlaneGeo.h.

References geo::vect::toPoint().

904  { return DecomposePoint(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
WireDecomposedVector_t DecomposePoint(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:901
WDDecomposedVector_t geo::PlaneGeo::DecomposePointWidthDepth ( geo::Point_t const &  point) const
inline

Decomposes a 3D point in two components.

Parameters
pointthe point to be decomposed
Returns
the two components of point, on the plane and orthogonal to it

The point is decomposed in:

  1. a component orthogonal to the plane, expressed as a signed real number
  2. a component lying on the plane, expressed as a 2D vector

The distance is obtained as by DistanceFromPlane(). The projection on the plane is obtained following the same convention as PointWidthDepthProjection().

Definition at line 1088 of file PlaneGeo.h.

Referenced by geo::TPCGeo::DecomposePoint().

1089  { return fDecompFrame.DecomposePoint(point); }
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
DecomposedVector_t DecomposePoint(Point_t const &point) const
Decomposes a 3D point in two components.
Definition: Decomposer.h:517
WDDecomposedVector_t geo::PlaneGeo::DecomposePointWidthDepth ( TVector3 const &  point) const
inline

Decomposes a 3D point in two components.

Parameters
pointthe point to be decomposed
Returns
the two components of point, on the plane and orthogonal to it

The point is decomposed in:

  1. a component orthogonal to the plane, expressed as a signed real number
  2. a component lying on the plane, expressed as a 2D vector

The distance is obtained as by DistanceFromPlane(). The projection on the plane is obtained following the same convention as PointWidthDepthProjection().

Definition at line 1090 of file PlaneGeo.h.

References geo::vect::toPoint().

1091  { return DecomposePointWidthDepth(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:1088
PlaneGeo::WidthDepthProjection_t geo::PlaneGeo::DeltaFromActivePlane ( WidthDepthProjection_t const &  proj,
double  wMargin,
double  dMargin 
) const

Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the active area of plane.

Parameters
projstarting projection
wMarginthe point is brought this amount inside the active area
dMarginthe point is brought this amount inside the active area
Returns
a projection displacement
See also
DeltaFromPlane()

The "active" area of the plane is the rectangular area which includes all the wires. The area is obtained as the smallest rectangle including the projection of both ends of all wires in the plane, less half a pitch. This defines a "fiducial" area away from the borders of the plane. The projection is in the frame reference (PointWidthDepthProjection()). The area is reduced on each side by the specified margins. If for example wMargin is 1.0, the active area lower border on the width direction will be increased by 1 cm, and the upper border will be decreased by 1 cm effectively making the active area 2 cm narrowed on the width direction. The same independently applies to the depth direction with dMargin. The main purpose of the margins is to accommodate for rounding errors. A version of this method with default margins of 0 is also available.

If the projection is already on the active area of the plane, the returned displacement is null. Otherwise, the displacement, added to proj, will bring it on the active plane area (in fact, on its border).

Definition at line 579 of file PlaneGeo.cxx.

References lar::util::simple_geo::Range< Data >::delta(), lar::util::simple_geo::Rectangle< Data >::depth, fActiveArea, and lar::util::simple_geo::Rectangle< Data >::width.

Referenced by DeltaFromPlane(), and larg4::LArVoxelReadout::RecoverOffPlaneDeposit().

580  {
581 
582  return {
583  fActiveArea.width.delta(proj.X(), wMargin),
584  fActiveArea.depth.delta(proj.Y(), dMargin)
585  };
586 
587  } // PlaneGeo::DeltaFromActivePlane()
Rect fActiveArea
Area covered by wires in frame base.
Definition: PlaneGeo.h:1498
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394
Data_t delta(Data_t v, Data_t margin=0.0) const
Definition: SimpleGeo.h:443
Float_t proj
Definition: plot.C:34
WidthDepthProjection_t geo::PlaneGeo::DeltaFromActivePlane ( WidthDepthProjection_t const &  proj,
double  margin = 0.0 
) const
inline

Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the active area of plane.

Parameters
projstarting projection
marginthe point is brought this amount inside the active area _(default: 0)_
Returns
a projection displacement
See also
DeltaFromActivePlane(WidthDepthProjection_t const&, double, double)

This is the implementation with default values for margins of DeltaFromActivePlane(). The depth and width margins are the same, and 0 by default.

Definition at line 1242 of file PlaneGeo.h.

1243  { return DeltaFromActivePlane(proj, margin, margin); }
WidthDepthProjection_t DeltaFromActivePlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:579
Float_t proj
Definition: plot.C:34
PlaneGeo::WidthDepthProjection_t geo::PlaneGeo::DeltaFromPlane ( WidthDepthProjection_t const &  proj,
double  wMargin,
double  dMargin 
) const

Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the plane.

Parameters
projstarting projection
wMarginthe point is brought this amount inside the target area
dMarginthe point is brought this amount inside the target area
Returns
a projection displacement
See also
DeltaFromActivePlane()

The returned projection vector is guaranteed, when added to proj, to yield a projection on or within the border of the plane (the "target area"), as defined by the GDML geometry.

The target plane area is reduced on each side by the specified margins. If for example wMargin is 1.0, the area lower border on the width direction will be increased by 1 cm, and the upper border will be decreased by 1 cm effectively making the area 2 cm narrowed on the width direction. The same independently applies to the depth direction with dMargin. The main purpose of the margins is to accommodate for rounding errors. A version of this method with default margins of 0 is also available.

If the projection is already on the target area, the returned displacement is null.

Definition at line 566 of file PlaneGeo.cxx.

References DeltaFromActivePlane(), fFrameSize, geo::PlaneGeo::RectSpecs::HalfDepth(), and geo::PlaneGeo::RectSpecs::HalfWidth().

Referenced by isProjectionOnPlane(), MovePointOverPlane(), MoveProjectionToPlane(), and PlaneInfo().

567  {
568 
569  return {
570  symmetricCapDelta(proj.X(), fFrameSize.HalfWidth() - wMargin),
571  symmetricCapDelta(proj.Y(), fFrameSize.HalfDepth() - dMargin)
572  };
573 
574  } // PlaneGeo::DeltaFromPlane()
double HalfWidth() const
Definition: PlaneGeo.h:1472
RectSpecs fFrameSize
Definition: PlaneGeo.h:1496
double HalfDepth() const
Definition: PlaneGeo.h:1473
Float_t proj
Definition: plot.C:34
WidthDepthProjection_t geo::PlaneGeo::DeltaFromPlane ( WidthDepthProjection_t const &  proj,
double  margin = 0.0 
) const
inline

Returns a projection vector that, added to the argument, gives a projection inside (or at the border of) the area of plane.

Parameters
projstarting projection
marginthe point is brought this amount inside the plane area _(default: 0)_
Returns
a projection displacement
See also
DeltaFromPlane(WidthDepthProjection_t const&, double, double)

This is the implementation with default values for margins of DeltaFromPlane(). The depth and width margins are the same, and 0 by default.

Definition at line 1194 of file PlaneGeo.h.

1195  { return DeltaFromPlane(proj, margin, margin); }
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:566
Float_t proj
Definition: plot.C:34
double geo::PlaneGeo::Depth ( ) const
inline

Return the depth of the plane.

See also
Width(), WidthDir(), DepthDir()

The precise definition is arbitrary (see DepthDir()).

Definition at line 254 of file PlaneGeo.h.

254 { return fFrameSize.Depth(); }
double Depth() const
Definition: PlaneGeo.h:1475
RectSpecs fFrameSize
Definition: PlaneGeo.h:1496
template<typename Vector >
Vector geo::PlaneGeo::DepthDir ( ) const
inline

Return the direction of plane depth.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)

The precise definition of the sides is arbitrary, but they are defined to lie on the wire plane and so that WidthDir(), DepthDir() and GetNormalDirection() make a orthonormal base. That base (width, depth, normal) is guaranteed to be positive defined.

Definition at line 236 of file PlaneGeo.h.

Referenced by MovePointOverPlane(), geo::TPCGeo::RefDepthDir(), and UpdateWidthDepthDir().

236 { return geo::vect::convertTo<Vector>(fDecompFrame.SecondaryDir()); }
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:466
DefaultVector_t geo::PlaneGeo::DepthDir ( ) const
inline

Return the direction of plane depth.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)

The precise definition of the sides is arbitrary, but they are defined to lie on the wire plane and so that WidthDir(), DepthDir() and GetNormalDirection() make a orthonormal base. That base (width, depth, normal) is guaranteed to be positive defined.

Definition at line 237 of file PlaneGeo.h.

237 { return DepthDir<DefaultVector_t>(); }
void geo::PlaneGeo::DetectGeometryDirections ( )
private

Sets the geometry directions.

Definition at line 798 of file PlaneGeo.cxx.

References util::abs(), dir, e, fDecompFrame, fFrameSize, fVolume, geo::PlaneGeo::RectSpecs::halfDepth, geo::PlaneGeo::RectSpecs::halfWidth, geo::origin(), geo::vect::rounded01(), geo::Decomposer< Vector, Point, ProjVector >::SetMainDir(), geo::Decomposer< Vector, Point, ProjVector >::SetOrigin(), geo::Decomposer< Vector, Point, ProjVector >::SetSecondaryDir(), toWorldCoords(), and Z.

Referenced by PlaneGeo().

798  {
799 
800  //
801  // We need to identify which are the "long" directions of the plane.
802  // We assume it is a box, and the shortest side is excluded.
803  // The first direction ("width") is given by preference to z.
804  // If z is the direction of the normal to the plane... oh well.
805  // Let's say privilege to the one which comes from local z, then y.
806  // That means: undefined.
807  //
808  // Requirements:
809  // - ROOT geometry information (shapes and transformations)
810  // - the shape must be a box (an error is PRINTED if not)
811  // - center of the wire plane (not just the center of the plane box)
812  //
813 
814  //
815  // how do they look like in the world?
816  //
817  TGeoBBox const* pShape = dynamic_cast<TGeoBBox const*>(fVolume->GetShape());
818  if (!pShape) {
819  mf::LogError("BoxInfo")
820  << "Volume " << fVolume->IsA()->GetName() << "['" << fVolume->GetName()
821  << "'] has a shape which is a " << pShape->IsA()->GetName()
822  << ", not a TGeoBBox! Dimensions won't be available.";
823  // set it invalid
825  fDecompFrame.SetMainDir({ 0., 0., 0. });
826  fDecompFrame.SetSecondaryDir({ 0., 0., 0. });
827  fFrameSize = { 0.0, 0.0 };
828  return;
829  }
830 
831  std::array<geo::Vector_t, 3U> sides;
832  size_t iSmallest = 3;
833  {
834 
835  size_t iSide = 0;
836  TVector3 dir;
837 
838  sides[iSide] = toWorldCoords(LocalVector_t{ pShape->GetDX(), 0.0, 0.0 });
839  iSmallest = iSide;
840  ++iSide;
841 
842  sides[iSide] = toWorldCoords(LocalVector_t{ 0.0, pShape->GetDY(), 0.0 });
843  if (sides[iSide].Mag2() < sides[iSmallest].Mag2()) iSmallest = iSide;
844  ++iSide;
845 
846  sides[iSide] = toWorldCoords(LocalVector_t{ 0.0, 0.0, pShape->GetDZ() });
847  if (sides[iSide].Mag2() < sides[iSmallest].Mag2()) iSmallest = iSide;
848  ++iSide;
849 
850  }
851 
852  //
853  // which are the largest ones?
854  //
855  size_t kept[2];
856  {
857  size_t iKept = 0;
858  for (size_t i = 0; i < 3; ++i) if (i != iSmallest) kept[iKept++] = i;
859  }
860 
861  //
862  // which is which?
863  //
864  // Pick width as the most z-like.
865  //
866  size_t const iiWidth =
867  std::abs(sides[kept[0]].Unit().Z()) > std::abs(sides[kept[1]].Unit().Z())
868  ? 0: 1;
869  size_t const iWidth = kept[iiWidth];
870  size_t const iDepth = kept[1 - iiWidth]; // the other
871 
872  fDecompFrame.SetMainDir(geo::vect::rounded01(sides[iWidth].Unit(), 1e-4));
874  (geo::vect::rounded01(sides[iDepth].Unit(), 1e-4));
875  fFrameSize.halfWidth = sides[iWidth].R();
876  fFrameSize.halfDepth = sides[iDepth].R();
877 
878  } // PlaneGeo::DetectGeometryDirections()
void SetSecondaryDir(Vector_t const &dir)
Change the secondary direction of the projection base.
Definition: Decomposer.h:447
constexpr auto abs(T v)
Returns the absolute value of the argument.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Float_t Z
Definition: plot.C:39
TGeoVolume const * fVolume
Plane volume description.
Definition: PlaneGeo.h:1479
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1351
RectSpecs fFrameSize
Definition: PlaneGeo.h:1496
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
void SetOrigin(Point_t const &point)
Change the 3D point of the reference frame origin.
Definition: Decomposer.h:441
TDirectory * dir
Definition: macro.C:5
Float_t e
Definition: plot.C:34
geo::Vector3DBase_t< PlaneGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML wire plane frame.
Definition: PlaneGeo.h:118
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
void SetMainDir(Vector_t const &dir)
Change the main direction of the projection base.
Definition: Decomposer.h:444
double geo::PlaneGeo::DistanceFromPlane ( geo::Point_t const &  point) const
inline

Returns the distance of the specified point from the wire plane.

Parameters
pointa point in world coordinates [cm]
Returns
the signed distance from the wire plane

The distance is defined positive if the point lies in the side the normal vector (GetNormalDirection()) points to.

The distance is defined from the geometric plane where the wires lie, and it may not match the distance from the center of the geometry box representing the plane. It should always match the drift distance from this wire plane, and the result of DriftPoint(point, DistanceFromPlane(point)) will bring the point to the plane.

Definition at line 621 of file PlaneGeo.h.

Referenced by geo::TPCGeo::ComputeDriftDistance(), geo::TPCGeo::DistanceFromReferencePlane(), larg4::LArVoxelReadout::RecoverOffPlaneDeposit(), and UpdateWirePlaneCenter().

622  { return fDecompWire.PointNormalComponent(point); }
auto PointNormalComponent(Point_t const &point) const
Returns the secondary component of a point.
Definition: Decomposer.h:486
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
double geo::PlaneGeo::DistanceFromPlane ( TVector3 const &  point) const
inline

Returns the distance of the specified point from the wire plane.

Parameters
pointa point in world coordinates [cm]
Returns
the signed distance from the wire plane

The distance is defined positive if the point lies in the side the normal vector (GetNormalDirection()) points to.

The distance is defined from the geometric plane where the wires lie, and it may not match the distance from the center of the geometry box representing the plane. It should always match the drift distance from this wire plane, and the result of DriftPoint(point, DistanceFromPlane(point)) will bring the point to the plane.

Definition at line 623 of file PlaneGeo.h.

References geo::vect::toPoint().

624  { return DistanceFromPlane(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:621
void geo::PlaneGeo::DriftPoint ( geo::Point_t position,
double  distance 
) const
inline

Shifts the position of an electron drifted by a distance.

Parameters
position_(modified)_ the position of the electron
distancedrift distance to shift the electron by [cm]

This is a pure geometry computation: the position is shifted by the drift distance in the direction opposite to the normal to the plane (as returned by GetNormalDirection()), no matter where the position is relative to the plane. The wording about "electron position" is just meant to remind that the drift shift is taken with opposite sign: since the point is assumed to be an electron, a positive drift normally moves its position toward the wire plane.

Definition at line 643 of file PlaneGeo.h.

Referenced by geo::TPCGeo::DriftPoint(), and UpdateWirePlaneCenter().

644  { position -= distance * GetNormalDirection<geo::Vector_t>(); }
void geo::PlaneGeo::DriftPoint ( TVector3 &  position,
double  distance 
) const
inline

Shifts the position of an electron drifted by a distance.

Parameters
position_(modified)_ the position of the electron
distancedrift distance to shift the electron by [cm]

This is a pure geometry computation: the position is shifted by the drift distance in the direction opposite to the normal to the plane (as returned by GetNormalDirection()), no matter where the position is relative to the plane. The wording about "electron position" is just meant to remind that the drift shift is taken with opposite sign: since the point is assumed to be an electron, a positive drift normally moves its position toward the wire plane.

Definition at line 645 of file PlaneGeo.h.

646  { position -= distance * GetNormalDirection(); }
Vector GetNormalDirection() const
Returns the direction normal to the plane.
Definition: PlaneGeo.h:442
void geo::PlaneGeo::DriftPoint ( geo::Point_t position) const
inline

Shifts the position along drift direction to fall on the plane.

Parameters
position_(modified)_ the position to be shifted

This is a pure geometry computation: the position is shifted by the drift distance in the direction opposite to the normal to the plane (as returned by GetNormalDirection()), no matter where the position is relative to the plane.

Definition at line 659 of file PlaneGeo.h.

660  { DriftPoint(position, DistanceFromPlane(position)); }
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:643
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:621
void geo::PlaneGeo::DriftPoint ( TVector3 &  position) const
inline

Shifts the position along drift direction to fall on the plane.

Parameters
position_(modified)_ the position to be shifted

This is a pure geometry computation: the position is shifted by the drift distance in the direction opposite to the normal to the plane (as returned by GetNormalDirection()), no matter where the position is relative to the plane.

Definition at line 661 of file PlaneGeo.h.

References dir.

662  { DriftPoint(position, DistanceFromPlane(position)); }
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:643
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:621
const WireGeo& geo::PlaneGeo::FirstWire ( ) const
inline

Return the first wire in the plane.

Definition at line 344 of file PlaneGeo.h.

Referenced by Coverage(), geo::details::ActiveAreaCalculator::initializeWireEnds(), ThetaZ(), UpdateDecompWireOrigin(), and UpdateWireDir().

344 { return Wire(0); }
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
template<typename Point >
Point geo::PlaneGeo::GetBoxCenter ( ) const
inline

Returns the centre of the box representing the plane.

Template Parameters
Pointtype of point to be returned (current default: TVector3)
Returns
the centre of the box, in world coordinates [cm]
See also
GetCenter()

This is the centre of the box representing the plane in the geometry description, in world coordinates. This is rarely of any use, as most of the times GetCenter() delivers the proper information, e.g. for simulation and reconstruction.

Definition at line 498 of file PlaneGeo.h.

Referenced by geo::TPCGeo::DetectDriftDirection(), geo::TPCGeo::ResetDriftDirection(), and UpdatePlaneNormal().

499  { return geo::vect::convertTo<Point>(toWorldCoords(LocalPoint_t{ 0.0, 0.0, 0.0 })); }
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1351
geo::Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
Definition: PlaneGeo.h:115
DefaultPoint_t geo::PlaneGeo::GetBoxCenter ( ) const
inline

Returns the centre of the box representing the plane.

Template Parameters
Pointtype of point to be returned (current default: TVector3)
Returns
the centre of the box, in world coordinates [cm]
See also
GetCenter()

This is the centre of the box representing the plane in the geometry description, in world coordinates. This is rarely of any use, as most of the times GetCenter() delivers the proper information, e.g. for simulation and reconstruction.

Definition at line 500 of file PlaneGeo.h.

501  { return GetBoxCenter<DefaultPoint_t>(); }
template<typename Point >
Point geo::PlaneGeo::GetCenter ( ) const
inline

Returns the centre of the wire plane in world coordinates [cm].

See also
GetBoxCenter()

The center of the plane is defined so that it has width and depth coordinates in the middle of the plane box (that is, the geometrical representation of the plane in the geometry description), and the other coordinate set at drift distance 0.

Note that this does not necessarily match the center of the box, if the geometry does not place the wires, which define the drift distance, in the plane in the middle of the box.

Definition at line 479 of file PlaneGeo.h.

Referenced by geo::DriftPartitions::computeCoverage(), geo::TPCGeo::ProjectionReferencePoint(), UpdateDecompWireOrigin(), and UpdateIncreasingWireDir().

480  { return geo::vect::convertTo<Point>(fCenter); }
geo::Point_t fCenter
Center of the plane, lying on the wire plane.
Definition: PlaneGeo.h:1500
DefaultPoint_t geo::PlaneGeo::GetCenter ( ) const
inline

Returns the centre of the wire plane in world coordinates [cm].

See also
GetBoxCenter()

The center of the plane is defined so that it has width and depth coordinates in the middle of the plane box (that is, the geometrical representation of the plane in the geometry description), and the other coordinate set at drift distance 0.

Note that this does not necessarily match the center of the box, if the geometry does not place the wires, which define the drift distance, in the plane in the middle of the box.

Definition at line 481 of file PlaneGeo.h.

481 { return GetCenter<DefaultPoint_t>(); }
WireGeo const& geo::PlaneGeo::GetElement ( WireID const &  wireid) const
inline

Returns the wire in wireid from this plane.

Parameters
wireidfull wire ID
Returns
a constant reference to the wire in wireid
Exceptions
cet::exception(category "WireOutOfRange") if no such wire

The cryostat, TPC and plane numbers in wireid are ignored, as it is ignored whether wireid is invalid.

Definition at line 315 of file PlaneGeo.h.

316  { return Wire(wireid); }
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
geo::WirePtr geo::PlaneGeo::GetElementPtr ( WireID const &  wireid) const
inline

Returns the wire in wireid from this plane.

Parameters
wireidfull wire ID
Returns
a constant pointer to the wire, or nullptr if it does not exist

The cryostat, TPC and plane numbers in wireid are ignored, as it is ignored whether wireid is invalid.

Definition at line 338 of file PlaneGeo.h.

339  { return WirePtr(wireid); }
geo::WirePtr WirePtr(unsigned int iwire) const
Returns the wire number iwire from this plane.
Definition: PlaneGeo.h:324
template<typename Vector >
Vector geo::PlaneGeo::GetIncreasingWireDirection ( ) const
inline

Returns the direction of increasing wires.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Returns
a TVector3 versor with the direction of increasing wires

The versor is orthogonal to the wires (assumed parallel), lies on the plane and its direction goes toward increasing wire IDs.

Definition at line 457 of file PlaneGeo.h.

Referenced by geo::details::ActiveAreaCalculator::adjustCorners(), ShowerRecoTools::ShowerSlidingStandardCalodEdx::CalculateElement(), trkf::TrackKalmanFitter::doFitWork(), shower::TRACSAlg::OrderShowerHits(), shouldFlipWire(), UpdatePhiZ(), and WireIDincreasesWithZ().

458  { return geo::vect::convertTo<Vector>(fDecompWire.SecondaryDir()); }
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:466
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultVector_t geo::PlaneGeo::GetIncreasingWireDirection ( ) const
inline

Returns the direction of increasing wires.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Returns
a TVector3 versor with the direction of increasing wires

The versor is orthogonal to the wires (assumed parallel), lies on the plane and its direction goes toward increasing wire IDs.

Definition at line 459 of file PlaneGeo.h.

460  { return GetIncreasingWireDirection<DefaultVector_t>(); }
geo::Vector_t geo::PlaneGeo::GetNormalAxis ( ) const
private

Returns a direction normal to the plane (pointing is not defined).

Definition at line 881 of file PlaneGeo.cxx.

References geo::WireGeo::Direction(), e, geo::WireGeo::GetCenter(), Nwires(), geo::vect::rounded01(), and Wire().

Referenced by UpdatePlaneNormal().

881  {
882  const unsigned int NWires = Nwires();
883  if (NWires < 2) return {}; // why are we even here?
884 
885  // 1) get the direction of the middle wire
886  auto const WireDir = Wire(NWires / 2).Direction<geo::Vector_t>();
887 
888  // 2) get the direction between the middle wire and the next one
889  auto const ToNextWire = Wire(NWires / 2 + 1).GetCenter<geo::Point_t>()
890  - Wire(NWires / 2).GetCenter<geo::Point_t>();
891 
892  // 3) get the direction perpendicular to the plane
893  // 4) round it
894  // 5) return its norm
895  return geo::vect::rounded01(WireDir.Cross(ToNextWire).Unit(), 1e-4);
896 
897  } // PlaneGeo::GetNormalAxis()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
Vector Direction() const
Definition: WireGeo.h:428
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:69
Float_t e
Definition: plot.C:34
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
template<typename Vector >
Vector geo::PlaneGeo::GetNormalDirection ( ) const
inline

Returns the direction normal to the plane.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Returns
a TVector3 versor with a direction normal to the plane

The versor is orthogonal to the plane. The direction is defined so that the semi-space pointed to contains the TPC center.

Note
Each decomposition base (wire-based and frame-based) has its own normal, defined solely from its two decomposition plane axes. The wire-based frame is nevertheless required to have a normal matching this one, while the frame-based normal might happen to be in the opposite direction depending on the original geometry description.

Definition at line 442 of file PlaneGeo.h.

Referenced by shouldFlipWire(), and UpdateWidthDepthDir().

442 { return geo::vect::convertTo<Vector>(fNormal); }
geo::Vector_t fNormal
Definition: PlaneGeo.h:1487
DefaultVector_t geo::PlaneGeo::GetNormalDirection ( ) const
inline

Return the wire pitch (in centimeters). It is assumed constant.

Definition at line 443 of file PlaneGeo.h.

444  { return GetNormalDirection<DefaultVector_t>(); }
template<typename Vector >
Vector geo::PlaneGeo::GetWireDirection ( ) const
inline

Returns the direction of the wires.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Returns
a unit vector following the direction of the wires

All wires in the plane are assumed parallel.

Definition at line 513 of file PlaneGeo.h.

513 { return geo::vect::convertTo<Vector>(fDecompWire.MainDir()); }
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:463
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultVector_t geo::PlaneGeo::GetWireDirection ( ) const
inline

Returns the direction of the wires.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)
Returns
a unit vector following the direction of the wires

All wires in the plane are assumed parallel.

Definition at line 514 of file PlaneGeo.h.

515  { return GetWireDirection<DefaultVector_t>(); }
bool geo::PlaneGeo::HasElement ( unsigned int  iwire) const
inline

Returns whether a wire with index iwire is present in this plane.

Parameters
iwireindex of wire in this plane
Returns
whether the wire with index iwire is present in this plane

Definition at line 280 of file PlaneGeo.h.

280 { return HasWire(iwire); }
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:279
bool geo::PlaneGeo::HasElement ( geo::WireID const &  wireid) const
inline

Returns whether the wire in wireid is present in this plane.

Parameters
wireidfull wire ID
Returns
whether the wire in wireid is present in this plane

The cryostat, TPC and plane numbers in wireid are ignored, as it is ignored whether wireid is invalid.

Definition at line 294 of file PlaneGeo.h.

295  { return HasWire(wireid); }
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:279
bool geo::PlaneGeo::HasWire ( unsigned int  iwire) const
inline

Returns whether a wire with index iwire is present in this plane.

Parameters
iwireindex of wire in this plane
Returns
whether the wire with index iwire is present in this plane

Definition at line 279 of file PlaneGeo.h.

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

279 { return iwire < Nwires(); }
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
bool geo::PlaneGeo::HasWire ( geo::WireID const &  wireid) const
inline

Returns whether the wire in wireid is present in this plane.

Parameters
wireidfull wire ID
Returns
whether the wire in wireid is present in this plane

The cryostat, TPC and plane numbers in wireid are ignored, as it is ignored whether wireid is invalid.

Definition at line 292 of file PlaneGeo.h.

References geo::WireID::Wire.

293  { return HasWire(wireid.Wire); }
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:279
geo::PlaneID const& geo::PlaneGeo::ID ( ) const
inline

Returns the identifier of this plane.

Definition at line 203 of file PlaneGeo.h.

Referenced by NearestWire(), NearestWireID(), geo::GeometryCore::Print(), and geo::TPCGeo::ReferencePlaneID().

203 { return fID; }
geo::PlaneID fID
ID of this plane.
Definition: PlaneGeo.h:1502
double geo::PlaneGeo::InterWireDistance ( geo::Vector_t const &  dir) const

Returns the distance between wires along the specified direction.

Parameters
dirthe direction (3D)
Returns
the distance between wires along that direction [cm]

The direction is specified as a 3D vector in the world coordinate frame. The modulus of the vector is ignored but expected to be non null.

The returned distance is the space that would be covered starting from a wire toward the dir direction and stopping when the projection on the wire plane reaches another wire. This distance is returned in centimeters, always positive and not smaller than the wire pitch.

Note
If the direction is too close to the wire direction, the result will be numerically unstable and might be infinite (test with std::isinf(), std::isfinite() or std::isnormal()). It is recommended that the caller take special actions when the result is too large.

Definition at line 723 of file PlaneGeo.cxx.

References util::abs(), e, fDecompWire, fWirePitch, and geo::Decomposer< Vector, Point, ProjVector >::VectorSecondaryComponent().

723  {
724  // the secondary component of the wire decomposition basis is wire coord.
725  double const r = dir.R();
726  assert(r >= 1.e-6);
727 
728  double const absWireCoordProj
730  return r / absWireCoordProj * fWirePitch;
731 
732  } // PlaneGeo::InterWireDistance()
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a vector.
Definition: Decomposer.h:531
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1483
constexpr auto abs(T v)
Returns the absolute value of the argument.
TDirectory * dir
Definition: macro.C:5
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
Float_t e
Definition: plot.C:34
double geo::PlaneGeo::InterWireDistance ( TVector3 const &  dir) const
inline

Returns the distance between wires along the specified direction.

Parameters
dirthe direction (3D)
Returns
the distance between wires along that direction [cm]

The direction is specified as a 3D vector in the world coordinate frame. The modulus of the vector is ignored but expected to be non null.

The returned distance is the space that would be covered starting from a wire toward the dir direction and stopping when the projection on the wire plane reaches another wire. This distance is returned in centimeters, always positive and not smaller than the wire pitch.

Note
If the direction is too close to the wire direction, the result will be numerically unstable and might be infinite (test with std::isinf(), std::isfinite() or std::isnormal()). It is recommended that the caller take special actions when the result is too large.

Definition at line 714 of file PlaneGeo.h.

References geo::vect::toVector().

::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
double InterWireDistance(geo::Vector_t const &dir) const
Returns the distance between wires along the specified direction.
Definition: PlaneGeo.cxx:723
TDirectory * dir
Definition: macro.C:5
double geo::PlaneGeo::InterWireProjectedDistance ( WireCoordProjection_t const &  projDir) const

Returns the distance between wires along the specified direction.

Parameters
projDirthe direction, projected on the plane (2D)
Returns
the distance between wires along that direction [cm]

The direction is specified as a geo::PlaneGeo::WireCoordProjection_t vector, defined as in geo::PlaneGeo::Projection(). The modulus of the projection is ignored but expected to be non null.

The returned distance is the space that would be covered starting from a wire toward the projDir direction and stopping at the first wire met. This distance is returned in centimeters, always positive and not smaller than the wire pitch.

Note
If the direction is too close to the wire direction, the result will be numerically unstable and might be infinite (test with std::isinf(), std::isfinite() or std::isnormal()). It is recommended that the caller take special actions when the result is too large.

Definition at line 715 of file PlaneGeo.cxx.

References e, fWirePitch, and geo::sqr().

Referenced by NearestWire().

716  {
717  assert(lar::util::Vector2DComparison{1e-6}.nonZero(projDir));
718  return std::sqrt(sqr(projDir.X() / projDir.Y()) + 1.0) * fWirePitch;
719  } // PlaneGeo::InterWireProjectedDistance()
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1483
T sqr(T v)
Class comparing 2D vectors.
Float_t e
Definition: plot.C:34
template<typename Vector >
std::enable_if_t<geo::vect::dimension<Vector>) == 3U, double> geo::PlaneGeo::InterWireProjectedDistance ( Vector const &  dir) const
inline

Returns the distance between wires along the specified direction.

Template Parameters
Vectortype of 3D vector
Parameters
dirthe direction in detector space (3D)
Returns
the distance between wires along that direction [cm]
See also
InterWireProjectedDistance(geo::PlaneGeo::WireCoordProjection_t const&) const

The direction is specified as a 3D vector. Its modulus is ignored but expected to be non null.

The returned distance is the space that would be covered starting from a wire toward the direction projection of dir on the wire plane, and stopping at the first wire met. This distance is returned in centimeters and always positive.

Note
This is not a 3D distance (for example, it's not useful to compute $ ds $ of a track to get its ionization energy $ dE/ds $), but it is the distance projected on the wire plane.

Definition at line 741 of file PlaneGeo.h.

double InterWireProjectedDistance(WireCoordProjection_t const &projDir) const
Returns the distance between wires along the specified direction.
Definition: PlaneGeo.cxx:715
WireCoordProjection_t VectorProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:963
TDirectory * dir
Definition: macro.C:5
bool geo::PlaneGeo::isProjectionOnPlane ( geo::Point_t const &  point) const

Returns if the projection of specified point is within the plane.

Parameters
pointworld coordinate of the point to test [cm]
Returns
whether the projection of specified point is within the plane
See also
PointWidthDepthProjection(), Width(), Height()

The method extracts the projection of the specified point on the plane, as in PointWidthDepthProjection(), and then verifies that the projection falls within the wire plane area, as defined by the dimensions from the geometry description.

Definition at line 591 of file PlaneGeo.cxx.

References DeltaFromPlane(), MoveProjectionToPlane(), and PointWidthDepthProjection().

591  {
592 
593  auto const deltaProj
595 
596  return (deltaProj.X() == 0.) && (deltaProj.Y() == 0.);
597 
598  } // PlaneGeo::isProjectionOnPlane()
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:1107
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:566
bool geo::PlaneGeo::isProjectionOnPlane ( TVector3 const &  point) const
inline

Returns if the projection of specified point is within the plane.

Parameters
pointworld coordinate of the point to test [cm]
Returns
whether the projection of specified point is within the plane
See also
PointWidthDepthProjection(), Width(), Height()

The method extracts the projection of the specified point on the plane, as in PointWidthDepthProjection(), and then verifies that the projection falls within the wire plane area, as defined by the dimensions from the geometry description.

Definition at line 1147 of file PlaneGeo.h.

References geo::vect::toPoint().

1148  { return isProjectionOnPlane(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
bool isProjectionOnPlane(geo::Point_t const &point) const
Returns if the projection of specified point is within the plane.
Definition: PlaneGeo.cxx:591
ElementIteratorBox geo::PlaneGeo::IterateElements ( ) const
inline

Allows range-for iteration on all wires in this plane.

Returns
an object suitable for range-for iteration on all wires

This example uses geometry to iterate on all planes in an outer loop, and then iterates on all wires in the plane in the inner loop:

auto geom = lar::providerFrom<geo::Geometry>();
for (geo::PlaneGeo const& plane: geom->IteratePlanes()) {
// collect plane information
for (geo::WireGeo const& wire: plane.IterateWires()) {
// do something with each single wire
}
} // for planes

(note that all data types here can be replaced with auto). The resulting sequence exposes the wires within the plane in their ID order, from plane 0 to Nplanes() - 1.

Since the wire ID is not contained in geo::WireGeo, further steps are needed to obtain it if needed. For example:

auto geom = lar::providerFrom<geo::Geometry>();
for (geo::PlaneGeo const& plane: geom->IteratePlanes()) {
// collect plane information
geo::PlaneID const planeid { plane.ID() };
for (auto&& iWire, wire: util::enumerate(plane.IterateWires())) {
geo::WireID const wireid (planeID, iWire);
// do something with each single wire and ID
}
} // for planes

Definition at line 400 of file PlaneGeo.h.

400 { return fWire; }
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
ElementIteratorBox geo::PlaneGeo::IterateWires ( ) const
inline

Allows range-for iteration on all wires in this plane.

Returns
an object suitable for range-for iteration on all wires

This example uses geometry to iterate on all planes in an outer loop, and then iterates on all wires in the plane in the inner loop:

auto geom = lar::providerFrom<geo::Geometry>();
for (geo::PlaneGeo const& plane: geom->IteratePlanes()) {
// collect plane information
for (geo::WireGeo const& wire: plane.IterateWires()) {
// do something with each single wire
}
} // for planes

(note that all data types here can be replaced with auto). The resulting sequence exposes the wires within the plane in their ID order, from plane 0 to Nplanes() - 1.

Since the wire ID is not contained in geo::WireGeo, further steps are needed to obtain it if needed. For example:

auto geom = lar::providerFrom<geo::Geometry>();
for (geo::PlaneGeo const& plane: geom->IteratePlanes()) {
// collect plane information
geo::PlaneID const planeid { plane.ID() };
for (auto&& iWire, wire: util::enumerate(plane.IterateWires())) {
geo::WireID const wireid (planeID, iWire);
// do something with each single wire and ID
}
} // for planes

Definition at line 401 of file PlaneGeo.h.

401 { return IterateElements(); }
ElementIteratorBox IterateElements() const
Allows range-for iteration on all wires in this plane.
Definition: PlaneGeo.h:400
const WireGeo& geo::PlaneGeo::LastWire ( ) const
inline

Return the last wire in the plane.

Definition at line 350 of file PlaneGeo.h.

Referenced by Coverage(), and geo::details::ActiveAreaCalculator::initializeWireEnds().

350 { return Wire(Nwires()-1); }
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
void geo::PlaneGeo::LocalToWorld ( const double *  plane,
double *  world 
) const
inline
TVector3 geo::PlaneGeo::LocalToWorld ( const TVector3 &  local) const
inline

Transform point from local plane frame to world frame.

Definition at line 1347 of file PlaneGeo.h.

1348  { return fTrans.LocalToWorld<TVector3>(local); }
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
void geo::PlaneGeo::LocalToWorldVect ( const double *  plane,
double *  world 
) const
inline

Transform direction vector from local to world.

Definition at line 1355 of file PlaneGeo.h.

1356  { fTrans.LocalToWorldVect(plane, world); }
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
TVector3 geo::PlaneGeo::LocalToWorldVect ( const TVector3 &  local) const
inline

Transform direction vector from local to world.

Definition at line 1359 of file PlaneGeo.h.

1360  { return fTrans.LocalToWorldVect<TVector3>(local); }
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
const WireGeo& geo::PlaneGeo::MiddleWire ( ) const
inline

Return the middle wire in the plane.

Definition at line 347 of file PlaneGeo.h.

347 { return Wire(Nwires()/2); }
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
geo::Point_t geo::PlaneGeo::MovePointOverPlane ( geo::Point_t const &  point) const

Returns the point, moved so that its projection is over the plane.

Parameters
pointpoint to be checked and moved
Returns
the new value of the point
See also
isProjectionOnPlane(), MoveProjectionToPlane(), Width(), Height()

If the projection of the point on the plane falls outside it, the returned point is translated so that its projection is now on the border of the plane. The translation happens along the directions of the plane frame, as described in MoveProjectionToPlane().

Definition at line 643 of file PlaneGeo.cxx.

References DeltaFromPlane(), and PointWidthDepthProjection().

643  {
644 
645  //
646  // This implementation is subject to rounding errors, since the result of
647  // the addition might jitter above or below the border.
648  //
649 
650  auto const deltaProj
652 
653  return point + deltaProj.X() * WidthDir<geo::Vector_t>() + deltaProj.Y() * DepthDir<geo::Vector_t>();
654 
655  } // PlaneGeo::MovePointOverPlane()
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:1107
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:566
TVector3 geo::PlaneGeo::MovePointOverPlane ( TVector3 const &  point) const

Returns the point, moved so that its projection is over the plane.

Parameters
pointpoint to be checked and moved
Returns
the new value of the point
See also
isProjectionOnPlane(), MoveProjectionToPlane(), Width(), Height()

If the projection of the point on the plane falls outside it, the returned point is translated so that its projection is now on the border of the plane. The translation happens along the directions of the plane frame, as described in MoveProjectionToPlane().

Definition at line 629 of file PlaneGeo.cxx.

References DeltaFromPlane(), DepthDir(), PointWidthDepthProjection(), and WidthDir().

629  {
630 
631  //
632  // This implementation is subject to rounding errors, since the result of
633  // the addition might jitter above or below the border.
634  //
635 
636  auto const deltaProj
638 
639  return point + deltaProj.X() * WidthDir() + deltaProj.Y() * DepthDir();
640 
641  } // PlaneGeo::MovePointOverPlane()
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:1107
Vector DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:236
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:566
Vector WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:221
PlaneGeo::WidthDepthProjection_t geo::PlaneGeo::MoveProjectionToPlane ( WidthDepthProjection_t const &  proj) const

Returns the projection, moved onto the plane if necessary.

Parameters
projprojection to be checked and moved
Returns
the new value of the projection
See also
isProjectionOnPlane(), Width(), Height()

The projection proj is defined as in the output of PointWidthDepthProjection(). The method caps width and depth of the projection so that it stays on the plane. A new capped value is returned. Since the reference point of the frame is defined as the center of the plane, this action is equivalent to force the width component in $ \left[ -\frac{w}{2}, \frac{w}{2} \right] $ range and the depth component into $ \left[ -\frac{d}{2}, \frac{d}{2} \right] $, with $ w $ and $ d $ the width and depth of the wire plane.

Definition at line 603 of file PlaneGeo.cxx.

References DeltaFromPlane(), fFrameSize, geo::PlaneGeo::RectSpecs::HalfDepth(), and geo::PlaneGeo::RectSpecs::HalfWidth().

Referenced by isProjectionOnPlane().

604  {
605  //
606  // We have a more complicate implementation to avoid rounding errors.
607  // In this way, the result is really guaranteed to be exactly on the border.
608  //
609  auto const delta = DeltaFromPlane(proj);
610  return {
611  (delta.X() == 0.0)
612  ? proj.X()
613  : ((delta.X() > 0)
614  ? -fFrameSize.HalfWidth() // delta positive -> proj on negative side
616  ),
617  (delta.Y() == 0.0)
618  ? proj.Y()
619  : ((delta.Y() > 0)
620  ? -fFrameSize.HalfDepth() // delta positive -> proj on negative side
622  )
623  };
624 
625  } // PlaneGeo::MoveProjectionToPlane()
double HalfWidth() const
Definition: PlaneGeo.h:1472
RectSpecs fFrameSize
Definition: PlaneGeo.h:1496
double HalfDepth() const
Definition: PlaneGeo.h:1473
WidthDepthProjection_t DeltaFromPlane(WidthDepthProjection_t const &proj, double wMargin, double dMargin) const
Returns a projection vector that, added to the argument, gives a projection inside (or at the border ...
Definition: PlaneGeo.cxx:566
Float_t proj
Definition: plot.C:34
geo::WireGeo const & geo::PlaneGeo::NearestWire ( geo::Point_t const &  pos) const

Returns the wire closest to the specified position.

Parameters
posworld coordinates of the point [cm]
Returns
the ID of the wire closest to the projection of pos on the plane
Exceptions
InvalidWireError(category: "Geometry") if out of range

The position is projected on the wire plane, and the nearest wire to the projected point is returned.

If the wire is father than half a wire pitch from the point, an exception is thrown that contains both the wire that would be the closest one (badWireID()), and also the wire that is actually the closest one (betterWireID()). When this happens, the specified position was outside the wire plane.

Note that the caller should check for containment: this function may or may not report the position being outside the plane, depending on where it is. In the current implementation, the wires are considered infinitely long, and if the position projection is closer than half the wire pitch from any of these extrapolated wires, the method will not report error.

Definition at line 691 of file PlaneGeo.cxx.

References ClosestWireID(), ID(), InterWireProjectedDistance(), NearestWireID(), Wire(), and geo::WireID::Wire.

691  {
692 
693  //
694  // Note that this code is ready for when NearestWireID() will be changed
695  // to return an invalid ID instead of throwing.
696  // As things are now, `NearestWireID()` will never return an invalid ID,
697  // but it will throw an exception similar to this one.
698  //
699 
700  geo::WireID const wireID = NearestWireID(point);
701  if (wireID) return Wire(wireID); // we have that wire, so we return it
702 
703  // wire ID is invalid, meaning it's out of range. Throw an exception!
704  geo::WireID const closestID = ClosestWireID(wireID);
705  throw InvalidWireError("Geometry", ID(), closestID.Wire, wireID.Wire)
706  << "Can't find nearest wire for position " << point
707  << " in plane " << std::string(ID()) << " approx wire number # "
708  << closestID.Wire << " (capped from " << wireID.Wire << ")\n";
709 
710  } // PlaneGeo::NearestWire()
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:576
geo::WireID NearestWireID(geo::Point_t const &pos) const
Returns the ID of wire closest to the specified position.
Definition: PlaneGeo.cxx:659
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
geo::WireID ClosestWireID(geo::WireID::WireID_t wireNo) const
Returns the closest valid wire ID to the specified wire.
Definition: PlaneGeo.h:1520
geo::WireID geo::PlaneGeo::NearestWireID ( geo::Point_t const &  pos) const

Returns the ID of wire closest to the specified position.

Parameters
posworld coordinates of the point [cm]
Returns
the ID of the wire closest to the projection of pos on the plane
Exceptions
InvalidWireError(category: "Geometry") if out of range

The position is projected on the wire plane, and the ID of the nearest wire to the projected point is returned.

If the wire does not exist, an exception is thrown that contains both the wire that would be the closest one (badWireID()), and also the wire that is actually the closest one (betterWireID()). When this happens, the specified position was outside the wire plane.

Note that the caller should check for containment: this function may or may not report the position being outside the plane, depending on where it is. In the current implementation, the wires are considered infinitely long, and if the position projection is closer than half the wire pitch from any of these extrapolated wires, the method will not report error.

Todo:
When the ID is out of range, instead of throwing an exception, return an invalid wire ID with the wire number set to the non-existing wire which would be the nearest to pos.

Definition at line 659 of file PlaneGeo.cxx.

References ID(), Nwires(), and WireCoordinate().

Referenced by NearestWire(), and geo::GeometryCore::NearestWireID().

659  {
660 
661  //
662  // 1) compute the wire coordinate of the point
663  // 2) get the closest wire number
664  // 3) check if the wire does exist
665  // 4) build and return the wire ID
666  //
667 
668  // this line merges parts (1) and (2); add 0.5 to have the correct rounding:
669  int nearestWireNo = int(0.5 + WireCoordinate(pos));
670 
671  // if we are outside of the wireplane range, throw an exception
672  if ((nearestWireNo < 0) || ((unsigned int) nearestWireNo >= Nwires())) {
673 
674  auto wireNo = nearestWireNo; // save for the output
675 
676  if (nearestWireNo < 0 ) wireNo = 0;
677  else wireNo = Nwires() - 1;
678 
679  throw InvalidWireError("Geometry", ID(), nearestWireNo, wireNo)
680  << "Can't find nearest wire for position " << pos
681  << " in plane " << std::string(ID()) << " approx wire number # "
682  << wireNo << " (capped from " << nearestWireNo << ")\n";
683  } // if invalid
684 
685  return { ID(), (geo::WireID::WireID_t) nearestWireNo };
686 
687  } // PlaneGeo::NearestWireID()
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:557
double WireCoordinate(Point const &point) const
Returns the coordinate of the point on the plane, in wire units.
Definition: PlaneGeo.h:882
geo::WireID geo::PlaneGeo::NearestWireID ( TVector3 const &  pos) const
inline

Returns the ID of wire closest to the specified position.

Parameters
posworld coordinates of the point [cm]
Returns
the ID of the wire closest to the projection of pos on the plane
Exceptions
InvalidWireError(category: "Geometry") if out of range

The position is projected on the wire plane, and the ID of the nearest wire to the projected point is returned.

If the wire does not exist, an exception is thrown that contains both the wire that would be the closest one (badWireID()), and also the wire that is actually the closest one (betterWireID()). When this happens, the specified position was outside the wire plane.

Note that the caller should check for containment: this function may or may not report the position being outside the plane, depending on where it is. In the current implementation, the wires are considered infinitely long, and if the position projection is closer than half the wire pitch from any of these extrapolated wires, the method will not report error.

Todo:
When the ID is out of range, instead of throwing an exception, return an invalid wire ID with the wire number set to the non-existing wire which would be the nearest to pos.

Definition at line 545 of file PlaneGeo.h.

References geo::vect::toPoint().

546  { return NearestWireID(geo::vect::toPoint(pos)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
geo::WireID NearestWireID(geo::Point_t const &pos) const
Returns the ID of wire closest to the specified position.
Definition: PlaneGeo.cxx:659
unsigned int geo::PlaneGeo::NElements ( ) const
inline

Number of wires in this plane.

Definition at line 270 of file PlaneGeo.h.

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

270 { return Nwires(); }
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
Orient_t geo::PlaneGeo::Orientation ( ) const
inline

What is the orientation of the plane.

Definition at line 187 of file PlaneGeo.h.

Referenced by trkf::SpacePointAlg::update().

187 { return fOrientation; }
Orient_t fOrientation
Is the plane vertical or horizontal?
Definition: PlaneGeo.h:1481
std::string geo::PlaneGeo::OrientationName ( geo::Orient_t  orientation)
static

Returns the name of the specified orientation.

Definition at line 788 of file PlaneGeo.cxx.

References geo::kHorizontal, and geo::kVertical.

788  {
789  switch (orientation) {
790  case geo::kHorizontal: return "horizontal"; break;
791  case geo::kVertical: return "vertical"; break;
792  default: return "unexpected"; break;
793  } // switch
794  } // PlaneGeo::OrientationName()
Planes that are in the horizontal plane.
Definition: geo_types.h:136
Planes that are in the vertical plane (e.g. ArgoNeuT).
Definition: geo_types.h:137
double geo::PlaneGeo::PhiZ ( ) const
inline

Angle from positive z axis of the wire coordinate axis, in radians.

Definition at line 193 of file PlaneGeo.h.

Referenced by geo::GeometryCore::ThirdPlane_dTdW(), and geo::GeometryCore::ThirdPlaneSlope().

194  { return std::atan2(fSinPhiZ, fCosPhiZ); }
double fSinPhiZ
Sine of .
Definition: PlaneGeo.h:1484
double fCosPhiZ
Cosine of .
Definition: PlaneGeo.h:1485
double geo::PlaneGeo::PlaneCoordinate ( geo::Point_t const &  point) const
inline

Returns the coordinate of the point on the plane.

Parameters
pointworld coordinate of the point to get the coordinate of [cm]
Returns
the coordinate of the point [cm]
See also
PlaneCoordinateFrom(TVector3 const&, geo::Wire const&)

The method returns the coordinate of the point in the direction measured by the wires on this plane starting on the first wire, in world units (that is, centimeters). A point on the first wire will have coordinate 0.0, one on the next wire will have coordinate equal to a single wire pitch, etc.

The point does not need to be on the plane, and the projection of the point to the plane is considered.

Definition at line 861 of file PlaneGeo.h.

Referenced by pma::GetProjectionToPlane(), and pma::Node3D::UpdateProj2D().

862  { return fDecompWire.PointSecondaryComponent(point); }
auto PointSecondaryComponent(Point_t const &point) const
Returns the secondary component of a point.
Definition: Decomposer.h:482
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
double geo::PlaneGeo::PlaneCoordinate ( TVector3 const &  point) const
inline

Returns the coordinate of the point on the plane.

Parameters
pointworld coordinate of the point to get the coordinate of [cm]
Returns
the coordinate of the point [cm]
See also
PlaneCoordinateFrom(TVector3 const&, geo::Wire const&)

The method returns the coordinate of the point in the direction measured by the wires on this plane starting on the first wire, in world units (that is, centimeters). A point on the first wire will have coordinate 0.0, one on the next wire will have coordinate equal to a single wire pitch, etc.

The point does not need to be on the plane, and the projection of the point to the plane is considered.

Definition at line 863 of file PlaneGeo.h.

References geo::vect::toPoint().

864  { return PlaneCoordinate(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
double PlaneCoordinate(geo::Point_t const &point) const
Returns the coordinate of the point on the plane.
Definition: PlaneGeo.h:861
double geo::PlaneGeo::PlaneCoordinateFrom ( geo::Point_t const &  point,
geo::WireGeo const &  refWire 
) const
inline

Returns the coordinate of point on the plane respect to a wire.

Parameters
pointworld coordinate of the point to get the coordinate of [cm]
refWirereference wire
Returns
the coordinate of the point [cm]
See also
WireCoordinate()

The method returns the coordinate of the point in the direction measured by the wires on this plane starting from the specified reference wire, in world units (that is, centimeters).

The point does not need to be on the plane, and the projection of the point to the plane is considered. The reference wire, instead, must belong to this plane. This assumption is not checked, and if violated the results are undefined (in the current implementation, they are just wrong).

Definition at line 834 of file PlaneGeo.h.

References geo::WireGeo::GetCenter(), and geo::vect::toPoint().

835  {
836  return
837  fDecompWire.VectorSecondaryComponent(point - geo::vect::toPoint(refWire.GetCenter()));
838  }
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a vector.
Definition: Decomposer.h:531
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
double geo::PlaneGeo::PlaneCoordinateFrom ( TVector3 const &  point,
geo::WireGeo const &  refWire 
) const
inline

Returns the coordinate of point on the plane respect to a wire.

Parameters
pointworld coordinate of the point to get the coordinate of [cm]
refWirereference wire
Returns
the coordinate of the point [cm]
See also
WireCoordinate()

The method returns the coordinate of the point in the direction measured by the wires on this plane starting from the specified reference wire, in world units (that is, centimeters).

The point does not need to be on the plane, and the projection of the point to the plane is considered. The reference wire, instead, must belong to this plane. This assumption is not checked, and if violated the results are undefined (in the current implementation, they are just wrong).

Definition at line 840 of file PlaneGeo.h.

References geo::vect::toPoint().

841  { return PlaneCoordinateFrom(geo::vect::toPoint(point), refWire); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
double PlaneCoordinateFrom(geo::Point_t const &point, geo::WireGeo const &refWire) const
Returns the coordinate of point on the plane respect to a wire.
Definition: PlaneGeo.h:834
std::string geo::PlaneGeo::PlaneInfo ( std::string  indent = "",
unsigned int  verbosity = 1 
) const

Returns a string with plane information.

See also
PrintPlaneInfo()

The information is provided by PrintPlaneInfo(), and the arguments have the same meaning.

Definition at line 556 of file PlaneGeo.cxx.

References DeltaFromPlane(), and PrintPlaneInfo().

Referenced by Coverage().

557  {
558  std::ostringstream sstr;
559  PrintPlaneInfo(sstr, indent, verbosity);
560  return sstr.str();
561  } // PlaneGeo::PlaneInfo()
std::string indent(std::size_t const i)
void PrintPlaneInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this plane.
Definition: PlaneGeo.h:1539
WireCoordProjection_t geo::PlaneGeo::PointProjection ( geo::Point_t const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the wire plane. The vector is expressed as $ ( \ell, w ) $. The component $ \ell $ is measured on the direction of the first wire (see WireGeo::Direction()), using its center (see WireGeo::GetCenter()) as reference point. The component $ w $ is defined on the wire coordinate direction (see GetIncreasingWireDirection()), relative to the first wire, as it is returned by PlaneCoordinate().

The reference point is also returned by ProjectionReferencePoint().

Definition at line 942 of file PlaneGeo.h.

943  { return Projection(point); }
WireCoordProjection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:940
WireCoordProjection_t geo::PlaneGeo::PointProjection ( TVector3 const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the wire plane. The vector is expressed as $ ( \ell, w ) $. The component $ \ell $ is measured on the direction of the first wire (see WireGeo::Direction()), using its center (see WireGeo::GetCenter()) as reference point. The component $ w $ is defined on the wire coordinate direction (see GetIncreasingWireDirection()), relative to the first wire, as it is returned by PlaneCoordinate().

The reference point is also returned by ProjectionReferencePoint().

Definition at line 944 of file PlaneGeo.h.

References geo::vect::toPoint().

945  { return PointProjection(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
WireCoordProjection_t PointProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:942
WidthDepthProjection_t geo::PlaneGeo::PointWidthDepthProjection ( geo::Point_t const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the wire plane. The vector is expressed as $ ( w, d ) $, components following the width direction (WidthDir()) and the depth direction (DepthDir()) respectively. The origin point is the center of the plane.

Definition at line 1107 of file PlaneGeo.h.

Referenced by geo::details::ActiveAreaCalculator::initializeWireEnds(), isProjectionOnPlane(), MovePointOverPlane(), geo::TPCGeo::Projection(), and larg4::LArVoxelReadout::RecoverOffPlaneDeposit().

1108  { return fDecompFrame.ProjectPointOnPlane(point); }
Projection_t ProjectPointOnPlane(Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: Decomposer.h:500
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
WidthDepthProjection_t geo::PlaneGeo::PointWidthDepthProjection ( TVector3 const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the wire plane. The vector is expressed as $ ( w, d ) $, components following the width direction (WidthDir()) and the depth direction (DepthDir()) respectively. The origin point is the center of the plane.

Definition at line 1110 of file PlaneGeo.h.

References geo::vect::toPoint().

1111  { return PointWidthDepthProjection(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:1107
template<typename Stream >
void geo::PlaneGeo::PrintPlaneInfo ( Stream &&  out,
std::string  indent = "",
unsigned int  verbosity = 1 
) const

Prints information about this plane.

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

Information on single wires is not printed. Note that the first line out the output is not indented.

Verbosity levels

  • 0: only plane ID
  • 1 _(default)_: also center and wire angle
  • 2: also information about wires
  • 3: also information about normal and increasing coordinate direction
  • 4: also information about wire direction, width and depth
  • 5: also coverage
  • 6: also bounding box

Definition at line 1539 of file PlaneGeo.h.

Referenced by PlaneInfo(), and geo::GeometryCore::Print().

1543  {
1544 
1545  //----------------------------------------------------------------------------
1546  out << "plane " << std::string(ID());
1547 
1548  if (verbosity-- <= 0) return; // 0
1549 
1550  //----------------------------------------------------------------------------
1551  out
1552  << " at " << GetCenter<geo::Vector_t>() << " cm"
1553  << ", theta: " << ThetaZ() << " rad";
1554 
1555  if (verbosity-- <= 0) return; // 1
1556 
1557  //----------------------------------------------------------------------------
1558  unsigned int const nWires = Nwires();
1559 
1560  out << "\n" << indent
1561  << "normal to wire: " << PhiZ() << " rad"
1562  << ", with orientation " << OrientationName(Orientation())
1563  << ", has " << nWires << " wires measuring " << ViewName(View())
1564  << " with a wire pitch of " << WirePitch() << " cm"
1565  ;
1566 
1567  if (verbosity-- <= 0) return; // 2
1568 
1569  //----------------------------------------------------------------------------
1570  auto const& normal = GetNormalDirection<geo::Vector_t>();
1571  auto const& incrZdir = GetIncreasingWireDirection<geo::Vector_t>();
1572  auto const& wireNormalDir = fDecompWire.NormalDir();
1573  out << "\n" << indent
1574  << "normal to plane: " << normal
1575  << ", direction of increasing wire number: " << incrZdir
1576  << " [wire frame normal: " << wireNormalDir << "]"
1577  << " (" << (WireIDincreasesWithZ()? "increases": "decreases") << " with z)";
1578 
1579  if (verbosity-- <= 0) return; // 3
1580 
1581  //----------------------------------------------------------------------------
1582 
1583  auto const& wireDir = GetWireDirection<geo::Vector_t>();
1584  auto const& widthDir = WidthDir<geo::Vector_t>();
1585  auto const& depthDir = DepthDir<geo::Vector_t>();
1586  auto const& frameNormalDir = fDecompFrame.NormalDir();
1587 
1588  out << "\n" << indent
1589  << "wire direction: " << wireDir
1590  << "; width " << Width() << " cm in direction: " << widthDir
1591  << ", depth " << Depth() << " cm in direction: " << depthDir
1592  << " [normal: " << frameNormalDir << "]"
1593  ;
1594 
1595  if (verbosity-- <= 0) return; // 4
1596 
1597  //----------------------------------------------------------------------------
1598  // get the area spanned by the wires
1599  out << "\n" << indent << "wires cover width "
1600  << ActiveArea().width.lower << " to " << ActiveArea().width.upper
1601  << ", depth "
1602  << ActiveArea().depth.lower << " to " << ActiveArea().depth.upper
1603  << " cm";
1604  if (verbosity-- <= 0) return; // 5
1605 
1606  //----------------------------------------------------------------------------
1607  // print also the containing box
1608  auto const box = BoundingBox();
1609  out << "\n" << indent
1610  << "bounding box: " << box.Min() << " -- " << box.Max();
1611 
1612 // if (verbosity-- <= 0) return; // 6
1613 
1614  //----------------------------------------------------------------------------
1615 } // geo::PlaneGeo::PrintPlaneInfo()
static std::string OrientationName(geo::Orient_t orientation)
Returns the name of the specified orientation.
Definition: PlaneGeo.cxx:788
static std::string ViewName(geo::View_t view)
Returns the name of the specified view.
Definition: PlaneGeo.cxx:773
Vector_t const & NormalDir() const
Returns the plane normal axis direction.
Definition: Decomposer.h:469
Rect const & ActiveArea() const
Returns an area covered by the wires in the plane.
Definition: PlaneGeo.h:758
geo::BoxBoundedGeo BoundingBox() const
Definition: PlaneGeo.cxx:476
double ThetaZ() const
Angle of the wires from positive z axis; .
Definition: PlaneGeo.cxx:736
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:184
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
double PhiZ() const
Angle from positive z axis of the wire coordinate axis, in radians.
Definition: PlaneGeo.h:193
double Depth() const
Return the depth of the plane.
Definition: PlaneGeo.h:254
std::string indent(std::size_t const i)
double Width() const
Return the width of the plane.
Definition: PlaneGeo.h:246
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Orient_t Orientation() const
What is the orientation of the plane.
Definition: PlaneGeo.h:187
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
bool WireIDincreasesWithZ() const
Returns whether the higher z wires have higher wire ID.
Definition: PlaneGeo.cxx:535
Data_t upper
Ending coordinate.
Definition: SimpleGeo.h:327
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
Data_t lower
Starting coordinate.
Definition: SimpleGeo.h:326
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:411
WireCoordProjection_t geo::PlaneGeo::Projection ( geo::Point_t const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the wire plane. The vector is expressed as $ ( \ell, w ) $. The component $ \ell $ is measured on the direction of the first wire (see WireGeo::Direction()), using its center (see WireGeo::GetCenter()) as reference point. The component $ w $ is defined on the wire coordinate direction (see GetIncreasingWireDirection()), relative to the first wire, as it is returned by PlaneCoordinate().

The reference point is also returned by ProjectionReferencePoint().

Definition at line 940 of file PlaneGeo.h.

941  { return fDecompWire.ProjectPointOnPlane(point); }
Projection_t ProjectPointOnPlane(Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: Decomposer.h:500
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
WireCoordProjection_t geo::PlaneGeo::Projection ( geo::Vector_t const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the wire plane. The vector is expressed as $ ( \ell, w ) $. The component $ \ell $ is measured on the direction of the first wire (see WireGeo::Direction()). The component $ w $ is defined on the wire coordinate direction (see GetIncreasingWireDirection()).

Definition at line 961 of file PlaneGeo.h.

962  { return fDecompWire.ProjectVectorOnPlane(v); }
Projection_t ProjectVectorOnPlane(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: Decomposer.h:549
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
template<typename Point >
Point geo::PlaneGeo::ProjectionReferencePoint ( ) const
inline

Returns the reference point used by PointProjection().

Template Parameters
Pointthe type of point to return (current default: TVector3)

The returned point is such that its decomposition results in a null projection and a 0 distance from the plane.

Definition at line 917 of file PlaneGeo.h.

918  { return geo::vect::convertTo<Point>(fDecompWire.ReferencePoint()); }
Point_t ReferencePoint() const
Returns the reference point for the plane coordinate, as a 3D point.
Definition: Decomposer.h:457
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
DefaultPoint_t geo::PlaneGeo::ProjectionReferencePoint ( ) const
inline

Returns the reference point used by PointProjection().

Template Parameters
Pointthe type of point to return (current default: TVector3)

The returned point is such that its decomposition results in a null projection and a 0 distance from the plane.

Definition at line 919 of file PlaneGeo.h.

920  { return ProjectionReferencePoint<DefaultPoint_t>(); }
void geo::PlaneGeo::SetView ( geo::View_t  view)
inline

Set the signal view (for TPCGeo).

Definition at line 1398 of file PlaneGeo.h.

Referenced by UpdateView().

1398 { fView = view; }
View_t fView
Does this plane measure U, V, or W?
Definition: PlaneGeo.h:1480
bool geo::PlaneGeo::shouldFlipWire ( geo::WireGeo const &  wire) const
private

Whether the specified wire should have start and end swapped.

Definition at line 1222 of file PlaneGeo.cxx.

References geo::WireGeo::Direction(), GetIncreasingWireDirection(), and GetNormalDirection().

Referenced by UpdateAfterSorting().

1222  {
1223  //
1224  // The correct orientation is so that:
1225  //
1226  // (direction) x (wire coordinate direction) . (plane normal)
1227  //
1228  // is positive; it it's negative, then we should flip the wire.
1229  //
1230  // Note that the increasing wire direction comes from the wire frame, while
1231  // the normal direction is computed independently by geometry.
1232  // The resulting normal in the wire frame is expected to be the same as the
1233  // plane normal from GetNormalDirection(); if this is not the case, flipping
1234  // the wire direction should restore it.
1235  //
1236 
1237  return wire.Direction()
1238  .Cross(GetIncreasingWireDirection())
1239  .Dot(GetNormalDirection())
1240  < +0.5; // should be in fact exactly +1
1241 
1242  } // PlaneGeo::shouldFlipWire()
Vector GetNormalDirection() const
Returns the direction normal to the plane.
Definition: PlaneGeo.h:442
Vector GetIncreasingWireDirection() const
Returns the direction of increasing wires.
Definition: PlaneGeo.h:457
double geo::PlaneGeo::SinPhiZ ( ) const
inline

Sine of PhiZ()

Definition at line 197 of file PlaneGeo.h.

197 { return fSinPhiZ; }
double fSinPhiZ
Sine of .
Definition: PlaneGeo.h:1484
void geo::PlaneGeo::SortWires ( geo::GeoObjectSorter const &  sorter)

Apply sorting to WireGeo objects.

Definition at line 525 of file PlaneGeo.cxx.

References fWire, util::SortByPointers(), and geo::GeoObjectSorter::SortWires().

526  {
527  // the sorter interface requires a vector of pointers;
528  // sorting is faster, but some gymnastics is required:
530  (fWire, [&sorter](auto& coll){ sorter.SortWires(coll); });
531  }
void SortByPointers(Coll &coll, Sorter sorter)
Applies sorting indirectly, minimizing data copy.
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
double geo::PlaneGeo::ThetaZ ( ) const

Angle of the wires from positive z axis; $ \theta_{z} \in [ 0, \pi ]$.

Definition at line 736 of file PlaneGeo.cxx.

References FirstWire(), geo::WireGeo::ThetaZ(), and UpdateAfterSorting().

Referenced by tca::dEdx(), calo::Calorimetry::GetPitch(), and geo::GeometryCore::WireAngleToVertical().

736 { return FirstWire().ThetaZ(); }
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:227
const WireGeo & FirstWire() const
Return the first wire in the plane.
Definition: PlaneGeo.h:344
LocalPoint_t geo::PlaneGeo::toLocalCoords ( geo::Point_t const &  world) const
inline

Transform point from world frame to local plane frame.

Definition at line 1375 of file PlaneGeo.h.

1376  { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
LocalVector_t geo::PlaneGeo::toLocalCoords ( geo::Vector_t const &  world) const
inline

Transform direction vector from world to local.

Definition at line 1387 of file PlaneGeo.h.

1388  { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
geo::Point_t geo::PlaneGeo::toWorldCoords ( LocalPoint_t const &  local) const
inline

Transform point from local plane frame to world frame.

Definition at line 1351 of file PlaneGeo.h.

Referenced by BoundingBox(), and DetectGeometryDirections().

1352  { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
geo::Vector_t geo::PlaneGeo::toWorldCoords ( LocalVector_t const &  local) const
inline

Transform direction vector from local to world.

Definition at line 1363 of file PlaneGeo.h.

1364  { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
void geo::PlaneGeo::UpdateActiveArea ( )
private

Updates the internally used active area.

Definition at line 1177 of file PlaneGeo.cxx.

References fActiveArea.

Referenced by UpdateAfterSorting().

1177  {
1178 
1179  //
1180  // The active area is defined in the width/depth space which include
1181  // approximatively all wires.
1182  //
1183  // See `ActiveAreaCalculator` for details of the algorithm.
1184  //
1185 
1186  // we scratch 1 um from each side to avoid rounding errors later
1187  fActiveArea = details::ActiveAreaCalculator(*this, 0.0001);
1188 
1189  } // PlaneGeo::UpdateActiveArea()
Rect fActiveArea
Area covered by wires in frame base.
Definition: PlaneGeo.h:1498
friend struct details::ActiveAreaCalculator
Definition: PlaneGeo.h:1504
void geo::PlaneGeo::UpdateAfterSorting ( geo::PlaneID  planeid,
geo::BoxBoundedGeo const &  TPCbox 
)

Performs all needed updates after the TPC has sorted the planes.

Definition at line 741 of file PlaneGeo.cxx.

References fID, fWire, shouldFlipWire(), UpdateActiveArea(), UpdateDecompWireOrigin(), UpdateIncreasingWireDir(), UpdateOrientation(), UpdatePhiZ(), UpdatePlaneNormal(), UpdateView(), UpdateWidthDepthDir(), UpdateWireDir(), UpdateWirePitch(), and UpdateWirePlaneCenter().

Referenced by ThetaZ().

742  {
743  // the order here matters
744 
745  // reset our ID
746  fID = planeid;
747 
748  UpdatePlaneNormal(TPCbox);
751 
752  // update wires
753  geo::WireID::WireID_t wireNo = 0;
754  for (auto& wire: fWire) {
755 
756  wire.UpdateAfterSorting(geo::WireID(fID, wireNo), shouldFlipWire(wire));
757 
758  ++wireNo;
759  } // for wires
760 
762  UpdateWireDir();
765  UpdateWirePitch();
767  UpdatePhiZ();
768  UpdateView();
769 
770  } // PlaneGeo::UpdateAfterSorting()
void UpdateIncreasingWireDir()
Updates the cached direction to increasing wires.
Definition: PlaneGeo.cxx:1097
void UpdateWirePitch()
Updates the stored wire pitch.
Definition: PlaneGeo.cxx:933
void UpdateWidthDepthDir()
Updates the cached depth and width direction.
Definition: PlaneGeo.cxx:1077
void UpdateOrientation()
Updates plane orientation.
Definition: PlaneGeo.cxx:901
geo::PlaneID fID
ID of this plane.
Definition: PlaneGeo.h:1502
bool shouldFlipWire(geo::WireGeo const &wire) const
Whether the specified wire should have start and end swapped.
Definition: PlaneGeo.cxx:1222
void UpdatePlaneNormal(geo::BoxBoundedGeo const &TPCbox)
Updates the cached normal to plane versor; needs the TPC box coordinates.
Definition: PlaneGeo.cxx:1056
void UpdatePhiZ()
Updates the stored .
Definition: PlaneGeo.cxx:945
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
void UpdateView()
Updates the stored view.
Definition: PlaneGeo.cxx:960
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:557
void UpdateWirePlaneCenter()
Updates the stored wire plane center.
Definition: PlaneGeo.cxx:1193
void UpdateDecompWireOrigin()
Updates the position of the wire coordinate decomposition.
Definition: PlaneGeo.cxx:1167
void UpdateActiveArea()
Updates the internally used active area.
Definition: PlaneGeo.cxx:1177
void UpdateWireDir()
Updates the cached direction to wire.
Definition: PlaneGeo.cxx:1131
void geo::PlaneGeo::UpdateDecompWireOrigin ( )
private

Updates the position of the wire coordinate decomposition.

Definition at line 1167 of file PlaneGeo.cxx.

References fDecompWire, FirstWire(), GetCenter(), geo::Decomposer< Vector, Point, ProjVector >::SetOrigin(), and geo::vect::toPoint().

Referenced by UpdateAfterSorting().

1167  {
1168 
1169  //
1170  // update the origin of the reference frame (the middle of the first wire)
1171  //
1173 
1174  } // PlaneGeo::UpdateDecompWireOrigin()
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:479
const WireGeo & FirstWire() const
Return the first wire in the plane.
Definition: PlaneGeo.h:344
void SetOrigin(Point_t const &point)
Change the 3D point of the reference frame origin.
Definition: Decomposer.h:441
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
void geo::PlaneGeo::UpdateIncreasingWireDir ( )
private

Updates the cached direction to increasing wires.

Definition at line 1097 of file PlaneGeo.cxx.

References e, fDecompWire, GetCenter(), Nwires(), geo::vect::rounded01(), geo::Decomposer< Vector, Point, ProjVector >::SetSecondaryDir(), geo::vect::toVector(), and Wire().

Referenced by UpdateAfterSorting().

1097  {
1098 
1099  //
1100  // Direction measured by the wires, pointing toward increasing wire number;
1101  // requires:
1102  // - the normal to the plane to be correct
1103  // - wires to be sorted
1104  //
1105 
1106  // 1) get the direction of the middle wire
1107  auto refWireNo = Nwires() / 2;
1108  if (refWireNo == Nwires() - 1) --refWireNo;
1109  auto const& refWire = Wire(refWireNo);
1110  auto const& WireDir = geo::vect::toVector(refWire.Direction()); // we only rely on the axis
1111 
1112 
1113  // 2) get the axis perpendicular to it on the wire plane
1114  // (arbitrary direction)
1115  auto wireCoordDir = GetNormalDirection<geo::Vector_t>().Cross(WireDir).Unit();
1116 
1117  // 3) where is the next wire?
1118  auto toNextWire
1119  = geo::vect::toVector(Wire(refWireNo + 1).GetCenter() - refWire.GetCenter());
1120 
1121  // 4) if wireCoordDir is pointing away from the next wire, flip it
1122  if (wireCoordDir.Dot(toNextWire) < 0) {
1123  wireCoordDir = -wireCoordDir;
1124  }
1126 
1127  } // PlaneGeo::UpdateIncreasingWireDir()
void SetSecondaryDir(Vector_t const &dir)
Change the secondary direction of the projection base.
Definition: Decomposer.h:447
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:479
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
Float_t e
Definition: plot.C:34
void geo::PlaneGeo::UpdateOrientation ( )
private

Updates plane orientation.

Definition at line 901 of file PlaneGeo.cxx.

References util::abs(), e, fOrientation, fWire, geo::kHorizontal, and geo::kVertical.

Referenced by UpdateAfterSorting().

901  {
902 
903  //
904  // this algorithm needs to know about the axis;
905  // the normal is expected to be already updated.
906  //
907 
908  // sanity check
909  if (fWire.size() < 2) {
910  // this likely means construction is not complete yet
911  throw cet::exception("NoWireInPlane")
912  << "PlaneGeo::UpdateOrientation(): only " << fWire.size()
913  << " wires!\n";
914  } // if
915 
916  auto normal = GetNormalDirection<geo::Vector_t>();
917 
918  if (std::abs(std::abs(normal.X()) - 1.) < 1e-3)
920  else if (std::abs(std::abs(normal.Y()) - 1.) < 1e-3)
922  else {
923  // at this point, the only problem is the lack of a label for this
924  // orientation; probably introducing a geo::kOtherOrientation would
925  // suffice
926  throw cet::exception("Geometry")
927  << "Plane with unsupported orientation (normal: " << normal << ")\n";
928  }
929 
930  } // PlaneGeo::UpdateOrientation()
constexpr auto abs(T v)
Returns the absolute value of the argument.
Planes that are in the horizontal plane.
Definition: geo_types.h:136
Planes that are in the vertical plane (e.g. ArgoNeuT).
Definition: geo_types.h:137
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
Float_t e
Definition: plot.C:34
Orient_t fOrientation
Is the plane vertical or horizontal?
Definition: PlaneGeo.h:1481
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void geo::PlaneGeo::UpdatePhiZ ( )
private

Updates the stored $ \phi_{z} $.

Definition at line 945 of file PlaneGeo.cxx.

References fCosPhiZ, fSinPhiZ, and GetIncreasingWireDirection().

Referenced by UpdateAfterSorting().

945  {
946  TVector3 const& wire_coord_dir = GetIncreasingWireDirection();
947  /*
948  TVector3 const& normal = GetNormalDirection();
949  TVector3 z(0., 0., 1.);
950 
951  // being defined in absolute terms as angle respect to z axis,
952  // we take the z component as cosine, and all the rest as sine
953  fCosPhiZ = wire_coord_dir.Dot(z);
954  fSinPhiZ = wire_coord_dir.Cross(z).Dot(normal);
955  */
956  fCosPhiZ = wire_coord_dir.Z();
957  fSinPhiZ = wire_coord_dir.Y();
958  } // PlaneGeo::UpdatePhiZ()
Vector GetIncreasingWireDirection() const
Returns the direction of increasing wires.
Definition: PlaneGeo.h:457
double fSinPhiZ
Sine of .
Definition: PlaneGeo.h:1484
double fCosPhiZ
Cosine of .
Definition: PlaneGeo.h:1485
void geo::PlaneGeo::UpdatePlaneNormal ( geo::BoxBoundedGeo const &  TPCbox)
private

Updates the cached normal to plane versor; needs the TPC box coordinates.

Definition at line 1056 of file PlaneGeo.cxx.

References geo::BoxBoundedGeo::Center(), e, fNormal, GetBoxCenter(), GetNormalAxis(), and geo::vect::round01().

Referenced by UpdateAfterSorting().

1056  {
1057 
1058  //
1059  // direction normal to the wire plane, points toward the center of TPC
1060  //
1061 
1062  // start from the axis
1063  fNormal = GetNormalAxis();
1064 
1065  // now evaluate where we are pointing
1066  auto const towardCenter
1067  = geo::vect::convertTo<TVector3>(TPCbox.Center()) - GetBoxCenter();
1068 
1069  // if they are pointing in opposite directions, flip the normal
1070  if (fNormal.Dot(towardCenter) < 0) fNormal = -fNormal;
1072 
1073  } // PlaneGeo::UpdatePlaneNormal()
void round01(Vector &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
Point GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:498
geo::Vector_t fNormal
Definition: PlaneGeo.h:1487
geo::Vector_t GetNormalAxis() const
Returns a direction normal to the plane (pointing is not defined).
Definition: PlaneGeo.cxx:881
Float_t e
Definition: plot.C:34
void geo::PlaneGeo::UpdateView ( )
private

Updates the stored view.

Definition at line 960 of file PlaneGeo.cxx.

References util::abs(), geo::vect::dot(), e, geo::kU, geo::kV, geo::kX, geo::kY, geo::kZ, geo::vect::mixedProduct(), SetView(), geo::Xaxis(), geo::Yaxis(), and geo::Zaxis().

Referenced by UpdateAfterSorting().

961  {
962  /*
963  * This algorithm assigns views according to the angle the wire axis cuts
964  * with y axis ("thetaY"), but from the point of view of the center of the
965  * TPC.
966  * A special case is when the drift axis is on y axis.
967  *
968  * In the normal case, the discrimination happens on the the arctangent of
969  * the point { (y,w), (y x n,w) }, where w is the wire direction, y is the
970  * coordinate axis and n the normal to the wire plane. This definition gives
971  * the same value regardless of the direction of w on its axis.
972  *
973  * If thetaY is 0, wires are parallel to the y axis:
974  * the view is assigned as kX or kZ depending on whether the plane normal is
975  * closer to the z axis or the x axis, respectively (the normal describes
976  * a direction _not_ measured by the wires).
977  *
978  * If thetaY is a right angle, the wires are orthogonal to y axis and view
979  * kY view is assigned.
980  * If thetaY is smaller than 0, the view is called "U".
981  * If thetaY is larger than 0, the view is called "V".
982  *
983  * The special case where the drift axis is on y axis is treated separately.
984  * In that case, the role of y axis is replaced by the z axis and the
985  * discriminating figure is equivalent to the usual ThetaZ().
986  *
987  * If thetaZ is 0, the wires are measuring x and kX view is chosen.
988  * If thetaZ is a right angle, the wires are measuring z and kZ view is
989  * chosen.
990  * If thetaZ is smaller than 0, the view is called "U".
991  * If thetaZ is larger than 0, the view is called "V".
992  *
993  */
994 
995  auto const& normalDir = GetNormalDirection<geo::Vector_t>();
996  auto const& wireDir = GetWireDirection<geo::Vector_t>();
997 
998  // normal direction has been rounded, so exact comparison can work
999  if (std::abs(normalDir.Y()) != 1.0) {
1000  //
1001  // normal case: drift direction is not along y (vertical)
1002  //
1003 
1004  // yw is pretty much GetWireDirection().Y()...
1005  // thetaY is related to atan2(ynw, yw)
1006  double const yw = geo::vect::dot(wireDir, geo::Yaxis());
1007  double const ynw = geo::vect::mixedProduct
1008  (geo::Yaxis(), normalDir, wireDir);
1009 
1010  if (std::abs(yw) < 1.0e-4) { // wires orthogonal to y axis
1011  double const closeToX
1012  = std::abs(geo::vect::dot(normalDir, geo::Xaxis()));
1013  double const closeToZ
1014  = std::abs(geo::vect::dot(normalDir, geo::Zaxis()));
1015  SetView((closeToZ > closeToX)? geo::kX: geo::kY);
1016  }
1017  else if (std::abs(ynw) < 1.0e-4) { // wires parallel to y axis
1018  SetView(geo::kZ);
1019  }
1020  else if ((ynw * yw) < 0) SetView(geo::kU); // different sign => thetaY > 0
1021  else if ((ynw * yw) > 0) SetView(geo::kV); // same sign => thetaY < 0
1022  else assert(false); // logic error?!
1023 
1024  }
1025  else { // if drift is vertical
1026  //
1027  // special case: drift direction is along y (vertical)
1028  //
1029 
1030  // zw is pretty much GetWireDirection().Z()...
1031  double const zw = geo::vect::dot(wireDir, geo::Zaxis());
1032  // while GetNormalDirection() axis is on y, its direction is not fixed:
1033  double const znw = geo::vect::mixedProduct
1034  (geo::Zaxis(), normalDir, wireDir);
1035 
1036  // thetaZ is std::atan(znw/zw)
1037 
1038  if (std::abs(zw) < 1.0e-4) { // orthogonal to z, orthogonal to y...
1039  // this is equivalent to thetaZ = +/- pi/2
1040  SetView(geo::kZ);
1041  }
1042  else if (std::abs(znw) < 1.0e-4) { // parallel to z, orthogonal to y...
1043  // this is equivalent to thetaZ = 0
1044  SetView(geo::kX);
1045  }
1046  else if ((znw * zw) < 0) SetView(geo::kU); // different sign => thetaZ > 0
1047  else if ((znw * zw) > 0) SetView(geo::kV); // same sign => thetaZ < 0
1048  else assert(false); // logic error?!
1049 
1050  } // if drift direction... else
1051 
1052  } // UpdateView()
void SetView(geo::View_t view)
Set the signal view (for TPCGeo).
Definition: PlaneGeo.h:1398
constexpr auto dot(Vector const &a, Vector const &b)
Return cross product of two vectors.
Planes which measure V.
Definition: geo_types.h:126
auto mixedProduct(Vector const &a, Vector const &b, Vector const &c)
Planes which measure X direction.
Definition: geo_types.h:130
constexpr Vector Yaxis()
Returns a y axis vector of the specified type.
Definition: geo_vectors.h:219
constexpr auto abs(T v)
Returns the absolute value of the argument.
Planes which measure Z direction.
Definition: geo_types.h:128
Planes which measure Y direction.
Definition: geo_types.h:129
Planes which measure U.
Definition: geo_types.h:125
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
Definition: geo_vectors.h:215
constexpr Vector Zaxis()
Returns a z axis vector of the specified type.
Definition: geo_vectors.h:223
Float_t e
Definition: plot.C:34
void geo::PlaneGeo::UpdateWidthDepthDir ( )
private

Updates the cached depth and width direction.

Definition at line 1077 of file PlaneGeo.cxx.

References DepthDir(), e, fDecompFrame, GetNormalDirection(), geo::vect::rounded01(), geo::Decomposer< Vector, Point, ProjVector >::SecondaryDir(), geo::Decomposer< Vector, Point, ProjVector >::SetSecondaryDir(), and WidthDir().

Referenced by UpdateAfterSorting().

1077  {
1078 
1079  //
1080  // fix the positiveness of the width/depth/normal frame
1081  //
1082 
1083  // The basis is already set and orthonormal, with only the width
1084  // and depth directions arbitrary.
1085  // We choose the direction of the secondary axis ("depth")
1086  // so that the frame normal is oriented in the general direction of the
1087  // plane normal (the latter is computed independently).
1088  if (WidthDir().Cross(DepthDir()).Dot(GetNormalDirection()) < 0.0) {
1091  }
1092 
1093  } // PlaneGeo::UpdateWidthDepthDir()
void SetSecondaryDir(Vector_t const &dir)
Change the secondary direction of the projection base.
Definition: Decomposer.h:447
Vector GetNormalDirection() const
Returns the direction normal to the plane.
Definition: PlaneGeo.h:442
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
Vector DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:236
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:466
Vector WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:221
Float_t e
Definition: plot.C:34
void geo::PlaneGeo::UpdateWireDir ( )
private

Updates the cached direction to wire.

Definition at line 1131 of file PlaneGeo.cxx.

References e, fDecompWire, FirstWire(), lar::util::makeVector3DComparison(), geo::Decomposer< Vector, Point, ProjVector >::NormalDir(), geo::vect::rounded01(), geo::Decomposer< Vector, Point, ProjVector >::SetMainDir(), and geo::vect::toVector().

Referenced by UpdateAfterSorting().

1131  {
1132 
1134 
1135  //
1136  // check that the resulting normal matches the plane one
1137  //
1139  .equal(fDecompWire.NormalDir(), GetNormalDirection<geo::Vector_t>()));
1140 
1141  } // PlaneGeo::UpdateWireDir()
Vector_t const & NormalDir() const
Returns the plane normal axis direction.
Definition: Decomposer.h:469
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
auto makeVector3DComparison(RealType threshold)
Creates a Vector3DComparison from a RealComparisons object.
const WireGeo & FirstWire() const
Return the first wire in the plane.
Definition: PlaneGeo.h:344
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
Direction
Definition: AssnsIter.h:13
WireDecomposer_t fDecompWire
Definition: PlaneGeo.h:1491
Float_t e
Definition: plot.C:34
void SetMainDir(Vector_t const &dir)
Change the main direction of the projection base.
Definition: Decomposer.h:444
void geo::PlaneGeo::UpdateWirePitch ( )
private

Updates the stored wire pitch.

Definition at line 933 of file PlaneGeo.cxx.

References fWirePitch, Nwires(), Wire(), and geo::WireGeo::WirePitch().

Referenced by UpdateAfterSorting().

933  {
934  // pick long wires around the center of the detector,
935  // so that their coordinates are defined with better precision
936  assert(Nwires() > 1);
937 
938  auto const iWire = Nwires() / 2;
939 
940  fWirePitch = geo::WireGeo::WirePitch(Wire(iWire - 1), Wire(iWire));
941 
942  } // PlaneGeo::UpdateWirePitch()
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1483
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
static double WirePitch(geo::WireGeo const &w1, geo::WireGeo const &w2)
Returns the pitch (distance on y/z plane) between two wires, in cm.
Definition: WireGeo.h:372
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:269
void geo::PlaneGeo::UpdateWirePitchSlow ( )
private

Updates the stored wire pitch with a slower, more robust algorithm.

Definition at line 1145 of file PlaneGeo.cxx.

References e, fWire, fWirePitch, and geo::WireGeo::WirePitch().

Referenced by PlaneGeo().

1145  {
1146 
1147  //
1148  // Compare one wire (the first one, for convenience) with all other wires;
1149  // the wire pitch is the smallest distance we find.
1150  //
1151  // This algorithm assumes wire pitch is constant, but it does not assume
1152  // wire ordering (which UpdateWirePitch() does).
1153  //
1154  auto firstWire = fWire.cbegin(), wire = firstWire, wend = fWire.cend();
1155  fWirePitch = geo::WireGeo::WirePitch(*firstWire, *(++wire));
1156 
1157  while (++wire != wend) {
1158  auto wirePitch = geo::WireGeo::WirePitch(*firstWire, *wire);
1159  if (wirePitch < 1e-4) continue; // it's 0!
1160  if (wirePitch < fWirePitch) fWirePitch = wirePitch;
1161  } // while
1162 
1163  } // PlaneGeo::UpdateWirePitchSlow()
double fWirePitch
Pitch of wires in this plane.
Definition: PlaneGeo.h:1483
static double WirePitch(geo::WireGeo const &w1, geo::WireGeo const &w2)
Returns the pitch (distance on y/z plane) between two wires, in cm.
Definition: WireGeo.h:372
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
Float_t e
Definition: plot.C:34
void geo::PlaneGeo::UpdateWirePlaneCenter ( )
private

Updates the stored wire plane center.

Definition at line 1193 of file PlaneGeo.cxx.

References DistanceFromPlane(), DriftPoint(), e, fCenter, fDecompFrame, geo::vect::round0(), and geo::Decomposer< Vector, Point, ProjVector >::SetOrigin().

Referenced by UpdateAfterSorting().

1193  {
1194 
1195  //
1196  // The center of the wire plane is defined as the center of the plane box,
1197  // translated to the plane the wires lie on.
1198  // This assumes that the thickness direction of the box is aligned with
1199  // the drift direction, so that the translated point is still in the middle
1200  // of width and depth dimensions.
1201  // It is possible to remove that assumption by translating the center of the
1202  // box along the thickness direction enough to bring it to the wire plane.
1203  // The math is just a bit less straightforward, so we don't bother yet.
1204  //
1205  // Requirements:
1206  // * the wire decomposition frame must be set up (at least its origin and
1207  // normal direction)
1208  //
1209 
1210  fCenter = GetBoxCenter<geo::Point_t>();
1211 
1213 
1214  geo::vect::round0(fCenter, 1e-7); // round dimensions less than 1 nm to 0
1215 
1216  fDecompFrame.SetOrigin(fCenter); // equivalent to GetCenter() now
1217 
1218  } // PlaneGeo::UpdateWirePlaneCenter()
geo::Point_t fCenter
Center of the plane, lying on the wire plane.
Definition: PlaneGeo.h:1500
void round0(Vector &v, Scalar tol)
Returns a vector with all components rounded if close to 0.
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:643
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
void SetOrigin(Point_t const &point)
Change the 3D point of the reference frame origin.
Definition: Decomposer.h:441
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:621
Float_t e
Definition: plot.C:34
WireCoordProjection_t geo::PlaneGeo::VectorProjection ( geo::Vector_t const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the wire plane. The vector is expressed as $ ( \ell, w ) $. The component $ \ell $ is measured on the direction of the first wire (see WireGeo::Direction()). The component $ w $ is defined on the wire coordinate direction (see GetIncreasingWireDirection()).

Definition at line 963 of file PlaneGeo.h.

964  { return Projection(v); }
WireCoordProjection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:940
WireCoordProjection_t geo::PlaneGeo::VectorProjection ( TVector3 const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the wire plane. The vector is expressed as $ ( \ell, w ) $. The component $ \ell $ is measured on the direction of the first wire (see WireGeo::Direction()). The component $ w $ is defined on the wire coordinate direction (see GetIncreasingWireDirection()).

Definition at line 965 of file PlaneGeo.h.

References geo::vect::toVector().

966  { return VectorProjection(geo::vect::toVector(v)); }
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
WireCoordProjection_t VectorProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:963
WidthDepthProjection_t geo::PlaneGeo::VectorWidthDepthProjection ( geo::Vector_t const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the wire plane. The vector is expressed as $ ( w, d ) $, components following the width direction (WidthDir()) and the depth direction (DepthDir()) respectively.

Definition at line 1127 of file PlaneGeo.h.

Referenced by geo::details::ActiveAreaCalculator::adjustCorners(), and geo::TPCGeo::Projection().

1128  { return fDecompFrame.ProjectVectorOnPlane(v); }
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
Projection_t ProjectVectorOnPlane(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: Decomposer.h:549
WidthDepthProjection_t geo::PlaneGeo::VectorWidthDepthProjection ( TVector3 const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the wire plane. The vector is expressed as $ ( w, d ) $, components following the width direction (WidthDir()) and the depth direction (DepthDir()) respectively.

Definition at line 1130 of file PlaneGeo.h.

References geo::vect::toVector().

WidthDepthProjection_t VectorWidthDepthProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:1127
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
std::string geo::PlaneGeo::ViewName ( geo::View_t  view)
static

Returns the name of the specified view.

Definition at line 773 of file PlaneGeo.cxx.

References geo::k3D, geo::kU, geo::kUnknown, geo::kV, geo::kX, geo::kY, geo::kZ, and util::to_string().

Referenced by trkf::SeedFinderAlgorithm::GetCenterAndDirection(), and geo::GeometryCore::WireAngleToVertical().

773  {
774  switch (view) {
775  case geo::kU: return "U";
776  case geo::kV: return "V";
777  case geo::kZ: return "Z";
778  case geo::kY: return "Y";
779  case geo::kX: return "X";
780  case geo::k3D: return "3D";
781  case geo::kUnknown: return "?";
782  default:
783  return "<UNSUPPORTED (" + std::to_string((int) view) + ")>";
784  } // switch
785  } // PlaneGeo::ViewName()
Planes which measure V.
Definition: geo_types.h:126
Unknown view.
Definition: geo_types.h:132
Planes which measure X direction.
Definition: geo_types.h:130
Planes which measure Z direction.
Definition: geo_types.h:128
Planes which measure Y direction.
Definition: geo_types.h:129
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:131
Planes which measure U.
Definition: geo_types.h:125
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
double geo::PlaneGeo::Width ( ) const
inline

Return the width of the plane.

See also
Depth(), WidthDir(), DepthDir()

The precise definition is arbitrary (see WidthDir()).

Definition at line 246 of file PlaneGeo.h.

246 { return fFrameSize.Width(); }
RectSpecs fFrameSize
Definition: PlaneGeo.h:1496
double Width() const
Definition: PlaneGeo.h:1474
template<typename Vector >
Vector geo::PlaneGeo::WidthDir ( ) const
inline

Return the direction of plane width.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)

The precise definition of the sides is arbitrary, but they are defined to lie on the wire plane and so that WidthDir(), DepthDir() and GetNormalDirection() make a orthonormal base. That base (width, depth, normal) is guaranteed to be positive defined.

Definition at line 221 of file PlaneGeo.h.

Referenced by MovePointOverPlane(), geo::TPCGeo::RefWidthDir(), and UpdateWidthDepthDir().

221 { return geo::vect::convertTo<Vector>(fDecompFrame.MainDir()); }
WidthDepthDecomposer_t fDecompFrame
Definition: PlaneGeo.h:1495
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:463
DefaultVector_t geo::PlaneGeo::WidthDir ( ) const
inline

Return the direction of plane width.

Template Parameters
Vectorthe type of vector to return (current default: TVector3)

The precise definition of the sides is arbitrary, but they are defined to lie on the wire plane and so that WidthDir(), DepthDir() and GetNormalDirection() make a orthonormal base. That base (width, depth, normal) is guaranteed to be positive defined.

Definition at line 222 of file PlaneGeo.h.

222 { return WidthDir<DefaultVector_t>(); }
geo::WireGeo const & geo::PlaneGeo::Wire ( unsigned int  iwire) const

Return the iwire'th wire in the plane.

Exceptions
cet::exception(category "WireOutOfRange") if no such wire
Note
In the past, no check was performed.

Definition at line 513 of file PlaneGeo.cxx.

References WirePtr().

Referenced by hit::MagDriftAna::analyze(), lar_pandora::LArPandoraInput::CreatePandoraHits2D(), lar_pandora::LArPandoraInput::CreatePandoraReadoutGaps(), hit::DisambigCheater::DisambigCheater(), trkf::Track3DKalmanSPS::dQdxCalc(), evd::RecoBaseDrawer::DrawTrack2D(), GetNormalAxis(), lar_pandora::PFParticleHitDumper::GetUVW(), geo::ChannelMapStandardAlg::Initialize(), trkf::SpacePointAlg::makeSpacePoints(), NearestWire(), geo::GeometryCore::Print(), trkf::SpacePts::produce(), trkf::Track3Dreco::produce(), vertex::VertexFinder2D::produce(), util::GeometryUtilities::Reconfigure(), trkf::SpacePointAlg::update(), UpdateIncreasingWireDir(), and UpdateWirePitch().

513  {
514  geo::WireGeo const* pWire = WirePtr(iwire);
515  if (!pWire) {
516  throw cet::exception("WireOutOfRange")
517  << "Request for non-existant wire " << iwire << "\n";
518  }
519  return *pWire;
520  } // PlaneGeo::Wire(int)
geo::WirePtr WirePtr(unsigned int iwire) const
Returns the wire number iwire from this plane.
Definition: PlaneGeo.h:324
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:64
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
WireGeo const& geo::PlaneGeo::Wire ( WireID const &  wireid) const
inline

Returns the wire in wireid from this plane.

Parameters
wireidfull wire ID
Returns
a constant reference to the wire in wireid
Exceptions
cet::exception(category "WireOutOfRange") if no such wire

The cryostat, TPC and plane numbers in wireid are ignored, as it is ignored whether wireid is invalid.

Definition at line 313 of file PlaneGeo.h.

References geo::WireID::Wire.

314  { return Wire(wireid.Wire); }
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:513
template<typename Point >
double geo::PlaneGeo::WireCoordinate ( Point const &  point) const
inline

Returns the coordinate of the point on the plane, in wire units.

Parameters
pointworld coordinate of the point to get the coordinate of
Returns
the coordinate of the point, in wire pitch units
See also
CoordinateFrom(TVector3 const&, geo::Wire const&)

The method returns the coordinate of the point in the direction measured by the wires on this plane starting on the first wire, in wire units (that is, wire pitches). A point on the first wire will have coordinate 0.0, one on the next wire will have coordinate 1.0, etc.

The point does not need to be on the plane, and the projection of the point to the plane is considered.

Definition at line 882 of file PlaneGeo.h.

Referenced by lar_cluster3d::StandardHit3DBuilder::NearestWireID(), NearestWireID(), and geo::GeometryCore::WireCoordinate().

883  { return PlaneCoordinate(point) / WirePitch(); }
double PlaneCoordinate(geo::Point_t const &point) const
Returns the coordinate of the point on the plane.
Definition: PlaneGeo.h:861
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:411
bool geo::PlaneGeo::WireIDincreasesWithZ ( ) const

Returns whether the higher z wires have higher wire ID.

Returns
whether the higher z wires have higher wire ID
See also
GetIncreasingWireDirection()

This method is related to GetIncreasingWireDirection() (it might be expressed as "GetIncreasingWireDirection()[2] > 0"), but it is implemented in a faster and independent way.

Definition at line 535 of file PlaneGeo.cxx.

References e, GetIncreasingWireDirection(), lar::util::RealComparisons< RealType >::nonNegative(), and Z.

535  {
538  } // PlaneGeo::WireIDincreasesWithZ()
Provides simple real number checks.
Vector GetIncreasingWireDirection() const
Returns the direction of increasing wires.
Definition: PlaneGeo.h:457
Float_t Z
Definition: plot.C:39
constexpr bool nonNegative(Value_t value) const
Returns whether value is larger than or equal() to zero.
Float_t e
Definition: plot.C:34
double geo::PlaneGeo::WirePitch ( ) const
inline
geo::WirePtr geo::PlaneGeo::WirePtr ( unsigned int  iwire) const
inline

Returns the wire number iwire from this plane.

Parameters
iwirethe number of local wire
Returns
a constant pointer to the wire, or nullptr if it does not exist

Definition at line 324 of file PlaneGeo.h.

Referenced by Wire(), and geo::GeometryCore::WirePtr().

325  { return HasWire(iwire)? &(fWire[iwire]): nullptr; }
WireCollection_t fWire
List of wires in this plane.
Definition: PlaneGeo.h:1482
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:279
geo::WirePtr geo::PlaneGeo::WirePtr ( WireID const &  wireid) const
inline

Returns the wire in wireid from this plane.

Parameters
wireidfull wire ID
Returns
a constant pointer to the wire, or nullptr if it does not exist

The cryostat, TPC and plane numbers in wireid are ignored, as it is ignored whether wireid is invalid.

Definition at line 336 of file PlaneGeo.h.

References geo::WireID::Wire.

337  { return WirePtr(wireid.Wire); }
geo::WirePtr WirePtr(unsigned int iwire) const
Returns the wire number iwire from this plane.
Definition: PlaneGeo.h:324
void geo::PlaneGeo::WorldToLocal ( const double *  world,
double *  plane 
) const
inline

Transform point from world frame to local plane frame.

Definition at line 1367 of file PlaneGeo.h.

1368  { fTrans.WorldToLocal(world, plane); }
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
TVector3 geo::PlaneGeo::WorldToLocal ( TVector3 const &  world) const
inline

Transform point from world frame to local plane frame.

Definition at line 1371 of file PlaneGeo.h.

1372  { return fTrans.WorldToLocal<TVector3>(world); }
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
void geo::PlaneGeo::WorldToLocalVect ( const double *  world,
double *  plane 
) const
inline

Transform direction vector from world to local.

Definition at line 1379 of file PlaneGeo.h.

1380  { fTrans.WorldToLocalVect(world, plane); }
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.
TVector3 geo::PlaneGeo::WorldToLocalVect ( TVector3 const &  world) const
inline

Transform direction vector from world to local.

Definition at line 1383 of file PlaneGeo.h.

1384  { return fTrans.WorldToLocalVect<TVector3>(world); }
LocalTransformation_t fTrans
Plane to world transform.
Definition: PlaneGeo.h:1478
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.

Friends And Related Function Documentation

friend struct details::ActiveAreaCalculator
friend

Definition at line 1504 of file PlaneGeo.h.

Member Data Documentation

Rect geo::PlaneGeo::fActiveArea
private

Area covered by wires in frame base.

Definition at line 1498 of file PlaneGeo.h.

Referenced by DeltaFromActivePlane(), and UpdateActiveArea().

geo::Point_t geo::PlaneGeo::fCenter
private

Center of the plane, lying on the wire plane.

Definition at line 1500 of file PlaneGeo.h.

Referenced by UpdateWirePlaneCenter().

double geo::PlaneGeo::fCosPhiZ
private

Cosine of $ \phi_{z} $.

Definition at line 1485 of file PlaneGeo.h.

Referenced by UpdatePhiZ().

WidthDepthDecomposer_t geo::PlaneGeo::fDecompFrame
private

Decomposition on frame coordinates; the main direction is a "width", the secondary one is just orthogonal to it ("depth"). Normal can differ in sign from the plane one.

Definition at line 1495 of file PlaneGeo.h.

Referenced by DetectGeometryDirections(), UpdateWidthDepthDir(), and UpdateWirePlaneCenter().

WireDecomposer_t geo::PlaneGeo::fDecompWire
private

Decomposition on wire coordinates; the main direction is along the wire, the secondary one is the one measured by the wire, the normal matches the plane's normal.

Definition at line 1491 of file PlaneGeo.h.

Referenced by InterWireDistance(), UpdateDecompWireOrigin(), UpdateIncreasingWireDir(), and UpdateWireDir().

RectSpecs geo::PlaneGeo::fFrameSize
private

Size of the frame of the plane.

Definition at line 1496 of file PlaneGeo.h.

Referenced by DeltaFromPlane(), DetectGeometryDirections(), and MoveProjectionToPlane().

geo::PlaneID geo::PlaneGeo::fID
private

ID of this plane.

Definition at line 1502 of file PlaneGeo.h.

Referenced by UpdateAfterSorting().

geo::Vector_t geo::PlaneGeo::fNormal
private

Normal to the plane, inward in TPC.

Definition at line 1487 of file PlaneGeo.h.

Referenced by UpdatePlaneNormal().

Orient_t geo::PlaneGeo::fOrientation
private

Is the plane vertical or horizontal?

Definition at line 1481 of file PlaneGeo.h.

Referenced by UpdateOrientation().

double geo::PlaneGeo::fSinPhiZ
private

Sine of $ \phi_{z} $.

Definition at line 1484 of file PlaneGeo.h.

Referenced by UpdatePhiZ().

LocalTransformation_t geo::PlaneGeo::fTrans
private

Plane to world transform.

Definition at line 1478 of file PlaneGeo.h.

View_t geo::PlaneGeo::fView
private

Does this plane measure U, V, or W?

Definition at line 1480 of file PlaneGeo.h.

TGeoVolume const* geo::PlaneGeo::fVolume
private

Plane volume description.

Definition at line 1479 of file PlaneGeo.h.

Referenced by BoundingBox(), DetectGeometryDirections(), and PlaneGeo().

WireCollection_t geo::PlaneGeo::fWire
private

List of wires in this plane.

Definition at line 1482 of file PlaneGeo.h.

Referenced by SortWires(), UpdateAfterSorting(), UpdateOrientation(), and UpdateWirePitchSlow().

double geo::PlaneGeo::fWirePitch
private

Pitch of wires in this plane.

Definition at line 1483 of file PlaneGeo.h.

Referenced by InterWireDistance(), InterWireProjectedDistance(), UpdateWirePitch(), and UpdateWirePitchSlow().

constexpr unsigned int geo::PlaneGeo::MaxVerbosity = 6
static

Maximum value for print verbosity.

Definition at line 802 of file PlaneGeo.h.

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


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