LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Class for track proxy elements. More...
#include "Track.h"
Public Types | |
using | base_t = CollectionProxyElement< CollProxy > |
Base type. More... | |
using | track_proxy_t = TrackCollectionProxyElement< CollProxy > |
This type. More... | |
using | point_iterator = TrackPointIterator< track_proxy_t > |
Iterator for trajectory point information. More... | |
using | collection_proxy_t = CollProxy |
using | main_element_t = typename collection_proxy_t::main_element_t |
using | aux_elements_t = typename details::SubstituteWithAuxList< typename collection_proxy_t::aux_collections_t >::type |
Tuple of elements (expected to be tagged types). More... | |
Public Member Functions | |
recob::Track const & | track () const |
Returns the pointed track. More... | |
recob::TrackTrajectory const * | operator() (proxy::Tracks::TrackType_t type) const noexcept |
Returns the requested trajectory from the proxy. More... | |
recob::TrackFitHitInfo const * | fitInfoAtPoint (std::size_t index) const |
Returns fit info for the specified point (nullptr if not available). More... | |
main_element_t const * | operator-> () const |
Returns a pointer to the main element. More... | |
main_element_t const & | operator* () const |
Returns a reference to the main element. More... | |
std::size_t | index () const |
Returns the index of this element in the collection. More... | |
template<typename Tag > | |
auto | get () const -> decltype(auto) |
Returns the auxiliary data specified by type (Tag ). More... | |
template<typename Tag , typename T = Tag const&> | |
auto | getIf () const -> decltype(auto) |
Returns the auxiliary data specified by type (Tag ). More... | |
Direct hit interface. | |
The track prescription requires one hit per trajectory point.
The interface at track proxy level allows for both access to the whole sequence of hits, or to the hit of a specific point: assert(track.nHits() > 0); art::Ptr<recob::Hit> maxHit = hits[0]; // direct access maxHit = hit; } // for | |
auto | hits () const -> decltype(auto) |
Returns a collection-like range of hits of this track, at point order. More... | |
auto | hitAtPoint (std::size_t index) const -> decltype(auto) |
Returns an art pointer to the hit associated with the specified point. More... | |
std::size_t | nHits () const |
Returns the number of hits associated with this track. More... | |
Direct track trajectory interface | |
The interface allows to check if this track has a trajectory associated with it, and to obtain a reference to it or its art pointer. bool hasTraj = proxy.hasOriginalTrajectory(); if (hasTraj) { // ... } art::Ptr<recob::TrackTrajectory> const& trajectoryPtr = proxy.originalTrajectoryPtr(); if (!trajectoryPtr.isNull()) { recob::TrackTrajectory const& trajectory = *trajectoryPtr; // ... }
| |
bool | hasOriginalTrajectory () const |
Returns whether this track is associated to a trajectory. More... | |
art::Ptr< recob::TrackTrajectory > const & | originalTrajectoryPtr () const |
recob::TrackTrajectory const & | originalTrajectory () const |
Returns a reference to the associated trajectory. More... | |
Point-by-point iteration interface | |
The points on track can be accessed individually with a special, non-extensible proxy. In this example, points are accessed via iteration: unsigned int nValidHits = 0; } unsigned int nValidPoints = std::count_if Random (index-based) access is also available: | |
auto | points () const |
Returns an iterable range with point-by-point information. More... | |
template<typename Pred > | |
auto | selectPoints (Pred &&pred) const |
Returns an iterable range with only points matching the mask . More... | |
auto | pointsWithFlags (recob::TrackTrajectory::PointFlags_t::Mask_t mask) const |
Returns an iterable range with only points matching the mask . More... | |
std::size_t | nPoints () const |
Returns the number of trajectory points in the track. More... | |
point_iterator | beginPoint () const |
Returns the iterator to the data of the first point. More... | |
point_iterator | endPoint () const |
Returns the iterator past the last point. More... | |
TrackPoint | point (std::size_t index) const |
TrackPoint | operator[] (std::size_t index) const |
Returns an iterable range with point-by-point information. More... | |
Static Public Member Functions | |
template<typename Tag > | |
static constexpr bool | has () |
Returns whether this class knowns about the specified type (Tag ). More... | |
Private Member Functions | |
recob::TrackTrajectory const * | originalTrajectoryCPtr () const noexcept |
Class for track proxy elements.
CollProxy | type of track proxy collection to get data from |
For details on the track point interface see proxy::TrackPoint
.
|
inherited |
Tuple of elements (expected to be tagged types).
Definition at line 166 of file CollectionProxyElement.h.
using proxy::TrackCollectionProxyElement< CollProxy >::base_t = CollectionProxyElement<CollProxy> |
|
inherited |
Definition at line 161 of file CollectionProxyElement.h.
|
inherited |
Definition at line 162 of file CollectionProxyElement.h.
using proxy::TrackCollectionProxyElement< CollProxy >::point_iterator = TrackPointIterator<track_proxy_t> |
using proxy::TrackCollectionProxyElement< CollProxy >::track_proxy_t = TrackCollectionProxyElement<CollProxy> |
|
inline |
|
inline |
Returns the iterator past the last point.
Definition at line 950 of file Track.h.
recob::TrackFitHitInfo const * proxy::TrackCollectionProxyElement< CollProxy >::fitInfoAtPoint | ( | std::size_t | index | ) | const |
Returns fit info for the specified point (nullptr
if not available).
Definition at line 1352 of file Track.h.
|
inlineinherited |
Returns the auxiliary data specified by type (Tag
).
Definition at line 185 of file CollectionProxyElement.h.
|
inherited |
Returns the auxiliary data specified by type (Tag
).
Tag | tag of the data to fetch (usually, its type) |
T | type to return (by default, a constant reference to Tag ) |
Tag
). std::logic_error | if the tag is not available. |
if constexpr
should be used instead (see the example below)This method is a get()
which forgives when the requested type is not available (because this proxy was configured not to hold it).
The difference with get()
is the following:
If the proxy tracks
has not been coded with recob::Hit
data, the code snippet will not compile, because get()
will not compile for tags that were not coded in. On the other end, if recob::Hit
is coded in tracks
but recob::SpacePoint
is not, the snippet will compile. In that case, if the has()
check had been omitted, getIt()
would throw a std::logic_error
exception when executed. With C++17, this will not be necessary any more by using "constexpr if":
recob::SpacePoint
) is not registered in the proxy, getIf()
has no clue of what the return value should be ("which is the type of
the data that does not exist?"). Definition at line 351 of file CollectionProxyElement.h.
|
inlinestaticinherited |
Returns whether this class knowns about the specified type (Tag
).
Definition at line 266 of file CollectionProxyElement.h.
|
inline |
Returns whether this track is associated to a trajectory.
Definition at line 800 of file Track.h.
|
inline |
Returns an art pointer to the hit associated with the specified point.
Definition at line 761 of file Track.h.
References hits().
|
inline |
Returns a collection-like range of hits of this track, at point order.
One hit is expected per trajectory point. Hits can be missing, in which case the art pointer will have isNull()
as true
.
|
inlineinherited |
Returns the index of this element in the collection.
Definition at line 181 of file CollectionProxyElement.h.
|
inline |
Returns the number of hits associated with this track.
Definition at line 764 of file Track.h.
References hits().
|
inline |
Returns the number of trajectory points in the track.
Definition at line 944 of file Track.h.
References track.
|
noexcept |
Returns the requested trajectory from the proxy.
type | type of the track trajectory to be returned |
Definition at line 1340 of file Track.h.
References proxy::Tracks::Fitted, track, and proxy::Tracks::Unfitted.
|
inlineinherited |
Returns a reference to the main element.
Definition at line 178 of file CollectionProxyElement.h.
|
inlineinherited |
Returns a pointer to the main element.
Definition at line 175 of file CollectionProxyElement.h.
|
inline |
Returns an iterable range with point-by-point information.
The interface of the elements is documented in TrackPointWrapper
. Example:
will iterate through all points (including the invalid ones, hence the check).
Definition at line 956 of file Track.h.
|
inline |
Returns a reference to the associated trajectory.
If the track is not associated to any trajectory, the return value is undefined. This condition should be checked beforehand, e.g. with hasTrajectory()
.
Definition at line 818 of file Track.h.
|
inlineprivatenoexcept |
Definition at line 969 of file Track.h.
|
inline |
|
inline |
Extracts information from the specified point.
Definition at line 954 of file Track.h.
References proxy::makeTrackPointData(), and track.
|
inline |
Returns an iterable range with point-by-point information.
The interface of the elements is documented in TrackPointWrapper
. Example:
will iterate through all points (including the invalid ones, hence the check).
auto proxy::TrackCollectionProxyElement< CollProxy >::pointsWithFlags | ( | recob::TrackTrajectory::PointFlags_t::Mask_t | mask | ) | const |
Returns an iterable range with only points matching the mask
.
mask | point flag mask to be matched |
points()
, util::flags::BitMask::match()
This methods is used in a way similar to points()
, with the addition of specifying a mask
of flags. The iteration will happen only through the points which match the mask. that is for which pointInfo.flags().match(mask)
is true
.
The interface of the elements is documented in TrackPointWrapper
. Example:
will iterate through only the points which do not have the NoPoint
flag set (which have in fact a valid position).
Definition at line 1373 of file Track.h.
auto proxy::TrackCollectionProxyElement< CollProxy >::selectPoints | ( | Pred && | pred | ) | const |
Returns an iterable range with only points matching the mask
.
Pred | type of predicate to test on points |
pred | predicate to be fulfilled by the points |
points()
, pointsWithFlags()
This methods is used in a way similar to points()
, with the addition of specifying a criterium (predicate) defining the selected points. The iteration will happen only through the points which fulfil the predicate.
The interface of the elements is documented in TrackPointWrapper
. Example:
will iterate through all points which are valid and whose position is at z absolute coordinate larger than 50 centimeters (whatever it means).
Pred
is a unary function object which can accept a TrackPoint
object as its sole argument and which returns a value convertible to bool
Definition at line 1366 of file Track.h.
References util::filterRangeFor().
|
inline |
Returns the pointed track.
Definition at line 712 of file Track.h.
References operator*().