11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATA_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATA_H
19 #include "canvas/Persistency/Common/Assns.h"
20 #include "canvas/Persistency/Common/Ptr.h"
27 #include <type_traits>
68 typename Main,
typename Aux,
typename Metadata ,
97 using assns_t = art::Assns<main_t, aux_t>;
103 bool has(std::size_t i)
const
116 "Inconsistent data types."
164 template <
typename Tag,
typename Assns>
167 template <
typename Assns>
169 {
return makeOneTo01data<typename Assns::right_t>(assns, minSize); }
191 template <
typename Tag,
typename MainColl,
typename Assns>
193 {
return makeOneTo01data<Tag>(assns, mainColl.size()); }
195 template <
typename MainColl,
typename Assns>
197 {
return makeOneTo01data<typename Assns::right_t>(mainColl, assns); }
213 template <
typename T>
216 typename std::vector<T>::size_type index,
217 typename std::vector<T>::value_type
const&
value
219 if (index >= v.size()) {
220 v.reserve(index + 1);
224 else v[index] =
value;
229 template <
typename T>
232 typename std::vector<T>::size_type index,
233 typename std::vector<T>::value_type&&
value
235 if (index >= v.size()) {
236 v.reserve(index + 1);
238 v.push_back(std::move(
value));
240 else v[index] = std::move(
value);
245 template <std::
size_t Key, std::
size_t Data,
typename Iter>
253 using value_type =
typename Iter::value_type;
254 using data_t = std::tuple_element_t<Data, value_type>;
255 std::vector<data_t> data(n);
256 for (
auto it = begin; it !=
end; ++it) {
257 auto const& keyPtr = std::get<Key>(*it);
269 template <
typename Tag,
typename Assns>
272 using Main_t =
typename Assns::left_t;
273 using Aux_t =
typename Assns::right_t;
275 using AssociatedData_t
280 return AssociatedData_t(
281 details::associationOneToOneFullSequence<0U, 1U>
291 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATA_H
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
auto makeOneTo01data(Assns const &assns, std::size_t minSize=0)
Processes and returns an one-to-(zero/one) associated data object.
art::Assns< main_t, aux_t > assns_t
Type of the source association.
art::Ptr< aux_t > aux_ptr_t
Type of art pointer to associated datum.
bool has(std::size_t i) const
Returns whether the element i is associated with auxiliary datum.
auto cbegin(FixedBins< T, C > const &) noexcept
OneTo01Data(aux_coll_t &&data)
Main main_t
Type of main datum.
auto cend(FixedBins< T, C > const &) noexcept
auto operator[](std::size_t index) const -> decltype(auto)
Returns the range with the specified index (no check performed).
Object for one-to-zero/or/one associated data interface.
auto end(FixedBins< T, C > const &) noexcept
Aux aux_t
Type of associated datum.
auto begin(FixedBins< T, C > const &) noexcept
Utilities to address elements of a tuple-like class by tag.
Traits for art associations.
Metadata metadata_t
Type of associated metadata.
void extendAndAssign(std::vector< T > &v, typename std::vector< T >::size_type index, typename std::vector< T >::value_type const &value)
std::vector< aux_ptr_t > aux_coll_t
Type of collection of auxiliary data for all main elements.
aux_coll_t auxData
Data associated to the main collection.
util::add_tag_t< aux_ptr_t, tag > auxiliary_data_t
Type of auxiliary data associated with a main item.
auto associationOneToOneFullSequence(Iter begin, Iter end, std::size_t n)