LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo Namespace Reference

ROOT libraries. More...

Namespaces

 details
 
 fhicl
 FHiCL objects representing geometry classes as configuration parameters.
 
 part
 Partition-related utilities.
 
 vect
 Utilities to manipulate geometry vectors.The utilities include generic vector interface facilities allowing to use different vector types via templates.
 

Classes

class  AffinePlaneBase
 
class  AuxDetGeo
 
class  AuxDetGeometry
 The geometry of one entire detector, as served by art. More...
 
class  AuxDetGeometryCore
 Description of physical geometry of one set of auxiliary detectors. More...
 
class  AuxDetGeoObjectSorter
 
class  AuxDetGeoObjectSorterStandard
 
class  AuxDetInitializer
 
class  AuxDetReadoutGeom
 
struct  AuxDetReadoutInitializers
 
class  AuxDetSensitiveGeo
 
class  BoxBoundedGeo
 A base class aware of world box coordinatesAn object describing a simple shape can inherit from this one to gain access to a common boundary checking interface. More...
 
struct  CollectNodesByName
 
struct  CollectPathsByName
 
class  CryostatGeo
 Geometry information for a single cryostat. More...
 
struct  CryostatID
 The data type to uniquely identify a cryostat. More...
 
struct  DecomposedVector
 
class  Decomposer
 Class with methods to decompose and compose back vectors. More...
 
struct  DriftAxis
 
class  DumpChannelMap
 Prints on screen the current channel-wire and optical detector maps. More...
 
class  DumpGeometry
 Describes on screen the current geometry. More...
 
class  GeoIDdataContainer
 Container with one element per geometry TPC. More...
 
class  GeoIDmapper
 Class managing the mapping between geometry/readout ID and flat index. More...
 
class  Geometry
 The geometry of one entire detector, as served by art. More...
 
class  GeometryBuilder
 Manages the extraction of LArSoft geometry information from ROOT. More...
 
class  GeometryBuilderStandard
 Extracts of LArSoft geometry information from ROOT. More...
 
class  GeometryConfigurationWriter
 Writes geometry configuration information into art runs. More...
 
class  GeometryCore
 Description of the physical geometry of one entire detector. More...
 
class  GeometryExtractor
 Object for extracting geometry objects from the GDML file. More...
 
class  GeoNodePath
 Representation of a node and its ancestry. More...
 
struct  GeoNodePathEntry
 
class  GeoObjectSorter
 
class  GeoObjectSorterStandard
 
struct  IntersectionPointAndOffsets
 Data structure for return values of LineClosestPointAndOffsets(). More...
 
class  InvalidWireError
 Exception thrown on invalid wire number. More...
 
class  Iterable
 
class  LocalTransformation
 Class to transform between world and local coordinates. More...
 
class  LocalTransformationGeo
 Class to transform between world and local coordinates. More...
 
struct  NodeNameMatcherClass
 
class  OpDetGeo
 
struct  OpDetID
 The data type to uniquely identify a optical detector. More...
 
struct  OpticalLocalCoordinateSystemTag
 The tag defining the optical detector local reference frame. More...
 
class  PlaneBase
 A base for a plane in space. More...
 
class  PlaneDataContainer
 Container with one element per geometry wire plane. More...
 
class  PlaneDecomposer
 Class with methods for projection of vectors on a plane. More...
 
class  PlaneGeo
 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...
 
struct  PlaneID
 The data type to uniquely identify a Plane. More...
 
class  PlaneIDmapper
 Mapping for sensitive plane identifiers. More...
 
class  ROOTGeometryNavigator
 Executes an operation on all the nodes of the ROOT geometry. More...
 
class  ROOTGeoNodeForwardIterator
 Iterator to navigate through all the nodes. More...
 
class  StandardWireReadout
 Simple implementation of channel mapping. More...
 
class  TPCDataContainer
 Container with one element per geometry TPC. More...
 
class  TPCGeo
 Geometry information for a single TPC. More...
 
struct  TPCID
 The data type to uniquely identify a TPC. More...
 
class  TPCIDmapper
 Mapping for TPC identifiers. More...
 
struct  void_tag
 
class  WireGeo
 Geometry description of a TPC wireThe wire is a single straight segment on a wire plane. Different wires may be connected to the same readout channel. That is of no relevance for the geometry description. More...
 
struct  WireID
 
struct  WireIDIntersection
 
class  WireReadout
 Interface to a service with a detector-specific, wire-readout geometry. More...
 
class  WireReadoutDumper
 Algorithm dumping the full detector geometry down to wires. More...
 
class  WireReadoutGeom
 Interface for a class providing readout channel mapping to geometry. More...
 
class  WireReadoutGeomBuilderStandard
 Extracts of LArSoft geometry information from ROOT. More...
 
class  WireReadoutGeometryBuilder
 Manages the extraction of LArSoft geometry information from ROOT. More...
 
class  WireReadoutSetupTool
 Interface for a tool creating a channel mapping object. More...
 
class  WireReadoutSorter
 
class  WireReadoutSorterStandard
 
class  WireReadoutStandardGeom
 

Typedefs

using chanAndSV = std::pair< std::uint32_t, std::size_t >
 
template<typename T >
using Compare = std::function< bool(T const &, T const &)>
 
using GeoNodeIterator_t = std::vector< GeoNodePathEntry >::const_iterator
 
using WirePtr = WireGeo const *
 
using TransformationMatrix = ROOT::Math::Transform3D
 Type of transformation matrix used in geometry. More...
 
Optical detector vector types.

Special tags for a generic "optical detector local coordinate system" are defined here, together with data types using them.

While the world coordinate system makes sense to be defined in this way, a local system depends by definition by the object it is anchored to: while two world coordinate vectors are always compatible, two local coordinate vectors are compatible only if they belong to the same local object. The purpose of these definitions is to declare the incompatibility between world coordinate vectors and the ones local to optical detectors, without attempting to claim that two of the latter are necessarily compatible.

template<typename T >
using OpticalVector3DBase_t = GenVector3DBase_t< T, OpticalLocalCoordinateSystemTag >
 
template<typename T >
using OpticalPoint3DBase_t = GenPoint3DBase_t< T, OpticalLocalCoordinateSystemTag >
 
using OpticalVector_t = OpticalVector3DBase_t< double >
 
using OpticalPoint_t = OpticalPoint3DBase_t< double >
 Type of optical 3D point with representation in double precision. More...
 
Generic vector types.
template<typename T , typename C = ROOT::Math::GlobalCoordinateSystemTag>
using GenVector3DBase_t = ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< T >, C >
 
template<typename T , typename C = ROOT::Math::GlobalCoordinateSystemTag>
using GenPoint3DBase_t = ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< T >, C >
 
template<typename C >
using Vector3DBase_t = GenVector3DBase_t< double, C >
 
template<typename C >
using Point3DBase_t = GenPoint3DBase_t< double, C >
 Type of 3D point with representation in double precision. More...
 

Functions

void ProjectToBoxEdge (double const xyz[], double const dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi, double xyzout[])
 
double ClosestApproach (double const point[], double const intercept[], double const slopes[], double closest[])
 
bool CrossesBoundary (double x0[], double gradient[], double x_lo, double x_hi, double y_lo, double y_hi, double z_lo, double z_hi, double point[])
 
bool IntersectLines (double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double &x, double &y)
 Computes the intersection between two lines on a plane. More...
 
bool IntersectSegments (double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double &x, double &y)
 Computes the intersection between two segments on a plane. More...
 
template<typename Point , typename Vector >
IntersectionPointAndOffsets< Point > LineClosestPointAndOffsets (Point const &startA, Vector const &dirA, Point const &startB, Vector const &dirB)
 Returns the point of a line that is closest to a second line. More...
 
template<typename Point , typename Vector >
Point LineClosestPoint (Point const &startA, Vector const &dirA, Point const &startB, Vector const &dirB)
 Returns the point of a line that is closest to a second line. More...
 
template<typename Point , typename UnitVector >
IntersectionPointAndOffsets< Point > LineClosestPointAndOffsetsWithUnitVectors (Point const &startA, UnitVector const &dirA, Point const &startB, UnitVector const &dirB)
 Returns the point of a line that is closest to a second line. More...
 
template<typename Point , typename UnitVector >
Point LineClosestPointWithUnitVectors (Point const &startA, UnitVector const &dirA, Point const &startB, UnitVector const &dirB)
 Returns the point of a line that is closest to a second line. More...
 
template<typename StoredMatrix , typename ITER >
static StoredMatrix transformationFromPath (ITER begin, ITER end)
 Builds a matrix to go from local to world coordinates in one step. More...
 
template<typename StoredMatrix >
static StoredMatrix transformationFromPath (std::vector< GeoNodePathEntry > const &path, size_t depth)
 Builds a matrix to go from local to world coordinates in one step. More...
 
template<typename Dest , typename Src >
decltype(auto) convertTransformationMatrix (Src &&trans)
 Converts a transformation matrix into Dest format. More...
 
template<typename Trans >
decltype(auto) makeTransformationMatrix (Trans &&trans)
 Converts a transformation matrix into a geo::TransformationMatrix. More...
 
Point_t WiresIntersection (WireGeo const &wireA, WireGeo const &wireB)
 Returns the point of wireA that is closest to wireB. More...
 
IntersectionPointAndOffsets< Point_tWiresIntersectionAndOffsets (WireGeo const &wireA, WireGeo const &wireB)
 Returns the point of wireA that is closest to wireB. More...
 
std::ostream & operator<< (std::ostream &out, WireReadoutDumper::StreamAdapter const &dumpAdapter)
 Helper for geo::WireReadoutDumper::toStream(). More...
 
std::string SignalTypeName (geo::SigType_t sigType)
 Returns the name of the specified signal type. More...
 
Geometry element IDs
std::ostream & operator<< (std::ostream &out, CryostatID const &cid)
 Generic output of CryostatID to stream. More...
 
std::ostream & operator<< (std::ostream &out, OpDetID const &oid)
 Generic output of OpDetID to stream. More...
 
std::ostream & operator<< (std::ostream &out, TPCID const &tid)
 Generic output of TPCID to stream. More...
 
std::ostream & operator<< (std::ostream &out, PlaneID const &pid)
 Generic output of PlaneID to stream. More...
 
std::ostream & operator<< (std::ostream &out, WireID const &wid)
 Generic output of WireID to stream. More...
 

Geometry enumerators

enum  Coordinate { Coordinate::X, Coordinate::Y, Coordinate::Z }
 Enumerate the possible plane projections. More...
 
enum  _plane_proj {
  kU, kV, kW, kZ = kW,
  kY, kX, k3D, kUnknown
}
 Enumerate the possible plane projections. More...
 
enum  _plane_orient { kHorizontal, kVertical }
 Enumerate the possible plane projections. More...
 
enum  _plane_sigtype { kInduction, kCollection, kMysteryType }
 Enumerate the possible plane projections. More...
 
enum  DriftSign { DriftSign::Unknown, DriftSign::Positive, DriftSign::Negative }
 Drift sign: positive or negative. More...
 
typedef enum geo::_plane_proj View_t
 Enumerate the possible plane projections. More...
 
typedef enum geo::_plane_orient Orient_t
 Enumerate the possible plane projections. More...
 
typedef enum geo::_plane_sigtype SigType_t
 Enumerate the possible plane projections. More...
 
std::ostream & operator<< (std::ostream &os, Coordinate const coordinate)
 Enumerate the possible plane projections. More...
 
std::ostream & operator<< (std::ostream &os, DriftSign const sign)
 Enumerate the possible plane projections. More...
 
bool operator== (DriftAxis const a, DriftAxis const b)
 Enumerate the possible plane projections. More...
 
bool operator!= (DriftAxis const a, DriftAxis const b)
 Enumerate the possible plane projections. More...
 
std::ostream & operator<< (std::ostream &os, DriftAxis const driftAxis)
 Enumerate the possible plane projections. More...
 
constexpr int to_int (Coordinate const coord) noexcept
 Enumerate the possible plane projections. More...
 
constexpr int to_int (DriftSign const sign)
 Enumerate the possible plane projections. More...
 

ID comparison operators

The result of comparison with invalid IDs is undefined.

template<typename BaseID , typename GeoID >
static constexpr bool is_base_of_strict
 Comparison: the IDs point to the same cryostat (validity is ignored) More...
 
constexpr bool operator== (CryostatID const &a, CryostatID const &b)
 Comparison: the IDs point to the same cryostat (validity is ignored) More...
 
constexpr bool operator!= (CryostatID const &a, CryostatID const &b)
 Comparison: the IDs point to different cryostats (validity is ignored) More...
 
constexpr bool operator< (CryostatID const &a, CryostatID const &b)
 Order cryostats with increasing ID. More...
 
template<typename GeoID >
constexpr std::enable_if_t< is_base_of_strict< CryostatID, GeoID >, bool > operator== (GeoID const &a, GeoID const &b)
 Comparison: the IDs point to same optical detector (validity is ignored) More...
 
template<typename GeoID >
constexpr std::enable_if_t< is_base_of_strict< CryostatID, GeoID >, bool > operator!= (GeoID const &a, GeoID const &b)
 Comparison: IDs point to different optical detectors (validity is ignored) More...
 
template<typename GeoID >
constexpr std::enable_if_t< is_base_of_strict< CryostatID, GeoID >, bool > operator< (GeoID const &a, GeoID const &b)
 Order OpDetID in increasing Cryo, then OpDet. More...
 

Vector types for the standard LArSoft geometry.

LArSoft geometry provides two main types of vectors in 3D space:

  1. geo::Point_t to describe an absolute position in global coordinates
  2. geo::Vector_t to describe a displacement or direction (or momentum!)

Both vectors are supposed to represent:

  • centimeters in double precision when used on the real geometry space
  • in the global coordinate system, which is represented by the tag geo::GlobalCoords.

These types constitute the basic objects the geometry works with.

All interfaces should support them.

Note
As this requires some transition, please report any interface missing support for these types by opening a "necessary maintenance" request in the LArSoft issue tracker at https://cdcvs.fnal.gov/redmine/projects/larsoft/issues . Even if there are plenty.

The same type of vectors, but in a different coordinate system representation, can be obtained by using geo::Point3DBase_t template:

(geo::Vector3DBase_t is also available). If a single precision vector is desired, the most general geo::GenPoint3DBase_t and geo::GenVector3DBase_t are also available:

using Length_t = double
 Type used for coordinates and distances. They are measured in centimeters. More...
 
using GlobalCoords = ROOT::Math::GlobalCoordinateSystemTag
 Tag for vectors in the global coordinate system. More...
 
using Vector_t = ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag >
 Type for representation of momenta in 3D space. More...
 
using Point_t = ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag >
 Type for representation of position in physical 3D space. More...
 
template<typename CoordSystemTag >
using VectorIn_t = Vector3DBase_t< CoordSystemTag >
 Type for representation of momenta in 3D space. More...
 
template<typename CoordSystemTag >
using PointIn_t = Point3DBase_t< CoordSystemTag >
 Type for representation of positions in 3D space. More...
 
using Rotation_t = ROOT::Math::Rotation3D
 Type for representation of space rotations. More...
 
template<typename Vector = Vector_t>
constexpr Vector Xaxis ()
 Returns a x axis vector of the specified type. More...
 
template<typename Vector = Vector_t>
constexpr Vector Yaxis ()
 Returns a y axis vector of the specified type. More...
 
template<typename Vector = Vector_t>
constexpr Vector Zaxis ()
 Returns a z axis vector of the specified type. More...
 
template<typename Point = Point_t>
constexpr Point origin ()
 Returns a origin position with a point of the specified type. More...
 

Detailed Description

ROOT libraries.

LArSoft geometry interface.

Namespace collecting geometry-related classes utilities.

Detector geometry definition and interface.

Title: SimPhotonCounterALG Class Author: Wes Ketchum (wketc.nosp@m.hum@.nosp@m.lanl..nosp@m.gov)

Description: Alg class that counts up sim photons, leading towards comparisons with flashes and flash hypotheses.

See also
geo::GeometryCore

The geo namespace includes all LArSoft data types, classes and functions related to detector geometry.

For more guidance, dee the LArSoft geometry module.

TrackLineFitAlg class

Bruce Baller, balle.nosp@m.r@fn.nosp@m.al.go.nosp@m.v

Algorithm for fitting a 3D line given a number of points in 3 wire planes

Typedef Documentation

using geo::chanAndSV = typedef std::pair<std::uint32_t, std::size_t>

Definition at line 22 of file AuxDetReadoutGeom.h.

template<typename T >
using geo::Compare = typedef std::function<bool(T const&, T const&)>

Definition at line 22 of file fwd.h.

template<typename T , typename C = ROOT::Math::GlobalCoordinateSystemTag>
using geo::GenPoint3DBase_t = typedef ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<T>, C>

Type of 3D point.

Template Parameters
Tdata type for coordinate representation
Ccoordinate system tag (default: global coordinates)

Definition at line 78 of file geo_vectors.h.

template<typename T , typename C = ROOT::Math::GlobalCoordinateSystemTag>
using geo::GenVector3DBase_t = typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<T>, C>

Type of 3D displacement vector.

Template Parameters
Tdata type for coordinate representation
Ccoordinate system tag (default: global coordinates)

Definition at line 72 of file geo_vectors.h.

Definition at line 35 of file LocalTransformation.h.

using geo::GlobalCoords = typedef ROOT::Math::GlobalCoordinateSystemTag

Tag for vectors in the global coordinate system.

A vector tagged as "global" is expected to be represented in the global (or "world") coordinate system.

That system is the one the detector geometry is described in, and it is defined by the GDML detector description. The linear coordinates are described in centimeters.

Definition at line 146 of file geo_vectors.h.

using geo::Length_t = typedef double

Type used for coordinates and distances. They are measured in centimeters.

Definition at line 133 of file geo_vectors.h.

Type of optical local 3D point.

Template Parameters
Tdata type for coordinate representation

Definition at line 51 of file geo_optical_vectors.h.

using geo::OpticalPoint_t = typedef OpticalPoint3DBase_t<double>

Type of optical 3D point with representation in double precision.

Definition at line 58 of file geo_optical_vectors.h.

Type of optical local 3D displacement vector.

Template Parameters
Tdata type for coordinate representation

Definition at line 46 of file geo_optical_vectors.h.

Type of optical 3D displacement vector with representation in double precision.

Definition at line 55 of file geo_optical_vectors.h.

Enumerate the possible plane projections.

template<typename C >
using geo::Point3DBase_t = typedef GenPoint3DBase_t<double, C>

Type of 3D point with representation in double precision.

Template Parameters
Ccoordinate system tag

Definition at line 88 of file geo_vectors.h.

using geo::Point_t = typedef ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<double>, ROOT::Math::GlobalCoordinateSystemTag>

Type for representation of position in physical 3D space.

A point represents a position in 3D space. As such, it makes no sense to add points, and the difference between two points is not a point any more (it is, in fact, a geo::Vector_t). Scaling and norm of a point also have no meaning.

A vector can be added to a point, resulting in another point.

Note that middlePoint() function and MiddlePointAccumulator class are provided to facilitate the computation of a middle point using any type of vector and in particular geo::Point_t.

Definition at line 180 of file geo_vectors.h.

template<typename CoordSystemTag >
using geo::PointIn_t = typedef Point3DBase_t<CoordSystemTag>

Type for representation of positions in 3D space.

Template Parameters
CoordSystemTagthe coordinate system tag for this point

This point type is equivalent to geo::Point_t but it's tagged as from a different coordinate system.

Definition at line 200 of file geo_vectors.h.

using geo::Rotation_t = typedef ROOT::Math::Rotation3D

Type for representation of space rotations.

Definition at line 203 of file geo_vectors.h.

Enumerate the possible plane projections.

using geo::TransformationMatrix = typedef ROOT::Math::Transform3D

Type of transformation matrix used in geometry.

This type is used for storing the transformation matrices of the various geometry description objects (e.g. geo::WireGeo, geo::OpDetGeo, ...).

Definition at line 27 of file TransformationMatrix.h.

template<typename C >
using geo::Vector3DBase_t = typedef GenVector3DBase_t<double, C>

Type of 3D displacement vector with representation in double precision.

Template Parameters
Ccoordinate system tag

Definition at line 83 of file geo_vectors.h.

using geo::Vector_t = typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>, ROOT::Math::GlobalCoordinateSystemTag>

Type for representation of momenta in 3D space.

A vector represents a direction and intensity, or a displacement respect to an unspecified starting point. Vectors can be added or subtracted, resulting in still a vector. Their modulus can also be scaled.

Definition at line 160 of file geo_vectors.h.

template<typename CoordSystemTag >
using geo::VectorIn_t = typedef Vector3DBase_t<CoordSystemTag>

Type for representation of momenta in 3D space.

Template Parameters
CoordSystemTagthe coordinate system tag for this vector

This vector type is equivalent to geo::Vector_t but it's tagged as from a different coordinate system.

Definition at line 190 of file geo_vectors.h.

Enumerate the possible plane projections.

using geo::WirePtr = typedef WireGeo const*

Definition at line 40 of file PlaneGeo.h.

Enumeration Type Documentation

Enumerate the possible plane projections.

Enumerator
kHorizontal 

Planes that are in the horizontal plane.

kVertical 

Planes that are in the vertical plane (e.g. ArgoNeuT).

Definition at line 141 of file geo_types.h.

141  {
142  kHorizontal,
143  kVertical
144  } Orient_t;
enum geo::_plane_orient Orient_t
Enumerate the possible plane projections.
Planes that are in the horizontal plane.
Definition: geo_types.h:142
Planes that are in the vertical plane (e.g. ArgoNeuT).
Definition: geo_types.h:143

Enumerate the possible plane projections.

Enumerator
kU 

Planes which measure U.

kV 

Planes which measure V.

kW 

Planes which measure W (third view for Bo, MicroBooNE, etc).

kZ 

Planes which measure Z direction.

kY 

Planes which measure Y direction.

kX 

Planes which measure X direction.

k3D 

3-dimensional objects, potentially hits, clusters, prongs, etc.

kUnknown 

Unknown view.

Definition at line 130 of file geo_types.h.

130  {
131  kU,
132  kV,
133  kW,
134  kZ = kW,
135  kY,
136  kX,
137  k3D,
138  kUnknown
139  } View_t;
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:132
Unknown view.
Definition: geo_types.h:138
Planes which measure X direction.
Definition: geo_types.h:136
Planes which measure Z direction.
Definition: geo_types.h:134
Planes which measure Y direction.
Definition: geo_types.h:135
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:137
Planes which measure U.
Definition: geo_types.h:131
Planes which measure W (third view for Bo, MicroBooNE, etc).
Definition: geo_types.h:133

Enumerate the possible plane projections.

Enumerator
kInduction 

Signal from induction planes.

kCollection 

Signal from collection planes.

kMysteryType 

Who knows?

Definition at line 146 of file geo_types.h.

146  {
147  kInduction,
148  kCollection,
149  kMysteryType
150  } SigType_t;
Who knows?
Definition: geo_types.h:149
Signal from induction planes.
Definition: geo_types.h:147
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Signal from collection planes.
Definition: geo_types.h:148
enum geo::Coordinate
strong

Enumerate the possible plane projections.

Enumerator

Definition at line 122 of file geo_types.h.

122 { X, Y, Z };
Float_t Y
Definition: plot.C:37
Float_t Z
Definition: plot.C:37
Float_t X
Definition: plot.C:37
enum geo::DriftSign
strong

Drift sign: positive or negative.

Enumerator
Unknown 

Drift direction is unknown.

Positive 

Drift towards positive values.

Negative 

Drift towards negative values.

Definition at line 155 of file geo_types.h.

155  {
156  Unknown,
157  Positive,
158  Negative
159  };
Drift towards negative values.
Drift towards positive values.

Function Documentation

double geo::ClosestApproach ( double const  point[],
double const  intercept[],
double const  slopes[],
double  closest[] 
)
inline

Find the distance of closest approach between point and line

Parameters
point- xyz coordinates of point
intercept- xyz coodinates of point on line
slopes- unit vector direction (need not be normalized)
closest- on output, point on line that is closest
Returns
distance from point to line

Definition at line 112 of file geo.h.

116 {
117  double s = (slopes[0] * (point[0] - intercept[0]) + slopes[1] * (point[1] - intercept[1]) +
118  slopes[2] * (point[2] - intercept[2]));
119  double sd = (slopes[0] * slopes[0] + slopes[1] * slopes[1] + slopes[2] * slopes[2]);
120  if (sd > 0.0) {
121  s /= sd;
122  closest[0] = intercept[0] + s * slopes[0];
123  closest[1] = intercept[1] + s * slopes[1];
124  closest[2] = intercept[2] + s * slopes[2];
125  }
126  else {
127  // How to handle this zero gracefully? Assume that the intercept
128  // is a particle vertex and "slopes" are momenta. In that case,
129  // the particle goes nowhere and the closest approach is the
130  // distance from the intercept to point
131  closest[0] = intercept[0];
132  closest[1] = intercept[1];
133  closest[2] = intercept[2];
134  }
135  return std::sqrt(pow((point[0] - closest[0]), 2) + pow((point[1] - closest[1]), 2) +
136  pow((point[2] - closest[2]), 2));
137 }
template<typename Dest , typename Src >
decltype(auto) geo::convertTransformationMatrix ( Src &&  trans)

Converts a transformation matrix into Dest format.

Definition at line 321 of file LocalTransformation.h.

322  {
323  return details::TransformationMatrixConverter<std::decay_t<Dest>, std::decay_t<Src>>::convert(
324  std::forward<Src>(trans));
325  }
bool geo::CrossesBoundary ( double  x0[],
double  gradient[],
double  x_lo,
double  x_hi,
double  y_lo,
double  y_hi,
double  z_lo,
double  z_hi,
double  point[] 
)
inline

Determine whether or not track intersects box of volume: ( x_hi - x_lo ) x ( y_hi - y_lo ) x ( z_hi - z_lo )

Parameters
x_hi- x box coordinates in space w.r.t. the origin
x_lo- x box coordinates in space w.r.t. the origin
y_hi- y box coordinates in space w.r.t. the origin
y_lo- y box coordinates in space w.r.t. the origin
z_hi- z box coordinates in space w.r.t. the origin
z_lo- z box coordinates in space w.r.t. the origin
x0[]- initial position of the particle
gradient[]- initial gradient of particle position
point[](output) - position of the particle at intersection
See also
geo::BoxBoundedGeo::GetIntersection()

*** assumes particle's track is linear

Definition at line 157 of file geo.h.

References n.

166 {
167 
168  double distance[3]; // distance to plane
169 
170  // puts box coordinates into more useful vectors (for loop later)
171  double lo[3] = {x_lo, y_lo, z_lo};
172  double hi[3] = {x_hi, y_hi, z_hi};
173 
174  // puts box coordinates into more useful vector (for loop later)
175  double facecoord[6] = {lo[0], hi[0], lo[1], hi[1], lo[2], hi[2]};
176 
177  int intersect[6] = {0, 0, 0, 0, 0, 0}; // initialize intersection tally vector
178  int count = 0;
179  // iterates through spatial axes (0,1,2) = (x,y,z)
180  for (int i = 0; i < 3; i++) {
181  // try both planes with normal parallel to axis
182  for (int p = 0; p < 2; p++) {
183 
184  point[i] = facecoord[count]; // point on face
185  distance[i] = point[i] - x0[i]; // calculate x-coordinate of track distance
186 
187  double C_dg = distance[i] / gradient[i]; // calculate correlation b/w gradient and distance
188 
189  for (int m = 0; m < 3; m++) {
190  distance[m] = C_dg * gradient[m];
191  }
192  for (int n = 0; n < 3; n++) {
193  point[n] = x0[n] + distance[n];
194  }
195 
196  int j, k;
197  switch (i) {
198  case 0:
199  j = 1;
200  k = 2;
201  break;
202  case 1:
203  j = 2;
204  k = 0;
205  break;
206  case 2:
207  j = 0;
208  k = 1;
209  break;
210  default: throw std::logic_error("Big trouble");
211  } // switch
212 
213  // now want to check to see if the point is in the right plane
214  if (lo[j] < point[j] && point[j] < hi[j] && lo[k] < point[k] && point[k] < hi[k]) {
215 
216  // double length = std::sqrt( distance[0]*distance[0]
217  // + distance[1]*distance[1]
218  // + distance[2]*distance[2] );
219 
220  // direction of motion w.r.t. start point
221  int direction = distance[i] * gradient[i] /
222  std::sqrt((distance[i] * distance[i]) * (gradient[i] * gradient[i]));
223  bool directed = (direction + 1) / 2;
224 
225  // checks if particle passes through face
226  // and also checks to see whether it passes inward or outward
227  //if ( track_length > length && directed ) {
228  if (directed) {
229  int normal = pow(-1, count + 1);
230  int thru = normal * gradient[i] / std::sqrt(gradient[i] * gradient[i]);
231  intersect[count] = thru;
232  }
233  }
234  count++;
235  }
236  }
237 
238  // count faces it passes through,
239  // ... not necessary now, but maybe useful in the future
240  int passes = 0;
241  for (int face = 0; face < 6; ++face) {
242  passes += (intersect[face] * intersect[face]);
243  }
244 
245  if (passes == 0) { return 0; }
246  else {
247  return 1;
248  }
249 }
Char_t n[5]
bool geo::IntersectLines ( double  A_start_x,
double  A_start_y,
double  A_end_x,
double  A_end_y,
double  B_start_x,
double  B_start_y,
double  B_end_x,
double  B_end_y,
double &  x,
double &  y 
)

Computes the intersection between two lines on a plane.

Parameters
A_start_xx coordinate of one point of the first segment
A_start_yy coordinate of one point of the first segment
A_end_xx coordinate of another point of the first segment
A_end_yy coordinate of another point of the first segment
B_start_xx coordinate of one point of the second segment
B_start_yy coordinate of one point of the second segment
B_end_xx coordinate of another point of the second segment
B_end_yy coordinate of another point of the second segment
x_(output)_ variable to store the x coordinate of intersection
y_(output)_ variable to store the y coordinate of intersection
Returns
whether intersection exists

The order of the ends is not relevant. The return value is false if the two segments are parallel. In that case, x and y variables are not changed. Otherwise, they hold the intersection coordinate, even if the intersection point is beyond one or both the segments.

Definition at line 12 of file Intersections.cxx.

References e.

Referenced by IntersectSegments(), and geo::WireReadoutGeom::WireIDsIntersect().

22  {
23  // Equation from http://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
24  // T.Yang Nov, 2014
25  // Notation: x => coordinate orthogonal to the drift direction and to the beam direction
26  // y => direction orthogonal to the previous and to beam direction
27 
28  double const denom =
29  (A_start_x - A_end_x) * (B_start_y - B_end_y) - (A_start_y - A_end_y) * (B_start_x - B_end_x);
30 
31  constexpr lar::util::RealComparisons<double> coordIs{1e-8};
32  if (coordIs.zero(denom)) return false;
33 
34  double const A = (A_start_x * A_end_y - A_start_y * A_end_x) / denom;
35  double const B = (B_start_x * B_end_y - B_start_y * B_end_x) / denom;
36 
37  x = (B_start_x - B_end_x) * A - (A_start_x - A_end_x) * B;
38  y = (B_start_y - B_end_y) * A - (A_start_y - A_end_y) * B;
39 
40  return true;
41  }
Float_t x
Definition: compare.C:6
Provides simple real number checks.
Float_t y
Definition: compare.C:6
Float_t e
Definition: plot.C:35
bool geo::IntersectSegments ( double  A_start_x,
double  A_start_y,
double  A_end_x,
double  A_end_y,
double  B_start_x,
double  B_start_y,
double  B_end_x,
double  B_end_y,
double &  x,
double &  y 
)

Computes the intersection between two segments on a plane.

Parameters
A_start_xx coordinate of the start of the first segment
A_start_yy coordinate of the start of the first segment
A_end_xx coordinate of the end of the first segment
A_end_yy coordinate of the end of the first segment
B_start_xx coordinate of the start of the second segment
B_start_yy coordinate of the start of the second segment
B_end_xx coordinate of the end of the second segment
B_end_yy coordinate of the end of the second segment
x_(output)_ variable to store the x coordinate of intersection
y_(output)_ variable to store the y coordinate of intersection
Returns
whether intersection exists and is on both segments

The order of the ends is not relevant. The return value is false if the two segments are parallel, or if their intersection point is not on both the segments. If the segments are parallel, x and y variables are not changed. Otherwise, they hold the intersection coordinate, even if the intersection point is beyond one or both the segments.

Definition at line 44 of file Intersections.cxx.

References IntersectLines(), and lar::util::PointWithinSegments().

54  {
55  bool const bCross = IntersectLines(
56  A_start_x, A_start_y, A_end_x, A_end_y, B_start_x, B_start_y, B_end_x, B_end_y, x, y);
57 
58  if (bCross) {
59  mf::LogWarning("IntersectSegments") << "The segments are parallel!";
60  return false;
61  }
62 
64  A_start_x, A_start_y, A_end_x, A_end_y, B_start_x, B_start_y, B_end_x, B_end_y, x, y);
65  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
bool PointWithinSegments(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double x, double y)
Returns whether x and y are within both specified ranges (A and B).
bool IntersectLines(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double &x, double &y)
Computes the intersection between two lines on a plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
template<typename Point , typename Vector >
Point geo::LineClosestPoint ( Point const &  startA,
Vector const &  dirA,
Point const &  startB,
Vector const &  dirB 
)

Returns the point of a line that is closest to a second line.

Template Parameters
Pointa type describing a point
Vectora type describing a direction (displacement vector)
Parameters
refAa reference point on the first line
dirAthe direction of the first line
refBa reference point on the second line
dirBthe direction of the second line
Returns
the point of A closest to B
See also
LineClosestPointAndOffsets(), LineClosestPointWithUnitVectors()

The point of line A that is closest to line B is returned.

The two lines are assumed not to be parallel, and when this prerequisite is not met the behaviour is undefined.

Note
This formulation is valid for lines in a Euclidean space of any dimension; the minimized distance is the Euclidean one.

A separate function, LineClosestPointAndOffsets(), also returns the offset of the intersection from the two reference points.

Requirements

The following operations between points, vectors and scalars must be defined:

  • Vector operator- (Point, Point): the difference of two points always exists and it returns a Vector;
  • Point operator+ (Point, Vector): translation of a point by a displacement vector;
  • Vector operator* (Vector, double): vector scaling by a real factor;
  • double dot(Vector, Vector): scalar (inner) product of two vectors.

Referenced by geo::IntersectionPointAndOffsets< Point >::operator std::tuple< Point &, double &, double & >().

template<typename Point , typename Vector >
IntersectionPointAndOffsets<Point> geo::LineClosestPointAndOffsets ( Point const &  startA,
Vector const &  dirA,
Point const &  startB,
Vector const &  dirB 
)

Returns the point of a line that is closest to a second line.

Template Parameters
Pointa type describing a point
Vectora type describing a direction (displacement vector)
Parameters
refAa reference point on the first line
dirAthe direction of the first line
refBa reference point on the second line
dirBthe direction of the second line
Returns
a data structure with three fields: point: the point of A closest to B, offset1: its offset on A in units of dirA, offset2: its offset on B in units of dirB
See also
LineClosestPointWithUnitVectors()
LineClosestPointAndOffsets()

The point of line A that is closest to line B is returned.

This function is equivalent to LineClosestPoint(), but it returns in addition the offsets of the intersection point from the reference points of the two lines, in the direction specified by dirA/dirB.

The return value is a data structure of type geo::IntersectionPointAndOffsets, which is most easily unpacked immediately:

auto [ point, offsetA, offsetB ] = geo::LineClosestPointAndOffsets(
geo::Point_t{ 2, 0, 1 }, geo::Vector_t{ 0.0, 0.5, 0.0 },
geo::Point_t{ 0, 1, 0 }, geo::Vector_t{ 0.866, 0.0, 0.0 }
);

will set point to geo::Point{ 2, 1, 1 }, offsetA to 2 and offsetB to 2.309.... To reassign the variables after they have been defined, though, a temporary structure is needed:

auto const xsectAndOfs = geo::LineClosestPointAndOffsets(
geo::Point_t{ 0, 1, 0 }, geo::Vector_t{ 0.866, 0.0, 0.0 },
geo::Point_t{ 2, 0, 1 }, geo::Vector_t{ 0.0, 0.5, 0.0 }
);
point = xsectAndOfs.point;
offsetA = xsectAndOfs.offset1;
offsetB = xsectAndOfs.offset2;

(point to geo::Point{ 2, 1, 0 }, offsetA to 2.039... and offsetB to 2, because the intersection point is always on the first line).

Referenced by geo::IntersectionPointAndOffsets< Point >::operator std::tuple< Point &, double &, double & >().

template<typename Point , typename UnitVector >
IntersectionPointAndOffsets<Point> geo::LineClosestPointAndOffsetsWithUnitVectors ( Point const &  startA,
UnitVector const &  dirA,
Point const &  startB,
UnitVector const &  dirB 
)

Returns the point of a line that is closest to a second line.

Template Parameters
Pointa type describing a point
UnitVectora type describing a direction (unit vector)
Parameters
refAa reference point on the first line
dirAthe direction of the first line (unity-normed)
refBa reference point on the second line
dirBthe direction of the second line (unity-normed)
Returns
a data structure with three fields: point: the point of A closest to B, offset1: its offset on A in units of dirA (i.e. unity), offset2: its offset on B in units of dirB (i.e. unity)
See also
LineClosestPointWithUnitVectors()
LineClosestPointAndOffsets()

The point of line A that is closest to line B is returned.

The return value is a data structure of type geo::IntersectionPointAndOffsets, which is most easily unpacked immediately:

auto [ point, offsetA, offsetB ] = geo::LineClosestPointAndOffsetsWithUnitVectors(
geo::Point_t{ 2, 0, 1 }, geo::Vector_t{ 0, 1, 0 },
geo::Point_t{ 0, 1, 0 }, geo::Vector_t{ 1, 0, 0 }
);

will set point to geo::Point{ 2, 1, 1 }, offsetA to 1 and offsetB to 2. To reassign the variables after they have been defined, instead:

geo::Point_t{ 0, 1, 0 }, geo::Vector_t{ 1, 0, 0 },
geo::Point_t{ 2, 0, 1 }, geo::Vector_t{ 0, 1, 0 }
);
point = xsectAndOfs.point;
offsetA = xsectAndOfs.offset1;
offsetB = xsectAndOfs.offset2;

(point to geo::Point{ 2, 1, 0 }, offsetA to 2 and offsetB to 1, because the intersection point is always on the first line).

Referenced by geo::IntersectionPointAndOffsets< Point >::operator std::tuple< Point &, double &, double & >(), and WiresIntersectionAndOffsets().

template<typename Point , typename UnitVector >
Point geo::LineClosestPointWithUnitVectors ( Point const &  startA,
UnitVector const &  dirA,
Point const &  startB,
UnitVector const &  dirB 
)

Returns the point of a line that is closest to a second line.

Template Parameters
Pointa type describing a point
UnitVectora type describing a direction (unit vector)
Parameters
refAa reference point on the first line
dirAthe direction of the first line (unity-normed)
refBa reference point on the second line
dirBthe direction of the second line (unity-normed)
Returns
the point of A closest to B
See also
LineClosestPointAndOffsetsWithUnitVectors(), LineClosestPoint()

The point of line A that is closest to line B is returned.

The two lines are assumed not to be parallel, and when this prerequisite is not met the behaviour is undefined.

The two directions are required to have norm 1. While formally if this prerequisite is not met the result is undefined, the result will be still mostly correct if their norm departs from unity only by a rounding error. The more the vectors deviate from that condition, the larger the error in the result.

Note
This formulation is valid for lines in a Euclidean space of any dimension; the minimized distance is the Euclidean one.

A separate function, LineClosestPointAndOffsetsWithUnitVectors(), also returne the offset of the intersection from the two reference points.

Requirements

The following operations between points, vectors and scalars must be defined:

  • Vector operator* (UnitVector, double): scaling of a unit vector by a real factor to produce a non-unit vector;
  • Vector operator- (Point, Point): the difference of two points always exists and it returns a Vector;
  • Point operator+ (Point, Vector): translation of a point by a displacement vector;
  • double dot(Vector, UnitVector), double dot(UnitVector, UnitVector): scalar (inner) product of one unit vector and a vector, or two unit vectors.

Referenced by geo::IntersectionPointAndOffsets< Point >::operator std::tuple< Point &, double &, double & >(), and WiresIntersection().

template<typename Trans >
decltype(auto) geo::makeTransformationMatrix ( Trans &&  trans)

Converts a transformation matrix into a geo::TransformationMatrix.

Definition at line 31 of file TransformationMatrix.h.

Referenced by geo::GeometryBuilderStandard::makeTPC(), and geo::TPCGeo::TPCGeo().

32  {
33  return convertTransformationMatrix<TransformationMatrix>(trans);
34  }
bool geo::operator!= ( DriftAxis const  a,
DriftAxis const  b 
)

Enumerate the possible plane projections.

Definition at line 42 of file geo_types.cxx.

43  {
44  return not(a == b);
45  }
constexpr bool geo::operator!= ( CryostatID const &  a,
CryostatID const &  b 
)
inline

Comparison: the IDs point to different cryostats (validity is ignored)

Definition at line 537 of file geo_types.h.

538  {
539  return !(a == b);
540  }
template<typename GeoID >
constexpr std::enable_if_t<is_base_of_strict<CryostatID, GeoID>, bool> geo::operator!= ( GeoID const &  a,
GeoID const &  b 
)
inline

Comparison: IDs point to different optical detectors (validity is ignored)

Definition at line 563 of file geo_types.h.

566  {
567  return !(a == b);
568  }
constexpr bool geo::operator< ( CryostatID const &  a,
CryostatID const &  b 
)
inline

Order cryostats with increasing ID.

Definition at line 543 of file geo_types.h.

References geo::CryostatID::Cryostat.

Referenced by lar::range_t< size_type >::borders(), larg4::LArVoxelReadoutGeometry::Construct(), and voronoi2d::BSTNode::setDepth().

544  {
545  return a.Cryostat < b.Cryostat;
546  }
template<typename GeoID >
constexpr std::enable_if_t<is_base_of_strict<CryostatID, GeoID>, bool> geo::operator< ( GeoID const &  a,
GeoID const &  b 
)
inline

Order OpDetID in increasing Cryo, then OpDet.

Definition at line 572 of file geo_types.h.

575  {
576  return std::tie(a.parentID(), a.deepestIndex()) < std::tie(b.parentID(), b.deepestIndex());
577  }
std::ostream & geo::operator<< ( std::ostream &  os,
Coordinate const  coordinate 
)

Enumerate the possible plane projections.

Definition at line 17 of file geo_types.cxx.

References X, Y, and Z.

18  {
19  switch (coordinate) {
20  case Coordinate::X: os << 'X'; break;
21  case Coordinate::Y: os << 'Y'; break;
22  case Coordinate::Z: os << 'Z'; break;
23  }
24  return os;
25  }
Float_t Y
Definition: plot.C:37
Float_t Z
Definition: plot.C:37
Float_t X
Definition: plot.C:37
std::ostream & geo::operator<< ( std::ostream &  os,
DriftSign const  sign 
)

Enumerate the possible plane projections.

Definition at line 27 of file geo_types.cxx.

References Negative, Positive, and Unknown.

28  {
29  switch (sign) {
30  case DriftSign::Positive: os << '+'; break;
31  case DriftSign::Negative: os << '-'; break;
32  case DriftSign::Unknown: os << '?'; break;
33  }
34  return os;
35  }
int sign(double val)
Definition: UtilFunc.cxx:104
std::ostream & geo::operator<< ( std::ostream &  os,
DriftAxis const  driftAxis 
)

Enumerate the possible plane projections.

Definition at line 47 of file geo_types.cxx.

References geo::DriftAxis::coordinate, and geo::DriftAxis::sign.

48  {
49  return os << driftAxis.sign << driftAxis.coordinate;
50  }
std::ostream & geo::operator<< ( std::ostream &  out,
WireReadoutDumper::StreamAdapter const &  dumpAdapter 
)

Helper for geo::WireReadoutDumper::toStream().

Definition at line 187 of file WireReadoutDumper.cxx.

References geo::WireReadoutDumper::dump(), geo::WireReadoutDumper::StreamAdapter::dumper, geo::WireReadoutDumper::StreamAdapter::firstIndent, and geo::WireReadoutDumper::StreamAdapter::indent.

189 {
190  dumpAdapter.dumper->dump(out, dumpAdapter.indent, dumpAdapter.firstIndent);
191  return out;
192 }
std::ostream& geo::operator<< ( std::ostream &  out,
CryostatID const &  cid 
)
inline

Generic output of CryostatID to stream.

Definition at line 485 of file geo_types.h.

References geo::CryostatID::Cryostat.

486  {
487  out << "C:" << cid.Cryostat;
488  return out;
489  }
std::ostream& geo::operator<< ( std::ostream &  out,
OpDetID const &  oid 
)
inline

Generic output of OpDetID to stream.

Definition at line 492 of file geo_types.h.

References geo::OpDetID::OpDet, and geo::OpDetID::parentID().

493  {
494  out << oid.parentID() << " O:" << oid.OpDet;
495  return out;
496  }
std::ostream& geo::operator<< ( std::ostream &  out,
TPCID const &  tid 
)
inline

Generic output of TPCID to stream.

Definition at line 499 of file geo_types.h.

References geo::TPCID::parentID(), and geo::TPCID::TPC.

500  {
501  out << tid.parentID() << " T:" << tid.TPC;
502  return out;
503  }
std::ostream& geo::operator<< ( std::ostream &  out,
PlaneID const &  pid 
)
inline

Generic output of PlaneID to stream.

Definition at line 506 of file geo_types.h.

References geo::PlaneID::parentID(), and geo::PlaneID::Plane.

507  {
508  out << pid.parentID() << " P:" << pid.Plane;
509  return out;
510  }
std::ostream& geo::operator<< ( std::ostream &  out,
WireID const &  wid 
)
inline

Generic output of WireID to stream.

Definition at line 513 of file geo_types.h.

References geo::WireID::parentID(), and geo::WireID::Wire.

514  {
515  out << wid.parentID() << " W:" << wid.Wire;
516  return out;
517  }
bool geo::operator== ( DriftAxis const  a,
DriftAxis const  b 
)

Enumerate the possible plane projections.

Definition at line 37 of file geo_types.cxx.

References geo::DriftAxis::coordinate, and geo::DriftAxis::sign.

38  {
39  return a.coordinate == b.coordinate and a.sign == b.sign;
40  }
constexpr bool geo::operator== ( CryostatID const &  a,
CryostatID const &  b 
)
inline

Comparison: the IDs point to the same cryostat (validity is ignored)

Definition at line 531 of file geo_types.h.

References geo::CryostatID::Cryostat.

532  {
533  return a.Cryostat == b.Cryostat;
534  }
template<typename GeoID >
constexpr std::enable_if_t<is_base_of_strict<CryostatID, GeoID>, bool> geo::operator== ( GeoID const &  a,
GeoID const &  b 
)
inline

Comparison: the IDs point to same optical detector (validity is ignored)

Definition at line 554 of file geo_types.h.

557  {
558  return std::tie(a.parentID(), a.deepestIndex()) == std::tie(b.parentID(), b.deepestIndex());
559  }
void geo::ProjectToBoxEdge ( double const  xyz[],
double const  dxyz[],
double  xlo,
double  xhi,
double  ylo,
double  yhi,
double  zlo,
double  zhi,
double  xyzout[] 
)
inline

Project along a direction from a particular starting point to the edge of a box

Parameters
xyz- The starting x,y,z location. Must be inside box.
dxyz- Direction vector
xlo- Low edge of box in x
xhi- Low edge of box in x
ylo- Low edge of box in y
yhi- Low edge of box in y
zlo- Low edge of box in z
zhi- Low edge of box in z
xyzout- On output, the position at the box edge

Note: It should be safe to use the same array for input and output.

Definition at line 54 of file geo.h.

References d.

63 {
64  // Make sure we're inside the box!
65  if (!(xyz[0] >= xlo && xyz[0] <= xhi) || !(xyz[1] >= ylo && xyz[1] <= yhi) ||
66  !(xyz[2] >= zlo && xyz[2] <= zhi))
67  throw cet::exception("ProjectToBoxEdge") << "desired point is not"
68  << " in the specififed box\n";
69 
70  // Compute the distances to the x/y/z walls
71  double dx = 99.E99;
72  double dy = 99.E99;
73  double dz = 99.E99;
74  if (dxyz[0] > 0.0) { dx = (xhi - xyz[0]) / dxyz[0]; }
75  else if (dxyz[0] < 0.0) {
76  dx = (xlo - xyz[0]) / dxyz[0];
77  }
78  if (dxyz[1] > 0.0) { dy = (yhi - xyz[1]) / dxyz[1]; }
79  else if (dxyz[1] < 0.0) {
80  dy = (ylo - xyz[1]) / dxyz[1];
81  }
82  if (dxyz[2] > 0.0) { dz = (zhi - xyz[2]) / dxyz[2]; }
83  else if (dxyz[2] < 0.0) {
84  dz = (zlo - xyz[2]) / dxyz[2];
85  }
86 
87  // Choose the shortest distance
88  double d = 0.0;
89  if (dx < dy && dx < dz)
90  d = dx;
91  else if (dy < dz && dy < dx)
92  d = dy;
93  else if (dz < dx && dz < dy)
94  d = dz;
95 
96  // Make the step
97  for (int i = 0; i < 3; ++i) {
98  xyzout[i] = xyz[i] + dxyz[i] * d;
99  }
100 }
Float_t d
Definition: plot.C:235
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::string geo::SignalTypeName ( SigType_t  sigType)

Returns the name of the specified signal type.

Definition at line 52 of file geo_types.cxx.

References kCollection, kInduction, kMysteryType, and util::to_string().

Referenced by geo::WireReadoutDumper::dumpTPCplane(), and geo::WireIDIntersection::invalid().

53  {
54  switch (sigType) {
55  case kInduction: return "induction";
56  case kCollection: return "collection";
57  case kMysteryType: return "unknown";
58  } // switch
59  throw std::logic_error("geo::SignalTypeName(): unexpected signal type #" +
60  std::to_string(static_cast<int>(sigType)));
61  }
Who knows?
Definition: geo_types.h:149
Signal from induction planes.
Definition: geo_types.h:147
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Signal from collection planes.
Definition: geo_types.h:148
constexpr int geo::to_int ( Coordinate const  coord)
noexcept
constexpr int geo::to_int ( DriftSign const  sign)

Enumerate the possible plane projections.

Definition at line 162 of file geo_types.h.

References Negative, Positive, and Unknown.

163  {
164  switch (sign) {
165  case DriftSign::Positive: return 1;
166  case DriftSign::Negative: return -1;
167  case DriftSign::Unknown: break;
168  }
169  return 0;
170  }
int sign(double val)
Definition: UtilFunc.cxx:104
template<typename StoredMatrix , typename ITER >
static StoredMatrix geo::transformationFromPath ( ITER  begin,
ITER  end 
)
static

Builds a matrix to go from local to world coordinates in one step.

template<typename StoredMatrix >
static StoredMatrix geo::transformationFromPath ( std::vector< GeoNodePathEntry > const &  path,
size_t  depth 
)
static

Builds a matrix to go from local to world coordinates in one step.

geo::Point_t geo::WiresIntersection ( WireGeo const &  wireA,
WireGeo const &  wireB 
)
inline

Returns the point of wireA that is closest to wireB.

Parameters
wireAthe first wire
wireBthe other wire
Returns
the point of wireA closest to wireB
See also
WiresIntersectionAndOffsets()

The point of wireA that is closest to wireB is returned.

The two wires are assumed not to be parallel, and when this prerequisite is not met the behaviour is undefined.

A separate function, WiresIntersectionAndOffsets(), also returns the offset of the intersection from the two reference points.

Definition at line 526 of file WireGeo.h.

References geo::WireGeo::Direction(), geo::WireGeo::GetCenter(), and LineClosestPointWithUnitVectors().

Referenced by geo::WireGeo::IntersectionWith().

527 {
529  wireA.GetCenter(), wireA.Direction(), wireB.GetCenter(), wireB.Direction());
530 }
Point LineClosestPointWithUnitVectors(Point const &startA, UnitVector const &dirA, Point const &startB, UnitVector const &dirB)
Returns the point of a line that is closest to a second line.
geo::IntersectionPointAndOffsets< geo::Point_t > geo::WiresIntersectionAndOffsets ( WireGeo const &  wireA,
WireGeo const &  wireB 
)
inline

Returns the point of wireA that is closest to wireB.

Parameters
wireAthe first wire
wireBthe other wire
Returns
a data structure with three fields: point: the point of wireA closest to wireB; offset1: its offset on wireA [cm]; offset2: its offset on wireB [cm]
See also
WiresIntersection()

Computes the point of wireA that is closest to wireB.

The returned intersection point is the same as for geo::WiresIntersection(). The return value is actually triplet, though, which is most easily unpacked immediately:

auto [ point, offsetA, offsetB ] = geo::WiresIntersection(wireA, wireB);

The two other elements of the triplets are the distances of the intersection point from the center of this wire (offset in the example) and from the center of the other wire (otherOffset), in centimeters. The sign of the offsets are positive if the intersection points lie on the side pointed by the Direction() of the respective wires.

To reassign the variables after they have been defined, instead:

std::tie(point, offsetB, offsetA) = geo::WiresIntersection(wireB, wireA);

Definition at line 516 of file WireGeo.h.

References geo::WireGeo::Direction(), geo::WireGeo::GetCenter(), and LineClosestPointAndOffsetsWithUnitVectors().

Referenced by geo::WireGeo::IntersectionAndOffsetsWith(), and geo::WireReadoutGeom::WireIDsIntersect().

519 {
520 
522  wireA.GetCenter(), wireA.Direction(), wireB.GetCenter(), wireB.Direction());
523 }
IntersectionPointAndOffsets< Point > LineClosestPointAndOffsetsWithUnitVectors(Point const &startA, UnitVector const &dirA, Point const &startB, UnitVector const &dirB)
Returns the point of a line that is closest to a second line.
template<typename Vector = Vector_t>
constexpr Vector geo::Xaxis ( )

Returns a x axis vector of the specified type.

Definition at line 208 of file geo_vectors.h.

Referenced by geo::TPCGeo::TPCGeo(), and geo::PlaneGeo::UpdateView().

209  {
210  return {1.0, 0.0, 0.0};
211  }
template<typename Vector = Vector_t>
constexpr Vector geo::Yaxis ( )

Returns a y axis vector of the specified type.

Definition at line 215 of file geo_vectors.h.

Referenced by geo::TPCGeo::TPCGeo(), and geo::PlaneGeo::UpdateView().

216  {
217  return {0.0, 1.0, 0.0};
218  }
template<typename Vector = Vector_t>
constexpr Vector geo::Zaxis ( )

Returns a z axis vector of the specified type.

Definition at line 222 of file geo_vectors.h.

Referenced by geo::TPCGeo::TPCGeo(), and geo::PlaneGeo::UpdateView().

223  {
224  return {0.0, 0.0, 1.0};
225  }

Variable Documentation

template<typename BaseID , typename GeoID >
constexpr bool geo::is_base_of_strict
static
Initial value:
{std::is_base_of<BaseID, GeoID>{} &&
!std::is_same<BaseID, GeoID>{}}

Comparison: the IDs point to the same cryostat (validity is ignored)

Definition at line 549 of file geo_types.h.