14 #include "Math/GenVector/Cartesian3D.h" 15 #include "Math/GenVector/DisplacementVector3D.h" 16 #include "Math/GenVector/PositionVector3D.h" 19 #include <type_traits> 26 (TVector3
const& point,
double wiggle )
const 31 (
double const* point,
double wiggle )
const 40 std::vector<geo::Point_t> IntersectionPoints;
41 std::vector<double> LineParameters;
47 static std::array<geo::Vector_t, 6U>
const NormalVectors = {{
48 -geo::Xaxis<geo::Vector_t>(), geo::Xaxis<geo::Vector_t>(),
49 -geo::Yaxis<geo::Vector_t>(), geo::Yaxis<geo::Vector_t>(),
50 -geo::Zaxis<geo::Vector_t>(), geo::Zaxis<geo::Vector_t>()
54 std::array<geo::Point_t, 6U>
const NormalVectorOffsets = {{
64 for(
unsigned int face_no = 0; face_no < NormalVectors.size(); face_no++)
67 if(NormalVectors[face_no].Dot(TrajectoryDirect))
70 LineParameters.push_back( NormalVectors[face_no].Dot(NormalVectorOffsets.at(face_no) - TrajectoryStart)
71 / NormalVectors[face_no].Dot(TrajectoryDirect) );
76 IntersectionPoints.push_back( TrajectoryStart + LineParameters.back()*TrajectoryDirect );
79 unsigned int NoCheckCoord;
85 NoCheckCoord = (face_no - 1)/2;
90 NoCheckCoord = face_no/2;
94 unsigned int coord = 0;
95 for(
auto extractCoord: geo::vect::coordReaders<geo::Point_t>())
105 if( coord++ != NoCheckCoord && ((lastPointCoord() > maxCoord()) || (lastPointCoord() < minCoord)) )
108 LineParameters.pop_back();
109 IntersectionPoints.pop_back();
116 if(LineParameters.size() == 2 && LineParameters.front() > LineParameters.back())
118 std::swap(IntersectionPoints.front(),IntersectionPoints.back());
121 return IntersectionPoints;
126 (TVector3
const& TrajectoryStart, TVector3
const& TrajectoryDirect)
const 128 std::vector<TVector3> intersections;
130 intersections.emplace_back(point.X(), point.Y(), point.Z());
131 return intersections;
137 for (
auto coordMan: geo::vect::coordManagers<geo::Point_t>()) {
Utilities to extend the interface of geometry vectors.
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.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
void swap(Handle< T > &a, Handle< T > &b)
geo::Point_t Min() const
Returns the corner point with the smallest coordinates.
static int max(int a, int b)
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)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
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.
LArSoft geometry interface.
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.