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

Utilities to manipulate geometry vectors.The utilities include generic vector interface facilities allowing to use different vector types via templates. More...

Namespaces

 details
 
 dump
 Utilities to print vector types.
 
 extra
 Convenience utilities not directly related to vectors.
 

Classes

class  CoordConstIterator
 Constant iterator to vector coordinates. More...
 
class  MiddlePointAccumulatorDim
 Helper class to compute the middle point in a point set. More...
 

Typedefs

template<typename Vector >
using coordinate_t = details::VectorScalar_t< Vector >
 Type of coordinate of the specified vector type. More...
 
template<typename Vector >
using CoordReader_t = decltype(details::makeCoordReader(&Vector::X))
 Type of a coordinate reader for a vector type. More...
 
template<typename Vector >
using CoordManager_t = decltype(details::makeCoordManager(&Vector::X,&Vector::SetX))
 Type of a coordinate manager for a vector type. More...
 
using MiddlePointAccumulator = MiddlePointAccumulatorDim< 3U >
 Middle-point accumulator for vectors of dimension 3. More...
 

Functions

template<typename Vector , typename Coords >
constexpr Vector makeFromCoords (Coords &&coords)
 Creates a Vector object with coordinates from coords. More...
 
template<typename Vector , typename Coords >
unsigned int fillCoords (Coords &dest, Vector const &src)
 Fills a coordinate array with the coordinates of a vector. More...
 
template<typename Vector >
constexpr auto coordManager (unsigned int n)
 Returns an object that can be bound to a vector to manage one of its coordinates. More...
 
template<typename Vector >
constexpr auto coordManager (unsigned int n, Vector &v)
 Returns an object that can be bound to a vector to manage one of its coordinates. More...
 
template<typename Vector >
constexpr auto bindCoord (Vector const &v, CoordReader_t< Vector > helper)
 Binds the specified constant vector to the coordinate reader. More...
 
template<typename Vector >
auto bindCoord (Vector &v, CoordManager_t< Vector > helper) -> details::BoundCoordManager< CoordManager_t< Vector >, Vector >
 Binds the specified vector to the coordinate manager. More...
 
template<typename Vector >
auto Xcoord (Vector &v)
 Returns an object to manage the coordinate X of the vector v. More...
 
template<typename Vector >
auto Ycoord (Vector &v)
 Returns an object to manage the coordinate Y of the vector v. More...
 
template<typename Vector >
auto Zcoord (Vector &v)
 Returns an object to manage the coordinate Z of the vector v. More...
 
template<typename Vector >
auto Tcoord (Vector &v)
 Returns an object to manage the coordinate T of the vector v. More...
 
template<typename Vector >
auto coord (Vector &v, unsigned int n) noexcept
 Returns an object to manage the coordinate n of a vector. More...
 
template<typename Vector >
constexpr auto bindCoordManagers (Vector &v)
 
template<typename Vector >
constexpr auto bindCoordReaders (Vector const &v)
 
template<typename Vector >
CoordConstIterator< Vector > operator+ (typename CoordConstIterator< Vector >::difference_type n, CoordConstIterator< Vector > const &v)
 
template<typename Vector >
auto vector_cbegin (Vector const &v)
 Returns a const-iterator pointing to the first coordinate of v. More...
 
template<typename Vector >
auto vector_cend (Vector const &v)
 Returns a const-iterator pointing after the last coordinate of v. More...
 
template<typename Vector >
auto iterateCoords (Vector const &v)
 Returns an object for ranged-for iteration on coordinates. More...
 
template<typename Dest , typename Source >
Dest convertTo (Source const &v)
 Returns a vector of type Dest with the same content as a Src. More...
 
template<typename Dest , typename Source >
std::vector< Dest > convertCollTo (std::vector< Source > const &coll)
 Returns a vector of type Dest with the same content as a Src. More...
 
template<typename Vector , typename Pred >
Vector transformCoords (Vector const &v, Pred &&pred)
 Returns a new vector applying a predicate to each component. More...
 
template<>
auto norm (geo::Vector_t const &v)
 
template<>
auto mag2< TVector2 > (TVector2 const &v)
 
Vector coordinate access abstraction

This group of utilities provides a common interface for tasks involving geometry vectors, which may have different interface. An example of that is the access of coordinates by an index: it is supported (and "slow") in TVector3 for read/write access, while in GenVector it is not supported (and given that the internal representation might be not cartesian, it's not surprising). We provide utilities which fill the gaps, relying on some looser requirements.

Coordinate managers

A "coordinate manager" is an object handling a specific coordinate out of a specific vector type; i.e., a coordinate manager object will manage for its entire lifetime the same coordinate, e.g. x or z. A coordinate manager can be:

  • bound to a vector object: that manager handles exclusively its managed coordinate for that vector object;
  • unbound: such a manager can handle the managed coordinate of any vector, which can be passed as an argument; or the unbound manager can be used to create a bound one.

Two types of managers are available:

  • reader, accesses the coordinate but can't modify it
  • manager, requires to be bound to a mutable vector and can assign and modify the coordinate via selected operations

Note that a coordinate is never returned as a reference, either mutable or constant.

Handling a coordinate of a vector object: bound managers

A bound coordinate manager can be created directly:

geo::Point_t p { 1.0, 2.0, 3.0 };
auto px = geo::vect::Xcoord(p);
std::cout << p << " has x=" << px() << std::endl;
px += 5.0;
std::cout << p << " has now x=" << px() << std::endl;

will return something along the line of

(1,2,3) has x=1
(6,2,3) has now x=6

Functions Xcoord(), Ycoord(), Zcoord() and Tcoord() (in namespace geo::vect) are available for the supporting vector types.

If access by numeric index is necessary, coord() can be used instead:

geo::Vector_t const v { 1.0, 2.0, 3.0 };
for (unsigned c = 0; c < 3; ++c) {
auto vc = geo::vect::coord(v, c);
std::cout << v << "[" << c << "]=" << vc() << std::endl;
}

(note that for this example we have implicitly obtained a coordinate reader instead of a full coordinate manager because v is constant). This will print:

v[0]=1
v[1]=2
v[2]=3

If there are more vectors to access the same coordinate of, it's better to use unbound managers (see below).

Handling a coordinate for any vector object

Unbound coordinate managers (and readers) can't operate directly on vectors but they need to be bound to one. Binding produces a new bound manager, leaving the unbound manager untouched. Binding is done with geo::vect::bindCoord(). For example:

geo::Point_t A { 1.0, 2.0, 3.0 };
auto Ax = geo::vect::bindCoord(A, YcoordManager<geo::Point_t>);
std::cout << A << " has y=" << Ax << std::endl;

should produce an output like

(1,2,3) has y=2

In the example, YcoordManager is a template coordinate manager. There are managers available for X, Y, Z and T coordinates, and each one can deal only with a specific vector type; also, specifying a non-constant vector type will deliver a full manager, which can't operate on constant vectors. The unbound coordinate managers are not as useful, but a possible use is for loops on coordinates from multiple vectors:

geo::Point_t A { 1.0, 2.0, 3.0 }, geo::Point_t B {5.0, 7.0, 9.0 };
for (unsigned c = 0; c < 3; ++c) {
auto coordMan = geo::vect::coordManager(c);
auto Ac = geo::vect::bindCoord(A, coordMan);
auto Bc = geo::vect::bindCoord(B, coordMan);
std::cout << (Bc() - Ac() * 2.0) << std::endl;
} // for

which will emit

3
3
3

This is marginally faster than the same code with geo::vect::bindCoord() call replaced by geo::vect::coord(). More convenient still, if the coordinates are treated all just the same and c is not needed (as above):

geo::Point_t A { 1.0, 2.0, 3.0 }, geo::Point_t B {5.0, 7.0, 9.0 };
for (auto coordMan: geo::vect::coordManagers<geo::Point_t const>()) {
auto Ac = geo::vect::bindCoord(A, coordMan);
auto Bc = geo::vect::bindCoord(B, coordMan);
std::cout << (Bc() - Ac() * 2.0) << std::endl;
} // for

Conversion between vector types

A convenience function convertTo() is provided to convert a vector into another of a different type (for example, from TVector3 to geo::Vector_t).

Vector requirements

So far, the requirements for this set of utilities are the following. The vector type must support:

  • a cartesian coordinate constructor: Vector v { 1.0, 2.0, 3.0 };
  • accessor methods named after the name of the coordinate, acting on constant vectors, taking no arguments, and returning a copy of the coordinate value, e.g. double X() const
  • coordinate assignment methods named SetC, where C is the name of each coordinate, after the name of the coordinate, with a single argument; the return type is not prescribed; e.g. void SetY(double)
  • the coordinate names must be X and Y for 2D vectors, plus Z for 3D vectors and T for 4D vectors (metric is irrelevant here)
template<typename Vector >
constexpr unsigned int dimension ()
 Returns the dimension of the specified vector type. More...
 
template<typename Vector >
constexpr unsigned int dimension (Vector &&)
 Returns the dimension of the specified vector type. More...
 
template<typename Vector >
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices ()
 Returns a sequence of indices valid for a vector of the specified type. More...
 
template<typename Vector >
constexpr auto indices (Vector const &) -> decltype(indices< Vector >())
 Returns a sequence of indices valid for a vector of the specified type. More...
 
template<typename Vector >
constexpr auto coordManagers ()
 Returns an array with all coordinate managers for a type of vector. More...
 
template<typename Vector >
constexpr auto coordManagers (Vector &&)
 Returns an array with all coordinate managers for a type of vector. More...
 
template<typename Vector >
constexpr auto coordReaders ()
 Returns an array with all coordinate readers for a type of vector. More...
 
template<typename Vector >
constexpr auto coordReaders (Vector &&)
 Returns an array with all coordinate readers for a type of vector. More...
 
Functions for common vector operations.

This group of template functions are meant to be used with vectors in a generic way. The default implementation is for TVector3. Specializations can be easily written for other vector types.

In addition, two "standard" representations for vectors and points are provided.

Note
The representations for vector and point objects are currently the same; this prevents relying on overload resolution to decide which function to use. For example, defining two functions with signature: will not compile since these two are exactly the same. A solution might be to derive two different classes from the common one:
struct Vector_t: public VectorBase_t { using VectorBase_t::VectorBase_t; };
struct Point_t: public VectorBase_t { using VectorBase_t::VectorBase_t; };
This will likely have consequences though (for example, the sum of two Vector_t or Point_t will become a VectorBase_t).
template<typename Vector , typename Scalar >
Vector rounded0 (Vector const &v, Scalar tol)
 Returns a vector with all components rounded if close to 0. More...
 
template<typename Vector , typename Scalar >
void round0 (Vector &v, Scalar tol)
 Returns a vector with all components rounded if close to 0. More...
 
template<typename Vector , typename Scalar >
Vector rounded01 (Vector const &v, Scalar tol)
 Returns a vector with all components rounded if close to 0, -1 or +1. More...
 
template<typename Vector , typename Scalar >
void round01 (Vector &v, Scalar tol)
 Returns a vector with all components rounded if close to 0, -1 or +1. More...
 
template<typename Vector >
bool isfinite (Vector const &v)
 Returns whether all components of the vector are finite. More...
 
template<typename Vector >
Vector normalize (Vector const &v)
 Returns a vector parallel to v and with norm 1. More...
 
template<typename Vector >
Vector cross (Vector const &a, Vector const &b)
 Return cross product of two vectors. More...
 
template<typename Vector , typename OtherVector >
constexpr auto dot (Vector const &a, OtherVector const &b)
 Return cross product of two vectors. More...
 
template<typename Vector >
auto mag2 (Vector const &v)
 Return norm of the specified vector. More...
 
template<typename Vector >
auto norm (Vector const &v)
 Return norm of the specified vector. More...
 
template<typename Vector >
auto mixedProduct (Vector const &a, Vector const &b, Vector const &c)
 
Middle point functions
template<typename Point , typename BeginIter , typename EndIter >
Point middlePointAs (BeginIter begin, EndIter end)
 Returns the middle of the specified points. More...
 
template<typename BeginIter , typename EndIter >
geo::Point_t middlePoint (BeginIter begin, EndIter end)
 Returns the middle of the specified points. More...
 
template<typename Point >
Point middlePoint (std::initializer_list< Point > points)
 Returns the middle of the specified points. More...
 
Support for LArSoft geometry vectors
template<typename Point >
::geo::Point_t toPoint (Point const &p)
 Convert the specified point into a geo::Point_t. More...
 
template<typename Vector >
::geo::Vector_t toVector (Vector const &v)
 Convert the specified vector into a geo::Vector_t. More...
 
template<typename Point >
std::vector< geo::Point_tconvertCollToPoint (std::vector< Point > const &coll)
 
template<typename Vector >
std::vector< geo::Vector_tconvertCollToVector (std::vector< Vector > const &coll)
 
template<typename Coords >
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords (Coords &&coords)
 Creates a geo::Point_t from its coordinates (see makeFromCoords()). More...
 
template<typename Coords >
GENVECTOR_CONSTEXPR::geo::Vector_t makeVectorFromCoords (Coords &&coords)
 Creates a geo::Vector_t from its coordinates (see makeFromCoords()). More...
 
TVector3 conversions
template<typename Vector >
TVector3 toTVector3 (Vector const &v)
 Converts a vector into a TVector3. More...
 

Variables

template<typename Vector >
static constexpr auto XcoordManager = details::makeCoordManager(&Vector::X, &Vector::SetX)
 Object that can be bound to a vector to manage its X coordinate. More...
 
template<typename Vector >
static constexpr auto XcoordManager< Vector const > = details::makeCoordReader(&Vector::X)
 Object that can be bound to a vector to access its X coordinate. More...
 
template<typename Vector >
static constexpr auto const YcoordManager
 
template<typename Vector >
static constexpr auto YcoordManager< Vector const > = details::makeCoordReader(&Vector::Y)
 
template<typename Vector >
static constexpr auto ZcoordManager = details::makeCoordManager(&Vector::Z, &Vector::SetZ)
 
template<typename Vector >
static constexpr auto ZcoordManager< Vector const > = details::makeCoordReader(&Vector::Z)
 
template<typename Vector >
static constexpr auto TcoordManager = details::makeCoordManager(&Vector::T, &Vector::SetT)
 
template<typename Vector >
static constexpr auto TcoordManager< Vector const > = details::makeCoordReader(&Vector::T)
 

Detailed Description

Utilities to manipulate geometry vectors.

The utilities include generic vector interface facilities allowing to use different vector types via templates.

Typedef Documentation

template<typename Vector >
using geo::vect::coordinate_t = typedef details::VectorScalar_t<Vector>

Type of coordinate of the specified vector type.

Definition at line 644 of file geo_vectors_utils.h.

template<typename Vector >
using geo::vect::CoordManager_t = typedef decltype(details::makeCoordManager(&Vector::X, &Vector::SetX))

Type of a coordinate manager for a vector type.

Definition at line 691 of file geo_vectors_utils.h.

template<typename Vector >
using geo::vect::CoordReader_t = typedef decltype(details::makeCoordReader(&Vector::X))

Type of a coordinate reader for a vector type.

Definition at line 687 of file geo_vectors_utils.h.

Middle-point accumulator for vectors of dimension 3.

Definition at line 1484 of file geo_vectors_utils.h.

Function Documentation

template<typename Vector >
constexpr auto geo::vect::bindCoord ( Vector const &  v,
CoordReader_t< Vector >  helper 
)

Binds the specified constant vector to the coordinate reader.

Definition at line 847 of file geo_vectors_utils.h.

Referenced by geo::vect::CoordConstIterator< Vector >::access(), geo::BoxBoundedGeo::GetIntersections(), and geo::BoxBoundedGeo::SortCoordinates().

848  {
849  return details::BoundCoordGetter<CoordReader_t<Vector>, Vector const>(v, helper);
850  }
template<typename Vector >
auto geo::vect::bindCoord ( Vector &  v,
CoordManager_t< Vector >  helper 
) -> details::BoundCoordManager<CoordManager_t<Vector>, Vector>

Binds the specified vector to the coordinate manager.

Definition at line 854 of file geo_vectors_utils.h.

Referenced by Xcoord().

856  {
857  return {v, helper};
858  }
template<typename Vector >
constexpr auto geo::vect::bindCoordManagers ( Vector &  v)

Returns an array with all coordinate managers bound to the specified vector.

Definition at line 2185 of file geo_vectors_utils.h.

Referenced by geo::vect::MiddlePointAccumulatorDim< N >::add(), and Tcoord().

2186 {
2187  return details::BindCoordManagersImpl<Vector, dimension<Vector>()>::bind(v);
2188 } // geo::vect::bindCoordManagers()
template<typename Vector >
constexpr auto geo::vect::bindCoordReaders ( Vector const &  v)

Returns an array with all coordinate readers bound to the specified vector.

Definition at line 2191 of file geo_vectors_utils.h.

Referenced by Tcoord(), and transformCoords().

2192 {
2193  using ConstVector = std::add_const_t<std::remove_reference_t<Vector>>;
2194  return details::BindCoordManagersImpl<ConstVector, dimension<ConstVector>()>::bind(v);
2195 } // geo::vect::bindCoordReaders()
template<typename Dest , typename Source >
std::vector< Dest > geo::vect::convertCollTo ( std::vector< Source > const &  coll)

Returns a vector of type Dest with the same content as a Src.

Template Parameters
Desttarget vector type
Sourcetype of the vector to be converted from
Parameters
collthe collection of vectors to be converted from
Returns
a collection of vectors with the same content as coll, but of type Dest
See also
convertTo()

This version applies convertTo() to all the elements of the specified collection, returning a collection of the same template type (std::vector).

For the requirements, see convertTo().

Definition at line 2206 of file geo_vectors_utils.h.

Referenced by iterateCoords().

2207 {
2208 
2209  std::vector<Dest> dest;
2210  dest.reserve(coll.size());
2211  std::transform(
2212  coll.begin(), coll.end(), std::back_inserter(dest), geo::vect::convertTo<Dest, Source>);
2213  return dest;
2214 
2215 } // geo::vect::convertCollTo()
template<typename Point >
std::vector<geo::Point_t> geo::vect::convertCollToPoint ( std::vector< Point > const &  coll)

Convert the specified collection of points into a collection of geo::Point_t.

Definition at line 1599 of file geo_vectors_utils.h.

1600  {
1601  return convertCollTo<geo::Point_t>(coll);
1602  }
template<typename Vector >
std::vector<geo::Vector_t> geo::vect::convertCollToVector ( std::vector< Vector > const &  coll)

Convert the specified collection of vectors into a collection of geo::Vector_t.

Definition at line 1607 of file geo_vectors_utils.h.

1608  {
1609  return convertCollTo<geo::Vector_t>(coll);
1610  }
template<typename Dest , typename Source >
Dest geo::vect::convertTo ( Source const &  v)

Returns a vector of type Dest with the same content as a Src.

Template Parameters
Desttarget vector type
Sourcetype of the vector to be converted from
Parameters
vthe vector to be converted from
Returns
a vector with the same content as v, but of type Dest

For this to work, both Src and Dest types must satisfy the requirements of Xcoord(), Ycoord(), Zcoord() etc.

Definition at line 2199 of file geo_vectors_utils.h.

Referenced by iterateCoords().

2200 {
2201  return details::ConvertToDispatcher<Dest, Source>::convert(v);
2202 }
template<typename Vector >
auto geo::vect::coord ( Vector &  v,
unsigned int  n 
)
noexcept

Returns an object to manage the coordinate n of a vector.

Template Parameters
Vectorthe type of vector to be managed
Parameters
vthe vector to be managed
nthe coordinate index: 0 for X, 1 for Y and 2 for Z
Returns
an object to manage the coordinate n of a vector
See also
Xcoord(), Ycoord(), Zcoord()

Result is undefined for any value of n other than 0, 1 and 2. See Xcoord(), Ycoord() and Zcoord() for Vector type requirements.

Definition at line 2141 of file geo_vectors_utils.h.

References n.

Referenced by fillCoords(), ShowerRecoTools::Shower2DLinearRegressionTrackHitFinder::FindInitialTrackHits(), shower::EMShowerAlg::FindInitialTrackHits(), geo::BoxBoundedGeo::GetIntersections(), evd::details::GridAxisClass::GridAxisClass(), geo::vect::details::isfiniteImpl(), simfilter::FilterGenInTime::KeepParticle(), geo::vect::CoordConstIterator< Vector >::operator*(), geo::vect::CoordConstIterator< Vector >::operator[](), detsim::DriftElectronstoPlane::produce(), detsim::SimDriftElectrons::produce(), and Tcoord().

2142 {
2143  return vect::bindCoord<Vector>(v, coordManager<Vector>(n));
2144 }
Char_t n[5]
template<typename Vector >
constexpr auto geo::vect::coordManager ( unsigned int  n)

Returns an object that can be bound to a vector to manage one of its coordinates.

Template Parameters
Vectortype of vector to get a manager for (constantness matters)
Parameters
nindex of the coordinate (0: X, 1: Y, 2: Z, 3: T)
Returns
a coordinate manager, undefined if index is invalid

Index n is assumed to be smaller than the dimension of the vector. The manager returned for a mutable vector exposes a read/write interface. Example of usage:

// mutable vectors get a full-featured "manager":
geo::Point_t p { 1.0, 2.0, 3.0 };
auto px
= geo::vect::bindCoord(p, geo::vect::coordManager<geo::Point_t>(0U));
px *= 5.0;
std::cout << p << " has now x=" << px() << std::endl;

will print something like:

(5,2,3) has now x=5

For a constant vector, the returned manager exposes a read-only interface. Example of usage:

// constant vectors get a "reader" (read-only manager):
geo::Vector_t v { 1.0, 2.0, 3.0 };
(v, geo::vect::coordManager<geo::Vector_t const>(1U));
std::cout << v << " has y=" << vy() << std::endl;

will print something like:

{1,2,3) has y=2

Note that the use in these examples, coord() is preferred.

Definition at line 2134 of file geo_vectors_utils.h.

References util::get().

2135 {
2137 }
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:120
Char_t n[5]
template<typename Vector >
constexpr auto geo::vect::coordManager ( unsigned int  n,
Vector &  v 
)

Returns an object that can be bound to a vector to manage one of its coordinates.

Template Parameters
Vectortype of vector to get a manager for (constantness matters)
Parameters
nindex of the coordinate (0: X, 1: Y, 2: Z, 3: T)
va vector of type Vector (ignored)
Returns
a coordinate manager, undefined if index is invalid
See also
geo::vect::coordManager(unsigned int)

An alias of geo::vect::coordManager(unsigned int).

template<typename Vector >
constexpr auto geo::vect::coordManagers ( )

Returns an array with all coordinate managers for a type of vector.

Definition at line 2158 of file geo_vectors_utils.h.

2159 {
2160  using PlainVector = std::remove_reference_t<Vector>;
2161  return details::CoordManagersImpl<PlainVector, dimension<PlainVector>()>::get();
2162 } // geo::vect::coordManagers()
template<typename Vector >
constexpr auto geo::vect::coordManagers ( Vector &&  )

Returns an array with all coordinate managers for a type of vector.

Definition at line 2165 of file geo_vectors_utils.h.

2166 {
2167  return coordManagers<Vector>();
2168 }
template<typename Vector >
constexpr auto geo::vect::coordReaders ( )

Returns an array with all coordinate readers for a type of vector.

Definition at line 2171 of file geo_vectors_utils.h.

2172 {
2173  using ConstVector = std::add_const_t<std::remove_reference_t<Vector>>;
2174  return details::CoordManagersImpl<ConstVector, dimension<ConstVector>()>::get();
2175 } // geo::vect::coordReaders()
template<typename Vector >
constexpr auto geo::vect::coordReaders ( Vector &&  )

Returns an array with all coordinate readers for a type of vector.

Definition at line 2178 of file geo_vectors_utils.h.

2179 {
2180  return coordReaders<Vector>();
2181 }
template<typename Vector >
Vector geo::vect::cross ( Vector const &  a,
Vector const &  b 
)

Return cross product of two vectors.

Definition at line 1265 of file geo_vectors_utils.h.

Referenced by geo::GeometryCore::ChannelsIntersect(), export_G4ThreeVector(), mixedProduct(), and pmtana::AlgoCFD::RecoPulse().

1266  {
1267  return a.Cross(b);
1268  }
template<typename Vector >
constexpr unsigned int geo::vect::dimension ( )

Returns the dimension of the specified vector type.

Definition at line 623 of file geo_vectors_utils.h.

Referenced by fillCoords(), and vector_cend().

624  {
625  return details::dimension<Vector>();
626  }
template<typename Vector >
constexpr unsigned int geo::vect::dimension ( Vector &&  )

Returns the dimension of the specified vector type.

Definition at line 628 of file geo_vectors_utils.h.

References indices().

629  {
630  return dimension<Vector>();
631  }
template<typename Vector , typename Coords >
unsigned int geo::vect::fillCoords ( Coords &  dest,
Vector const &  src 
)

Fills a coordinate array with the coordinates of a vector.

Template Parameters
Vectortype of vector being copied from
Coordstype of coordinate array to be filled
Parameters
srcthe vector to read the coordinates from
destthe array to be filled
Returns
the number of coordinates filled (that's Vector's dimension)
See also
geo::vect::makeFromCoords()

The Coords array type is expected to provide a indexing operator returning a r-value, that is coords[i] can be assigned to.

Definition at line 2148 of file geo_vectors_utils.h.

References coord(), and dimension().

Referenced by geo::LocalTransformation< StoredMatrix >::LocalToWorld(), geo::LocalTransformation< StoredMatrix >::LocalToWorldVect(), geo::TPCGeo::UpdatePlaneCache(), larg4::OpFastScintillation::VISHits(), larg4::OpFastScintillation::VUVHits(), geo::LocalTransformation< StoredMatrix >::WorldToLocal(), and geo::LocalTransformation< StoredMatrix >::WorldToLocalVect().

2149 {
2150  // this is simpler than makeFromCoords() because doesn't attempt constexpr
2151  for (std::size_t i = 0; i < geo::vect::dimension(src); ++i)
2152  dest[i] = geo::vect::coord(src, i);
2153  return geo::vect::dimension(src);
2154 } // geo::vect::fillCoords()
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
constexpr unsigned int dimension()
Returns the dimension of the specified vector type.
template<typename Vector >
constexpr auto geo::vect::indices ( Vector const &  ) -> decltype(indices<Vector>())

Returns a sequence of indices valid for a vector of the specified type.

Definition at line 2119 of file geo_vectors_utils.h.

Referenced by dimension().

2120 {
2121  return indices<Vector>();
2122 }
template<typename Vector >
bool geo::vect::isfinite ( Vector const &  v)

Returns whether all components of the vector are finite.

Definition at line 2230 of file geo_vectors_utils.h.

References geo::vect::details::isfiniteImpl().

Referenced by cluster::ClusterParamsAlg::GetRoughAxis(), geo::vect::details::isfiniteImpl(), trkf::KTrack::isValid(), round01(), pma::Track3D::TuneFullTree(), and geo::WireGeo::WireGeo().

2231 {
2232  return details::isfiniteImpl(v, details::makeVectorIndices<Vector>());
2233 }
bool isfiniteImpl(Point const &point, std::index_sequence< I... >)
template<typename Vector >
auto geo::vect::iterateCoords ( Vector const &  v)

Returns an object for ranged-for iteration on coordinates.

Template Parameters
Vectortype of vector to iterate through
Parameters
vvector whose coordinates will be iterated
Returns
an object suitable for range-for loop

Example:

geo::Vector_t v{ 3.0, 4.0, 5.0 };
for (auto c: geo::vect::iterateCoords(v)) std::cout << c << ' ';

will print 3 4 5.

Definition at line 1139 of file geo_vectors_utils.h.

References convertCollTo(), convertTo(), util::span(), transformCoords(), vector_cbegin(), and vector_cend().

1140  {
1141  return util::span(vector_cbegin(v), vector_cend(v));
1142  }
auto vector_cend(Vector const &v)
Returns a const-iterator pointing after the last coordinate of v.
auto vector_cbegin(Vector const &v)
Returns a const-iterator pointing to the first coordinate of v.
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
template<typename Vector >
auto geo::vect::mag2 ( Vector const &  v)

Return norm of the specified vector.

Definition at line 1279 of file geo_vectors_utils.h.

Referenced by export_G4ThreeVector(), and export_G4TwoVector().

1280  {
1281  return v.Mag2();
1282  }
template<>
auto geo::vect::mag2< TVector2 > ( TVector2 const &  v)
inline

Definition at line 123 of file geo_vectors_utils_TVector.h.

124  {
125  return v.Mod2();
126  }
template<typename Vector , typename Coords >
constexpr Vector geo::vect::makeFromCoords ( Coords &&  coords)

Creates a Vector object with coordinates from coords.

Template Parameters
Vectorthe type of vector to be created
Coordstype of object holding the value of the needed coordinates
Parameters
coordsobject holding the value of the needed coordinates
Returns
a newly created Vector object with coordinates from coords
See also
geo::vect::fillCoords()

To create a vector of dimension N, the first N values are extracted from coords using Coords::operator[](std::size_t). For example:

constexpr std::array<float, 5U> data { 2.0, 5.0, 7.0, 11.0, 15.5 };
constexpr auto p = geo::vect::makeFromCoords<geo::Point_t>(data);
auto v = geo::vect::makeFromCoords<geo::Vector_t>(data.data() + 1);

will set p as constexpr geo::Point_t {2.0, 5.0, 7.0 }, ignoring the additional data. Likewise, it will set v to geo::Vector_t{ 5.0, 7.0, 11.0 }. In both cases, the coordinates are implicitly converted from float into the scalar type of the target vectors (in both cases, double).

Definition at line 2126 of file geo_vectors_utils.h.

2127 {
2128  using namespace geo::vect::details;
2129  return makeFromCoordsImpl<Vector>(constexpr_forward<Coords>(coords), makeVectorIndices<Vector>());
2130 } // geo::vect::makeFromCoords()
template<typename Coords >
GENVECTOR_CONSTEXPR ::geo::Point_t geo::vect::makePointFromCoords ( Coords &&  coords)

Creates a geo::Point_t from its coordinates (see makeFromCoords()).

Definition at line 1614 of file geo_vectors_utils.h.

Referenced by geo::BoxBoundedGeo::ContainsPosition(), geo::AuxDetSensitiveGeo::DistanceToPoint(), geo::CryostatGeo::GetClosestOpDet(), geo::GeometryCore::MassBetweenPoints(), proxy::SpacePointWithCharge< CollProxy >::position(), and geo::CryostatGeo::PositionToTPC().

1615  {
1616  return makeFromCoords<::geo::Point_t>(std::forward<Coords>(coords));
1617  }
template<typename Coords >
GENVECTOR_CONSTEXPR ::geo::Vector_t geo::vect::makeVectorFromCoords ( Coords &&  coords)

Creates a geo::Vector_t from its coordinates (see makeFromCoords()).

Definition at line 1621 of file geo_vectors_utils.h.

1622  {
1623  return makeFromCoords<::geo::Vector_t>(std::forward<Coords>(coords));
1624  }
template<typename BeginIter , typename EndIter >
geo::Point_t geo::vect::middlePoint ( BeginIter  begin,
EndIter  end 
)

Returns the middle of the specified points.

Template Parameters
BeginItertype of iterator to a point type compatible with add()
EndItertype of end iterator
Parameters
beginiterator to the first point to be averaged
enditerator after the last point to be averaged
Returns
an object of type Point_t with the value of the middle point

Example of usage:

std::vector<geo::Point_t> points {
geo::Point_t(1., 2., 3.),
geo::Point_t(2., 4., 6.),
geo::Point_t(3., 6., 9.)
};
auto mp = geo::vect::middlePoint(points.begin(), points.end());

The variable mp of the example will be of type geo::Point_t.

Definition at line 1542 of file geo_vectors_utils.h.

References ROOT::Math::begin(), and ROOT::Math::end().

Referenced by sim::PhotonVoxel::GetCenter().

1543  {
1544  return middlePointAs<geo::Point_t>(begin, end);
1545  }
decltype(auto) begin(ROOT::Math::LorentzVector< CoordSystem > const &v)
decltype(auto) end(ROOT::Math::LorentzVector< CoordSystem > const &v)
template<typename Point >
Point geo::vect::middlePoint ( std::initializer_list< Point >  points)

Returns the middle of the specified points.

Template Parameters
Pointcartesian-represented point type with 3-component constructor and X(), Y() and Z() accessors.
Parameters
pointsthe list of points to be included
Returns
the value of the middle point

Example of usage:

({ geo::Point_t(1., 2., 3.), geo::Point_t(3., 6., 9.) });

The variable mp will contain the middle point between the two specified in the initializer list.

Definition at line 1564 of file geo_vectors_utils.h.

1565  {
1566  constexpr auto Dim = geo::vect::dimension<Point>();
1567  return MiddlePointAccumulatorDim<Dim>(points.begin(), points.end())
1568  .template middlePointAs<Point>();
1569  }
template<typename Point , typename BeginIter , typename EndIter >
Point geo::vect::middlePointAs ( BeginIter  begin,
EndIter  end 
)

Returns the middle of the specified points.

Template Parameters
Pointcartesian-represented point type with 3-component constructor
BeginItertype of iterator to a point type compatible with add()
EndItertype of end iterator
Parameters
beginiterator to the first point to be averaged
enditerator after the last point to be averaged
Returns
an object of type Point with the value of the middle point

Example of usage:

std::vector<geo::Point_t> points {
geo::Point_t(1., 2., 3.),
geo::Point_t(2., 4., 6.),
geo::Point_t(3., 6., 9.)
};
auto mp = geo::vect::middlePointAs<geo::Vector_t>(points.begin(), points.end());

The variable mp of the example will be of type geo::Vector_t (converted component by components from a geo::Point_t).

Definition at line 1514 of file geo_vectors_utils.h.

References ROOT::Math::begin(), and ROOT::Math::end().

1515  {
1516  constexpr auto Dim = geo::vect::dimension<Point>();
1517  return MiddlePointAccumulatorDim<Dim>(begin, end).template middlePointAs<Point>();
1518  }
decltype(auto) begin(ROOT::Math::LorentzVector< CoordSystem > const &v)
decltype(auto) end(ROOT::Math::LorentzVector< CoordSystem > const &v)
template<typename Vector >
auto geo::vect::mixedProduct ( Vector const &  a,
Vector const &  b,
Vector const &  c 
)

Return "mixed" product of three vectors: $ \vec{a} \times \vec{b} \cdot \vec{c} $

Definition at line 1294 of file geo_vectors_utils.h.

References cross(), and dot().

Referenced by geo::PlaneGeo::UpdateView().

1295  {
1296  return dot(cross(a, b), c);
1297  }
constexpr auto dot(Vector const &a, OtherVector const &b)
Return cross product of two vectors.
Vector cross(Vector const &a, Vector const &b)
Return cross product of two vectors.
template<typename Vector >
auto geo::vect::norm ( Vector const &  v)

Return norm of the specified vector.

Definition at line 1286 of file geo_vectors_utils.h.

1287  {
1288  return v.Mag();
1289  }
template<>
auto geo::vect::norm ( geo::Vector_t const &  v)
inline

Definition at line 1786 of file geo_vectors_utils.h.

1787  {
1788  return v.R();
1789  }
template<typename Vector >
Vector geo::vect::normalize ( Vector const &  v)

Returns a vector parallel to v and with norm 1.

Definition at line 1258 of file geo_vectors_utils.h.

Referenced by geo::PlaneBase< geo::Vector_t >::PastorizeUnitVector(), and geo::TPCGeo::SortPlanes().

1259  {
1260  return v.Unit();
1261  }
template<typename Vector >
CoordConstIterator<Vector> geo::vect::operator+ ( typename CoordConstIterator< Vector >::difference_type  n,
CoordConstIterator< Vector > const &  v 
)

Definition at line 1105 of file geo_vectors_utils.h.

References n.

1107  {
1108  return v + n;
1109  }
Char_t n[5]
template<typename Vector , typename Scalar >
void geo::vect::round0 ( Vector &  v,
Scalar  tol 
)

Returns a vector with all components rounded if close to 0.

Definition at line 1233 of file geo_vectors_utils.h.

References rounded0().

Referenced by geo::PlaneGeo::UpdateWirePlaneCenter().

1234  {
1235  v = rounded0(v, tol);
1236  }
Vector rounded0(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0.
template<typename Vector , typename Scalar >
void geo::vect::round01 ( Vector &  v,
Scalar  tol 
)

Returns a vector with all components rounded if close to 0, -1 or +1.

Definition at line 1247 of file geo_vectors_utils.h.

References isfinite(), and rounded01().

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

1248  {
1249  v = rounded01(v, tol);
1250  }
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
template<typename Vector , typename Scalar >
Vector geo::vect::rounded0 ( Vector const &  v,
Scalar  tol 
)

Returns a vector with all components rounded if close to 0.

Definition at line 1226 of file geo_vectors_utils.h.

References geo::vect::extra::roundValue0(), and transformCoords().

Referenced by round0().

1227  {
1228  return transformCoords(v, [tol](auto c) { return extra::roundValue0(c, tol); });
1229  }
constexpr T roundValue0(T value, T tol)
Returns value, rounded to 0 if closer than tol.
Vector transformCoords(Vector const &v, Pred &&pred)
Returns a new vector applying a predicate to each component.
template<typename Vector , typename Scalar >
Vector geo::vect::rounded01 ( Vector const &  v,
Scalar  tol 
)

Returns a vector with all components rounded if close to 0, -1 or +1.

Definition at line 1240 of file geo_vectors_utils.h.

References geo::vect::extra::roundValue01(), and transformCoords().

Referenced by geo::PlaneGeo::DetectGeometryDirections(), geo::PlaneGeo::GetNormalAxis(), groupTPCsByDriftDir(), geo::PlaneBase< geo::Vector_t >::PastorizeUnitVector(), round01(), geo::PlaneGeo::UpdateIncreasingWireDir(), geo::PlaneGeo::UpdateWidthDepthDir(), and geo::PlaneGeo::UpdateWireDir().

1241  {
1242  return transformCoords(v, [tol](auto c) { return extra::roundValue01(c, tol); });
1243  }
Vector transformCoords(Vector const &v, Pred &&pred)
Returns a new vector applying a predicate to each component.
constexpr T roundValue01(T value, T tol)
Returns value, rounded to 0, -1 or +1 if closer than tol.
template<typename Vector >
auto geo::vect::Tcoord ( Vector &  v)

Returns an object to manage the coordinate T of the vector v.

Template Parameters
Vectorthe type of vector to be managed
Parameters
vthe vector with the coordinate T to be managed
Returns
an object to manage the coordinate T of v

The type Vector needs to have a double T() const method and a auto SetT(auto) method, where the argument is the type of the managed coordinate and the return value is unspecified.

Definition at line 919 of file geo_vectors_utils.h.

References bindCoordManagers(), bindCoordReaders(), coord(), and n.

Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), and geo::vect::details::ConvertToImplDim< Dest, Source, 4U >::convert().

920  {
921  return bindCoord<Vector>(v, TcoordManager<Vector>);
922  }
template<typename Point >
::geo::Point_t geo::vect::toPoint ( Point const &  p)

Convert the specified point into a geo::Point_t.

Definition at line 1584 of file geo_vectors_utils.h.

Referenced by larg4::LArG4Ana::analyze(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerStartPositionCheater::CalculateElement(), shower::EMShowerAlg::ConstructTrack(), geo::BoxBoundedGeo::ContainsPosition(), phot::PhotonVisibilityService::DistanceToOpDet(), util::GeometryUtilities::Get2DPointProjection(), phot::PhotonVisibilityService::GetAllVisibilities(), sim::PhotonVoxelDef::GetNeighboringVoxelIDs(), pma::GetProjectionToPlane(), phot::PhotonVisibilityService::GetReflT0s(), shower::TCShowerElectronLikelihood::getShowerProfile(), phot::PhotonVisibilityService::GetTimingPar(), phot::PhotonVisibilityService::GetTimingTF1(), phot::PhotonVisibilityService::GetVisibility(), sim::PhotonVoxelDef::GetVoxelID(), phot::PhotonVisibilityService::HasVisibility(), apa::APAGeometryAlg::LineSegChanIntersect(), lar_cluster3d::StandardHit3DBuilder::NearestWireID(), lar_cluster3d::SnippetHit3DBuilder::NearestWireID(), detsim::SimDriftElectrons::produce(), evd::RecoBaseDrawer::Seed2D(), shower::TCShowerTemplateMaker::showerProfile(), phot::PhotonVisibilityService::SolidAngleFactor(), filt::LArG4ParticleFilter::StartInTPCCheck(), filt::LArG4ParticleFilter::StopInTPCCheck(), geo::TPCGeo::TPCGeo(), filt::LArG4ParticleFilter::TPCTrajLengthCheck(), DUNE::NeutrinoTrackingEff::truthLength(), DUNE::MuonTrackingEff::truthLength(), geo::PlaneGeo::UpdateDecompWireOrigin(), pma::Node3D::UpdateProj2D(), pma::ProjectionMatchingAlg::validate(), pma::ProjectionMatchingAlg::validate_on_adc(), and pma::ProjectionMatchingAlg::validate_on_adc_test().

1585  {
1586  return geo::vect::convertTo<::geo::Point_t>(p);
1587  }
template<typename Vector >
TVector3 geo::vect::toTVector3 ( Vector const &  v)

Converts a vector into a TVector3.

Definition at line 42 of file geo_vectors_utils_TVector.h.

Referenced by larg4::OpFastScintillation::propagationTime().

43  {
44  return convertTo<TVector3>(v);
45  }
template<typename Vector >
::geo::Vector_t geo::vect::toVector ( Vector const &  v)

Convert the specified vector into a geo::Vector_t.

Definition at line 1591 of file geo_vectors_utils.h.

Referenced by ShowerRecoTools::ShowerTrackDirection::CalculateElement(), and shower::TCShowerElectronLikelihood::getShowerProfile().

1592  {
1593  return geo::vect::convertTo<::geo::Vector_t>(v);
1594  }
template<typename Vector , typename Pred >
Vector geo::vect::transformCoords ( Vector const &  v,
Pred &&  pred 
)

Returns a new vector applying a predicate to each component.

Template Parameters
Vectortype of the vector in input (and output)
Predtype of unary predicate to be applied
Parameters
vthe vector to be transformed
predthe predicate to be applied
Returns
a vector equivelent to { pred(x), pred(y), ... }

The predicate is a "functor" type, taking as the single argument the coordinate to be transformed, and returning the transformed value of it.

Definition at line 2219 of file geo_vectors_utils.h.

References bindCoordReaders(), and util::values().

Referenced by iterateCoords(), rounded0(), and rounded01().

2220 {
2221  details::CoordinateArray_t<Vector> values;
2222  unsigned int i = 0;
2223  for (auto c : bindCoordReaders(v))
2224  values[i++] = pred(c());
2225  return makeFromCoords<Vector>(values);
2226 } // geo::vect::transformCoords()
constexpr auto bindCoordReaders(Vector const &v)
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
template<typename Vector >
auto geo::vect::vector_cbegin ( Vector const &  v)

Returns a const-iterator pointing to the first coordinate of v.

Definition at line 1113 of file geo_vectors_utils.h.

Referenced by begin(), ROOT::Math::begin(), cbegin(), ROOT::Math::cbegin(), and iterateCoords().

1114  {
1115  return CoordConstIterator(v, 0);
1116  }
template<typename Vector >
auto geo::vect::vector_cend ( Vector const &  v)

Returns a const-iterator pointing after the last coordinate of v.

Definition at line 1120 of file geo_vectors_utils.h.

References dimension().

Referenced by cend(), ROOT::Math::cend(), end(), ROOT::Math::end(), and iterateCoords().

1121  {
1122  return CoordConstIterator(v, geo::vect::dimension(v));
1123  }
constexpr unsigned int dimension()
Returns the dimension of the specified vector type.
template<typename Vector >
auto geo::vect::Xcoord ( Vector &  v)

Returns an object to manage the coordinate X of the vector v.

Template Parameters
Vectorthe type of vector to be managed
Parameters
vthe vector with the coordinate X to be managed
Returns
an object to manage the coordinate X of v

The type Vector needs to have a double X() const method and a auto SetX(auto) method, where the argument is the type of the managed coordinate and the return value is unspecified.

Definition at line 871 of file geo_vectors_utils.h.

References bindCoord().

Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 2U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 3U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), geo::vect::details::ConvertToImplDim< Dest, Source, 2U >::convert(), geo::vect::details::ConvertToImplDim< Dest, Source, 3U >::convert(), geo::vect::details::ConvertToImplDim< Dest, Source, 4U >::convert(), and geo::TPCGeo::GetCathodeCenterImpl().

872  {
873  return bindCoord(v, XcoordManager<Vector>);
874  }
auto bindCoord(Vector &v, CoordManager_t< Vector > helper) -> details::BoundCoordManager< CoordManager_t< Vector >, Vector >
Binds the specified vector to the coordinate manager.
template<typename Vector >
auto geo::vect::Ycoord ( Vector &  v)

Returns an object to manage the coordinate Y of the vector v.

Template Parameters
Vectorthe type of vector to be managed
Parameters
vthe vector with the coordinate Y to be managed
Returns
an object to manage the coordinate Y of v

The type Vector needs to have a double Y() const method and a auto SetY(auto) method, where the argument is the type of the managed coordinate and the return value is unspecified.

Definition at line 887 of file geo_vectors_utils.h.

Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 2U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 3U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), geo::vect::details::ConvertToImplDim< Dest, Source, 2U >::convert(), geo::vect::details::ConvertToImplDim< Dest, Source, 3U >::convert(), and geo::vect::details::ConvertToImplDim< Dest, Source, 4U >::convert().

888  {
889  return bindCoord<Vector>(v, YcoordManager<Vector>);
890  }
template<typename Vector >
auto geo::vect::Zcoord ( Vector &  v)

Returns an object to manage the coordinate Z of the vector v.

Template Parameters
Vectorthe type of vector to be managed
Parameters
vthe vector with the coordinate Z to be managed
Returns
an object to manage the coordinate Z of v

The type Vector needs to have a double Z() const method and a auto SetZ(auto) method, where the argument is the type of the managed coordinate and the return value is unspecified.

Definition at line 903 of file geo_vectors_utils.h.

Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 3U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), geo::vect::details::ConvertToImplDim< Dest, Source, 3U >::convert(), and geo::vect::details::ConvertToImplDim< Dest, Source, 4U >::convert().

904  {
905  return bindCoord<Vector>(v, ZcoordManager<Vector>);
906  }

Variable Documentation

template<typename Vector >
constexpr auto geo::vect::TcoordManager = details::makeCoordManager(&Vector::T, &Vector::SetT)
static

An object that can be bound to a vector to manage its T coordinate.

See also
geo::vect::XcoordManager

Definition at line 765 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto geo::vect::TcoordManager< Vector const > = details::makeCoordReader(&Vector::T)
static

An object that can be bound to a vector to manage its T coordinate.

See also
geo::vect::XcoordManager

Definition at line 770 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto geo::vect::XcoordManager = details::makeCoordManager(&Vector::X, &Vector::SetX)
static

Object that can be bound to a vector to manage its X coordinate.

Template Parameters
Vectortype of vector to get a manager for (mutable type required)

The manager exposes a read/write interface. Example of usage:

// mutable vectors get a full-featured "manager":
geo::Point_t p { 1.0, 2.0, 3.0 };
auto px
= geo::vect::bindCoord(p, geo::vect::XcoordManager<geo::Point_t>);
px *= 5.0;
std::cout << p << " has now x=" << px() << std::endl;

will print something like:

(5,2,3) has now x=5

Note that the use in the example, Xcoord() is preferred.

Definition at line 715 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto geo::vect::XcoordManager< Vector const > = details::makeCoordReader(&Vector::X)
static

Object that can be bound to a vector to access its X coordinate.

Template Parameters
Vectortype of vector to get a manager for (constant type required)

The manager exposes a read-only interface. Example of usage:

// constant vectors get a "reader" (read-only manager):
geo::Vector_t v { 1.0, 2.0, 3.0 };
(v, geo::vect::XcoordManager<geo::Vector_t const>);
std::cout << v << " has x=" << vx() << std::endl;

will print something like:

(1,2,3) has x=1

Note that the use in the example, Xcoord() is preferred.

Definition at line 739 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto const geo::vect::YcoordManager
static
Initial value:
=
Float_t Y
Definition: plot.C:37
constexpr auto makeCoordManager(Getter getter, Setter setter)

An object that can be bound to a vector to manage its Y coordinate.

See also
geo::vect::XcoordManager

Definition at line 744 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto geo::vect::YcoordManager< Vector const > = details::makeCoordReader(&Vector::Y)
static

An object that can be bound to a vector to manage its Y coordinate.

See also
geo::vect::XcoordManager

Definition at line 750 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto geo::vect::ZcoordManager = details::makeCoordManager(&Vector::Z, &Vector::SetZ)
static

An object that can be bound to a vector to manage its Z coordinate.

See also
geo::vect::XcoordManager

Definition at line 755 of file geo_vectors_utils.h.

template<typename Vector >
constexpr auto geo::vect::ZcoordManager< Vector const > = details::makeCoordReader(&Vector::Z)
static

An object that can be bound to a vector to manage its Z coordinate.

See also
geo::vect::XcoordManager

Definition at line 760 of file geo_vectors_utils.h.