229 #ifndef LARDATA_RECOBASEPROXY_TRACK_H 230 #define LARDATA_RECOBASEPROXY_TRACK_H 245 #include "range/v3/view/filter.hpp" 251 template <
typename TrackProxy>
254 template <
typename Data>
260 template <
typename CollProxy>
263 template <
typename T>
266 template <
typename Obj>
269 template <
typename Data>
273 static_assert(
sizeof(
Wrapper_t) == 1U,
"Wrapper carries data!");
275 static_assert(std::is_same<
276 std::decay_t<decltype(std::declval<Wrapper_t>().position())>,
279 "position() is not a recob::Track::Point_t" 281 static_assert(std::is_same<
282 std::decay_t<decltype(std::declval<Wrapper_t>().momentum())>,
285 "momentum() is not a recob::Track::Vector_t" 287 static_assert(std::is_same<
288 std::decay_t<decltype(std::declval<Wrapper_t>().flags())>,
291 "flags() is not a recob::Track::PointFlags_t" 293 static_assert(std::is_same<
294 std::decay_t<decltype(std::declval<Wrapper_t>().hitPtr())>,
297 "hit() is not a art::Ptr<recob::Hit>" 299 static_assert(std::is_same<
300 std::decay_t<decltype(std::declval<Wrapper_t>().index())>,
303 "index() is not a std::size_t" 585 template <
typename Data>
590 static constexpr std::size_t TrackIndex = 0;
591 static constexpr std::size_t HitIndex = 1;
592 static constexpr std::size_t FitHitInfoIndex = 2;
593 static constexpr std::size_t IndexIndex = 3;
594 static constexpr std::size_t NIndices = 4;
597 "Unexpected data size.");
600 {
return reinterpret_cast<Wrapped_t const&
>(*this); }
602 template <std::
size_t N>
603 auto get()
const -> decltype(
auto) {
return std::get<N>(base()); }
616 {
return *get<TrackIndex>(); }
621 {
return track().Trajectory().LocationAtPoint(index()); }
626 {
return track().Trajectory().MomentumVectorAtPoint(index()); }
633 auto flags()
const -> decltype(
auto)
636 {
return track().Trajectory().FlagsAtPoint(index()); }
652 art::Ptr<recob::Hit>
hitPtr()
const {
return get<HitIndex>(); }
664 {
return get<FitHitInfoIndex>(); }
667 auto index() const -> decltype(auto) {
return get<IndexIndex >(); }
671 { decltype(
auto) ptr = hitPtr();
return ptr? ptr.get():
nullptr; }
692 static constexpr
bool asserts
706 template <
typename TrackProxy>
708 (TrackProxy
const&
track, std::size_t index)
713 track.hitAtPoint(index),
714 track.fitInfoAtPoint(index),
729 template <
typename CollProxy>
734 using base_t::base_t;
791 auto hits() const -> decltype(auto)
792 {
return base_t::template get<Tracks::HitTag>(); }
796 {
return hits()[index]; }
806 recob::TrackFitHitInfo
const* fitInfoAtPoint(std::size_t index)
const;
838 {
return !originalTrajectoryPtr().isNull(); }
843 {
return base_t::template get<Tracks::TrackTrajectoryTag>(); }
855 {
return *originalTrajectoryPtr(); }
949 template <
typename Pred>
950 auto selectPoints(Pred&& pred)
const;
998 {
return point(index); }
1014 {
return hasOriginalTrajectory()? &originalTrajectory():
nullptr; }
1034 template <
typename TrackCollProxy>
1206 template <
typename MainColl,
typename... AuxColl>
1237 template <
typename Event,
typename... WithArgs>
1250 return maker_base_t::make(
1252 withAssociatedAs<recob::Hit, Tracks::HitTag>(),
1253 std::forward<WithArgs>(withArgs)...
1261 template <
typename Data>
1270 template <
typename TrackProxy>
1326 : track(&track), index(index)
1332 {
auto it = *
this; this->operator++();
return it; }
1339 {
return (index == other.
index) && (track == other.
track); }
1342 {
return (index != other.
index) || (track != other.
track); }
1356 template <
typename T>
1357 struct isTrackProxy:
public std::false_type {};
1359 template <
typename TrackCollProxy>
1365 template <
typename CollProxy>
1373 {
return track->beginPoint(); }
1376 {
return track->endPoint(); }
1389 template <
typename CollProxy>
1396 return &(
track().Trajectory());
1398 return originalTrajectoryCPtr();
1406 template <
typename CollProxy>
1407 recob::TrackFitHitInfo
const*
1409 (std::size_t index)
const 1411 if (!base_t::template has<Tracks::TrackFitHitInfoTag>())
1413 auto&& fitInfo = base_t::template getIf<
1415 std::vector<recob::TrackFitHitInfo>
const&
1417 return &(fitInfo[index]);
1422 template <
typename CollProxy>
1423 template <
typename Pred>
1429 template <
typename CollProxy>
1434 selectPoints([mask](
auto&& point) {
return point.flags().match(mask); });
1443 #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.
recob::TrackFitHitInfo TrackFitHitInfoTag
Tag used for the "standard" track fit information.
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).
Declaration of signal hit object.
Proxy tag for a recob::Track collection proxy.
auto withZeroOrOneAs(Args &&...args)
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)
Provides recob::Track data product.
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
Returns an iterable range with point-by-point information.
auto wrapTrackPoint(Data const &wrappedData)
"Converts" point data into a proxy::TrackPointWrapper.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Data product for reconstructed trajectory in space.
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.
recob::TrackFitHitInfo const * fitInfoPtr() const
Returns fit info associated with the trajectory point.
TrackPoint point(std::size_t index) const
std::string value(boost::any 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
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.
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 withParallelDataAs(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.