9 #ifndef ICARUSCODE_ANALYSIS_TRIGGER_DETAILS_CATHODECROSSINGUTILS_H
10 #define ICARUSCODE_ANALYSIS_TRIGGER_DETAILS_CATHODECROSSINGUTILS_H
22 #include <type_traits>
47 static std::size_t
const NoIndex = std::numeric_limits<std::size_t>::max();
114 template <
typename Iter>
116 (Iter
begin, Iter
end, CathodeDesc_t
const& cathode);
127 template <
typename Iter>
129 (Iter
begin, Iter
end, CathodeDesc_t
const& cathode)
131 using Point_t =
typename Iter::value_type;
135 static_assert(std::is_same_v<Point_t, geo::Point_t>,
136 "icarus::detectCrossing() only supports geo::Point_t points;"
137 " if needed, ask the author for extension"
140 auto const isNegative = [&cathode]
141 (
auto const&
p) {
return distance(
p, cathode) < 0.0; };
143 auto const [ itBeforeCathode, itAfterCathode ]
146 if (itBeforeCathode == itAfterCathode) {
155 CathodeCrossing_t crossInfo;
157 crossInfo.indexBefore =
std::distance(begin, itBeforeCathode);
164 auto const step = (*itAfterCathode - *itBeforeCathode);
170 double const fTotal = fBefore + fAfter;
174 crossInfo.before += fBefore * stepLength;
175 crossInfo.after += fAfter * stepLength;
177 crossInfo.crossingPoint = *itBeforeCathode + fBefore * step;
186 #endif // ICARUSCODE_ANALYSIS_TRIGGER_DETAILS_CATHODECROSSINGUTILS_H
bool operator!() const
Returns whether the crossing information is invalid.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
geo::Point_t crossingPoint
Trajectory crossing point.
CathodeDesc_t findTPCcathode(geo::Point_t const &point, geo::GeometryCore const &geom)
Returns cathode information for cryostat at the specified point.
double after
Length of the path "after" the cathode.
Geometry information for a single cryostat.
geo::Point_t findCathodeCenter(geo::CryostatGeo const &cryo)
Returns the center of the cathode in the specified cryostat.
recob::tracking::Point_t Point_t
Simple description for the cathode.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Definitions of geometry vector data types.
std::size_t indexBefore
Index of the point "before" cathode.
auto end(FixedBins< T, C > const &) noexcept
double pathLength(BIter begin, EIter end)
Returns the total length of the specified path.
Description of geometry of one entire detector.
auto norm(Vector const &v)
Return norm of the specified vector.
auto begin(FixedBins< T, C > const &) noexcept
CathodeCrossing_t detectCrossing(Iter begin, Iter end, CathodeDesc_t const &cathode)
Returns the crossing point of a trajectory on the cathode.
double before
Length of the path "before" the cathode.
Algorithms dealing with a trajectory as a sequence of 3D points.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Information about the cathode crossing of a path.
static std::size_t const NoIndex
std::size_t indexAfter
Index of the point "after" cathode.
std::pair< Iter, Iter > findCrossingSegment(Iter begin, Iter end, SideFunc sideOf)
Returns a path segment with ends on different sides than path ends.