229 #ifndef LARDATA_RECOBASEPROXY_TRACK_H
230 #define LARDATA_RECOBASEPROXY_TRACK_H
242 #include "canvas/Persistency/Common/Ptr.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"
553 art::Ptr<recob::Hit>,
586 template <
typename Data>
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>(); }
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; }
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>(); }
844 {
return base_t::template get<Tracks::TrackTrajectoryTag>(); }
950 template <
typename Pred>
999 {
return point(index); }
1035 template <
typename TrackCollProxy>
1207 template <
typename MainColl,
typename... AuxColl>
1238 template <
typename Event,
typename... WithArgs>
1240 (Event
const& event, art::InputTag
const& tag, WithArgs&&... withArgs)
1251 return maker_base_t::make(
1253 withAssociatedAs<recob::Hit, Tracks::HitTag>(),
1254 std::forward<WithArgs>(withArgs)...
1262 template <
typename Data>
1271 template <
typename TrackProxy>
1272 class TrackPointIterator {
1310 std::size_t index = std::numeric_limits<std::size_t>::max();
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>
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 momentum() const -> decltype(auto)
TrackPointIterator operator++(int)
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
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).
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Declaration of signal hit object.
Proxy tag for a recob::Track collection proxy.
auto index() const -> decltype(auto)
Returns the index of this point in the trajectory.
static constexpr std::size_t IndexIndex
bool isPointValid() const
Returns whether the trajectory point is valid.
Structure for range-for iteration.
process_name use argoneut_mc_hitfinder track
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.
static constexpr std::size_t TrackIndex
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.
static constexpr std::size_t NIndices
static constexpr std::size_t FitHitInfoIndex
TrackPointIterator< track_proxy_t > point_iterator
Iterator for trajectory point information.
tracking::Vector_t Vector_t
TrackPointIterator()=default
Type of track point information.
static constexpr std::size_t HitIndex
A class containing a set of flags.
Wrapper for a track data proxy.
TrackPointIteratorBox(track_proxy_t const &track)
TrackPoint(TrackPointData const &data)
PointFlags_t const & FlagsAtPoint(size_t i) const
Returns the flags for the specified trajectory point.
constexpr mask_t< EnumType > mask(EnumType bit, OtherBits...otherBits)
Returns a mask with all specified bits set.
TrackPointIterator(track_proxy_t const &track, std::size_t index)
static auto make(Event const &event, art::InputTag const &tag, WithArgs &&...withArgs)
Creates and returns a collection proxy based on CollProxy and with the requested associated data...
A trajectory in space reconstructed from hits.
T LocationAtPoint(unsigned int p) const
Position at point p. Use e.g. as:
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.
std::size_t index() const
Returns the index of this element in the collection.
Data product for reconstructed trajectory in space.
auto withParallelDataAs(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.
std::size_t nHits() const
Returns the number of hits associated with this track.
auto flags() const -> decltype(auto)
Provides recob::Track data product.
static constexpr bool asserts
auto position() const -> decltype(auto)
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
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.
tracking::Point_t Point_t
auto hitAtPoint(std::size_t index) const -> decltype(auto)
Returns an art pointer to the hit associated with the specified point.
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.
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.
T MomentumVectorAtPoint(unsigned int p) const
Momentum vector at point p. Use e.g. as:
auto points() const
Returns an iterable range with point-by-point information.
main_element_t const & operator*() const
Returns a reference to the main element.
Number of supported track types.
TrackPoint const * pointer
recob::Track const & track() const
Returns the track this point belongs to.
bool operator!=(TrackPointIterator const &other) const
recob::TrackTrajectory const * originalTrajectoryCPtr() const noexcept
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:
recob::Track const & track() const
Returns the pointed track.
TrackPointWrapper & operator=(TrackPointWrapper const &)=default
auto withZeroOrOneAs(Args &&...args)
TrackPointWrapper()=default