14 #include "Math/GenVector/Cartesian3D.h" 15 #include "Math/GenVector/DisplacementVector3D.h" 16 #include "Math/GenVector/PositionVector3D.h" 19 #include <type_traits> 41 std::vector<geo::Point_t> IntersectionPoints;
42 std::vector<double> LineParameters;
48 static std::array<geo::Vector_t, 6U>
const NormalVectors = {{
49 -geo::Xaxis<geo::Vector_t>(),
50 geo::Xaxis<geo::Vector_t>(),
51 -geo::Yaxis<geo::Vector_t>(),
52 geo::Yaxis<geo::Vector_t>(),
53 -geo::Zaxis<geo::Vector_t>(),
54 geo::Zaxis<geo::Vector_t>()
58 std::array<geo::Point_t, 6U>
const NormalVectorOffsets = {{
68 for (
unsigned int face_no = 0; face_no < NormalVectors.size(); face_no++) {
70 if (NormalVectors[face_no].Dot(TrajectoryDirect)) {
72 LineParameters.push_back(
73 NormalVectors[face_no].Dot(NormalVectorOffsets.at(face_no) - TrajectoryStart) /
74 NormalVectors[face_no].Dot(TrajectoryDirect));
80 IntersectionPoints.push_back(TrajectoryStart + LineParameters.back() * TrajectoryDirect);
83 unsigned int NoCheckCoord;
88 NoCheckCoord = (face_no - 1) / 2;
92 NoCheckCoord = face_no / 2;
96 unsigned int coord = 0;
97 for (
auto extractCoord : geo::vect::coordReaders<geo::Point_t>()) {
106 if (coord++ != NoCheckCoord &&
107 ((lastPointCoord() > maxCoord()) || (lastPointCoord() < minCoord))) {
109 LineParameters.pop_back();
110 IntersectionPoints.pop_back();
117 if (LineParameters.size() == 2 && LineParameters.front() > LineParameters.back()) {
118 std::swap(IntersectionPoints.front(), IntersectionPoints.back());
121 return IntersectionPoints;
126 TVector3
const& TrajectoryDirect)
const 128 std::vector<TVector3> intersections;
129 for (
auto const& point :
131 intersections.emplace_back(point.X(), point.Y(), point.Z());
132 return intersections;
139 for (
auto coordMan : geo::vect::coordManagers<geo::Point_t>()) {
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
constexpr auto bindCoord(Vector const &v, CoordReader_t< Vector > helper)
Binds the specified constant vector to the coordinate reader.
Utilities to extend the interface of geometry vectors.
geo::Point_t Min() const
Returns the corner point with the smallest coordinates.
Provides a base class aware of world box coordinates.
Coords_t c_max
maximum coordinates (x, y, z)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Coords_t c_min
minimum coordinates (x, y, z)
void SortCoordinates()
Makes sure each coordinate of the minimum point is smaller than maximum.
std::vector< TVector3 > GetIntersections(TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
Calculates the entry and exit points of a trajectory on the box surface.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
Namespace collecting geometry-related classes utilities.
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
bool ContainsPosition(geo::Point_t const &point, double wiggle=1.0) const
Returns whether this volume contains the specified point.