229 #ifndef LARDATA_RECOBASEPROXY_TRACK_H 230 #define LARDATA_RECOBASEPROXY_TRACK_H 252 template <
typename TrackProxy>
255 template <
typename Data>
261 template <
typename CollProxy>
264 template <
typename T>
267 template <
typename Obj>
270 template <
typename Data>
274 static_assert(
sizeof(
Wrapper_t) == 1U,
"Wrapper carries data!");
276 static_assert(std::is_same<
277 std::decay_t<decltype(std::declval<Wrapper_t>().
position())>,
280 "position() is not a recob::Track::Point_t" 282 static_assert(std::is_same<
283 std::decay_t<decltype(std::declval<Wrapper_t>().
momentum())>,
286 "momentum() is not a recob::Track::Vector_t" 288 static_assert(std::is_same<
289 std::decay_t<decltype(std::declval<Wrapper_t>().flags())>,
292 "flags() is not a recob::Track::PointFlags_t" 294 static_assert(std::is_same<
295 std::decay_t<decltype(std::declval<Wrapper_t>().hitPtr())>,
298 "hit() is not a art::Ptr<recob::Hit>" 300 static_assert(std::is_same<
301 std::decay_t<decltype(std::declval<Wrapper_t>().
index())>,
304 "index() is not a std::size_t" 586 template <
typename Data>
591 static constexpr std::size_t TrackIndex = 0;
592 static constexpr std::size_t HitIndex = 1;
593 static constexpr std::size_t FitHitInfoIndex = 2;
594 static constexpr std::size_t IndexIndex = 3;
595 static constexpr std::size_t NIndices = 4;
598 "Unexpected data size.");
603 template <std::
size_t N>
604 auto get()
const -> decltype(
auto) {
return std::get<N>(
base()); }
617 {
return *get<TrackIndex>(); }
622 {
return track().Trajectory().LocationAtPoint(
index()); }
627 {
return track().Trajectory().MomentumVectorAtPoint(
index()); }
637 {
return track().Trajectory().FlagsAtPoint(
index()); }
653 art::Ptr<recob::Hit>
hitPtr()
const {
return get<HitIndex>(); }
665 {
return get<FitHitInfoIndex>(); }
668 auto index()
const -> decltype(auto) {
return get<IndexIndex >(); }
672 { decltype(
auto) ptr = hitPtr();
return ptr? ptr.get():
nullptr; }
693 static constexpr
bool asserts
707 template <
typename TrackProxy>
709 (TrackProxy
const& track, std::size_t
index)
714 track.hitAtPoint(index),
715 track.fitInfoAtPoint(index),
730 template <
typename CollProxy>
735 using base_t::base_t;
793 {
return base_t::template get<Tracks::HitTag>(); }
797 {
return hits()[
index]; }
800 std::size_t
nHits()
const {
return hits().size(); }
807 recob::TrackFitHitInfo
const* fitInfoAtPoint(std::size_t index)
const;
839 {
return !originalTrajectoryPtr().isNull(); }
844 {
return base_t::template get<Tracks::TrackTrajectoryTag>(); }
856 {
return *originalTrajectoryPtr(); }
950 template <
typename Pred>
951 auto selectPoints(Pred&&
pred)
const;
985 std::size_t
nPoints()
const {
return track().NPoints(); }
999 {
return point(index); }
1015 {
return hasOriginalTrajectory()? &originalTrajectory():
nullptr; }
1035 template <
typename TrackCollProxy>
1207 template <
typename MainColl,
typename... AuxColl>
1238 template <
typename Event,
typename... WithArgs>
1253 withAssociatedAs<recob::Hit, Tracks::HitTag>(),
1254 std::forward<WithArgs>(withArgs)...
1262 template <
typename Data>
1271 template <
typename TrackProxy>
1327 : track(&track), index(index)
1333 {
auto it = *
this; this->operator++();
return it; }
1340 {
return (index == other.
index) && (track == other.
track); }
1343 {
return (index != other.
index) || (track != other.
track); }
1357 template <
typename T>
1358 struct isTrackProxy:
public std::false_type {};
1360 template <
typename TrackCollProxy>
1366 template <
typename CollProxy>
1374 {
return track->beginPoint(); }
1377 {
return track->endPoint(); }
1390 template <
typename CollProxy>
1397 return &(track().Trajectory());
1399 return originalTrajectoryCPtr();
1407 template <
typename CollProxy>
1408 recob::TrackFitHitInfo
const*
1410 (std::size_t index)
const 1412 if constexpr (base_t::template has<Tracks::TrackFitHitInfoTag>()) {
1413 auto const& fitInfo = base_t::template get<Tracks::TrackFitHitInfoTag>();
1414 return &(fitInfo[
index]);
1416 else return nullptr;
1421 template <
typename CollProxy>
1422 template <
typename Pred>
1428 template <
typename CollProxy>
1433 selectPoints([mask](
auto&& point) {
return point.flags().match(mask); });
1442 #endif // LARDATA_RECOBASEPROXY_TRACK_H auto hitAtPoint(std::size_t index) const -> decltype(auto)
Returns an art pointer to the hit associated with the specified point.
TrackPointIterator operator++(int)
auto withOriginalTrajectory(art::InputTag const &inputTag)
Adds recob::TrackTrajectory information to the proxy.
std::size_t nPoints() const
Returns the number of trajectory points in the track.
Collection of data type definitions for collection proxies.
const_iterator begin() const
auto selectPoints(Pred &&pred) const
Returns an iterable range with only points matching the mask.
std::vector< recob::Track > TrackDataProduct_t
Type of the main collection.
std::ptrdiff_t difference_type
art::Ptr< recob::TrackTrajectory > const & originalTrajectoryPtr() const
art::Ptr< recob::Hit > hitPtr() const
Returns the hit associated with the trajectory point.
Class to assemble the required proxy.
std::input_iterator_tag iterator_category
recob::TrackFitHitInfo const * fitInfoAtPoint(std::size_t index) const
Returns fit info for the specified point (nullptr if not available).
Proxy tag for a recob::Track collection proxy.
bool isPointValid() const
Returns whether the trajectory point is valid.
auto position() const -> decltype(auto)
Structure for range-for iteration.
auto filterRangeFor(Range &&range, Pred &&pred) -> decltype(auto)
Provides iteration only through elements passing a condition.
Base utilities for the implementation of data product facades.
auto hits() const -> decltype(auto)
Returns a collection-like range of hits of this track, at point order.
bool operator==(TrackPointIterator const &other) const
Class for track proxy elements.
std::tuple< recob::Track const *, art::Ptr< recob::Hit >, recob::TrackFitHitInfo const *, std::size_t > TrackPointData
Container of track point information.
Base representation of a collection of proxied objects.
TrackPointData makeTrackPointData(TrackProxy const &track, std::size_t index)
Returns an object with information about the specified track point.
tracking::Vector_t Vector_t
Type of track point information.
A class containing a set of flags.
Wrapper for a track data proxy.
TrackPointIteratorBox(track_proxy_t const &track)
TrackPoint(TrackPointData const &data)
TrackPointIterator(track_proxy_t const &track, std::size_t index)
recob::TrackTrajectory const * originalTrajectoryCPtr() const noexcept
A trajectory in space reconstructed from hits.
Object storing per-hit information from a track fit.
TrackPoint(TrackPointData &&data)
const_iterator end() const
std::add_const_t< TrackPointData > Wrapped_t
Class to assemble the required proxy.
TrackPoint operator[](std::size_t index) const
auto wrapTrackPoint(Data const &wrappedData)
"Converts" point data into a proxy::TrackPointWrapper.
auto withParallelDataAs(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.
static int max(int a, int b)
auto index() const -> decltype(auto)
Returns the index of this point in the trajectory.
std::size_t nHits() const
Returns the number of hits associated with this track.
point_iterator endPoint() const
Returns the iterator past the last point.
value_type operator*() const
An element of a collection proxy.
auto flags() const -> decltype(auto)
recob::TrackFitHitInfo const * fitInfoPtr() const
Returns fit info associated with the trajectory point.
Declaration of signal hit object.
TrackPoint point(std::size_t index) const
recob::Hit const * hit() const
Returns a pointer to the hit on the trajectory point, if any.
auto pointsWithFlags(recob::TrackTrajectory::PointFlags_t::Mask_t mask) const
Returns an iterable range with only points matching the mask.
typename track_proxy_t::point_iterator const_iterator
Represents a track trajectory before the final fit.
track_proxy_t const * track
tracking::Point_t Point_t
Provides recob::Track data product.
TrackType_t
Types of tracks and trajectories.
Utilities to manipulate range for loops.
auto withFitHitInfo(art::InputTag const &inputTag)
Adds recob::TrackFitHitInfo information to the proxy.
point_iterator beginPoint() const
Returns the iterator to the data of the first point.
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
bool hasOriginalTrajectory() const
Returns whether this track is associated to a trajectory.
auto momentum() const -> decltype(auto)
2D representation of charge deposited in the TDC/wire plane
recob::TrackTrajectory const & originalTrajectory() const
Returns a reference to the associated trajectory.
Represents a track trajectory from the final fit.
auto points() const
Returns an iterable range with point-by-point information.
def momentum(x1, x2, x3, scale=1.)
QuadExpr operator*(double v, const QuadExpr &e)
TrackPoint const * pointer
recob::Track const & track() const
Returns the track this point belongs to.
bool operator!=(TrackPointIterator const &other) const
Wrapped_t const & base() const
Set of flags pertaining a point of the track.
TrackPointIterator & operator++()
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Event finding and building.
recob::Track const & track() const
Returns the pointed track.
auto withZeroOrOneAs(Args &&...args)