LArSoft utility namespace. More...
Namespaces | |
detail | |
details | |
LArSoft utility implementation details. | |
simple_geo | |
Simple class definitions for geometry concepts. | |
Classes | |
struct | RealComparisons |
Provides simple real number checks. More... | |
struct | Vector2DComparison |
Class comparing 2D vectors. More... | |
struct | Vector3DComparison |
Class comparing 2D vectors. More... | |
struct | assns_has_metadata |
Trait: value true if Assns (association or its node) has metadata. More... | |
struct | assns_metadata_type |
Trait: type is metadata in Assns (association or its node). More... | |
struct | assns_iterator_type |
Trait: type is iterator of Assns . More... | |
struct | assns_traits |
Data types for the specified association type (or its node). More... | |
struct | assns_metadata_type< art::Assns< L, R, D > > |
struct | assns_metadata_type< art::AssnsNode< L, R, D > > |
struct | assns_metadata_type< std::pair< art::Ptr< L >, art::Ptr< R > > > |
struct | assns_iterator_type< art::Assns< L, R, D > > |
struct | assns_iterator_type< art::Assns< L, R, void > > |
struct | assns_traits< art::Assns< L, R, D > > |
struct | assns_traits< art::AssnsNode< L, R, D > > |
struct | assns_traits< std::pair< art::Ptr< L >, art::Ptr< R > > > |
struct | assns_metadata_type< proxy::details::AssnsNode< ArtAssnsIterValue > > |
class | ChiSquareAccumulator |
Computes a χ from expectation function and data points. More... | |
struct | dereferenced_type |
Class defining the dereferenced type of the specified type. More... | |
class | LinearFit |
Performs a linear regression of data. More... | |
class | QuadraticFit |
Performs a second-degree fit of data. More... | |
class | GaussianFit |
"Fast" Gaussian fit More... | |
struct | identity |
A unary functor returning its own argument (any type) More... | |
class | StatCollector |
Collects statistics on a single quantity (weighted) More... | |
class | StatCollector2D |
Collects statistics on two homogeneous quantities (weighted) More... | |
class | MinMaxCollector |
Keeps track of the minimum and maximum value we observed. More... | |
Typedefs | |
template<typename Iter > | |
using | DereferenceConstIterator = detail::DereferenceIteratorBase< Iter, std::add_const_t< std::decay_t< decltype(**(std::declval< Iter >()))>> > |
An iterator wrapper to dereference pointed values. More... | |
template<typename Iter > | |
using | DereferenceIterator = detail::DereferenceIteratorBase< Iter, std::decay_t< decltype(**(std::declval< Iter >()))> > |
An iterator wrapper to dereferencing pointed values as constant. More... | |
using | HitToWire = details::FindAllP< recob::Hit, recob::Wire > |
Query object connecting a hit to a wire. More... | |
template<typename Assns > | |
using | assns_metadata_t = typename assns_metadata_type< Assns >::type |
Trait: type of metadata in Assns (association or its node). More... | |
template<typename Assns > | |
using | assns_iterator_t = typename assns_iterator_type< Assns >::type |
Trait: type of iterator of Assns . More... | |
Functions | |
template<typename Iter > | |
auto | makeDereferenceIterator (Iter &&iter) |
Returns a dereference iterator to the begin of specified container. More... | |
template<typename Cont > | |
auto | beginDereferenceIterator (Cont &cont) |
Returns a dereference iterator to the begin of specified container. More... | |
template<typename Cont > | |
auto | endDereferenceIterator (Cont &cont) |
Returns a dereference iterator to the end of specified container. More... | |
template<typename Cont > | |
auto | rbeginDereferenceIterator (Cont &cont) |
Returns a dereference reverse iterator to the begin of container. More... | |
template<typename Cont > | |
auto | rendDereferenceIterator (Cont &cont) |
Returns a dereference reverse iterator to the end of container. More... | |
template<typename Cont > | |
auto | dereferenceIteratorLoop (Cont &cont) |
Returns an object enabling a dereferencing range-for loop. More... | |
template<typename Cont > | |
auto | dereferenceIteratorReverseLoop (Cont &cont) |
Returns an object enabling a dereferencing reverse range-for loop. More... | |
template<typename RealType > | |
auto | makeVector2DComparison (RealType threshold) |
Creates a Vector2DComparison from a RealComparisons object. More... | |
template<typename RealType > | |
auto | makeVector2DComparison (lar::util::RealComparisons< RealType > const &comp) |
Creates a Vector2DComparison from a RealComparisons object. More... | |
template<typename RealType > | |
auto | makeVector3DComparison (RealType threshold) |
Creates a Vector3DComparison from a RealComparisons object. More... | |
template<typename RealType > | |
auto | makeVector3DComparison (lar::util::RealComparisons< RealType > const &comp) |
Creates a Vector3DComparison from a RealComparisons object. More... | |
double | TrackProjectedLength (recob::Track const &track, geo::View_t view) |
Returns the length of the projection of a track on a view. More... | |
double | TrackPitchInView (recob::Track const &track, geo::View_t view, size_t trajectory_point=0U) |
Returns the projected length of track on a wire pitch step [cm]. More... | |
template<typename F > | |
auto | makeChiSquareAccumulator (F &&e) |
Creates a ChiSquareAccumulator object with the specified function. More... | |
template<typename T , typename F > | |
auto | makeChiSquareAccumulator (F &&e) |
Creates a ChiSquareAccumulator object with the specified function. More... | |
template<typename T > | |
details::dereference_class< T, details::has_dereference_class < T >::value >::reference_type | dereference (T &v) |
Returns the value pointed by the argument, or the argument itself. More... | |
template<typename T > | |
details::make_pointer_class< T, details::has_dereference_class < T >::value >::pointer_type | make_pointer (T &v) |
Returns a pointer to the value of argument, or the argument itself. More... | |
Constant iterator functions | |
See the documentation of the similar non-const ones. | |
template<typename Iter > | |
auto | makeDereferenceConstIterator (Iter &&iter) |
template<typename Cont > | |
auto | cbeginDereferenceIterator (Cont &cont) |
template<typename Cont > | |
auto | cendDereferenceIterator (Cont &cont) |
template<typename Cont > | |
auto | crbeginDereferenceIterator (Cont &cont) |
template<typename Cont > | |
auto | crendDereferenceIterator (Cont &cont) |
template<typename Cont > | |
auto | dereferenceConstIteratorLoop (Cont &cont) |
Returns an object enabling a dereferencing range-for loop. More... | |
template<typename Cont > | |
auto | dereferenceConstIteratorReverseLoop (Cont &cont) |
Returns an object enabling a dereferencing reverse range-for loop. More... | |
Variables | |
template<typename Assns > | |
constexpr bool | assns_has_metadata_v = assns_has_metadata<Assns>::value |
Trait: true if Assns (association or its node) has metadata. More... | |
LArSoft utility namespace.
LArSoft utilities namespace.
using lar::util::DereferenceConstIterator = typedef detail::DereferenceIteratorBase< Iter, std::add_const_t<std::decay_t<decltype(**(std::declval<Iter>()))>> > |
An iterator wrapper to dereference pointed values.
Iter | type of iterator being wrapped |
This iterator is useful to iterate a collection of pointers accessing directly the pointed values.
It's probably easier to use cbeginDereferenceIterator(), cendDereferenceIterator() and dereferenceConstIteratorLoop() rather than instantiating this class directly.
boost::indirect_iterator
instead (boost/iterator/indirect_iterator.hpp
). Definition at line 220 of file DereferenceIterator.h.
using lar::util::DereferenceIterator = typedef detail::DereferenceIteratorBase< Iter, std::decay_t<decltype(**(std::declval<Iter>()))> > |
An iterator wrapper to dereferencing pointed values as constant.
Iter | type of iterator being wrapped |
This class behaves like DereferenceConstIterator, except that it returns mutable references to values.
boost::indirect_iterator
instead (boost/iterator/indirect_iterator.hpp
). Definition at line 237 of file DereferenceIterator.h.
using lar::util::HitToWire = typedef details::FindAllP<recob::Hit, recob::Wire> |
Query object connecting a hit to a wire.
Once upon a time, recob::Hit had a art::Ptr<recob::Wire> in it, and life was easy. When it was discovered that art pointers in data products were evil, they were banned from recob::Hit. As always, evil turns out to be convenient. This query object tries to provide in an efficient way a connection between a hit and the wire that has generated it.
This object expects
Example of usage: let hit_ptr be a valid art::Ptr<recob::Hit>. Then
HitToWire HtoW(evt); art::Ptr<recob::Wire> wire_ptr = HtoW[hit_ptr];
If the association label is known, it can be used to selectively load that association:
HitToWire HtoW(evt, AssociationInputTag); art::Ptr<recob::Wire> wire_ptr = HtoW[hit_ptr];
that has little advantage (in fact, it is possibly slower) respect to using art::FindOneP.
Definition at line 56 of file HitUtils.h.
auto lar::util::beginDereferenceIterator | ( | Cont & | cont | ) |
Returns a dereference iterator to the begin of specified container.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
If the type is constant, the iterator will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 269 of file DereferenceIterator.h.
auto lar::util::cbeginDereferenceIterator | ( | Cont & | cont | ) |
Definition at line 395 of file DereferenceIterator.h.
auto lar::util::cendDereferenceIterator | ( | Cont & | cont | ) |
Definition at line 400 of file DereferenceIterator.h.
auto lar::util::crbeginDereferenceIterator | ( | Cont & | cont | ) |
Definition at line 405 of file DereferenceIterator.h.
auto lar::util::crendDereferenceIterator | ( | Cont & | cont | ) |
Definition at line 410 of file DereferenceIterator.h.
|
inline |
Returns the value pointed by the argument, or the argument itself.
T | the type of the argument |
v | the value to be dereferenced |
This function allows the use of the same template code to process both pointers and pointed values. For example:
template <typename T> std::vector<int> extract_int(std::vector<T> const& from) { std::vector<int> v; v.reserve(from.size()); std::transform(from.begin(), from.end(), std::back_inserter(v), util::dereference); return v; } int value = 10; std::vector<int> v(10, value); std::vector<int*> v_ptr(10, &value); extract_int(v); extract_int(v_ptr);
shows that the same function can be used on vectors of integers and of their pointers.
Definition at line 254 of file Dereference.h.
auto lar::util::dereferenceConstIteratorLoop | ( | Cont & | cont | ) |
Returns an object enabling a dereferencing range-for loop.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
Example of usage:
This wrapper forces the iteration variable to be constant.
Definition at line 436 of file DereferenceIterator.h.
auto lar::util::dereferenceConstIteratorReverseLoop | ( | Cont & | cont | ) |
Returns an object enabling a dereferencing reverse range-for loop.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
This function is similar to dereferenceConstIteratorLoop(), but the order of iteration is reversed.
Example of usage:
If the type is constant, the loop variable will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 472 of file DereferenceIterator.h.
auto lar::util::dereferenceIteratorLoop | ( | Cont & | cont | ) |
Returns an object enabling a dereferencing range-for loop.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
Example of usage:
If the type is constant, the loop variable will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 340 of file DereferenceIterator.h.
auto lar::util::dereferenceIteratorReverseLoop | ( | Cont & | cont | ) |
Returns an object enabling a dereferencing reverse range-for loop.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
This function is similar to dereferenceIteratorLoop(), but the order of iteration is reversed.
Example of usage:
If the type is constant, the loop variable will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 376 of file DereferenceIterator.h.
auto lar::util::endDereferenceIterator | ( | Cont & | cont | ) |
Returns a dereference iterator to the end of specified container.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
If the type is constant, the iterator will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 283 of file DereferenceIterator.h.
|
inline |
Returns a pointer to the value of argument, or the argument itself.
T | the type of the argument |
v | the value to be taken the pointer of |
This function allows the use of the same template code to process both pointers and pointed values. For example:
template <typename T> std::vector<int*> extract_int(std::vector<T> const& from) { std::vector<int*> v; v.reserve(from.size()); std::transform(from.begin(), from.end(), std::back_inserter(v), util::make_pointer); return v; } int value = 10; std::vector<int> v(10, value); std::vector<int*> v_ptr(10, &value); extract_int(v); extract_int(v_ptr);
shows that the same function can be used on vectors of integers and of their pointers.
Definition at line 293 of file Dereference.h.
auto lar::util::makeChiSquareAccumulator | ( | F && | e | ) |
Creates a ChiSquareAccumulator
object with the specified function.
F | type of function (deduced from e ) |
e | expectation function |
ChiSquareAccumulator<F>
instance with specified expectationExample of usage:
declare chiSquare
in a way equivalent to: lar::util::ChiSquareAccumulator<decltype(zero)> chiSquare(zero)
.
Definition at line 161 of file ChiSquareAccumulator.h.
auto lar::util::makeChiSquareAccumulator | ( | F && | e | ) |
Creates a ChiSquareAccumulator
object with the specified function.
T | type of data (default: double ) |
F | type of function (deduced from e ) |
e | expectation function |
ChiSquareAccumulator<F,T>
instance with specified expectationExample of usage:
declare chiSquare
in a way equivalent to: lar::util::ChiSquareAccumulator<decltype(zero), float> chiSquare(zero)
.
Definition at line 180 of file ChiSquareAccumulator.h.
auto lar::util::makeDereferenceConstIterator | ( | Iter && | iter | ) |
Definition at line 390 of file DereferenceIterator.h.
auto lar::util::makeDereferenceIterator | ( | Iter && | iter | ) |
Returns a dereference iterator to the begin of specified container.
Iter | type of the iterator to be wrapped (may be constant) |
iter | the iterator to be wrapped |
If the type is constant, the iterator will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 255 of file DereferenceIterator.h.
auto lar::util::makeVector2DComparison | ( | RealType | threshold | ) |
Creates a Vector2DComparison
from a RealComparisons
object.
Definition at line 187 of file RealComparisons.h.
auto lar::util::makeVector2DComparison | ( | lar::util::RealComparisons< RealType > const & | comp | ) |
Creates a Vector2DComparison
from a RealComparisons
object.
Definition at line 193 of file RealComparisons.h.
auto lar::util::makeVector3DComparison | ( | RealType | threshold | ) |
Creates a Vector3DComparison
from a RealComparisons
object.
Definition at line 252 of file RealComparisons.h.
auto lar::util::makeVector3DComparison | ( | lar::util::RealComparisons< RealType > const & | comp | ) |
Creates a Vector3DComparison
from a RealComparisons
object.
Definition at line 258 of file RealComparisons.h.
auto lar::util::rbeginDereferenceIterator | ( | Cont & | cont | ) |
Returns a dereference reverse iterator to the begin of container.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
If the type is constant, the iterator will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 297 of file DereferenceIterator.h.
auto lar::util::rendDereferenceIterator | ( | Cont & | cont | ) |
Returns a dereference reverse iterator to the end of container.
Cont | type of the container (may be constant) |
cont | container to extract the iterator from |
If the type is constant, the iterator will likely be constant too. This wrapper is quite blind to the meaning of iterators and their constantness.
Definition at line 311 of file DereferenceIterator.h.
double lar::util::TrackPitchInView | ( | recob::Track const & | track, |
geo::View_t | view, | ||
size_t | trajectory_point = 0U |
||
) |
Returns the projected length of track on a wire pitch step [cm].
track | the track to be projected on a view |
view | the view for track projection |
trajectory_point | at which point of the track to look for the pitch (default: 0 ) |
cet::exception | (category "TrackPitchInView" ) if the trajectory_point index is not valid in track |
cet::exception | (category "Geometry" ) if the point is in no TPC |
cet::exception | (category "TPCGeo" ) if the view is unknown, not available or otherwise invalid |
cet::exception | (category "Track" ) if the track projection on the wire plane is parallel to the wires (< 0.01%) |
This function returns the distance covered by the track between two wires, projected on the wire plane. The direction of the track is the one at the specified trajectory point (the first one by default). That direction is projected on the wire plane with the specified view
within the TPC that contains that point.
The returned value is the distance, in centimeters, between two consecutive wires on that projected direction. This is always a positive number, regardless the direction of the track, and never smaller than the wire pitch on the projection wire plane.
Definition at line 79 of file TrackUtils.cxx.
double lar::util::TrackProjectedLength | ( | recob::Track const & | track, |
geo::View_t | view | ||
) |
Returns the length of the projection of a track on a view.
track | the track to be projected on a view |
view | the view to project the track on |
Definition at line 35 of file TrackUtils.cxx.